Updated on 2024-07-08 GMT+08:00

Viewing Resource Package Usage

Function

Customers can query the resource package usage on the self-built platform by resource.

Customers can log in to Billing center and go to My Packages. Click the Resource Packages tab, and then the resource package name to view the resource usage.

Constraints

This API can be invoked only by the customer AK/SK or token.

If a resource package has expired for more than 18 months, its information cannot be queried.

URI

POST /v2/payments/free-resources/usages/details/query

Table 1 Header parameter

Parameter

Mandatory

Value Range

Description

X-Language

No

A maximum of 8 characters

Language.

  • zh_CN: Chinese
  • en_US: English

Default value: zh_CN

Request

Request Parameters

Parameter

Mandatory

Type

Value Range

Description

free_resource_ids

Yes

List<string>

A maximum of 100 records

List of resource item IDs. Each ID contains a maximum of 64 bytes.

Resource ID. A resource package contains multiple resources, and a resource has a usage type. The resource ID is obtained from the response of the API in Querying Resource Packages.

Example Request

POST https://bss.myhuaweicloud.eu/v2/payments/free-resources/usages/details/query HTTP/1.1
Content-Type: application/json
X-Auth-Token: MIIPAgYJKoZIhvcNAQcCo...ggg1BBIINPXsidG9rZ

{
    "free_resource_ids": [
        "d4463497-991b-439d-9ab6-23f9ed197fe9"
    ]
}

Response

Response Parameters

Parameter

Type

Maximum Length of Characters

Description

error_code

String

20

Error code.

For details, see Returned Values. This parameter is returned only when the query failed.

error_msg

String

1000

Error description.

This parameter is returned only when the query failed.

free_resources

List<FreeResourceDetail>

-

Resource information (resource details) in a resource package. For details, see Table 2.

Table 2 FreeResourceDetail

Parameter

Type

Maximum Length of Characters

Description

free_resource_id

String

A maximum of 64 characters

Resource ID. A resource package contains multiple resources, and a resource has a usage type.

free_resource_type_name

String

-

Resource type name.

quota_reuse_cycle

Integer

-

Reset period. This parameter is valid only when quota_reuse_mode is set to 1 (Resettable).

  • 1: Hour
  • 2: Day
  • 3: Week
  • 4: Month
  • 5: Year

quota_reuse_cycle_type

Integer

-

Reset period type. This field is valid only when quota_reuse_mode is set to 1 (Resettable).

  • 1: Reset by calendar period

    Indicates that the resource package is reset by calendar month or calendar year. For example, if you set quota_reuse_cycle to 4 (month) and quota_reuse_cycle_type to 1, the resource package is reset on the first day of each month.

  • 2: Reset by order period

    Indicates that the resource package is reset by order period. For example, if you set quota_reuse_cycle to 4 (month), quota_reuse_cycle_type to 2, and you purchase this resource package on the 15th day of the month, then the resource package will be reset on the 15th day of each month.

usage_type_name

String

-

Usage type name.

start_time

String

-

Start time. The value is in UTC format.

  • If quota_reuse_mode is set to 1, the value is the start time of the reset period for the current time.
  • If quota_reuse_mode is set to 2, the value is the time when the purchased instance takes effect.

end_time

String

-

End time. The value is in UTC format.

  • If quota_reuse_mode is set to 1, the value is the end time of the reset period for the current time.
  • If quota_reuse_mode is set to 2, the value is the time when the purchased instance becomes invalid.

amount

BigDecimal

-

Remaining resource quota of a package whose quota_reuse_mode is Resettable, that is, the remaining resource quota in the current reset period.

original_amount

BigDecimal

-

Original resource quota of a package whose quota_reuse_mode is Resettable, that is, the total resource quota in each reset period.

measure_id

Integer

-

Measurement unit of the quota of a free resource package. Call the API in Querying Measurement Units to obtain the value.

Example Response

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: length
Date: response time 
{
    "free_resources": [
        {
            "free_resource_id": "d4463497-991b-439d-9ab6-23f9ed197fe9",
            "free_resource_type_name": "test1",
            "quota_reuse_cycle": 4,
            "quota_reuse_cycle_type": 1,
            "usage_type_name": "Duration",
            "start_time": "2021-04-30T03:30:56Z",
            "end_time": "2021-05-31T15:59:59Z",
            "amount": 100,
            "original_amount": 100,
            "measure_id": 37
        }
    ]
}

Returned Values

  • 4xx: This class of HTTP status code is intended for situations in which the error seems to have been caused by the client, for example, the request contains bad syntax or incorrect parameters. You must ensure the request is correct.
  • 5xx: This class of HTTP status code is intended for cases in which the Huawei Cloud server is aware that it has encountered an error or is otherwise incapable of performing the request. In this case, contact Huawei Cloud customer service.

HTTP Status Code

Error Code

Description

400

CBC.0100

Incorrect parameter.

403

CBC.0151

Access denied.

500

CBC.0999

Other errors.