| Required role: | TenantReader |
| POST | /api/resources/{Id}/restart | Restart the resource | |
|---|---|---|---|
| POST | /resources/{Id}/restart | Restart the resource |
import java.math.*;
import java.util.*;
import java.io.InputStream;
import net.servicestack.client.*;
public class dtos
{
/**
* Restart the resource
*/
@Api(Description="Restart the resource")
@ApiResponse(Description="Operation started", IsDefaultResponse=true, ResponseType=JobDto.class, StatusCode=202)
public static class RestartResource implements 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")
public UUID id = null;
@ApiMember(DataType="string", IsRequired=true, ParameterType="header")
@Validate(Validator="NotEmpty")
public String tenantName = null;
/**
* The cron expression for scheduling the operation
*/
@ApiMember(DataType="string", Description="The cron expression for scheduling the operation", Format="Cron", ParameterType="body")
public String cronExpression = null;
/**
* Inform users when the job has finished
*/
@ApiMember(DataType="bool", Description="Inform users when the job has finished", ParameterType="body")
public Boolean sendNotifications = null;
public UUID getId() { return id; }
public RestartResource setId(UUID value) { this.id = value; return this; }
public String getTenantName() { return tenantName; }
public RestartResource setTenantName(String value) { this.tenantName = value; return this; }
public String getCronExpression() { return cronExpression; }
public RestartResource setCronExpression(String value) { this.cronExpression = value; return this; }
public Boolean isSendNotifications() { return sendNotifications; }
public RestartResource setSendNotifications(Boolean value) { this.sendNotifications = value; return this; }
}
public static class JobDto implements IHasIdName, IHasTenantId, IAuditable, IHasObjectType
{
/**
* The id of the job
*/
public UUID id = null;
/**
* The id of the tenant
*/
public UUID tenantId = null;
/**
* The name of the job
*/
public String name = null;
public ObjectTypes objectType = null;
/**
* An additional message
*/
public String message = null;
/**
* Api link pointing to this object
*/
public String selfLink = null;
/**
* The id of the configitem the job belongs to
*/
public UUID configItemId = null;
/**
* The type of the configitem the job belongs to
*/
public ObjectTypes configItemType = null;
/**
* The job type
*/
public JobTypes jobType = null;
/**
* The current state of the job
*/
public JobStates state = null;
/**
* The timestamp, when the job got started
*/
public Date startTime = null;
/**
* The timestamp, when the job has finished
*/
public Date endTime = null;
/**
* The duration (in seconds) of the job
*/
public Integer duration = null;
/**
* The id of the related workflow
*/
public String workflowId = null;
/**
* The id of the related scheduled task
*/
public String schedulerId = null;
/**
* The jobs progress in percent (0...100)
*/
public Double progress = null;
/**
* Contains various infos about the job
*/
public HashMap<String,Object> config = new HashMap<String,Object>();
/**
* The time the job was created
*/
public Date created = null;
/**
* The user the job was created with
*/
public String createUser = null;
/**
* The user id the job was created with
*/
public String createUserId = null;
/**
* The user email the job was created with
*/
public String createUserEmail = null;
/**
* The time the job was last modified
*/
public Date modified = null;
/**
* The user the job was modified with
*/
public String modifyUser = null;
/**
* The user id the job was modified with
*/
public String modifyUserId = null;
/**
* True if the job is deleted
*/
public Boolean isDeleted = null;
/**
* The time the job was deleted
*/
public Date deleted = null;
/**
* The user the job was deleted with
*/
public String deleteUser = null;
/**
* The user id the job was deleted with
*/
public String deleteUserId = null;
/**
* Will be evaluated by event endpoints
*/
public Boolean sendNotifications = null;
/**
* True if it is in any of the 'running' states
*/
public Boolean isRunning = null;
/**
* Jobs with failed JobEvents are marked with NeedsAttention
*/
public Boolean needsAttention = null;
public UUID getId() { return id; }
public JobDto setId(UUID value) { this.id = value; return this; }
public UUID getTenantId() { return tenantId; }
public JobDto setTenantId(UUID value) { this.tenantId = value; return this; }
public String getName() { return name; }
public JobDto setName(String value) { this.name = value; return this; }
public ObjectTypes getObjectType() { return objectType; }
public JobDto setObjectType(ObjectTypes value) { this.objectType = value; return this; }
public String getMessage() { return message; }
public JobDto setMessage(String value) { this.message = value; return this; }
public String getSelfLink() { return selfLink; }
public JobDto setSelfLink(String value) { this.selfLink = value; return this; }
public UUID getConfigItemId() { return configItemId; }
public JobDto setConfigItemId(UUID value) { this.configItemId = value; return this; }
public ObjectTypes getConfigItemType() { return configItemType; }
public JobDto setConfigItemType(ObjectTypes value) { this.configItemType = value; return this; }
public JobTypes getJobType() { return jobType; }
public JobDto setJobType(JobTypes value) { this.jobType = value; return this; }
public JobStates getState() { return state; }
public JobDto setState(JobStates value) { this.state = value; return this; }
public Date getStartTime() { return startTime; }
public JobDto setStartTime(Date value) { this.startTime = value; return this; }
public Date getEndTime() { return endTime; }
public JobDto setEndTime(Date value) { this.endTime = value; return this; }
public Integer getDuration() { return duration; }
public JobDto setDuration(Integer value) { this.duration = value; return this; }
public String getWorkflowId() { return workflowId; }
public JobDto setWorkflowId(String value) { this.workflowId = value; return this; }
public String getSchedulerId() { return schedulerId; }
public JobDto setSchedulerId(String value) { this.schedulerId = value; return this; }
public Double getProgress() { return progress; }
public JobDto setProgress(Double value) { this.progress = value; return this; }
public HashMap<String,Object> getConfig() { return config; }
public JobDto setConfig(HashMap<String,Object> value) { this.config = value; return this; }
public Date getCreated() { return created; }
public JobDto setCreated(Date value) { this.created = value; return this; }
public String getCreateUser() { return createUser; }
public JobDto setCreateUser(String value) { this.createUser = value; return this; }
public String getCreateUserId() { return createUserId; }
public JobDto setCreateUserId(String value) { this.createUserId = value; return this; }
public String getCreateUserEmail() { return createUserEmail; }
public JobDto setCreateUserEmail(String value) { this.createUserEmail = value; return this; }
public Date getModified() { return modified; }
public JobDto setModified(Date value) { this.modified = value; return this; }
public String getModifyUser() { return modifyUser; }
public JobDto setModifyUser(String value) { this.modifyUser = value; return this; }
public String getModifyUserId() { return modifyUserId; }
public JobDto setModifyUserId(String value) { this.modifyUserId = value; return this; }
public Boolean getIsDeleted() { return isDeleted; }
public JobDto setIsDeleted(Boolean value) { this.isDeleted = value; return this; }
public Date getDeleted() { return deleted; }
public JobDto setDeleted(Date value) { this.deleted = value; return this; }
public String getDeleteUser() { return deleteUser; }
public JobDto setDeleteUser(String value) { this.deleteUser = value; return this; }
public String getDeleteUserId() { return deleteUserId; }
public JobDto setDeleteUserId(String value) { this.deleteUserId = value; return this; }
public Boolean isSendNotifications() { return sendNotifications; }
public JobDto setSendNotifications(Boolean value) { this.sendNotifications = value; return this; }
public Boolean getIsRunning() { return isRunning; }
public JobDto setIsRunning(Boolean value) { this.isRunning = value; return this; }
public Boolean isNeedsAttention() { return needsAttention; }
public JobDto setNeedsAttention(Boolean value) { this.needsAttention = value; return this; }
}
public static 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;
}
public static enum JobTypes
{
Create,
Update,
Delete,
Start,
Stop,
Restart,
Backup,
Restore,
Patch,
Action;
}
public static enum JobStates
{
Pending,
Starting,
Running,
Suspended,
Stopping,
Completed,
Failed;
}
}
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/resources/{Id}/restart 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}