| Required role: | TenantReader |
| POST | /api/action-assignments/{Id}/start | Start a custom action | |
|---|---|---|---|
| POST | /action-assignments/{Id}/start | Start a custom action |
Imports System
Imports System.IO
Imports System.Collections
Imports System.Collections.Generic
Imports System.Runtime.Serialization
Imports ServiceStack
Imports ServiceStack.DataAnnotations
Imports CoreService.ServiceModel.Dtos.ActionAssignments.Operations
Imports CoreService.ServiceModel.Dtos.Base.Responses
Imports CoreService.ServiceModel.Enums
Imports CoreService.ServiceModel.Dtos.Jobs.Responses
Imports YCO.Dune.Models.Enums
Namespace Global
Namespace CoreService.ServiceModel.Dtos.ActionAssignments.Operations
'''<Summary>
'''Start a custom action
'''</Summary>
<Api(Description:="Start a custom action")>
<ApiResponse(Description:="Operation started", IsDefaultResponse:=true, ResponseType:=GetType(JobDto), StatusCode:=202)>
Public Partial Class StartActionAssignment
Implements IBaseRequest
Implements IHasId
Implements IHasTenantName
Implements IPost
<ApiMember(DataType:="string", Format:="guid", IsRequired:=true, ParameterType:="path")>
Public Overridable Property Id As Guid Implements IHasId.Id
<ApiMember(DataType:="string", IsRequired:=true, ParameterType:="header")>
<Validate(Validator:="NotEmpty")>
Public Overridable Property TenantName As String Implements IHasTenantName.TenantName
<ApiMember(DataType:="array", ParameterType:="body")>
Public Overridable Property Parameters As IList(Of ParameterDto)
'''<Summary>
'''Whether to execute the action even if it's already running
'''</Summary>
<ApiMember(DataType:="bool", Description:="Whether to execute the action even if it's already running", ParameterType:="body")>
Public Overridable Property Force As Boolean?
'''<Summary>
'''Inform users when the job has finished
'''</Summary>
<ApiMember(DataType:="bool", Description:="Inform users when the job has finished", ParameterType:="body")>
Public Overridable Property SendNotifications As Boolean?
End Class
End Namespace
Namespace CoreService.ServiceModel.Dtos.Base.Responses
Public Partial Class ParameterDto
Public Overridable Property Name As String
Public Overridable Property Description As String
'''<Summary>
'''Value in form of a json string (e.g. Number = 1234, String = "foo", Boolean = false). Note: string values need extra quotes
'''</Summary>
Public Overridable Property Value As String
'''<Summary>
'''Optional default value for the frontend. Needs to be in the same format as the value
'''</Summary>
Public Overridable Property [Default] As String
'''<Summary>
'''Optional parameters do not need to have a value. Default -> Optional=false
'''</Summary>
Public Overridable Property [Optional] As Boolean
'''<Summary>
'''The data type of the value and default property
'''</Summary>
Public Overridable Property Type As ParameterValueType
Public Overridable Property Validation As String
End Class
End Namespace
Namespace CoreService.ServiceModel.Dtos.Jobs.Responses
Public Partial Class JobDto
Implements IHasIdName
Implements IHasTenantId
Implements IAuditable
Implements IHasObjectType
'''<Summary>
'''The id of the job
'''</Summary>
Public Overridable Property Id As Guid
'''<Summary>
'''The id of the tenant
'''</Summary>
Public Overridable Property TenantId As Guid Implements IHasTenantId.TenantId
'''<Summary>
'''The name of the job
'''</Summary>
Public Overridable Property Name As String Implements IHasIdName.Name
Public Overridable Property ObjectType As ObjectTypes Implements IHasObjectType.ObjectType
'''<Summary>
'''An additional message
'''</Summary>
Public Overridable Property Message As String
'''<Summary>
'''Api link pointing to this object
'''</Summary>
Public Overridable Property SelfLink As String
'''<Summary>
'''The id of the configitem the job belongs to
'''</Summary>
Public Overridable Property ConfigItemId As Guid?
'''<Summary>
'''The type of the configitem the job belongs to
'''</Summary>
Public Overridable Property ConfigItemType As ObjectTypes?
'''<Summary>
'''The job type
'''</Summary>
Public Overridable Property JobType As JobTypes
'''<Summary>
'''The current state of the job
'''</Summary>
Public Overridable Property State As JobStates
'''<Summary>
'''The timestamp, when the job got started
'''</Summary>
Public Overridable Property StartTime As Date
'''<Summary>
'''The timestamp, when the job has finished
'''</Summary>
Public Overridable Property EndTime As Date?
'''<Summary>
'''The duration (in seconds) of the job
'''</Summary>
Public Overridable Property Duration As Integer
'''<Summary>
'''The id of the related workflow
'''</Summary>
Public Overridable Property WorkflowId As String
'''<Summary>
'''The id of the related scheduled task
'''</Summary>
Public Overridable Property SchedulerId As String
'''<Summary>
'''The jobs progress in percent (0...100)
'''</Summary>
Public Overridable Property Progress As Double
'''<Summary>
'''Contains various infos about the job
'''</Summary>
Public Overridable Property Config As Dictionary(Of String, Object) = New Dictionary(Of String, Object)
'''<Summary>
'''The time the job was created
'''</Summary>
Public Overridable Property Created As Date Implements IAuditable.Created
'''<Summary>
'''The user the job was created with
'''</Summary>
Public Overridable Property CreateUser As String Implements IAuditable.CreateUser
'''<Summary>
'''The user id the job was created with
'''</Summary>
Public Overridable Property CreateUserId As String Implements IAuditable.CreateUserId
'''<Summary>
'''The user email the job was created with
'''</Summary>
Public Overridable Property CreateUserEmail As String
'''<Summary>
'''The time the job was last modified
'''</Summary>
Public Overridable Property Modified As Date Implements IAuditable.Modified
'''<Summary>
'''The user the job was modified with
'''</Summary>
Public Overridable Property ModifyUser As String Implements IAuditable.ModifyUser
'''<Summary>
'''The user id the job was modified with
'''</Summary>
Public Overridable Property ModifyUserId As String Implements IAuditable.ModifyUserId
'''<Summary>
'''True if the job is deleted
'''</Summary>
Public Overridable Property IsDeleted As Boolean Implements IAuditable.IsDeleted
'''<Summary>
'''The time the job was deleted
'''</Summary>
Public Overridable Property Deleted As Date? Implements IAuditable.Deleted
'''<Summary>
'''The user the job was deleted with
'''</Summary>
Public Overridable Property DeleteUser As String Implements IAuditable.DeleteUser
'''<Summary>
'''The user id the job was deleted with
'''</Summary>
Public Overridable Property DeleteUserId As String Implements IAuditable.DeleteUserId
'''<Summary>
'''Will be evaluated by event endpoints
'''</Summary>
Public Overridable Property SendNotifications As Boolean
'''<Summary>
'''True if it is in any of the 'running' states
'''</Summary>
Public Overridable Property IsRunning As Boolean
'''<Summary>
'''Jobs with failed JobEvents are marked with NeedsAttention
'''</Summary>
Public Overridable Property NeedsAttention As Boolean
End Class
End Namespace
Namespace CoreService.ServiceModel.Enums
Public Enum JobStates
Pending
Starting
Running
Suspended
Stopping
Completed
Failed
End Enum
Public Enum JobTypes
Create
Update
Delete
Start
[Stop]
Restart
Backup
Restore
Patch
Action
End Enum
Public Enum ParameterValueType
[String]
Number
[Boolean]
SecureString
End Enum
End Namespace
Namespace YCO.Dune.Models.Enums
Public Enum 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
End Enum
End Namespace
End Namespace
VB.NET StartActionAssignment 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/{Id}/start HTTP/1.1
Host: core.starburst.svc
Accept: application/json
Content-Type: application/json
Content-Length: length
{"id":"00000000-0000-0000-0000-000000000000","tenantName":"String","parameters":null,"force":false,"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","tenantId":"00000000-0000-0000-0000-000000000000","name":"String","objectType":"Job","message":"String","selfLink":"String","configItemId":"00000000-0000-0000-0000-000000000000","configItemType":"None","jobType":"Create","state":"Pending","startTime":"0001-01-01T00:00:00.0000000Z","endTime":"0001-01-01T00:00:00.0000000Z","duration":0,"workflowId":"String","schedulerId":"String","progress":0,"config":{"String":{}},"created":"0001-01-01T00:00:00.0000000Z","createUser":"String","createUserId":"String","createUserEmail":"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","sendNotifications":false,"isRunning":false,"needsAttention":false}