Set Allocations for an Entity

The API helps you allocate computing resources to an entity in a hierarchy.

Syntax

The syntax for calling this method is:

PUT <Base_Url>/hierarchy/{hierarchyId}/entity/{entityId}/allocations

A sample API call is as follows:

PUT https://123.123.123.123/vCenter-CB/api/hierarchy/1/entity/51/allocations

User Privilege

To call this API, you should have a role with Read privilege on the hierarchy and Update privilege on the entity.

URL Parameters

Name

Data Type

Required/Optional

Description

Sample Value

startTime

Long

Required

Start time (in milliseconds, from January 1, 1970 GMT 00:00) of the time period for which you want to set the allocation.

1232562600000

endTime

Long

Optional

End time (in milliseconds, from January 1, 1970 GMT 00:00) of the time period for which you want to set the allocation. If this is not specified, the allocation will be effective for an infinite time period from the specified start time. If specified, this parameter must be specified as later than the start time.

1232649000000

Request Parameters

In the request XML, specify the parameters provided in the following table.

XPath

Type

Min Occurs

Max Occurs

Description

Hierarchies/Hierarchy

 

1

1

Represents the hierarchy to which the entity belongs.

Hierarchies/Hierarchy/@id

xs:int

0

1

ID of the hierarchy.

Hierarchies/Hierarchy/Entities/Entity

 

1

1

Represents the entity for which you want to set the allocations.

Hierarchies/Hierarchy/Entities/Entity/@id

xs:int

0

1

ID of the entity.

Hierarchies/Hierarchy/Entities/Entity/Allocations/Allocation

 

1

n

Represents each computing resource allocation for the entity.

Hierarchies/Hierarchy/Entities/Entity/Allocations/Allocation/ComputingResource/@id

xs:int

1

1

ID of the computing resource which you want to allocate. For a list of supported computing resources, see the Appendix.

Hierarchies/Hierarchy/Entities/Entity/Allocations/Allocation/Values/Value

xs:int

1

1

Represents the value of the computing resource allocation.

If you want to clear the existing value of this element, specify an empty value.

Hierarchies/Hierarchy/Entities/Entity/Allocations/Allocation /Values/Value/AllocationValue

xs:double

1

1

Value of the computing resource allocation to be set for this entity.

 

A sample request XML is provided here.

API Response

If the operation is successful, the API gets an XML response indicating the status.

A sample response is provided here.

Error Response

The following table explains the error codes displayed by the API.

Error Code

Description

VCB_ERR_INVALID_ENTITY_ID

Specified entity is not found in the hierarchy.

VCB_ERR_INVALID_TIME_PERIOD

Start date is not specified or is specified as later than the end date.

VCB_ERR_INVALID_COMPUTING_RESOURCE_ID

Computing resource ID is not specified or is invalid.

VCB_ERR_INVALID_VALUE

Specified allocation value is less than zero.