Queries the details of one or more capacity reservations.

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 parameters

Parameter Type Required Example Description
Action String Yes DescribeCapacityReservations

The operation that you want to perform. Set the value to DescribeCapacityReservations.

RegionId String Yes cn-hangzhou

The region ID of the capacity reservation. You can call the DescribeRegions operation to query the most recent region list.

ResourceGroupId String No rg-bp67acfmxazb4p****

The ID of the resource group to which the capacity reservation belongs.

Tag.N.Key String No TestKey

The key of tag N of the capacity reservation. You can specify multiple tag keys to query. Valid values of N: 1 to 20.

If a single tag is specified to query resources, up to 1,000 resources that have this tag added can be displayed in the response. If multiple tags are specified to query resources, up to 1,000 resources that have all these tags added can be displayed in the response. To query more than 1,000 resources that have specified tags added, call the ListTagResources operation.

Tag.N.Value String No TestValue

The value of tag N of the capacity reservation. You can specify multiple tag values to query. Valid values of N: 1 to 20.

MaxResults Integer No 10

The number of entries to return on each page.

Maximum value: 100.

Default value: 10.

NextToken String No caeba0bbb2be03f84eb48b699f0a4883

The token used to start the query. The token is obtained from the response to the previous request.

PrivatePoolOptions.Ids String No ["crp-bp67acfmxazb4****", "crp-bp67acfmxazb5****"]

The IDs of the capacity reservations. The value can be a JSON array that consists of up to 100 IDs. Separate multiple IDs with commas (,).

Platform String No linux

The operating system of instances that can be created by using the capacity reservation. Valid values:

  • Windows: queries only capacity reservations that reserve capacity for Windows instances.
  • Linux: queries only capacity reservations that reserve capacity for Linux instances.
  • all: queries all capacity reservations.

Default value: all.

InstanceType String No ecs.c6.large

The instance type of instances that can be created by using the capacity reservation.

ZoneId String No cn-hangzhou-h

The zone ID of the capacity reservation.

InstanceChargeType String No PostPaid

The billing method of instances that can be created by using the capacity reservation. Set the value to PostPaid. You can query only capacity reservations that reserve capacity for pay-as-you-go instances.

Default value: PostPaid.

Status String No Active

The state of the capacity reservation. Valid values:

  • Preparing: The capacity reservation is being prepared.
  • Active: The capacity reservation is in effect.
  • Released: The capacity reservation is manually released or automatically released due to expiration.

Default value: Active.

Response parameters

Parameter Type Example Description
CapacityReservationSet Array of CapacityReservationItem

Details about the capacity reservations.

CapacityReservationItem
AllocatedResources Array of AllocatedResource

Details about the allocated resources.

AllocatedResource
InstanceType String ecs.c6.large

The instance type of instances that can be created by using the capacity reservation.

TotalAmount Integer 2

The total number of instances for which to reserve capacity of an instance type.

UsedAmount Integer 2

The number of instances that are created by using the capacity reservation.

zoneId String cn-hangzhou-h

The zone ID of the capacity reservation.

Description String This is description.

The description of the capacity reservation.

EndTime String 2021-02-19T03:02Z

The time when the capacity reservation expires.

EndTimeType String Unlimited

The release mode of the capacity reservation. Valid values:

  • Limited: The capacity reservation is automatically released at the specified time.
  • Unlimited: The capacity reservation is manually released. You can release capacity reservations anytime.
InstanceChargeType String PostPaid

The billing method of the instances that can be created by using the capacity reservation.

Platform String linux

The operating system of the instances that can be created by using the capacity reservation. Valid values:

  • windows
  • linux
PrivatePoolOptionsId String crp-bp11pp9wynwtu6st****

The ID of the capacity reservation.

PrivatePoolOptionsMatchCriteria String Open

The type of the private pool generated after the capacity reservation takes effect. Valid values:

  • Open: open private pool
  • Target: specified private pool
PrivatePoolOptionsName String crpTestName

The name of the capacity reservation.

RegionId String cn-hangzhou

The region ID of the capacity reservation.

ResourceGroupId String rg-bp67acfmxazb4p****

The ID of the resource group to which the capacity reservation belongs.

StartTime String 2021-02-19T02:01Z

The time when the capacity reservation takes effect.

Status String Active

The state of the capacity reservation. Valid values:

  • Preparing: The capacity reservation is being prepared.
  • Active: The capacity reservation is in effect.
  • Released: The capacity reservation is manually released or automatically released due to expiration.
Tags Array of Tag

The tags that are added to the capacity reservation.

Tag
TagKey String TestKey

The tag key of the capacity reservation.

TagValue String TestValue

The tag value of the capacity reservation.

TimeSlot String null
Note This parameter is in invitational preview and unavailable.
MaxResults Integer 10

The maximum number of entries returned per page.

NextToken String caeba0bbb2be03f84eb48b699f0a4883

The token used to start the next query.

RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

TotalCount Integer 1

The total number of entries returned.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=DescribeCapacityReservations
&RegionId=cn-hangzhou
&PrivatePoolOptions.Ids=["crp-bp67acfmxazb4****", "crp-bp67acfmxazb5****"]
&InstanceType=ecs.c6.large
&<Common request parameters>

Sample success responses

XML format

<DescribeCapacityReservationsResponse>
      <TotalCount>1</TotalCount>
      <NextToken>caeba0bbb2be03f84eb48b699f0a4883</NextToken>
      <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
      <MaxResults>10</MaxResults>
      <CapacityReservationSet>
            <CapacityReservationItem>
                  <Status>Active</Status>
                  <Description>This is description.</Description>
                  <EndTime>2021-02-19T03:02Z</EndTime>
                  <ResourceGroupId>rg-bp67acfmxazb4p****</ResourceGroupId>
                  <Platform>linux</Platform>
                  <PrivatePoolOptionsName>crpTestName</PrivatePoolOptionsName>
                  <InstanceChargeType>PostPaid</InstanceChargeType>
                  <StartTime>2021-02-19T02:01Z</StartTime>
                  <PrivatePoolOptionsMatchCriteria>Open</PrivatePoolOptionsMatchCriteria>
                  <TimeSlot></TimeSlot>
                  <AllocatedResources>
                        <AllocatedResource>
                              <UsedAmount>2</UsedAmount>
                              <zoneId>cn-hangzhou-h</zoneId>
                              <TotalAmount>2</TotalAmount>
                              <InstanceType>ecs.c6.large</InstanceType>
                        </AllocatedResource>
                  </AllocatedResources>
                  <PrivatePoolOptionsId>crp-bp11pp9wynwtu6st****</PrivatePoolOptionsId>
                  <EndTimeType>Unlimited</EndTimeType>
                  <RegionId>cn-hangzhou</RegionId>
                  <Tags>
                        <Tag>
                              <TagKey>TestKey</TagKey>
                              <TagValue>TestValue</TagValue>
                        </Tag>
                  </Tags>
            </CapacityReservationItem>
      </CapacityReservationSet>
</DescribeCapacityReservationsResponse>

JSON format

{
    "TotalCount": 1,
    "NextToken": "caeba0bbb2be03f84eb48b699f0a4883",
    "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
    "MaxResults": 10,
    "CapacityReservationSet": {
        "CapacityReservationItem": [
            {
                "Status": "Active",
                "Description": "This is description.",
                "EndTime": "2021-02-19T03:02Z",
                "ResourceGroupId": "rg-bp67acfmxazb4p****",
                "Platform": "linux",
                "PrivatePoolOptionsName": "crpTestName",
                "InstanceChargeType": "PostPaid",
                "StartTime": "2021-02-19T02:01Z",
                "PrivatePoolOptionsMatchCriteria": "Open",
                "TimeSlot": "",
                "AllocatedResources": {
                    "AllocatedResource": [
                        {
                            "UsedAmount": 2,
                            "zoneId": "cn-hangzhou-h",
                            "TotalAmount": 2,
                            "InstanceType": "ecs.c6.large"
                        }
                    ]
                },
                "PrivatePoolOptionsId": "crp-bp11pp9wynwtu6st****",
                "EndTimeType": "Unlimited",
                "RegionId": "cn-hangzhou",
                "Tags": {
                    "Tag": [
                        {
                            "TagKey": "TestKey",
                            "TagValue": "TestValue"
                        }
                    ]
                }
            }
        ]
    }
}

Error codes

HTTP status code Error code Error message Description
400 MissingParameter.RegionId The specified RegionId should not be null. The error message returned because the required RegionId parameter is not specified.
400 InvalidParameter.RegionId The specified RegionId is not exist. The error message returned because the specified RegionId parameter does not exist.
500 InternalError The request processing has failed due to some unknown error, exception or failure. The error message returned because an internal error has occurred. Try again later. If the error persists, submit a ticket.

For a list of error codes, visit the API Error Center.