All Products
Search
Document Center

BSS OpenAPI:AllocateCostUnitResource

Last Updated:Mar 01, 2024

Transfers resource instances from the source cost center to the destination cost center.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
bss:AllocateCostUnitResourceWRITE
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
FromUnitUserIdlongYes

The user ID of the owner of the source cost center.

273394581313325532
FromUnitIdlongYes

The ID of the source cost center.

  • A value of 0 indicates that the resources to be transferred have not been allocated to a cost center.
  • A value greater than 0 indicates the ID of an existing cost center.
0
ToUnitUserIdlongYes

The user ID of the owner of the destination cost center.

241021678450941490
ToUnitIdlongYes

The ID of the destination cost center.

  • A value of -1 indicates that the allocated resources are changed to unallocated.
  • A value greater than 0 indicates the ID of an existing cost center.
186419
ResourceInstanceListobject []Yes

The resource instances to be transferred.

ApportionCodestringNo

The split item of the shared instance. This parameter is required only for shared instances.

  • Eight cloud services support bill splitting. The commodity codes of the eight services are oss, dcdn, snapshot, vod, cdn, live, cbwp, and pcdn.
  • You can obtain the split item of a shared instance by calling QueryCostUnitResource operation to obtain all resource instances within a cost center.
qwer1-cn-beijing
CommodityCodestringYes

The commodity code of the resource instance.

oss
ResourceUserIdlongYes

The user ID of the resource instance owner.

273394581313325532
ResourceIdstringYes

The ID of the resource instance.

cn-hangzhou;standard

Response parameters

ParameterTypeDescriptionExample
object
Codestring

The status code.

success
Messagestring

The error message returned.

Successful!
RequestIdstring

The ID of the request.

845C629F-47A7-4F46-A470-ED5047C4C250
Successboolean

Indicates whether the request was successful.

false
Dataobject

The data returned.

ToUnitUserIdlong

The user ID of the owner of the destination cost center.

34857693874
IsSuccessboolean

Indicates whether resources are allocated to the specified cost center. Valid values:

  • true: The resources are allocated to the specified cost center.
  • false: The resources fail to be allocated to the specified cost center.
true
ToUnitIdlong

The ID of the destination cost center.

32857346527

Examples

Sample success responses

JSONformat

{
  "Code": "success",
  "Message": "Successful!",
  "RequestId": "845C629F-47A7-4F46-A470-ED5047C4C250",
  "Success": false,
  "Data": {
    "ToUnitUserId": 34857693874,
    "IsSuccess": true,
    "ToUnitId": 32857346527
  }
}

Error codes

For a list of error codes, visit the Service error codes.