@Sample(name="remove-managed-object",
description="demonstrates Destroy or Unregister Managed Inventory Object like a Host, VM, Folder, etc")
public class RemoveManagedObject
extends ConnectedVimServiceBase
This sample demonstrates Destroy or Unregister
Managed Inventory Object like a Host, VM, Folder, etc
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
objtype [required] : type of managedobject to remove or unregister");
e.g. HostSystem, Datacenter, ResourcePool, Folder
objname [required] : Name of the object
operation [optional] : Name of the operation - [remove | unregister]
Command Line:
Remove a folder named Fold
run.bat com.vmware.general.RemoveManagedObject --url [webserviceurl]
--username [username] --password [password]
--objtype Folder --objname Fold
Unregister a virtual machine named VM1
run.bat com.vmware.general.RemoveManagedObject
--url [webserviceurl] --username [username] --password [password]
--objtype VirtualMachine --objname VM1 --operation unregister
ConnectedVimServiceBase.ConnectionException| Modifier and Type | Field and Description |
|---|---|
static java.lang.String[] |
OBJECT_TYPES |
java.lang.String |
SVC_INST_NAME |
PROP_ME_NAME| Constructor and Description |
|---|
RemoveManagedObject() |
| Modifier and Type | Method and Description |
|---|---|
void |
deleteManagedObjectReference() |
void |
run() |
void |
setObjectname(java.lang.String objectname) |
void |
setObjecttype(java.lang.String objecttype) |
void |
setOperation(java.lang.String operation) |
boolean |
validateObjectType(java.lang.String type) |
boolean |
validateTheInput() |
basicConnectionFromConnection, connect, disconnect, getServiceInstanceReference, setConnection, setHostConnectionpublic final java.lang.String SVC_INST_NAME
public static final java.lang.String[] OBJECT_TYPES
@Option(name="objtype",
description="type of managedobject to remove or unregister e.g. HostSystem, VirtualMachine, Folder, ResourcePool, Datacenter")
public void setObjecttype(java.lang.String objecttype)
@Option(name="objname",
description="Name of the object")
public void setObjectname(java.lang.String objectname)
@Option(name="operation",
required=false,
description="Name of the operation - [remove | unregister]")
public void setOperation(java.lang.String operation)
public boolean validateObjectType(java.lang.String type)
public boolean validateTheInput()
public void deleteManagedObjectReference()
throws com.vmware.vim25.RuntimeFaultFaultMsg,
com.vmware.vim25.InvalidPropertyFaultMsg,
com.vmware.vim25.VimFaultFaultMsg,
com.vmware.vim25.InvalidCollectorVersionFaultMsg,
com.vmware.vim25.TaskInProgressFaultMsg,
com.vmware.vim25.InvalidPowerStateFaultMsg
com.vmware.vim25.RuntimeFaultFaultMsgcom.vmware.vim25.InvalidPropertyFaultMsgcom.vmware.vim25.VimFaultFaultMsgcom.vmware.vim25.InvalidCollectorVersionFaultMsgcom.vmware.vim25.TaskInProgressFaultMsgcom.vmware.vim25.InvalidPowerStateFaultMsg@Action
public void run()
throws com.vmware.vim25.RuntimeFaultFaultMsg,
com.vmware.vim25.TaskInProgressFaultMsg,
com.vmware.vim25.InvalidPropertyFaultMsg,
com.vmware.vim25.VimFaultFaultMsg,
com.vmware.vim25.InvalidCollectorVersionFaultMsg,
com.vmware.vim25.InvalidPowerStateFaultMsg
com.vmware.vim25.RuntimeFaultFaultMsgcom.vmware.vim25.TaskInProgressFaultMsgcom.vmware.vim25.InvalidPropertyFaultMsgcom.vmware.vim25.VimFaultFaultMsgcom.vmware.vim25.InvalidCollectorVersionFaultMsgcom.vmware.vim25.InvalidPowerStateFaultMsg