Scripting Object - VcTask

Scripting-object corresponding to
Task
Attribute of
_VcPlugin, VcClusterAttemptedVmInfo, VcClusterComputeResource, VcComputeResource, VcDatacenter, VcDatastore, VcDistributedVirtualPortgroup, VcDistributedVirtualSwitch, VcFolder, VcHostSystem, VcNetwork, VcResourcePool, VcScheduledTaskInfo, VcSdkConnection, VcStoragePlacementResult, VcStoragePod, VcTaskInfo, VcTaskManager, VcVirtualApp, VcVirtualMachine, VcVmwareDistributedVirtualSwitch
Returned by
addDVPortgroup_Task, addDVPortgroup_Task, addHost_Task, addStandaloneHost_Task, addStandaloneHost_Task, applyHostConfig_Task, applyStorageDrsRecommendation_Task, applyStorageDrsRecommendationToPod_Task, checkAnswerFileStatus_Task, checkCompatibility_Task, checkCompliance_Task, checkHostPatch_Task, checkMigrate_Task, checkProfileCompliance_Task, checkProfileCompliance_Task, checkProfileCompliance_Task, checkRelocate_Task, cloneVApp_Task, cloneVM_Task, configureDatastoreIORM_Task, configureHostCache_Task, configureStorageDrsForPod_Task, consolidateVMDisks_Task, copyDatastoreFile_Task, copyVirtualDisk_Task, createChildVM_Task, createChildVM_Task, createDVPortgroup_Task, createDVPortgroup_Task, createDVS_Task, createDVS_Task, createScreenshot_Task, createSecondaryVM_Task, createSnapshot_Task, createVirtualDisk_Task, createVM_Task, createVM_Task, customizeVM_Task, datastoreExitMaintenanceMode_Task, defragmentVirtualDisk_Task, deleteDatastoreFile_Task, deleteVirtualDisk_Task, destroy_Task, destroy_Task, destroy_Task, destroy_Task, destroy_Task, destroy_Task, destroy_Task, destroy_Task, destroy_Task, destroy_Task, destroy_Task, destroy_Task, destroy_Task, destroy_Task, disableSecondaryVM_Task, disconnectHost_Task, dVPortgroupRollback_Task, dVSManagerExportEntity_Task, dVSManagerImportEntity_Task, dVSRollback_Task, dVSRollback_Task, eagerZeroVirtualDisk_Task, enableSecondaryVM_Task, enterMaintenanceMode_Task, estimateStorageForConsolidateSnapshots_Task, exitMaintenanceMode_Task, exportAnswerFile_Task, extendVirtualDisk_Task, generateLogBundles_Task, getAllTasks, getAllTasks, importCertificateForCAM_Task, inflateVirtualDisk_Task, installHostPatch_Task, installHostPatchV2_Task, joinDomain_Task, joinDomainWithCAM_Task, leaveCurrentDomain_Task, makePrimaryVM_Task, mergeDvs_Task, mergeDvs_Task, migrateVM_Task, moveDatastoreFile_Task, moveDVPort_Task, moveDVPort_Task, moveHostInto_Task, moveInto_Task, moveIntoFolder_Task, moveIntoFolder_Task, moveVirtualDisk_Task, performDvsProductSpecOperation_Task, performDvsProductSpecOperation_Task, powerDownHostToStandBy_Task, powerOffVApp_Task, powerOffVM_Task, powerOnMultiVM_Task, powerOnVApp_Task, powerOnVM_Task, powerUpHostFromStandBy_Task, promoteDisks_Task, queryHostPatch_Task, queryVMotionCompatibilityEx_Task, rebootHost_Task, reconfigureCluster_Task, reconfigureComputeResource_Task, reconfigureComputeResource_Task, reconfigureDatacenter_Task, reconfigureDVPort_Task, reconfigureDVPort_Task, reconfigureDVPortgroup_Task, reconfigureDvs_Task, reconfigureDvs_Task, reconfigureHostForDAS_Task, reconfigVM_Task, reconnectHost_Task, rectifyDvsHost_Task, rectifyDvsHost_Task, rectifyDvsOnHost_Task, registerChildVM_Task, registerChildVM_Task, registerVM_Task, registerVM_Task, reloadVirtualMachineFromPath_Task, relocateVM_Task, removeAllSnapshots_Task, removeSnapshot_Task, rename_Task, rename_Task, rename_Task, rename_Task, rename_Task, rename_Task, rename_Task, rename_Task, rename_Task, rename_Task, rename_Task, rename_Task, rename_Task, rename_Task, resetVM_Task, resignatureUnresolvedVmfsVolume_Task, revertToCurrentSnapshot_Task, revertToSnapshot_Task, scanHostPatch_Task, scanHostPatchV2_Task, searchDatastore_Task, searchDatastoreSubFolders_Task, shrinkVirtualDisk_Task, shutdownHost_Task, stageHostPatch_Task, startRecording_Task, startReplaying_Task, stopRecording_Task, stopReplaying_Task, suspendVApp_Task, suspendVM_Task, terminateFaultTolerantVM_Task, turnOffFaultToleranceForVM_Task, uninstallHostPatch_Task, unregisterAndDestroy_Task, unregisterAndDestroy_Task, unregisterVApp_Task, updateAnswerFile_Task, updateDVSHealthCheckConfig_Task, updateDVSHealthCheckConfig_Task, updateVirtualMachineFiles_Task, upgradeTools_Task, upgradeVM_Task, zeroFillVirtualDisk_Task

Scripting Object Description

A task is used to monitor and potentially cancel long running operations.

Attributes

Name Type Description
availableField*VcCustomFieldDef []

List of custom field definitions that are valid for the object's type. The fields are sorted by VcCustomFieldDef.
idstring

returns the id of this ManagedObject
infoVcTaskInfo

Detailed information about this task.
referenceVcManagedObjectReference

returns the ManagedObjectReference of this ManagedObject
sdkConnectionVcSdkConnection

returns the parent SdkConnection
value*VcCustomFieldValue []

List of custom field values. Each value uses a key to associate an instance of a VcCustomFieldStringValue with a custom field definition.
vimHostVcSdkConnection

returns the parent SdkConnection (deprecated)
vimTypestring

returns the type of this ManagedObject
*May not be present

Methods

Methods defined in this Scripting Object
cancelTask, createEndOfTaskTrigger, createTrigger, setCustomValue, setTaskDescription, setTaskState, updateProgress

setCustomValue

Assigns a value to a custom field. The setCustomValue method requires whichever updatePrivilege is defined as one of the VcCustomFieldDef for the CustomFieldDef whose value is being changed.

Parameters

NameTypeDescription
keystring

The name of the field whose value is to be updated.
valuestring

Value to be assigned to the custom field.

Return Value

Type Description
None

cancelTask

Cancels a running or queued task. A task may only be canceled if it is cancelable. Multiple cancel requests will be treated as a single cancelation request. Canceling a completed or already canceled task will throw an InvalidState exception.

If a task is canceled, its runtime state will be set to error and its error state will be set to VcRequestCanceled.

A cancel operation is asynchronous. The operation may return before the task is canceled.

Parameters

NameTypeDescription
None

Return Value

Type Description
None

updateProgress

Sets percentage done for this task and recalculates overall percentage done. If a percentDone value of less than zero or greater than 100 is specified, a value of zero or 100 respectively is used.

Parameters

NameTypeDescription
percentDonenumber

Percentage to set for this task

Return Value

Type Description
None

setTaskState

Sets task state and optionally sets results or fault, as appropriate for state

Parameters

NameTypeDescription
stateVcTaskInfoState

New state for task
result*any

Result to set, valid only if task state is TaskInfo.State.success
fault*VcMethodFault

Fault to set, valid only if task state is VcTaskInfoState. The fault must be a of a fault type that directly or indirectly extends VcVimFault.
*Need not be set

Return Value

Type Description
None

setTaskDescription

Updates task description to describe the current phase of the task.

Parameters

NameTypeDescription
descriptionVcLocalizableMessage

New description for task

Return Value

Type Description
None

createEndOfTaskTrigger

Create a trigger from this task waiting on completed or error state

Parameters

NameTypeDescription
timeoutnumber

Waiting timout in seconds

Return Value

Type Description
Trigger

createTrigger

Create a trigger from this ManagedObject

Parameters

NameTypeDescription
timeoutnumber

Waiting timout in seconds
filterstring

The monitored vCenter API filter
conditionstring

The condition in OGNL language
filterToSync*string

The vCenter API filter used to synchronize the content of the session
*Need not be set

Return Value

Type Description
Trigger