AllocateCostCenterResource

Updated at:
Copy as MD

Allocates resource instances (instance-based and attached-resource-based) from a source cost center to a destination cost center.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

bss:AllocateCostUnitResource

update

*全部资源

*

None None

Request parameters

Parameter

Type

Required

Description

Example

FromOwnerAccountId

integer

No

The ID of the owner of the source cost center.

1529600453335198

FromCostCenterId

integer

No

The ID of the source cost center. This parameter is required.

  • 0 indicates that the cost center is unallocated.

  • A value greater than 0 indicates an allocated cost center ID.

637180

ToCostCenterId

integer

No

The ID of the destination cost center. Valid values:

  • -1: moves the allocated resource to the unallocated state.

  • A value greater than 0: allocates the resource to the specified cost center.

638288

ResourceInstanceList

array<object>

Yes

The list of resource instances.

object

No

The list of resource instances.

ResourceUserId

integer

No

The ID of the owner of the billing instance. This parameter is required.

273394581313325532

InstanceId

string

No

The billing granularity ID. This parameter is required.

cn-hangzhou;standard

ResourceType

string

No

The resource type.

SCU

PipCode

string

No

The product code, which is the same as the product code in User Center bills.

ecs

ResourceNick

string

No

The custom nickname of the resource.

ecs-test-1

ApportionCode

string

No

The attached resource type of the attached-resource instance. This parameter is required only for attached-resource product instances.

  • Currently, eight commodities support attached resources. The commodity codes are oss, dcdn, snapshot, vod, cdn, live, and cbwp.

  • You can call the QueryCostUnitResource operation to obtain all billing instances (including attached-resource instances with their attached resources) under a specific cost center (including the unallocated cost center) of a user.

qwer1-cn-beijing

ResourceTag

string

No

The tag of the resource.

tag-test1

RelatedResources

string

No

The resources related to the resource instance.

related-resource

ApportionName

string

No

The attached resource name.

split-item-test1

ResourceId

string

No

The resource ID.

cn-hangzhou;standard:app

ResourceSource

string

No

The resource source. Valid values:

  • AUTO_ALLOCATE: automatic allocation.

  • MANUAL_ALLOCATE: manual allocation.

AUTO_ALLOCATE

CommodityCode

string

No

The commodity code of the billing instance. This parameter is required.

oss

ResourceStatus

string

No

The resource status.

0

ResourceUserName

string

No

The resource ownership username.

test

CommodityName

string

No

The commodity name of the resource.

RESOURCE_UDR

ResourceGroup

string

No

The resource group.

xihe_mpp

Nbid

string

No

The primary sales channel ID. If this parameter is left empty, the sales channel ID of the current user is used by default.

2684201000001

Response elements

Element

Type

Description

Example

object

BssApiPlainResult

Metadata

any

The metadata of the response struct.

{}

RequestId

string

The request ID.

UUID

OwnerAccountId

integer

The owner of the cost center.

1529600453335198

CostCenterId

integer

The cost center ID.

640403

IsSuccess

boolean

Indicates whether the operation was successful.

true

Examples

Success response

JSON format

{
  "Metadata": "{}",
  "RequestId": "UUID",
  "OwnerAccountId": 1529600453335198,
  "CostCenterId": 640403,
  "IsSuccess": true
}

Error codes

HTTP status code

Error code

Error message

Description

400 CostCenter.MasterAndSubHasNoRelation Your account has no valid account relation yet.
400 CostCenter.ResourceAuthFailed The instance does not belong to the current user.
400 CostCenter.ResourceNotExist The specified instance is not found in our records.
400 CostCenter.AllocateResourceRepeat The instance has already been assigned a financial unit. Use transfer allocation for adjustment.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.