All Products
Search
Document Center

BSS OpenAPI:QueryCostUnitResource

Last Updated:Mar 01, 2024

Queries the resource instances that are allocated to a cost center. If the unitId parameter is set to 0, the unallocated primary resource instances and sub-resource instances are queried.

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:QueryCostUnitResourceREAD
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
OwnerUidlongYes

The user ID of the cost center owner.

23453245
UnitIdlongYes

The ID of the cost center.

235325
PageNumintegerNo

The number of the page to return.

1
PageSizeintegerNo

The number of entries to return on each page.

20

Response parameters

ParameterTypeDescriptionExample
object
Codestring

The status code.

Success
Messagestring

The error message.

Successful!
RequestIdstring

The ID of the request.

04332CB7-9A57-4461-97E0-02821D044414
Successboolean

Indicates whether the request was successful.

true
Dataobject

The data returned.

PageNuminteger

The page number of the returned page.

1
PageSizeinteger

The number of entries returned per page.

20
TotalCountinteger

The total number of returned entries.

12
ResourceInstanceDtoListobject []

The resource instances.

CommodityCodestring

The product code of the resource.

rds
ResourceUserNamestring

The username of the resource owner.

test@test.aliyun.com
CommodityNamestring

The commodity name of the resource.

ApsaraDB
ResourceUserIdlong

The user ID of the resource owner.

2424242134
ApportionNamestring

The split name of the resource.

test
ApportionCodestring

The split code of the resource.

test
ResourceTypestring

The type of the resource.

FPT_ossbag_absolute_Storage_bj
ResourceNickstring

The custom name of the resource.

testResource
ResourceTagstring

The tags of the resource.

testResource
ResourceIdstring

The instance ID of the resource.

OSSBAG-cn-v0h1s4hma018
ResourceGroupstring

The resource group to which the resource belongs.

Default Resource Group
RelatedResourcesstring

The resources related to the resource instance.

oss
ResourceStatusstring

The status of the resource.

Available
CostUnitobject

The information about the cost center.

ParentUnitIdlong

The ID of the parent cost center. A value of -1 indicates the root cost center.

23421
UnitNamestring

The name of the cost center.

test
UnitIdlong

The ID of the cost center.

123412
OwnerUidlong

The user ID of the cost center owner.

321432
CostUnitStatisInfoobject

The statistical information about the cost center.

TotalResourceCountlong

The total number of resource instances, including resource instances of sub-cost centers, in the cost center.

3
ResourceCountlong

The number of resource instances in the cost center.

1
TotalUserCountlong

The total number of the associated accounts, including associated accounts of sub-cost centers, in the cost center.

2
SubUnitCountlong

The number of sub-cost centers in the cost center.

2
ResourceGroupCountlong

The number of resource groups in the cost center.

1
TotalResourceGroupCountlong

The total number of resource groups, including resource groups of sub-cost centers, in the cost center.

2
UserCountlong

The number of sub-cost centers in the cost center.

0

Examples

Sample success responses

JSONformat

{
  "Code": "Success",
  "Message": "Successful!",
  "RequestId": "04332CB7-9A57-4461-97E0-02821D044414",
  "Success": true,
  "Data": {
    "PageNum": 1,
    "PageSize": 20,
    "TotalCount": 12,
    "ResourceInstanceDtoList": [
      {
        "CommodityCode": "rds",
        "ResourceUserName": "test@test.aliyun.com",
        "CommodityName": "ApsaraDB\n",
        "ResourceUserId": 2424242134,
        "ApportionName": "test",
        "ApportionCode": "test",
        "ResourceType": "FPT_ossbag_absolute_Storage_bj",
        "ResourceNick": "testResource",
        "ResourceTag": "testResource",
        "ResourceId": "OSSBAG-cn-v0h1s4hma018",
        "ResourceGroup": "Default Resource Group\n",
        "RelatedResources": "oss",
        "ResourceStatus": "Available"
      }
    ],
    "CostUnit": {
      "ParentUnitId": 23421,
      "UnitName": "test",
      "UnitId": 123412,
      "OwnerUid": 321432
    },
    "CostUnitStatisInfo": {
      "TotalResourceCount": 3,
      "ResourceCount": 1,
      "TotalUserCount": 2,
      "SubUnitCount": 2,
      "ResourceGroupCount": 1,
      "TotalResourceGroupCount": 2,
      "UserCount": 0
    }
  }
}

Error codes

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