tencent cloud

文档反馈

DescribeDisks

最后更新时间:2023-06-21 15:01:17

1. API Description

Domain name for API request: cbs.tencentcloudapi.com.

This API (DescribeDisks) is used to query the list of cloud disks.

  • The details of the cloud disk can be queried based on the ID, type or status of the cloud disk. The relationship between different conditions is AND. For more information about filtering, please see the Filter.
  • If the parameter is empty, a certain number (specified by Limit; the default is 20) of cloud disk lists are returned to the current user.

A maximum of 100 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: DescribeDisks.
Version Yes String Common Params. The value used for this API: 2017-03-12.
Region No String Common Params. This parameter is not required for this API.
DiskIds.N No Array of String Query by one or more cloud disk IDs, such as disk-11112222. For the format of this parameter, please see the ids.N section of the API Introduction. This parameter does not support specifying both DiskIds and Filters.
Filters.N No Array of Filter Filters. You cannot specify DiskIds and Filters at the same time.
  • disk-usage - Array of String - Optional - Filters by cloud disk type. (SYSTEM_DISK: system disk | DATA_DISK: data disk)
  • disk-charge-type - Array of String - Optional - Filters by cloud disk billing method. (POSTPAID_BY_HOUR: pay-as-you-go)
  • portable - Array of String- Optional - Filters by whether the cloud disk is elastic or not. (TRUE: elastic | FALSE: non-elastic)
  • project-id - Array of Integer - Optional - Filters by the ID of the project to which a cloud disk belongs.
  • disk-id - Array of String - Optional - Filters by cloud disk ID, such as disk-11112222.
  • disk-name - Array of String - Optional - Filters by cloud disk name.
  • disk-type - Array of String - Optional - Filters by cloud disk media type (CLOUD_BASIC: HDD cloud disk | CLOUD_PREMIUM: Premium Cloud Storage | CLOUD_SSD: SSD cloud disk.)
  • disk-state - Array of String - Optional - Filters by cloud disk state. (UNATTACHED: not mounted | ATTACHING: being mounted | ATTACHED: mounted | DETACHING: being unmounted | EXPANDING: being expanded | ROLLBACKING: being rolled back | TORECYCLE: to be repossessed.)
  • instance-id - Array of String - Optional - Filters by the ID of the CVM instance on which a cloud disk is mounted. You can use this parameter to query the cloud disks mounted on specific CVMs.
  • zone - Array of String - Optional - Filters by availability zone
  • instance-ip-address - Array of String - Optional - Filters by the private or public IP of the CVM on which a cloud disk is mounted.
  • instance-name - Array of String - Optional - Filters by the name of the instance on which a cloud disk is mounted.
  • tag-key - Array of String - Optional - Filters by tag key.
  • tag-value - Array of String - Optional - Filters by tag value.
  • tag:tag-key - Array of String - Optional - Filters by tag key-value pair. Please replace tag-key with a specific tag key.
  • Offset No Integer Offset. Default is 0. For more information on Offset, please see relevant sections in API Introduction.
    Limit No Integer Number of results to be returned. Default is 20. Maximum is 100. For more information on Limit, please see relevant sections in API Introduction.
    Order No String Outputs the ordering of the cloud disk list. Value range:
  • ASC: Ascending order
  • DESC: Descending order.
  • OrderField No String The field by which the cloud disk list is sorted. Value range:
  • CREATE_TIME: sorted by the creation time of cloud disks
  • DEADLINE: sorted by the expiration time of cloud disks
    By default, the cloud disk list is sorted by the creation time of cloud disks.
  • ReturnBindAutoSnapshotPolicy No Boolean Whether the ID of the periodic snapshot policy bound to the cloud disk needs to be returned in the cloud disk details. TRUE: return; FALSE: do not return.

    3. Output Parameters

    Parameter Name Type Description
    TotalCount Integer The quantity of cloud disks meeting the conditions.
    DiskSet Array of Disk List of cloud disk details.
    RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

    4. Example

    Example1 Querying all attached data disks

    This example shows you how to query all attached data disks.

    Input Example

    POST / HTTP/1.1
    Host: cbs.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: DescribeDisks
    <Common request parameters>
    
    {
        "Filters": [
            {
                "Values": [
                    "ATTACHED"
                ],
                "Name": "disk-state"
            },
            {
                "Values": [
                    "DATA_DISK"
                ],
                "Name": "disk-usage"
            }
        ]
    }
    

    Output Example

    {
        "Response": {
            "TotalCount": 1,
            "RequestId": "e2386a23-48c1-4c18-9a36-4e7354f333b2",
            "DiskSet": [
                {
                    "DeleteWithInstance": false,
                    "Encrypt": false,
                    "DiskType": "CLOUD_BASIC",
                    "AutoRenewFlagError": false,
                    "Rollbacking": false,
                    "RenewFlag": "NOTIFY_AND_MANUAL_RENEW",
                    "DiskName": "test",
                    "Tags": [],
                    "InstanceId": "",
                    "DifferDaysOfDeadline": 1,
                    "DiskId": "disk-b94t5dzt",
                    "DiskState": "ATTACHED",
                    "Placement": {
                        "ProjectId": 0,
                        "Zone": "ap-guangzhou-2"
                    },
                    "IsReturnable": false,
                    "DeadlineTime": "2018-10-26 10:55:43",
                    "Attached": true,
                    "DiskSize": 10,
                    "DiskUsage": "DATA_DISK",
                    "Portable": true,
                    "DiskChargeType": "PREPAID",
                    "SnapshotAbility": true,
                    "DeadlineError": false,
                    "RollbackPercent": 100,
                    "AutoSnapshotPolicyIds": null,
                    "ReturnFailCode": 3,
                    "CreateTime": "2018-09-26 17:36:07",
                    "ThroughputPerformance": 1,
                    "Migrating": true,
                    "InstanceIdList": [
                        "ins-test1234"
                    ],
                    "Shareable": true,
                    "MigratePercent": 100,
                    "SnapshotSize": 100,
                    "SnapshotCount": 0,
                    "BackupDisk": true,
                    "AttachMode": "PF",
                    "DiskBackupQuota": 1,
                    "DiskBackupCount": 1,
                    "DeleteSnapshot": 0,
                    "InstanceType": "CVM"
                }
            ]
        }
    }
    

    5. Developer Resources

    SDK

    TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

    Command Line Interface

    6. Error Code

    The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

    Error Code Description
    InvalidFilter The specified Filter is not supported.
    InvalidParameterValue Invalid parameter value.
    MissingParameter Missing parameter.
    UnsupportedOperation Unsupported operation