tencent cloud

Feedback

DescribeDBInstances

Last updated: 2024-01-30 10:26:04

    1. API Description

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

    This API (DescribeDBInstances) is used to query the list of TencentDB instances (which can be primary, disaster recovery, or read-only instances). It supports filtering instances by project ID, instance ID, access address, and instance status.

    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: DescribeDBInstances.
    Version Yes String Common Params. The value used for this API: 2017-03-20.
    Region No String Common Params. This parameter is not required for this API.
    ProjectId No Integer Project ID.
    InstanceTypes.N No Array of Integer Instance type. Value range: 1 (primary), 2 (disaster recovery), 3 (read-only).
    Vips.N No Array of String Private IP address of the instance.
    Status.N No Array of Integer Instance status. Valid values:
    0 (creating)
    1 (running)
    4 (isolating)
    5 (isolated; the instance can be restored and started in the recycle bin)
    Offset No Integer Offset. Default value: 0.
    Limit No Integer Number of results to be returned for a single request. Default value: 20. Maximum value: 2,000.
    SecurityGroupId No String Security group ID. When it is used as a filter, the WithSecurityGroup parameter should be set to 1.
    PayTypes.N No Array of Integer Billing method. Value range: 0 (monthly subscribed), 1 (hourly).
    InstanceNames.N No Array of String Instance name.
    TaskStatus.N No Array of Integer Instance task status. Valid values:
    0 - no task
    1 - upgrading
    2 - importing data
    3 - enabling secondary instance access
    4 - enabling public network access
    5 - batch operation in progress
    6 - rolling back
    7 - disabling public network access
    8 - modifying password
    9 - renaming instance
    10 - restarting
    12 - migrating self-built database
    13 - dropping tables
    14 - Disaster recovery instance creating sync task
    15 - waiting for switch
    16 - switching
    17 - upgrade and switch completed
    19 - parameter settings to be executed
    EngineVersions.N No Array of String Version of the instance database engine. Value range: 5.1, 5.5, 5.6, 5.7.
    VpcIds.N No Array of Integer VPC ID.
    ZoneIds.N No Array of Integer AZ ID.
    SubnetIds.N No Array of Integer Subnet ID.
    CdbErrors.N No Array of Integer Whether to lock disk write. Valid values: 0(unlock), 1(lock). Default value: 0.
    OrderBy No String Sort by field of the returned result set. Currently, supported values include "InstanceId", "InstanceName", "CreateTime", and "DeadlineTime".
    OrderDirection No String Sorting method of the returned result set. Currently, "ASC" or "DESC" is supported.
    WithSecurityGroup No Integer Whether security group ID is used as a filter
    WithExCluster No Integer Whether dedicated cluster details are included. Value range: 0 (not included), 1 (included)
    ExClusterId No String Exclusive cluster ID.
    InstanceIds.N No Array of String Instance ID.
    InitFlag No Integer Initialization flag. Value range: 0 (not initialized), 1 (initialized).
    WithDr No Integer Whether instances corresponding to the disaster recovery relationship are included. Valid values: 0 (not included), 1 (included). Default value: 1. If a primary instance is pulled, the data of the disaster recovery relationship will be in the DrInfo field. If a disaster recovery instance is pulled, the data of the disaster recovery relationship will be in the MasterInfo field. The disaster recovery relationship contains only partial basic data. To get the detailed data, you need to call an API to pull it.
    WithRo No Integer Whether read-only instances are included. Valid values: 0 (not included), 1 (included). Default value: 1.
    WithMaster No Integer Whether primary instances are included. Valid values: 0 (not included), 1 (included). Default value: 1.
    DeployGroupIds.N No Array of String Placement group ID list.
    TagKeysForSearch.N No Array of String Whether to use the tag key as a filter condition
    CageIds.N No Array of String Financial cage IDs.
    TagValues.N No Array of String Tag value
    UniqueVpcIds.N No Array of String VPC character vpcId
    UniqSubnetIds.N No Array of String VPC character subnetId
    Tags.N No Array of Tag Tag key value
    ProxyVips.N No Array of String Database proxy IP
    ProxyIds.N No Array of String Database proxy ID
    EngineTypes.N No Array of String Database engine type

    3. Output Parameters

    Parameter Name Type Description
    TotalCount Integer Number of eligible instances.
    Items Array of InstanceInfo List of instance details
    RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

    4. Example

    Example1 Querying the list of instances

    This example shows you how to query the list of instances.

    Input Example

    POST / HTTP/1.1
    Host: cdb.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: DescribeDBInstances
    <Common request parameters>
    
    {
        "InstanceIds": [
            "cdb-70zdmgg1"
        ]
    }
    

    Output Example

    {
        "Response": {
            "TotalCount": 1,
            "RequestId": "97939db3-ef94-4a60-9b64-2a1f4e2f1ea3",
            "Items": [
                {
                    "WanStatus": 0,
                    "Zone": "100001",
                    "WanPort": 0,
                    "DiskType": "test",
                    "RoVipInfo": {
                        "RoVport": 0,
                        "RoVpcId": 0,
                        "RoVipStatus": 0,
                        "RoVip": "192.168.1.1",
                        "RoSubnetId": 0
                    },
                    "Memory": 1000,
                    "EngineType": "InnoDB",
                    "Status": 1,
                    "VpcId": 511512,
                    "SlaveInfo": {
                        "Second": {
                            "Vport": 0,
                            "Vip": "test",
                            "Region": "ap-guangzhou",
                            "Zone": "ap-guangzhou-1"
                        },
                        "First": {
                            "Vport": 0,
                            "Vip": "test",
                            "Region": "ap-guangzhou",
                            "Zone": "ap-guangzhou-1"
                        }
                    },
                    "InstanceId": "cdn-abc",
                    "PhysicalId": "test",
                    "Volume": 50,
                    "AutoRenew": 0,
                    "ProtectMode": 0,
                    "CdbError": 0,
                    "DeviceClass": "test",
                    "MasterInfo": {
                        "Status": 0,
                        "VpcId": 0,
                        "Zone": "100001",
                        "ExClusterName": "test",
                        "InstanceId": "test",
                        "ResourceId": "test",
                        "Region": "ap-guangzhou",
                        "RegionId": 0,
                        "ZoneId": 0,
                        "Volume": 0,
                        "DeviceType": "test",
                        "Memory": 0,
                        "SubnetId": 0,
                        "Qps": 0,
                        "TaskStatus": 0,
                        "InstanceName": "test",
                        "InstanceType": 0,
                        "ExClusterId": "test"
                    },
                    "DeployGroupId": "test",
                    "InstanceNodes": 2,
                    "RoGroups": [
                        {
                            "RoOfflineDelay": 0,
                            "RoGroupMode": "test",
                            "RoGroupZone": "test",
                            "MinRoInGroup": 1,
                            "DelayReplicationTime": 0,
                            "RoGroupId": "test",
                            "RoMaxDelayTime": 1,
                            "RoGroupName": "test",
                            "Weight": 0,
                            "UniqVpcId": "test",
                            "RoInstances": [
                                {
                                    "Zone": "test",
                                    "MasterInstanceId": "test",
                                    "Memory": 1000,
                                    "Status": 1,
                                    "VpcId": 511512,
                                    "InstanceId": "test",
                                    "Volume": 50,
                                    "OfflineTime": "test",
                                    "SubnetId": 115839,
                                    "HourFeeStatus": 1,
                                    "RoStatus": "test",
                                    "Region": "test",
                                    "DeadlineTime": "test",
                                    "TaskStatus": 0,
                                    "DeviceType": "test",
                                    "EngineVersion": "test",
                                    "InstanceName": "test",
                                    "Weight": 0,
                                    "PayType": 1,
                                    "InstanceType": 3,
                                    "Vip": "test",
                                    "Qps": 1000,
                                    "Vport": 3306
                                }
                            ],
                            "Vip": "test",
                            "UniqSubnetId": "test",
                            "RoGroupRegion": "test",
                            "Vport": 3306,
                            "WeightMode": "test"
                        },
                        {
                            "RoOfflineDelay": 0,
                            "RoGroupMode": "test",
                            "RoGroupZone": "test",
                            "MinRoInGroup": 1,
                            "DelayReplicationTime": 0,
                            "RoGroupId": "test",
                            "RoMaxDelayTime": 1,
                            "RoGroupName": "test",
                            "UniqVpcId": "test",
                            "Weight": 0,
                            "RoInstances": [
                                {
                                    "Zone": "test",
                                    "MasterInstanceId": "test",
                                    "Memory": 1000,
                                    "Status": 1,
                                    "VpcId": 511512,
                                    "InstanceId": "test",
                                    "Volume": 25,
                                    "OfflineTime": "test",
                                    "SubnetId": 115839,
                                    "HourFeeStatus": 1,
                                    "RoStatus": "test",
                                    "Region": "test",
                                    "DeadlineTime": "test",
                                    "TaskStatus": 0,
                                    "DeviceType": "test",
                                    "EngineVersion": "test",
                                    "InstanceName": "test",
                                    "Weight": 0,
                                    "PayType": 1,
                                    "InstanceType": 3,
                                    "Vip": "test",
                                    "Qps": 1000,
                                    "Vport": 3306
                                }
                            ],
                            "Vip": "test",
                            "UniqSubnetId": "test",
                            "RoGroupRegion": "test",
                            "Vport": 3306,
                            "WeightMode": "test"
                        }
                    ],
                    "ProjectId": 0,
                    "DeadlineTime": "2020-09-22 00:00:00",
                    "DeployMode": 0,
                    "TaskStatus": 0,
                    "SubnetId": 115839,
                    "DeviceType": "test",
                    "EngineVersion": "test",
                    "MaxDelayTime": 0,
                    "InstanceName": "test",
                    "Cpu": 8,
                    "DrInfo": [
                        {
                            "Status": 0,
                            "Zone": "test",
                            "InstanceId": "test",
                            "Region": "test",
                            "SyncStatus": 0,
                            "InstanceName": "test",
                            "InstanceType": 0
                        }
                    ],
                    "UniqVpcId": "test",
                    "WanDomain": "test",
                    "InitFlag": 1,
                    "PayType": 1,
                    "InstanceType": 1,
                    "Vip": "test",
                    "UniqSubnetId": "test",
                    "Region": "test",
                    "Qps": 0,
                    "Vport": 3306,
                    "TagList": [
                        {
                            "TagKey": "test",
                            "TagValue": "test"
                        }
                    ],
                    "CreateTime": "test",
                    "ZoneId": 720001,
                    "ZoneName": "test"
                }
            ]
        }
    }
    

    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
    AuthFailure CAM signature/authentication error.
    CdbError Backend or process error.
    InternalError.CdbError System error.
    InternalError.DBOperationError Database operation failed.
    InternalError.DatabaseAccessError Internal database error.
    InternalError.DesError Internal system error.
    InternalError.InternalHttpServerError An exception occurred while executing the request.
    InternalError.InternalServiceErrorErr An error occurred while accessing internal service.
    InternalError.UndefinedError Unknown error
    InternalError.UnknownError Unknown error
    InvalidParameter Parameter error.
    InvalidParameter.ExceptionParam Parameter exception.
    InvalidParameter.InstanceNotFound The instance does not exist.
    InvalidParameterValue.DataConvertError Data conversion failed.
    InvalidParameterValue.InvalidParameterValueError Invalid parameter value
    OperationDenied.UserHasNoStrategy This account is not authorized to access the requested resource.
    OperationDenied.WrongStatus The backend task status is invalid.
    UnsupportedOperation Unsupported operation.