| Required role: | TenantReader |
| POST | /api/action-assignments | Assigns an action to a config item | |
|---|---|---|---|
| POST | /action-assignments | Assigns an action to a config item |
import java.math.*
import java.util.*
import java.io.InputStream
import net.servicestack.client.*
import com.google.gson.annotations.*
import com.google.gson.reflect.*
/**
* Adds an action to a config item
*/
@Api(Description="Adds an action to a config item")
@ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType=ActionAssignmentDto::class, StatusCode=201)
open class CreateActionAssignment : IPost, ISchedulableRequest
{
@ApiMember(DataType="string", IsRequired=true, ParameterType="header")
@Validate(Validator="NotEmpty")
open var tenantName:String? = null
/**
* The unique id of the config item
*/
@ApiMember(DataType="string", Description="The unique id of the config item", Format="guid", IsRequired=true, ParameterType="path")
open var configItemId:UUID? = null
/**
* The type of the config item (either Deployment, ResourceGroup or Resource)
*/
@ApiMember(Description="The type of the config item (either Deployment, ResourceGroup or Resource)", IsRequired=true, ParameterType="body")
@Validate(Validator="NotNull")
open var configItemType:ObjectTypes? = null
@ApiMember(DataType="string", Format="guid", IsRequired=true, ParameterType="path")
open var actionId:UUID? = null
/**
* A unique name for the action
*/
@ApiMember(DataType="string", Description="A unique name for the action", IsRequired=true, ParameterType="body")
@Validate(Validator="NotEmpty")
open var name:String? = null
@ApiMember(DataType="array", ParameterType="body")
open var parameters:ArrayList<ParameterDto> = ArrayList<ParameterDto>()
/**
* The cron expression for scheduling the operation
*/
@ApiMember(DataType="string", Description="The cron expression for scheduling the operation", Format="Cron", ParameterType="body")
override var cronExpression:String? = null
/**
* Inform users when the job has finished
*/
@ApiMember(DataType="bool", Description="Inform users when the job has finished", ParameterType="body")
open var sendNotifications:Boolean? = null
}
enum class ObjectTypes
{
None,
ConfigItem,
Tenant,
Collection,
Resource,
ComputeNode,
VirtualMachine,
PhysicalMachine,
Disk,
Subnet,
IpAddress,
Job,
JobEvent,
FreezePeriod,
ResourceGroup,
Deployment,
ResourceGroupTemplate,
DeploymentTemplate,
ResourceProvider,
GenericResource,
Role,
Permission,
User,
PatchingWindow,
Update,
ReportDefinition,
TimeSeries,
DataPoint,
Action,
ActionAssignment,
UserNote,
}
open class ParameterDto
{
open var name:String? = null
open var description:String? = null
/**
* Value in form of a json string (e.g. Number = 1234, String = "foo", Boolean = false). Note: string values need extra quotes
*/
open var value:String? = null
/**
* Optional default value for the frontend. Needs to be in the same format as the value
*/
@SerializedName("default") open var Default:String? = null
/**
* Optional parameters do not need to have a value. Default -> Optional=false
*/
open var optional:Boolean? = null
/**
* The data type of the value and default property
*/
@SerializedName("type") open var Type:ParameterValueType? = null
open var validation:String? = null
}
enum class ParameterValueType
{
String,
Number,
Boolean,
SecureString,
}
open class ActionAssignmentDto
{
open var id:UUID? = null
open var name:String? = null
open var actionId:UUID? = null
open var action:ActionDto? = null
open var configItemId:UUID? = null
open var configItemName:String? = null
open var configItemType:ObjectTypes? = null
open var parameters:ArrayList<ParameterDto> = ArrayList<ParameterDto>()
open var selfLink:String? = null
open var scope:ActionScopes? = null
open var cronExpression:String? = null
open var links:IList<LinkDto>? = null
open var scheduledTaskAssignmentId:UUID? = null
open var scheduledTaskAssignment:ScheduledTaskAssignmentDto? = null
open var objectType:ObjectTypes? = null
}
open class ActionDto : ConfigItemDto(), IHasTenantId
{
override var tenantId:UUID? = null
/**
* The schema version of the attached definition (json/yaml structure)
*/
open var schemaVersion:Int? = null
/**
* The action definition as json/yaml
*/
open var definition:String? = null
/**
* Action parameters
*/
open var parameters:IList<ParameterDto>? = null
/**
* Disabled actions cannot be assigned to a configitem
*/
open var isDisabled:Boolean? = null
/**
* This action can anly be assigned to configitems of this type
*/
open var scope:ActionScopes? = null
/**
* The individual steps of the action
*/
open var steps:ArrayList<ActionStepDto> = ArrayList<ActionStepDto>()
}
open class ConfigItemDto : IConfigItem
{
open var id:UUID? = null
open var name:String? = null
override var displayName:String? = null
override var description:String? = null
open var objectType:ObjectTypes? = null
override var selfLink:String? = null
override var tags:IList<TagDto>? = null
open var path:IList<PathItemDto>? = null
open var created:Date? = null
open var createUser:String? = null
open var createUserId:String? = null
open var modified:Date? = null
open var modifyUser:String? = null
open var modifyUserId:String? = null
open var isDeleted:Boolean? = null
open var deleted:Date? = null
open var deleteUser:String? = null
open var deleteUserId:String? = null
open var links:IList<LinkDto>? = null
}
open class TagDto
{
open var name:String? = null
open var value:String? = null
open var isProtected:Boolean? = null
}
open class PathItemDto
{
open var label:String? = null
open var link:String? = null
open var objectType:ObjectTypes? = null
open var objectId:UUID? = null
}
open class LinkDto
{
open var caption:String? = null
open var rel:String? = null
open var hRef:String? = null
open var method:String? = null
}
enum class ActionScopes
{
Deployment,
ResourceGroup,
Resource,
}
open class ActionStepDto
{
open var name:String? = null
open var displayName:String? = null
/**
* The variables which are used in the ansible job
*/
open var variables:HashMap<String,Object> = HashMap<String,Object>()
/**
* Optional credential to be used in awx (credential stored in awx)
*/
open var credential:String? = null
/**
* Ansible limit (optional if Scope is Resource)
*/
open var limit:String? = null
/**
* Optional type of the awx action to run (job, workflow, etc.)
*/
@SerializedName("type") open var Type:String? = null
/**
* Optional ansible module to be used
*/
open var module:String? = null
/**
* Optional image for the execution environment which runs the action
*/
open var executionEnvironment:String? = null
/**
* Optional inventory
*/
open var inventory:String? = null
}
open class ScheduledTaskAssignmentDto
{
open var id:UUID? = null
open var configItemId:UUID? = null
open var objectType:ObjectTypes? = null
open var displayName:String? = null
open var taskId:Long? = null
open var taskName:String? = null
open var cronExpression:String? = null
}
Kotlin CreateActionAssignment DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /api/action-assignments HTTP/1.1
Host: core.starburst.svc
Accept: application/json
Content-Type: application/json
Content-Length: length
{"tenantName":"String","configItemId":"00000000-0000-0000-0000-000000000000","configItemType":"None","actionId":"00000000-0000-0000-0000-000000000000","name":"String","parameters":[{"name":"String","description":"String","value":"String","default":"String","optional":false,"type":"String","validation":"String"}],"cronExpression":"String","sendNotifications":false,"txId":"00000000-0000-0000-0000-000000000000"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"id":"00000000-0000-0000-0000-000000000000","name":"String","actionId":"00000000-0000-0000-0000-000000000000","action":{"tenantId":"00000000-0000-0000-0000-000000000000","schemaVersion":0,"definition":"String","parameters":null,"isDisabled":false,"scope":"Deployment","steps":[{"name":"String","displayName":"String","variables":{"String":{}},"credential":"String","limit":"String","type":"String","module":"String","executionEnvironment":"String","inventory":"String"}],"id":"00000000-0000-0000-0000-000000000000","name":"String","displayName":"String","description":"String","objectType":"None","selfLink":"String","tags":null,"path":null,"created":"0001-01-01T00:00:00.0000000Z","createUser":"String","createUserId":"String","modified":"0001-01-01T00:00:00.0000000Z","modifyUser":"String","modifyUserId":"String","isDeleted":false,"deleted":"0001-01-01T00:00:00.0000000Z","deleteUser":"String","deleteUserId":"String","links":null},"configItemId":"00000000-0000-0000-0000-000000000000","configItemName":"String","configItemType":"None","parameters":[{"name":"String","description":"String","value":"String","default":"String","optional":false,"type":"String","validation":"String"}],"selfLink":"String","scope":"Deployment","cronExpression":"String","links":[{"caption":"Start","rel":"start","hRef":"/action-assignments/00000000-0000-0000-0000-000000000000/start","method":"POST"},{"caption":"Completed","rel":"completed","hRef":"/action-assignments/00000000-0000-0000-0000-000000000000/completed","method":"PATCH"}],"scheduledTaskAssignmentId":"00000000-0000-0000-0000-000000000000","scheduledTaskAssignment":{"id":"00000000-0000-0000-0000-000000000000","configItemId":"00000000-0000-0000-0000-000000000000","objectType":"None","displayName":"String","taskId":0,"taskName":"String","cronExpression":"String"},"objectType":"ActionAssignment"}