Folder APIs

Folder APIs

The Folder managed object is a container for storing and organizing inventory objects.

Folders can contain folders and other objects. The childType property identifies a folder's type and determines the types of folders and objects the folder can contain.

See ServiceInstance for a representation of the organization of the inventory.

The Folder managed object also acts as a factory object, meaning it creates new entities in a folder. The object provides methods to create child folders and objects, methods to add existing objects to folders, and methods to remove objects from folders and to delete folders.

Folder inherits the Destroy_Task method. Destroy_Task is a recursive operation that removes all child objects and folders. When you call Destroy_Task to destroy a folder, the system uses the specified folder as a root and traverses its descendant hierarchy, calling Destroy_Task on each object. Destroy_Task is a single operation that treats each recursive call as a single transaction, committing each call to remove an object individually. If Destroy_Task fails on an object, the method terminates at that point with an exception, leaving some or all of the objects still in the inventory.

Notes on the folder destroy method:

  • Calling Destroy_Task on a virtual machine folder recursively calls Destroy_Task on all the child virtual machines and vApps, which are then removed from disk. Use UnregisterAndDestroy_Task to unregister virtual machines or vApps recursively without removing them from the disk.
  • For virtual machine folders, the Destroy_Task method requires the VirtualMachine.Delete privilege on the folder as well as all virtual machines to be destroyed. It also requires the VirtualApp.Delete privilege on all VirtualApp objects to be destroyed.
  • Destroying a host folder or datacenter folder unregisters all child hosts and virtual machines from vCenter. The hosts are simply removed from the inventory, along with their virtual machines. The virtual machines are not removed from disk nor are their runtime states changed.
  • You can remove network and datastore folders only if they are empty.
  • You cannot destroy, rename, or move the virtual machine, compute resource, network entity, and datastore child folders of a Datacenter.

Operations
POST
Folder Add Standalone Host Task
Creates a new single-host compute resource.
POST
Folder Batch Add Hosts To Cluster Task
Adds a set of new and existing hosts to the cluster.
POST
Folder Batch Add Standalone Hosts Task
Adds a list of hosts to inventory, as standalone hosts, in a single invocation.
POST
Folder Create Cluster
Creates a new cluster compute resource in this folder.
POST
Folder Create Cluster Ex
Creates a new cluster compute resource in this folder.
POST
Folder Create Datacenter
Creates a new datacenter with the given name.
POST
Folder Create DVS Task
Create a *DistributedVirtualSwitch* in the folder according to the specified *DVSCreateSpec*.
POST
Folder Create Folder
Creates a new sub-folder with the specified name.
POST
Folder Create Storage Pod
Creates a new storage pod in this folder.
POST
Folder Create VM Task
Creates a new virtual machine in the current folder and attaches it to the specified resource pool.
POST
Folder Destroy Task
Destroys this object, deleting its contents and removing it from its parent folder (if any).
GET
Folder Get Alarm Actions Enabled
Whether alarm actions are enabled for this entity.
GET
Folder Get Available Field
List of custom field definitions that are valid for the object's type.
GET
Folder Get Child Entity
An array of managed object references.
GET
Folder Get Child Type
Specifies the object types a folder may contain.
GET
Folder Get Config Issue
Current configuration issues that have been detected for this entity.
GET
Folder Get Config Status
The configStatus indicates whether or not the system has detected a configuration issue involving this entity.
GET
Folder Get Custom Value
Custom field values.
GET
Folder Get Declared Alarm State
A set of alarm states for alarms that apply to this managed entity.
GET
Folder Get Disabled Method
List of operations that are disabled, given the current runtime state of the entity.
GET
Folder Get Effective Role
Access rights the current session has to this entity.
GET
Folder Get Name
Name of this entity, unique relative to its parent.
GET
Folder Get Namespace
The namespace with which the Folder is associated.
GET
Folder Get Overall Status
General health of this managed entity.
GET
Folder Get Parent
Parent of this entity.
GET
Folder Get Permission
List of permissions defined for this entity.
GET
Folder Get Recent Task
The set of recent tasks operating on this managed entity.
GET
Folder Get Tag
The set of tags associated with this managed entity.
GET
Folder Get Triggered Alarm State
A set of alarm states for alarms triggered by this entity or by its descendants.
GET
Folder Get Value
List of custom field values.
POST
Folder Move Into Folder Task
Moves a set of managed entities into this folder.
POST
Folder Register VM Task
Adds an existing virtual machine to the folder.
POST
Folder Reload
Reload the entity state.
POST
Folder Rename Task
Renames this managed entity.
POST
Folder Set Custom Value
Assigns a value to a custom field.
POST
Folder Unregister And Destroy Task
Recursively unregisters all virtual machines and vApps, and destroys all child virtual machine folders.