vcenter extension tasks: create
Returns a taskId for the task using the CreateSpec. The taskId can be used for querying or updating the status of the task by the client. Warning: This operation is part of a new feature in development. It may be changed at any time and may not have all supported functionality implemented.
Request:
HTTP request
POST https://{server}/rest/vcenter/extension/tasks
Request Body Structure:
{
"spec" : {
"result" : "opaque_string_value",
"start_time" : "2015-01-01T22:13:05.651Z",
"percent_done" : {
"total" : 1,
"completed" : 1,
"message" : {
"args" : [
"string",
"string"
],
"default_message" : "string",
"localized" : "string",
"id" : "string",
"params" : [
{
"value" : {
"dt" : "2015-01-01T22:13:05.651Z",
"s" : "string",
"d" : 1.5,
"precision" : 1,
"format" : "SHORT_DATE",
"i" : 1,
"l" : {
"id" : "string",
"params" : [
{
"value" : {
"dt" : "2015-01-01T22:13:05.651Z",
"s" : "string",
"d" : 1.5,
"precision" : 1,
"format" : "SHORT_DATE",
"i" : 1,
"l" : {
"id" : "string",
"params" : [
{
"key" : "string"
}
]
}
},
"key" : "string"
}
]
}
},
"key" : "string"
}
]
}
},
"cancelable" : true,
"parent_task" : "obj-103",
"end_time" : "2015-01-01T22:13:05.651Z",
"description" : {
"args" : [
"string",
"string"
],
"default_message" : "string",
"localized" : "string",
"id" : "string",
"params" : [
{
"value" : {
"dt" : "2015-01-01T22:13:05.651Z",
"s" : "string",
"d" : 1.5,
"precision" : 1,
"format" : "SHORT_DATE",
"i" : 1,
"l" : {
"id" : "string",
"params" : [
{
"value" : {
"dt" : "2015-01-01T22:13:05.651Z",
"s" : "string",
"d" : 1.5,
"precision" : 1,
"format" : "SHORT_DATE",
"i" : 1,
"l" : {
"id" : "string",
"params" : [
{
"key" : "string"
}
]
}
},
"key" : "string"
}
]
}
},
"key" : "string"
}
]
},
"operation_id" : "obj-103",
"error" : {},
"user" : "string",
"target" : {
"id" : "obj-103",
"type" : "string"
},
"status" : "PENDING"
}
}
"spec" : {
"result" : "opaque_string_value",
"start_time" : "2015-01-01T22:13:05.651Z",
"percent_done" : {
"total" : 1,
"completed" : 1,
"message" : {
"args" : [
"string",
"string"
],
"default_message" : "string",
"localized" : "string",
"id" : "string",
"params" : [
{
"value" : {
"dt" : "2015-01-01T22:13:05.651Z",
"s" : "string",
"d" : 1.5,
"precision" : 1,
"format" : "SHORT_DATE",
"i" : 1,
"l" : {
"id" : "string",
"params" : [
{
"value" : {
"dt" : "2015-01-01T22:13:05.651Z",
"s" : "string",
"d" : 1.5,
"precision" : 1,
"format" : "SHORT_DATE",
"i" : 1,
"l" : {
"id" : "string",
"params" : [
{
"key" : "string"
}
]
}
},
"key" : "string"
}
]
}
},
"key" : "string"
}
]
}
},
"cancelable" : true,
"parent_task" : "obj-103",
"end_time" : "2015-01-01T22:13:05.651Z",
"description" : {
"args" : [
"string",
"string"
],
"default_message" : "string",
"localized" : "string",
"id" : "string",
"params" : [
{
"value" : {
"dt" : "2015-01-01T22:13:05.651Z",
"s" : "string",
"d" : 1.5,
"precision" : 1,
"format" : "SHORT_DATE",
"i" : 1,
"l" : {
"id" : "string",
"params" : [
{
"value" : {
"dt" : "2015-01-01T22:13:05.651Z",
"s" : "string",
"d" : 1.5,
"precision" : 1,
"format" : "SHORT_DATE",
"i" : 1,
"l" : {
"id" : "string",
"params" : [
{
"key" : "string"
}
]
}
},
"key" : "string"
}
]
}
},
"key" : "string"
}
]
},
"operation_id" : "obj-103",
"error" : {},
"user" : "string",
"target" : {
"id" : "obj-103",
"type" : "string"
},
"status" : "PENDING"
}
}
Request Body Parameters:
Name | Type | Description |
---|---|---|
bold = required | ||
spec | create_spec | Specification to be used by the service for creating a task. |
spec.target | dynamic_ID | Target with which Task will be associated. Warning: This attribute is part of a new feature in development. It may be changed at any time and may not have all supported functionality implemented. Optional. This field will be set if the client provides a Target ID, or set as Datacenter Root Folder otherwise. |
spec.target.type | string | The type of resource being identified (for example com.acme.Person ). Services that contain operations for creating and deleting resources typically contain a constant specifying the resource type for the resources being created and deleted. The API metamodel metadata services include a service that allows retrieving all the known resource types. |
spec.target.id | string | The identifier for a resource whose type is specified by vapi.std.dynamic_ID.type. When clients pass a value of this structure as a parameter, the field type must contain the actual resource type. When operations return a value of this structure as a result, the field type will contain the actual resource type. |
spec.operation_id | string | Extension registered operation identifier associated the the task. Warning: This attribute is part of a new feature in development. It may be changed at any time and may not have all supported functionality implemented. When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: com.vmware.cis.task . When operations return a value of this structure as a result, the field will be an identifier for the resource type: com.vmware.cis.task . |
spec.percent_done | progress | The percentage completion of the operation associated with the task. In the current release, the 'LocalizableMessage message' field of Info.progress will be ignored. Warning: This attribute is part of a new feature in development. It may be changed at any time and may not have all supported functionality implemented. Optional. If unset, the field will be set to 0. |
spec.percent_done.total | long | Total amount of the work for the operation. This attribute was added in vSphere API 6.7. |
spec.percent_done.completed | long | The amount of work completed for the operation. The value can only be incremented. This attribute was added in vSphere API 6.7. |
spec.percent_done.message | localizable_message | Message about the work progress. This attribute was added in vSphere API 6.7. |
spec.percent_done.message.id | string | Unique identifier of the localizable string or message template. This identifier is typically used to retrieve a locale-specific string or message template from a message catalog. |
spec.percent_done.message.default_message | string | The value of this localizable string or message template in the en_US (English) locale. If vapi.std.localizable_message.id refers to a message template, the default message will contain the substituted arguments. This value can be used by clients that do not need to display strings and messages in the native language of the user. It could also be used as a fallback if a client is unable to access the appropriate message catalog. |
spec.percent_done.message.args | string[] | Positional arguments to be substituted into the message template. This list will be empty if the message uses named arguments or has no arguments. |
spec.percent_done.message.params | list | Named arguments to be substituted into the message template. This attribute was added in vSphere API 7.0.0.0. Optional. Unset means that the message template requires no arguments or positional arguments are used. |
spec.percent_done.message.localized | string | Localized string value as per request requirements. This attribute was added in vSphere API 7.0.0.0. Optional. when the client has not requested specific locale the implementation may not populate this field to conserve resources. |
spec.description | localizable_message | The description of the operation associated with the task. Warning: This attribute is part of a new feature in development. It may be changed at any time and may not have all supported functionality implemented. Optional. If unset, the field will be set to empty string. |
spec.description.id | string | Unique identifier of the localizable string or message template. This identifier is typically used to retrieve a locale-specific string or message template from a message catalog. |
spec.description.default_message | string | The value of this localizable string or message template in the en_US (English) locale. If vapi.std.localizable_message.id refers to a message template, the default message will contain the substituted arguments. This value can be used by clients that do not need to display strings and messages in the native language of the user. It could also be used as a fallback if a client is unable to access the appropriate message catalog. |
spec.description.args | string[] | Positional arguments to be substituted into the message template. This list will be empty if the message uses named arguments or has no arguments. |
spec.description.params | list | Named arguments to be substituted into the message template. This attribute was added in vSphere API 7.0.0.0. Optional. Unset means that the message template requires no arguments or positional arguments are used. |
spec.description.localized | string | Localized string value as per request requirements. This attribute was added in vSphere API 7.0.0.0. Optional. when the client has not requested specific locale the implementation may not populate this field to conserve resources. |
spec.status | string | The status of the operation associated with the task. Warning: This attribute is part of a new feature in development. It may be changed at any time and may not have all supported functionality implemented. Optional. If unset, the field will be set to PENDING a.k.a. queued. |
spec.user | string | The name of the user who performed the operation in the Extension. Warning: This attribute is part of a new feature in development. It may be changed at any time and may not have all supported functionality implemented. Optional. This field will be unset if not provided by the client. |
spec.cancelable | boolean | Flag to indicate whether or not the operation can be canceled. The value may change as the operation progresses. Warning: This attribute is part of a new feature in development. It may be changed at any time and may not have all supported functionality implemented. |
spec.parent_task | string | Parent of the current task. Warning: This attribute is part of a new feature in development. It may be changed at any time and may not have all supported functionality implemented. Optional. This field will be unset if the task has no parent.When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: com.vmware.cis.task . When operations return a value of this structure as a result, the field will be an identifier for the resource type: com.vmware.cis.task . |
spec.error | exception | Description of the error if the operation status is "FAILED". Warning: This attribute is part of a new feature in development. It may be changed at any time and may not have all supported functionality implemented. Optional. It is only relevant when status has value [FAILED]. If unset when status is "FAILED", InvalidArgument exception will be thrown. |
spec.result | opaque | Result of the operation. If an operation reports partial results before it completes, this field could be set before the status has the value "SUCCEEDED". The value could change as the operation progresses. Warning: This attribute is part of a new feature in development. It may be changed at any time and may not have all supported functionality implemented. Optional. It is only relevant when status has value [RUNNING, BLOCKED, SUCCEEDED, FAILED]. This field will be unset if the operation does not return a result or if the result is not available at the current step of the operation. |
spec.start_time | date_time | Time when the operation is started. Warning: This attribute is part of a new feature in development. It may be changed at any time and may not have all supported functionality implemented. Optional. It is only relevant when status has value [RUNNING, BLOCKED, SUCCEEDED, FAILED]. This field will be unset if the status is PENDING. If the status is not PENDING, and the client does not provide this field, the current system time will be set. |
spec.end_time | date_time | Time when the operation is completed. Warning: This attribute is part of a new feature in development. It may be changed at any time and may not have all supported functionality implemented. Optional. It is only relevant when status has value [SUCCEEDED, FAILED]. This field will be unset if the status is not SUCCEEDED or FAILED. If status is SUCCEEDED or FAILED and client does not this field, the current system time will be set. |
Response:
HTTP Status Code: 200
Representation:
{
"value" : "obj-103"
}
"value" : "obj-103"
}
Response Type:
Name | Type | Description |
---|---|---|
bold = required | ||
value | string | Unique id of the task created, which can be used by client for querying and updating the task's status. |
Errors:
HTTP Status Code | Type | Description |
---|---|---|
500 | error | if the system reported an error while responding to the request. |
400 | not_allowed_in_current_state | if attempted to update percentDone of a task that is not running or to change state after task is completed or errored or to set startTime of a non-running task or to set endTime of a non-completed task. |
400 | invalid_argument | when the percentDone.completed of the task is less than 0 or greater than percentDone.total or if the error field is not populated for a failed task or if client passes a invalid status, startTime or endTime. |