Updated on 2024-01-02 GMT+08:00
Querying Customer's Pay-Per-Use Resources

Querying Customer's Pay-Per-Use Resources

Function

A customer can query its provisioned pay-per-use resources on the partner sales platform. The data obtained using this API is for reference only because it has a delay, and the delay for each cloud service is different.

Note:

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

This API will be brought offline. For details about the API for querying a customer's pay-per-use resources, see Querying Customer's Pay-Per-Use Resources.

URI

POST /v1.0/{partner_id}/partner/customer-mgr/customer-resource/query-resources

Table 1 describes the parameters.

Table 1 URI parameters

Parameter

Mandatory

Maximum Length of Characters

Description

partner_id

Yes

A maximum of 64 characters

Partner ID (assigned by Huawei).

For details about how to obtain the partner ID, see How Do I Check the Partner ID?

Request

Request Parameters

Parameter

Mandatory

Type

Maximum Length of Characters/Value Range

Description

customerResourceId

No

String

[1-64]

Customer resource ID.

Queries information about a specified resource.

If this parameter is not included in the request parameters or is set to null, it cannot be used as a filter criterion. It cannot be set to "".

customerId

Yes

String

[1-64]

Customer account ID. For details, see How Do I Obtain Customer's customer_id and domain_id Values?

regionCode

No

String

[1-64]

Cloud service region code, for example, ap-southeast-1. Obtain the value from the Region column in Regions and Endpoints.

If this parameter is not included in the request parameters or is set to null, it cannot be used as a filter criterion. It cannot be set to "".

cloudServiceTypeCode

No

String

[1-64]

Cloud service type code. For example, the cloud service type code of OBS is hws.service.type.obs. To obtain a specific service type, call the API in Querying Cloud Service Types.

If this parameter is not included in the request parameters or is set to null, it cannot be used as a filter criterion. It cannot be set to "".

resourceTypeCode

No

String

[1-64]

Resource type code. For example, the VM resource type code of ECS is hws.resource.type.vm. To obtain a specific resource type, call the API in Querying Resource Types.

If this parameter is not included in the request parameters or is set to null, it cannot be used as a filter criterion. It cannot be set to "".

resourceIds

No

List<Stirng>

[0-50]

Resource ID query in batches.

This parameter is used to query the resource of a specified ID.

A maximum of 50 IDs can be configured at a time.

If this parameter is not included in the request parameters, is set to an empty array, or is set to null, it cannot be used as a filter criterion.

resourceName

No

String

[1-64]

Resource instance name.

If this parameter is not included in the request parameters or is set to null, it cannot be used as a filter criterion. It cannot be set to "".

startTimeBegin

No

String

[1-64]

Start time of the validity period.

UTC time in "yyyy-MM-dd'T'HH:mm:ss'Z'" format, for example, 2019-05-06T08:05:01Z.

The range of HH is 0-23, and the range of mm and ss is 0-59.

If this parameter is not included in the request parameters or is set to null, it cannot be used as a filter criterion. It cannot be set to "".

startTimeEnd

No

String

[1-64]

End time of the validity period.

UTC time in "yyyy-MM-dd'T'HH:mm:ss'Z'" format, for example, 2019-05-06T08:05:01Z.

The range of HH is 0-23, and the range of mm and ss is 0-59.

If this parameter is not included in the request parameters or is set to null, it cannot be used as a filter criterion. It cannot be set to "".

pageNo

No

Integer

An integer greater than or equal to 1

Current page number

The default value is 1.

If this parameter is not included in the request parameters, is set to "", or is set to null, the value 1 is used.

pageSize

No

Integer

[1-100]

Number of records displayed on the current page. The default value is 10.

If this parameter is not included in the request parameters, is set to "", or is set to null, the value 10 is used.

Example Request

POST https://bss-intl.myhuaweicloud.com/v1.0/{partner_id}/partner/customer-mgr/customer-resource/query-resources HTTP/1.1
Content-Type: application/json
X-Auth-Token: MIIPAgYJKoZIhvcNAQcCo...ggg1BBIINPXsidG9rZ

{
    "customerId": "3d2c6b3ab1fd4e26846b0f2c46e67bda",
    "regionCode": "cn-north-1",
    "cloudServiceTypeCode": "hws.service.type.ebs",
    "resourceTypeCode": "hws.resource.type.volume",
    "resourceIds":["71e3eeb5-4b77-44ae-9c42-119ee7976cf7","39d90d01-4774-4af6-8136-83ba5732bccf"],
    "startTimeBegin": "2018-06-01T11:00:00Z",
    "startTimeEnd":"2018-06-30T11:00:00Z"
}

Response

Response Parameters

Parameter

Type

Description

error_code

String

Error code. For details, see Status Code.

error_msg

String

Error description.

customerResources

List<CustomerResource>

Customer resources.

For details, see Table 2.

totalCount

Integer

Total number of queries.

Table 2 CustomerResource

Parameter

Type

Description

customerResourceId

String

Customer resource ID.

customerId

String

Customer ID.

regionCode

String

Cloud service region code, for example, ap-southeast-1. Obtain the value from the Region column in Regions and Endpoints.

azCode

String

AZ code.

cloudServiceTypeCode

String

Cloud service type code. For example, the cloud service type code of OBS is hws.service.type.obs. To obtain a specific service type, call the API in Querying Cloud Service Types.

resourceTypeCode

String

Resource type code. For example, the VM resource type code of ECS is hws.resource.type.vm. To obtain a specific resource type, call the API in Querying Resource Types.

resourceId

String

Resource ID.

resourceName

String

Resource instance name.

startTime

String

Effective time.

UTC time in "yyyy-MM-dd'T'HH:mm:ss'Z'" format, for example, 2019-05-06T08:05:01Z.

The range of HH is 0-23, and the range of mm and ss is 0-59.

endTime

String

Expiration time.

UTC time in "yyyy-MM-dd'T'HH:mm:ss'Z'" format, for example, 2019-05-06T08:05:01Z.

The range of HH is 0-23, and the range of mm and ss is 0-59.

status

Integer

Resource status.

  • 1: Normal (provisioned)
  • 2: Grace period
  • 3. Freezing
  • 4: Changing
  • 5: Canceling
  • 6: Canceled

resourceSpecCode

String

Specification code of the pay-per-use resource.

resourceInfo

String

Resource capacity

Format: "resourceInfo": "{\"specSize\":40.0}"

chargingModeChangeFlag

String

Whether the pay-per-use billing can be changed to yearly/monthly billing.

  • 0: No
  • 1: Yes
NOTE:

This parameter has been discarded.

lastDeductType

String

Account type of the last deduction for the resource. The value can be:

  • 0: HUAWEI CLOUD account that the customer directly tops up.
  • 1: Account that the customer receives the budget configured by the partner.
  • If this parameter is left empty, no fee is deducted for the resource.

Example Response

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: length
Date: response time 

{
  "totalCount": 2,
  "customerResources": [
    {
      "customerResourceId": "745b8963bb75409bb35f10d0e9c5cdf0",
      "customerId": "3d2c6b3ab1fd4e26846b0f2c46e67bda",
      "regionCode": "cn-north-1",
      "azCode": null,
      "cloudServiceTypeCode": "hws.service.type.ebs",
      "resourceTypeCode": "hws.resource.type.volume",
      "resourceId": "39d90d01-4774-4af6-8136-83ba5732bccf",
      "resourceName": null,
      "startTime": "2018-06-11T20:00:00Z",
      "endTime": null,
      "status": 3,
      "resourceSpecCode": "SAS",
      "resourceInfo": "{\"specSize\":50.0}",
      "chargingModeChangeFlag": "0",
      "lastDeductType": "1"
    },
    {
      "customerResourceId": "4d46e052379941d3b0d6cf34697b8ce7",
      "customerId": "3d2c6b3ab1fd4e26846b0f2c46e67bda",
      "regionCode": "cn-north-1",
      "azCode": null,
      "cloudServiceTypeCode": "hws.service.type.ebs",
      "resourceTypeCode": "hws.resource.type.volume",
      "resourceId": "71e3eeb5-4b77-44ae-9c42-119ee7976cf7",
      "resourceName": null,
      "startTime": "2018-06-11T20:00:00Z",
      "endTime": null,
      "status": 3,
      "resourceSpecCode": "SATA",
      "resourceInfo": "{\"specSize\":50.0}",
      "chargingModeChangeFlag": "0",
      "lastDeductType": "1"
    }
  ],
  "error_code": "CBC.0000",
  "error_msg": "success"
}

Status Code

  • 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

200

CBC.0000

Succeeded.

500

CBC.0999

Other errors.

400

CBC.0100

Incorrect parameter.

403

CBC.0151

Access denied.

200

CBC.5004

You do not have the operation permission to the customer.