QueryCostCenterRule

Updated at:
Copy as MD

Queries cost center rules.

Operation description

Queries the parent cost center and its child cost centers.

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:DescribeCostUnit

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

CostCenterId

integer

No

The ID of the cost center.

597745

EcIdAccountIds

array<object>

No

The list of enterprises and accounts. If this parameter is left empty, the current account is queried.

object

No

The list of enterprises and accounts. If this parameter is left empty, the current account is queried.

AccountIds

array

No

The list of accounts to access. If this parameter is left empty, all accounts under the current entity ID are selected.

integer

No

The ID of the member accounts.

1990699401005016

EcId

string

Yes

The ID of the enterprise entity.

1004064243473974

Nbid

string

No

The ID of the level-1 marketplace. If this parameter is left empty, the ID of the marketplace to which the current user belongs is used by default.

2684201000001

Response elements

Element

Type

Description

Example

object

BssApiPlainResult

CostCenterId

integer

The ID of the cost center.

597745

FilterExpression

object

The rule expression.

ExpressionType

string

The operation type.

Valid values:

  • DIMENSION :

    Leaf node filter type (used when code is not a tag).

  • TAG :

    Leaf node filter type (used when code is a tag).

  • NARY :

    Sub-condition relationship (used for non-leaf conditions).

NARY

FilterValues

object

The sub-condition filter.

Code

string

The condition filter key.

Valid values:

  • OWNER :

    Account.

  • ARTICLE :

    Product details.

  • RESOURCE_GROUP :

    Resource group.

  • xxx(用户自定义标签key) :

    Business tag based on the actual value configured by the user.

  • PRODUCT :

    Product.

  • INSTANCE_NICK :

    Instance name.

  • INSTANCE_ID :

    Instance ID (billing granularity).

TAG-test-xxx-key

CodeName

string

[Deprecated] The name of the condition filter key.

None

SelectType

string

The association between code and value.

Valid values:

  • LIKE :

    Used in other cases.

  • IN :

    Used when Code is INSTANCE_NICK.

IN

Values

array

The property value type corresponding to the module code. Valid values:

  • single_float: single value type.

  • range_float: range value type.

string

The condition filter value. Only one value can be entered when the code is INSTANCE_NICK.

["TAG-test-xxx"]

Operand

any

[Deprecated] The filter condition.

None

Operands

array

The conditional expression.

any

The conditional expression. For the overall structure, see the example. Multilayer nesting is supported. The following fields are for description purposes only.

{ "Operands": [ { "FilterValues": { "Code": "TAG-xxx", "Values": [ "xxxx" ], "SelectType": "IN" }, "ExpressionType": "TAG" }, { "FilterValues": { "Code": "INSTANCE_ID", "Values": [ "xxxxx" ], "SelectType": "LIKE" }, "ExpressionType": "DIMENSION" }, { "FilterValues": { "Code": "INSTANCE_NICK", "Values": [ "111" ], "SelectType": "LIKE" }, "ExpressionType": "DIMENSION" }, { "FilterValues": { "Code": "RESOURCE_GROUP", "Values": [ "xxxxx" ], "SelectType": "IN" }, "ExpressionType": "DIMENSION" }, { "FilterValues": { "Code": "ARTICLE", "Values": [ "xxxxx" ], "SelectType": "IN" }, "ExpressionType": "DIMENSION" }, { "FilterValues": { "Code": "PRODUCT", "Values": [ "xxxxx" ], "SelectType": "IN" }, "ExpressionType": "DIMENSION" }, { "FilterValues": { "Code": "OWNER", "Values": [ "xxxxx" ], "SelectType": "IN" }, "ExpressionType": "DIMENSION" } ] }

OperatorType

string

The relational expression.

Valid values:

  • OR :

    OR

  • AND :

    AND

AND

GmtCreate

string

The creation time.

Tue Nov 12 14:49:43 CST 2024

GmtModified

string

The modification time.

Wed Oct 16 10:15:37 CST 2024

Id

integer

The ID of the cost center automatic allocation rule.

32048

IsDeleted

integer

The deletion status. Valid values:

  • 0: active.

  • 1: inactive.

0

Metadata

any

The metadata of the response structure.

{}

OwnerAccountId

integer

The owner account of the cost center.

1977800748053695

RequestId

string

Id of the request

UUID

RootCostCenterId

integer

The ID of the root cost center.

0

Status

string

The status. Valid values:

  • on: valid.

  • off: invalid.

on

Examples

Success response

JSON format

{
  "CostCenterId": 597745,
  "FilterExpression": {
    "ExpressionType": "NARY",
    "FilterValues": {
      "Code": "TAG-test-xxx-key\n",
      "CodeName": "None",
      "SelectType": "IN",
      "Values": [
        "[\"TAG-test-xxx\"]\n"
      ]
    },
    "Operand": "None",
    "Operands": [
      "{\n \n                \"Operands\": [\n                    {\n                        \"FilterValues\": {\n                            \"Code\": \"TAG-xxx\",\n                            \"Values\": [\n                                \"xxxx\"\n                            ],\n                            \"SelectType\": \"IN\"\n                        },\n                        \"ExpressionType\": \"TAG\"\n                    },\n                    {\n                        \"FilterValues\": {\n                            \"Code\": \"INSTANCE_ID\",\n                            \"Values\": [\n                                \"xxxxx\"\n                            ],\n                            \"SelectType\": \"LIKE\"\n                        },\n                        \"ExpressionType\": \"DIMENSION\"\n                    },\n                    {\n                        \"FilterValues\": {\n                            \"Code\": \"INSTANCE_NICK\",\n                            \"Values\": [\n                                \"111\"\n                            ],\n                            \"SelectType\": \"LIKE\"\n                        },\n                        \"ExpressionType\": \"DIMENSION\"\n                    },\n                    {\n                        \"FilterValues\": {\n                            \"Code\": \"RESOURCE_GROUP\",\n                            \"Values\": [\n                                \"xxxxx\"\n                            ],\n                            \"SelectType\": \"IN\"\n                        },\n                        \"ExpressionType\": \"DIMENSION\"\n                    },\n                    {\n                        \"FilterValues\": {\n                            \"Code\": \"ARTICLE\",\n                            \"Values\": [\n                                \"xxxxx\"\n                            ],\n                            \"SelectType\": \"IN\"\n                        },\n                        \"ExpressionType\": \"DIMENSION\"\n                    },\n                    {\n                        \"FilterValues\": {\n                            \"Code\": \"PRODUCT\",\n                            \"Values\": [\n                                \"xxxxx\"\n                            ],\n                            \"SelectType\": \"IN\"\n                        },\n                        \"ExpressionType\": \"DIMENSION\"\n                    },\n                    {\n                        \"FilterValues\": {\n                            \"Code\": \"OWNER\",\n                            \"Values\": [\n                                \"xxxxx\"\n                            ],\n                            \"SelectType\": \"IN\"\n                        },\n                        \"ExpressionType\": \"DIMENSION\"\n                    }\n                ]\n       }"
    ],
    "OperatorType": "AND"
  },
  "GmtCreate": "Tue Nov 12 14:49:43 CST 2024",
  "GmtModified": "Wed Oct 16 10:15:37 CST 2024",
  "Id": 32048,
  "IsDeleted": 0,
  "Metadata": "{}",
  "OwnerAccountId": 1977800748053695,
  "RequestId": "UUID",
  "RootCostCenterId": 0,
  "Status": "on"
}

Error codes

HTTP status code

Error code

Error message

Description

400 CostCenter.MasterAndSubHasNoRelation Your account has no valid account relation yet.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.