All Products
Search
Document Center

:Query resources in a cluster

更新时间:Nov 17, 2023

You can call the DescribeClusterResources operation to query all resources in a cluster by cluster ID.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request header

This operation uses only common request headers. For more information, see Common request parameters.

Request syntax

GET /clusters/{ClusterId}/resources HTTP/1.1

Request parameters

Parameter

Type

Position

Required

Example

Description

ClusterId String Path Yes cb95aa626a47740afbf6aa099b65****

The cluster ID.

For more information about how to query cluster IDs, see View cluster information.

You can also call the DescribeClustersV1 API operation to query all clusters that belong to an Alibaba Cloud account.

Response parameters

Parameter

Type

Example

Description

An array of returned data.

The list of resources in the cluster.

cluster_id String cb95aa626a47740afbf6aa099b65****

The cluster ID.

created String 2023-08-15T14:34:42+08:00

The time when the resource was created.

instance_id String ngw-wz9sphwk42sdtjixo****

The resource ID.

resource_info String {\"Id\":\"k8s_NAT_Gateway\",\"Name\":\"k8s_NAT_Gateway\",\"Type\":\"ALIYUN::VPC::NatGateway\",\"Status\":\"CREATE_COMPLETE\",\"StatusReason\":\"state changed\",\"Updated\":\"2023-08-15T06:33:10\",\"PhysicalId\":\"ngw-wz9sphwk42sdtjixo****\"}

The information about the resource. For more information about how to query the source information about a resource, see ListStackResources.

resource_type String ALIYUN::VPC::NatGateway

The type of resource.

state String CREATE_COMPLETE

The status of the resource. Valid values:

  • CREATE_COMPLETE: The resource is created.
  • CREATE_FAILED: The resource failed to be created.
  • CREATE_IN_PROGRESS: The resource is being created.
  • DELETE_FAILED: The resource failed to be deleted.
  • DELETE_IN_PROGRESS: The resource is being deleted.
  • ROLLBACK_COMPLETE: The resource is rolled back.
  • ROLLBACK_FAILED: The resource failed to be rolled back.
  • ROLLBACK_IN_PROGRESS: The resource is being rolled back.
auto_create Long 1

Indicates whether the resource is created by Container Service for Kubernetes (ACK). Valid values:

  • 1: The resource is created by ACK.
  • 0: The resource is an existing resource.
dependencies An array of dependent resources.

The list of dependent resources.

cluster_id String cc5ee03f63e43425cb6f71f1a1756****

The ID of the cluster in which the dependent resources are deployed.

resource_type String ALIYUN::VPC::NatGateway

The type of dependent resource.

instance_id String ngw-wz9sphwk42sdtjixo****

The ID of the dependent resource.

Examples

Sample requests

GET /clusters/cb95aa626a47740afbf6aa099b65****/resources HTTP/1.1
Host:cs.aliyuncs.com
Content-Type:application/json

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<DescribeClusterResourcesResponse>
    <cluster_id>cb95aa626a47740afbf6aa099b65****</cluster_id>
    <created>2023-08-15T14:34:42+08:00</created>
    <instance_id>ngw-wz9sphwk42sdtjixo****</instance_id>
    <resource_info>{\"Id\":\"k8s_NAT_Gateway\",\"Name\":\"k8s_NAT_Gateway\",\"Type\":\"ALIYUN::VPC::NatGateway\",\"Status\":\"CREATE_COMPLETE\",\"StatusReason\":\"state changed\",\"Updated\":\"2023-08-15T06:33:10\",\"PhysicalId\":\"ngw-wz9sphwk42sdtjixo****\"}</resource_info>
    <resource_type>ALIYUN::VPC::NatGateway</resource_type>
    <state>CREATE_COMPLETE</state>
    <auto_create>1</auto_create>
    <dependencies>
        <cluster_id>cc5ee03f63e43425cb6f71f1a1756****</cluster_id>
        <resource_type>ALIYUN::VPC::NatGateway</resource_type>
        <instance_id>ngw-wz9sphwk42sdtjixo****</instance_id>
    </dependencies>
</DescribeClusterResourcesResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

[ {
  "cluster_id" : "cb95aa626a47740afbf6aa099b65****",
  "created" : "2023-08-15T14:34:42+08:00",
  "instance_id" : "ngw-wz9sphwk42sdtjixo****",
  "resource_info" : "{\\\"Id\\\":\\\"k8s_NAT_Gateway\\\",\\\"Name\\\":\\\"k8s_NAT_Gateway\\\",\\\"Type\\\":\\\"ALIYUN::VPC::NatGateway\\\",\\\"Status\\\":\\\"CREATE_COMPLETE\\\",\\\"StatusReason\\\":\\\"state changed\\\",\\\"Updated\\\":\\\"2023-08-15T06:33:10\\\",\\\"PhysicalId\\\":\\\"ngw-wz9sphwk42sdtjixo****\\\"}",
  "resource_type" : "ALIYUN::VPC::NatGateway",
  "state" : "CREATE_COMPLETE",
  "auto_create" : 1,
  "dependencies" : {
    "cluster_id" : "cc5ee03f63e43425cb6f71f1a1756****",
    "resource_type" : "ALIYUN::VPC::NatGateway",
    "instance_id" : "ngw-wz9sphwk42sdtjixo****"
  }
} ]

Error codes

For a list of error codes, see Service error codes.