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

Querying Customer's Yearly/Monthly Resources (Old)

Function

A customer can query one or all yearly/monthly resources on the partner sales platform.

Note:

  • This API can be invoked by the customer AK/SK or token.
  • This API can only be used to query resources successfully provisioned.

URI

GET /v1.0/{domain_id}/common/order-mgr/resources/detail

The following table describes the parameters.

Table 1 URI parameters

Parameter

Mandatory

Maximum Length of Characters

Description

domain_id

Yes

A maximum of 64 characters

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

Table 2 Request parameters

Parameter

Mandatory

Type

Maximum Length of Characters/Value Range

Description

resource_ids

No

String

A maximum of 4096 characters

Resource IDs.

Queries resources with the specified resource IDs. When only_main_resource is 0, the system queries the specified resources and their auxiliary resources. A maximum of 50 IDs can be queried at the same time. Use commas (,) to separate multiple IDs.

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

NOTE:

A resource ID is allocated by a cloud service after the resource is provisioned, such as server_id in ECS.

order_id

No

String

A maximum of 64 characters

Order ID.

This parameter can be used for querying the resources in a specified order.

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

only_main_resource

No

Integer

[0|1]

Whether to query only the primary resources. This parameter is invalid when resource_ids are IDs of attached resources. In this case, the system queries the attached resources.

  • 0: Queries both the primary resources and attached resources.
  • 1: Queries only the primary resources.

The default value is 0.

If this parameter is not included in the request parameters, is left empty, or is set to null, the default value 0 is used. This parameter cannot be set to "".

NOTE:

A primary resource takes the primary position in the associated resources.

  • For the ECS service, ECSs are the primary resources, and EVS disks are attached resource.
  • For VPC, if the shared bandwidth is used, the bandwidth is the primary resource, and EIPs are the attached resource. If the exclusive bandwidth is used, EIPs are the primary resources, and the bandwidth is the attached resource.

status_list

No

String

-

Resource status.

Queries resources in a specified status. If there are multiple statuses, separate them using commas (,).

  • 2: Provisioned
  • 4: Frozen
  • 5: Expired

If this parameter is not included in the request parameters or is left empty, resources in all statuses will be returned. This parameter cannot be set to "" or null.

page_no

No

Integer

An integer greater than or equal to 1

Page number.

The default value is 1.

If this parameter is not included in the request parameters, is left empty, or is set to null, the default value 1 is used. This parameter cannot be set to "".

page_size

No

Integer

[1-500]

Number of records on each page.

The default value is 10. The maximum value is 500.

If this parameter is not included in the request parameters, is left empty, or is set to null, the default value 10 is used. This parameter cannot be set to "".

Request

Request Parameters

None

Example Request

GET https://bss-intl.myhuaweicloud.com/v1.0/{domain_id}/common/order-mgr/resources/detail?resource_ids=b38*****62e,249*****c07&only_main_resource=1&page_no=1&page_size=100 HTTP/1.1
Content-Type: application/json
X-Auth-Token: MIIPAgYJKoZIhvcNAQcCo...ggg1BBIINPXsidG9rZ

Response

Response Parameters

Parameter

Type

Description

error_code

String

Error code.

For details, see Status Code.

error_msg

String

Error description.

data

List<ResourceInstance>

Resource list.

For details, see Table 3.

total_count

Integer

Total number of records.

The default value is 0.

Table 3 ResourceInstance

Parameter

Type

Description

id

String

Internal ID of the resource to be provisioned. The ID generated after the resource is provisioned is resourceID.

resource_id

String

Resource ID.

resource_name

String

Resource instance name.

region_code

String

Region code.

cloud_service_type_code

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.

resource_type_code

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.

resource_spec_code

String

Specification of a cloud service resource. For example, a VM resource specification is s2.small.1.linux (.win or .linux should be added at the end of the specification).

project_code

String

Resource project ID.

product_id

String

Product ID.

main_resource_id

String

Primary resource ID.

is_main_resource

Integer

Primary resource or not.

  • 0: No
  • 1: Yes

status

Integer

Resource status.

  • 2: Provisioned
  • 3: Closed (not visible to customers)
  • 4: Frozen
  • 5: Expired

valid_time

String

Effective time of a resource.

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

expire_time

String

Expiration time of a resource.

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

next_operation_policy

Integer

Next billing policy.

  • 0: Entering the grace period upon expiration
  • 1: Yearly/monthly to pay-per-use
  • 2: Automatically deleted upon expiration (directly deleted from resources that take effect)
  • 3: Automatically renewed upon expiration
  • 4: Automatically frozen upon expiration
  • 5: Automatically deleted upon expiration (deleted from resources in the retention period)
NOTE:

Only 3 indicates that the resource is automatically renewed. In other cases, the expiration policy for non-automatic renewal is used.

Example Response

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

{
  "data": [
    {
      "id": "01154-21800069-0",
      "status": 2,
      "resource_id": "249*****c07",
      "resource_name": "114.115.169.185",
      "region_code": "cn-north-1",
      "cloud_service_type_code": "hws.service.type.vpc",
      "resource_type_code": "hws.resource.type.ip",
      "resource_spec_code": "5_sbgp",
      "project_code": "3f*****400",
      "product_id": "c1*****55",
      "main_resource_id": "249*****c07",
      "is_main_resource": 1,
      "valid_time": "2018-04-26T18:03:03Z",
      "expire_time": "2018-06-27T15:59:59Z",
      "next_operation_policy": 3
    },
    {
      "id": "01154-21800073-0",
      "status": 2,
      "resource_id": "b3*****62e",
      "resource_name": "ecs-9f88-0001",
      "region_code": "cn-north-1",
      "cloud_service_type_code": "hws.service.type.ec2",
      "resource_type_code": "hws.resource.type.vm",
      "resource_spec_code": "s3.medium.2.linux",
      "project_code": "3f*****400",
      "product_id": "00301-62057-0--0",
      "main_resource_id": "b38*****62e",
      "is_main_resource": 1,
      "valid_time": "2018-04-26T18:02:33Z",
      "expire_time": "2018-06-27T15:59:59Z",
      "next_operation_policy": 3
    }
  ],
  "error_code": "CBC.0000",
  "error_msg": "success",
  "total_count": 2
}

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.

400

CBC.0100

Incorrect parameter.

403

CBC.0151

Access denied.

500

CBC.0999

Other errors.