CoreService

<back to all web services

StopResource

Resource - Operations

Stop the resource

Requires Authentication
Required role:TenantReader
The following routes are available for this service:
POST/api/resources/{Id}/stopStop the resource
POST/resources/{Id}/stopStop the resource
import java.math.*
import java.util.*
import java.io.InputStream
import net.servicestack.client.*


/**
* Stop the resource
*/
@Api(Description="Stop the resource")
@ApiResponse(Description="Operation started", IsDefaultResponse=true, ResponseType=JobDto::class, StatusCode=202)
open class StopResource : ISchedulableRequest, IHasId, IPost
{
    /**
    * The primary key of every config item
    */
    @ApiMember(DataType="string", Description="The primary key of every config item", Format="guid", IsRequired=true, ParameterType="path")
    override var id:UUID? = null

    @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
    @Validate(Validator="NotEmpty")
    open var tenantName:String? = null

    /**
    * 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
}

open class JobDto : IHasIdName, IHasTenantId, IAuditable, IHasObjectType
{
    /**
    * The id of the job
    */
    open var id:UUID? = null
    /**
    * The id of the tenant
    */
    override var tenantId:UUID? = null
    /**
    * The name of the job
    */
    override var name:String? = null
    override var objectType:ObjectTypes? = null
    /**
    * An additional message
    */
    open var message:String? = null
    /**
    * Api link pointing to this object
    */
    open var selfLink:String? = null
    /**
    * The id of the configitem the job belongs to
    */
    open var configItemId:UUID? = null
    /**
    * The type of the configitem the job belongs to
    */
    open var configItemType:ObjectTypes? = null
    /**
    * The job type
    */
    open var jobType:JobTypes? = null
    /**
    * The current state of the job
    */
    open var state:JobStates? = null
    /**
    * The timestamp, when the job got started
    */
    open var startTime:Date? = null
    /**
    * The timestamp, when the job has finished
    */
    open var endTime:Date? = null
    /**
    * The duration (in seconds) of the job
    */
    open var duration:Int? = null
    /**
    * The id of the related workflow
    */
    open var workflowId:String? = null
    /**
    * The id of the related scheduled task
    */
    open var schedulerId:String? = null
    /**
    * The jobs progress in percent (0...100)
    */
    open var progress:Double? = null
    /**
    * Contains various infos about the job
    */
    open var config:HashMap<String,Object> = HashMap<String,Object>()
    /**
    * The time the job was created
    */
    override var created:Date? = null
    /**
    * The user the job was created with
    */
    override var createUser:String? = null
    /**
    * The user id the job was created with
    */
    override var createUserId:String? = null
    /**
    * The user email the job was created with
    */
    open var createUserEmail:String? = null
    /**
    * The time the job was last modified
    */
    override var modified:Date? = null
    /**
    * The user the job was modified with
    */
    override var modifyUser:String? = null
    /**
    * The user id the job was modified with
    */
    override var modifyUserId:String? = null
    /**
    * True if the job is deleted
    */
    override var isDeleted:Boolean? = null
    /**
    * The time the job was deleted
    */
    override var deleted:Date? = null
    /**
    * The user the job was deleted with
    */
    override var deleteUser:String? = null
    /**
    * The user id the job was deleted with
    */
    override var deleteUserId:String? = null
    /**
    * Will be evaluated by event endpoints
    */
    open var sendNotifications:Boolean? = null
    /**
    * True if it is in any of the 'running' states
    */
    open var isRunning:Boolean? = null
    /**
    * Jobs with failed JobEvents are marked with NeedsAttention
    */
    open var needsAttention: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,
}

enum class JobTypes
{
    Create,
    Update,
    Delete,
    Start,
    Stop,
    Restart,
    Backup,
    Restore,
    Patch,
    Action,
}

enum class JobStates
{
    Pending,
    Starting,
    Running,
    Suspended,
    Stopping,
    Completed,
    Failed,
}

Kotlin StopResource 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

HTTP + JSON

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /api/resources/{Id}/stop 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","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","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}