文档首页/ 安全云脑 SecMaster/ API参考/ 安全云脑 API V1/ 计量计费管理/ 查询已购资源清单 - ListSubscriptionGlobalOrder
更新时间:2026-02-05 GMT+08:00

查询已购资源清单 - ListSubscriptionGlobalOrder

功能介绍

查询已购资源清单

调用方法

请参见如何调用API

授权信息

账号具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备调用API所需的权限,具体权限要求请参见权限和授权项

URI

GET /v1/subscriptions/orders

请求参数

表1 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。

X-Language

String

用户当前语言环境, zh-cn简体中文,en-us英文环境

响应参数

状态码:200

表2 响应Body参数

参数

参数类型

描述

resources

Array of SubscriptionGlobalResource objects

已购资源列表

表3 SubscriptionGlobalResource

参数

参数类型

描述

project_id

String

项目ID

region_id

String

当前region编码,默认为null,即为当前region

resources

Array of SubscriptionResourceInfo objects

当前demo-regionon已购资源列表

表4 SubscriptionResourceInfo

参数

参数类型

描述

resource_id

String

资源Id

resource_size

Integer

资源规格

resource_type

String

资源类型

resource_spec_code

String

资源规格编码

create_time

Long

创建时间戳

expire_time

Long

到期时间戳,只有按需资源有该字段

resource_status

Integer

资源状态,目前返回正常运行的资源,其状态值为0

order_id

String

订单Id,包周期资源有该字段

charging_mode

String

计费模式,目前有包周期(包年包月)PREPAID、按需POSTPAID,大小写不敏感

to_period

Boolean

当前资源是否能进行按需转包周期操作

tag_list

Array of TagInfo objects

资源列表

表5 TagInfo

参数

参数类型

描述

key

String

标识

中文、字母、数字、_或者-,且长度范围[2, 36]

value

String

内容

中文、字母、数字、_或者-,且长度范围[2, 36]

状态码:400

表6 响应Body参数

参数

参数类型

描述

error_code

String

参数解释:

错误码

取值范围:

不涉及

error_msg

String

参数解释:

错误描述

取值范围:

不涉及

状态码:403

表7 响应Body参数

参数

参数类型

描述

error_code

String

参数解释:

错误码

取值范围:

不涉及

error_msg

String

参数解释:

错误描述

取值范围:

不涉及

状态码:500

表8 响应Body参数

参数

参数类型

描述

error_code

String

参数解释:

错误码

取值范围:

不涉及

error_msg

String

参数解释:

错误描述

取值范围:

不涉及

请求示例

返回已购资源清单

GET https://{endpoint}/v1/subscriptions/orders

响应示例

状态码:200

当前站点SecMaster支持的商品清单

{
  "resources" : [ {
    "region_id" : "demo-region",
    "project_id" : "15645222e8744afa985c93dab6341da6",
    "resources" : [ {
      "resource_id" : "c9528aa2-d593-11f0-a34e-fa163e798915",
      "resource_type" : "xxx.resource.type.secmaster.typical",
      "resource_spec_code" : "csb.professional",
      "resource_size" : 2,
      "resource_status" : 0,
      "to_period" : false,
      "order_id" : "CS2510212051NLDL4",
      "charging_mode" : "PREPAID",
      "create_time" : 1765349400000,
      "expire_time" : 1796885400000,
      "tag_list" : [ {
        "key" : "dept",
        "value" : "dev"
      } ]
    } ]
  } ]
}

SDK代码示例

SDK代码示例如下。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.huaweicloud.sdk.test;

import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.BasicCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.secmaster.v1.region.SecMasterRegion;
import com.huaweicloud.sdk.secmaster.v1.*;
import com.huaweicloud.sdk.secmaster.v1.model.*;


public class ListSubscriptionGlobalOrderSolution {

    public static void main(String[] args) {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        String ak = System.getenv("CLOUD_SDK_AK");
        String sk = System.getenv("CLOUD_SDK_SK");

        ICredential auth = new BasicCredentials()
                .withAk(ak)
                .withSk(sk);

        SecMasterClient client = SecMasterClient.newBuilder()
                .withCredential(auth)
                .withRegion(SecMasterRegion.valueOf("<YOUR REGION>"))
                .build();
        ListSubscriptionGlobalOrderRequest request = new ListSubscriptionGlobalOrderRequest();
        try {
            ListSubscriptionGlobalOrderResponse response = client.listSubscriptionGlobalOrder(request);
            System.out.println(response.toString());
        } catch (ConnectionException e) {
            e.printStackTrace();
        } catch (RequestTimeoutException e) {
            e.printStackTrace();
        } catch (ServiceResponseException e) {
            e.printStackTrace();
            System.out.println(e.getHttpStatusCode());
            System.out.println(e.getRequestId());
            System.out.println(e.getErrorCode());
            System.out.println(e.getErrorMsg());
        }
    }
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdksecmaster.v1.region.secmaster_region import SecMasterRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdksecmaster.v1 import *

if __name__ == "__main__":
    # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak = os.environ["CLOUD_SDK_AK"]
    sk = os.environ["CLOUD_SDK_SK"]

    credentials = BasicCredentials(ak, sk)

    client = SecMasterClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(SecMasterRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ListSubscriptionGlobalOrderRequest()
        response = client.list_subscription_global_order(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    secmaster "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1/region"
)

func main() {
    // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak := os.Getenv("CLOUD_SDK_AK")
    sk := os.Getenv("CLOUD_SDK_SK")

    auth := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        Build()

    client := secmaster.NewSecMasterClient(
        secmaster.SecMasterClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.ListSubscriptionGlobalOrderRequest{}
	response, err := client.ListSubscriptionGlobalOrder(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。

状态码

状态码

描述

200

当前站点SecMaster支持的商品清单

400

参数异常

403

无权限访问

500

服务内部异常

错误码

请参见错误码