查询实例列表

最近更新时间:2018-09-18 17:03:17

1. 接口描述

接口请求域名: postgres.tencentcloudapi.com 。

本接口 (DescribeDBInstances) 用于查询一个或多个实例的详细信息。

默认接口请求频率限制:20次/每秒。

注意:本接口支持金融区地域。由于金融区和非金融区是隔离不互通的,因此当公共参数 Region 为金融区地域(例如 ap-shanghai-fsi )时,需要同时指定带金融区地域的域名,最好和 Region 的地域保持一致,例如:postgres.ap-shanghai-fsi.tencentcloudapi.com 。

2. 输入参数

以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见公共请求参数

参数名称 必选 类型 描述
Action String 公共参数,本接口取值:DescribeDBInstances
Version String 公共参数,本接口取值:2017-03-12
Region String 公共参数,详见产品支持的地域列表
Filters.N Array of Filter 过滤条件,目前支持:db-instance-id、db-instance-name两种。
Limit Integer 每页显示数量,默认返回10条。
Offset Integer 分页序号,从0开始。

3. 输出参数

参数名称 类型 描述
TotalCount Integer 查询到的实例数量。
DBInstanceSet Array of DBInstance 实例详细信息集合。
RequestId String 唯一请求ID,每次请求都会返回。定位问题时需要提供该次请求的RequestId。

4. 示例

示例1 根据实例ID查询实例信息

输入示例

https://postgres.tencentcloudapi.com/?Action=DescribeDBInstances
&Limit=10
&Offset=0
&Filters.0.Name=db-instance-id
&Filters.0.Values.0=postgres-6bwgamo3
&<公共请求参数>

输出示例

{
  "Response": {
    "DBInstanceSet": [
      {
        "AppId": 100000000,
        "AutoRenew": false,
        "CreateTime": "2017-12-28 19:23:19",
        "DBCharset": "UTF8",
        "DBInstanceClass": "cdb.pg.z1.4g",
        "DBInstanceCpu": 2,
        "DBInstanceId": "postgres-6bwgamo3",
        "DBInstanceMemory": 4,
        "DBInstanceName": "test",
        "DBInstanceNetInfo": [
          {
            "Address": "",
            "Ip": "xxxx",
            "NetType": "inner",
            "Port": 5432,
            "Status": "opened"
          },
          {
            "Address": "",
            "Ip": "",
            "NetType": "public",
            "Port": 0,
            "Status": "0"
          }
        ],
        "DBInstanceStatus": "running",
        "DBInstanceStorage": 20,
        "DBInstanceType": "primary",
        "DBInstanceVersion": "standard",
        "DBVersion": "9.5.4",
        "ExpireTime": "2018-01-28 19:23:23",
        "IsolatedTime": "0000-00-00 00:00:00",
        "PayType": "prepaid",
        "ProjectId": 0,
        "Region": "ap-guangzhou",
        "SubnetId": "",
        "UpdateTime": "2018-01-18 15:54:32",
        "VpcId": "",
        "Zone": "ap-guangzhou-2"
      }
    ],
    "RequestId": "d849664a-191c-48bf-b42f-444caa189557",
    "TotalCount": 2
  }
}

示例2 查询所有实例列表

输入示例

https://postgres.tencentcloudapi.com/?Action=DescribeDBInstances
&Limit=10
&Offset=0
&<公共请求参数>

输出示例

{
  "Response": {
    "DBInstanceSet": [
      {
        "AppId": 251000710,
        "AutoRenew": false,
        "CreateTime": "2017-12-28 19:23:19",
        "DBCharset": "UTF8",
        "DBInstanceClass": "cdb.pg.z1.4g",
        "DBInstanceCpu": 2,
        "DBInstanceId": "postgres-6bwgamo3",
        "DBInstanceMemory": 4,
        "DBInstanceName": "test",
        "DBInstanceNetInfo": [
          {
            "Address": "",
            "Ip": "10.66.187.1",
            "NetType": "inner",
            "Port": 5432,
            "Status": "opened"
          },
          {
            "Address": "",
            "Ip": "",
            "NetType": "public",
            "Port": 0,
            "Status": "0"
          }
        ],
        "DBInstanceStatus": "running",
        "DBInstanceStorage": 20,
        "DBInstanceType": "primary",
        "DBInstanceVersion": "standard",
        "DBVersion": "9.5.4",
        "ExpireTime": "2018-01-28 19:23:23",
        "IsolatedTime": "0000-00-00 00:00:00",
        "PayType": "prepaid",
        "ProjectId": 0,
        "Region": "ap-guangzhou",
        "SubnetId": "",
        "UpdateTime": "2018-01-18 15:54:32",
        "VpcId": "",
        "Zone": "ap-guangzhou-2"
      },
      {
        "AppId": 251000710,
        "AutoRenew": false,
        "CreateTime": "2017-12-28 19:50:15",
        "DBCharset": "UTF8",
        "DBInstanceClass": "cdb.pg.z1.4g",
        "DBInstanceCpu": 2,
        "DBInstanceId": "postgres-1e2srvtt",
        "DBInstanceMemory": 4,
        "DBInstanceName": "未命名",
        "DBInstanceNetInfo": [
          {
            "Address": "",
            "Ip": "10.66.195.51",
            "NetType": "inner",
            "Port": 5432,
            "Status": "opened"
          },
          {
            "Address": "",
            "Ip": "",
            "NetType": "public",
            "Port": 0,
            "Status": "0"
          }
        ],
        "DBInstanceStatus": "running",
        "DBInstanceStorage": 20,
        "DBInstanceType": "primary",
        "DBInstanceVersion": "standard",
        "DBVersion": "9.5.4",
        "ExpireTime": "2018-01-28 19:50:17",
        "IsolatedTime": "0000-00-00 00:00:00",
        "PayType": "prepaid",
        "ProjectId": 0,
        "Region": "ap-guangzhou",
        "SubnetId": "",
        "UpdateTime": "2018-01-19 10:34:21",
        "VpcId": "",
        "Zone": "ap-guangzhou-2"
      }
    ],
    "RequestId": "a6e3c73c-6810-42c2-842e-fa759ce52fa0",
    "TotalCount": 2
  }
}

5. 开发者资源

API Explorer

该工具提供了在线调用、签名验证、 SDK 代码生成和快速检索接口等能力,能显著降低使用云 API 的难度,推荐使用。

SDK

云 API 3.0 提供了配套的开发工具集( SDK ),支持多种编程语言,能更方便的调用 API 。

命令行工具

6. 错误码

以下仅列出了接口业务逻辑相关的错误码,其他错误码详见公共错误码

错误码 描述
FailedOperation.LimitOperation 实例被限制操作。
InternalError.DBError 后台DB执行错误。
InternalError.SystemError 系统错误。出现这种错误时,请联系客服支持。
InternalError.UnknownError 其他未知错误。出现这种错误时,请联系客服支持。
InvalidParameterValue.InstanceNotExist 当前实例不存在。
InvalidParameterValue.RegionNotSupported 不支持当前地域。
InvalidParameterValue.StructParseFailed 解析参数出错。
ResourceUnavailable.InvalidInstanceStatus 实例状态错误。