Updated on 2024-04-01 GMT+08:00

Querying Details of DB Instances in Batches

Function

This API is used to query details of DB instances in batches. Before calling this API:

This API will be unavailable on March 31, 2025.

URI

GET /v3/{project_id}/instances/details

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID of a tenant in a region.

To obtain this value, see Obtaining a Project ID.

Table 2 Query parameters

Parameter

Mandatory

Type

Description

instance_ids

Yes

String

Instance ID. A maximum of 20 instance IDs can be entered at a time. Separate them with commas (,).

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

If the following response body is returned for calling the API used to obtain a user token, the request is successful.

After the request is processed, the value of X-Subject-Token in the message header is the token value.

X-Language

No

String

Request language type. The default value is en-us.

Value:

  • en-us
  • zh-cn

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

instances

Array of MysqlInstanceInfoDetail objects

Instance details.

Table 5 MysqlInstanceInfoDetail

Parameter

Type

Description

id

String

Instance ID.

name

String

Instance name.

project_id

String

Project ID of a tenant in a region.

status

String

Instance status.

Value:

  • BUILD: The DB instance is being created.
  • ACTIVE: The DB instance is normal.
  • FAILED: The instance fails to be created.
  • FROZEN: The DB instance is frozen.
  • MODIFYING: The DB instance is being scaled up.
  • REBOOTING: The DB instance is being rebooted.
  • RESTORING: The DB instance is being restored.
  • SWITCHOVER: A primary/standby switchover is being performed.
  • MIGRATING: The DB instance is being migrated.
  • BACKING UP: The DB instance is being backed up.
  • MODIFYING DATABASE PORT: The database port is being changed.
  • STORAGE FULL: The DB instance storage space is full.

port

String

Database port.

alias

String

Instance remarks.

type

String

Instance type. The value is Cluster.

charge_info

MysqlInstanceChargeInfo object

Billing mode, which is yearly/monthly or pay-per-use (default setting).

node_count

Integer

Number of nodes.

datastore

MysqlDatastoreWithKernelVersion object

Database information.

backup_used_space

Double

Used backup space in GB.

created

String

Creation time in the "yyyy-mm-ddThh:mm:ssZ" format. T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset. For example, in the Beijing time zone, the time zone offset is shown as +0800.

NOTE:

The value is empty when the DB instance is being created. After the DB instance is created, the value is not empty.

updated

String

Update time. The format is the same as that of the created field.

NOTE:

The value is empty when the DB instance is being created. After the DB instance is created, the value is not empty.

private_write_ips

Array of strings

Private IP address for write.

private_dns_names

Array of strings

Private domain names of the instance. After a DB instance is created, you need to manually apply for a private domain name, or the private domain name is left blank.

public_ips

String

Public IP address of the instance.

db_user_name

String

Default username.

vpc_id

String

VPC ID.

subnet_id

String

Network ID of the subnet.

security_group_id

String

Security group ID.

configuration_id

String

ID of the parameter template used for creating an instance or ID of the latest parameter template that is applied to an instance.

backup_strategy

MysqlBackupStrategy object

Automated backup policy.

nodes

Array of MysqlInstanceNodeInfo objects

Node information.

enterprise_project_id

String

Enterprise project ID.

time_zone

String

Time zone.

az_mode

String

AZ type.

Value:

  • single: single AZ
  • multi: multiple AZs

master_az_code

String

Primary AZ.

maintenance_window

String

Maintenance window in the UTC format.

tags

Array of MysqlTags objects

Tags for managing instances.

dedicated_resource_id

String

Dedicated resource pool ID. This parameter is returned only when the instance belongs to a dedicated resource pool.

proxies

Array of MysqlProxyInfo objects

Proxy instance information.

Table 6 MysqlInstanceChargeInfo

Parameter

Type

Description

charge_mode

String

Billing mode.

order_id

String

Order ID.

Table 7 MysqlDatastoreWithKernelVersion

Parameter

Type

Description

type

String

DB engine. Currently, only gaussdb-mysql is supported.

version

String

DB version.

For details about supported DB versions, see Querying Version Information About a DB Engine.

kernel_version

String

Database kernel version.

Table 8 MysqlBackupStrategy

Parameter

Type

Description

start_time

String

Automated backup start time. The automated backup will be triggered within one hour after the time specified by this parameter.

The value cannot be empty. It must be a valid value in the "hh:mm-HH:MM" format. The current time is in the UTC format.

  1. The HH value must be 1 greater than the hh value.
  2. The values of mm and MM must be the same and must be set to 00.

keep_days

String

Automated backup retention days. Value: 1-732.

Table 9 MysqlInstanceNodeInfo

Parameter

Type

Description

id

String

Instance ID.

name

String

Node name.

type

String

Node type.

Value:

  • master: primary node
  • slave: read replica

status

String

Node status.

port

Integer

Database port.

private_read_ips

Array of strings

Private IP address for read of the node.

volume

MysqlInstanceNodeVolumeInfo object

Storage disk information.

az_code

String

AZ.

region_code

String

Region where the instance is located.

created

String

Creation time in the "yyyy-mm-ddThh:mm:ssZ" format. T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset. For example, in the Beijing time zone, the time zone offset is shown as +0800.

NOTE:

The value is empty when the DB instance is being created. After the DB instance is created, the value is not empty.

updated

String

Update time. The format is the same as that of the created field.

NOTE:

The value is empty when the DB instance is being created. After the DB instance is created, the value is not empty.

flavor_id

String

Specification ID.

flavor_ref

String

Specification code.

max_connections

String

Maximum number of connections.

vcpus

String

Number of vCPUs.

ram

String

Memory size in GB.

need_restart

Boolean

Whether to reboot the instance for the parameter modifications to take effect.

priority

Integer

Failover priority.

Table 10 MysqlInstanceNodeVolumeInfo

Parameter

Type

Description

type

String

Disk type.

used

String

Used disk size in GB.

size

Long

Disk size of the yearly/monthly instance in GB

Table 11 MysqlTags

Parameter

Type

Description

key

String

Tag key. The value can contain a maximum of 36 Unicode characters. The value cannot be an empty string, a space, or left blank. Only uppercase letters, lowercase letters, digits, hyphens (-), and underscores (_) are allowed.

value

String

Tag value. It contains a maximum of 43 Unicode characters. The value can be an empty string. Only uppercase letters, lowercase letters, digits, periods (.), hyphens (-), and underscores (_) are allowed.

Table 12 MysqlProxyInfo

Parameter

Type

Description

pool_id

String

Proxy instance ID.

name

String

Proxy instance name.

address

String

Read/Write splitting address of a proxy instance

Status code: 400

Table 13 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 500

Table 14 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Request

Querying details of DB instances in batches

GET https://{endpoint}/v3/97b026aa9cc4417888c14c84a1ad9860/instances/details?instance_ids=436aaafb689c4250a9a5bb33cb271e8cin07,d738399de028480fabb2b8120d4e01a4in07

Example Response

Status code: 200

Success.

{
  "instances" : [ {
    "id" : "d738399de028480fabb2b8120d4e01a4in07",
    "name" : "gaussdb-mysql-instance01",
    "alias" : "",
    "status" : "ACTIVE",
    "project_id" : "3cedfc54-b105-4652-a4e0-847b11576628",
    "enterprise_project_id" : 0,
    "type" : "Cluster",
    "charge_info" : {
      "charge_mode" : "postPaid",
      "order_id" : ""
    },
    "node_count" : 2,
    "datastore" : {
      "type" : "gaussdb-mysql",
      "version" : "8.0",
      "kernel_version" : "2.0.29.1"
    },
    "created" : "2022-07-14T16:26:58+0800",
    "updated" : "2022-07-18T14:20:33+0800",
    "public_ips" : [ "10.154.219.187" ],
    "private_write_ips" : [ "192.168.0.142" ],
    "private_dns_names" : [ "11684a0e59e94bceba7880d58cfb07b5in07.internal.cn-xianhz-1.gaussdbformysql.myhuaweicloud.com" ],
    "db_user_name" : "root",
    "port" : 3306,
    "vpc_id" : "3cedfc54-b105-4652-a4e0-847b11576b58",
    "subnet_id" : "c1cfa53c-65d3-431e-8552-326bf310c7ad",
    "security_group_id" : "fc577a1a-f202-424a-977f-24faec3fdd55",
    "backup_strategy" : {
      "start_time" : "19:00-20:00",
      "keep_days" : 7
    },
    "nodes" : [ {
      "id" : "799a0f2fa49a4151bf9f7063c1fbba36no07",
      "name" : "gauss-d616-lb07_node01",
      "type" : "master",
      "status" : "ACTIVE",
      "port" : 3306,
      "private_read_ips" : [ "192.168.0.163" ],
      "volume" : {
        "type" : "POOL",
        "used" : 0.07
      },
      "az_code" : "az1xahz",
      "region_code" : "cn-xianhz-1",
      "flavor_id" : "3169caaf-6c2f-41d5-aadd-c8fc3d83597e",
      "flavor_ref" : "gaussdb.mysql.xlarge.x86.4",
      "max_connections" : 1500,
      "vcpus" : 4,
      "ram" : 16,
      "need_restart" : false,
      "priority" : 1,
      "created" : "2022-07-14T16:26:58+0800",
      "updated" : "2022-07-18T09:24:18+0800"
    }, {
      "id" : "799a0f2fa49a4151bf9f7063c1fbba35no07",
      "name" : "gauss-d616-lb07_node02",
      "type" : "slave",
      "status" : "ACTIVE",
      "port" : 3306,
      "private_read_ips" : [ "192.168.0.162" ],
      "volume" : {
        "type" : "POOL",
        "used" : 0.07
      },
      "az_code" : "az1xahz",
      "region_code" : "cn-xianhz-1",
      "flavor_id" : "3169caaf-6c2f-41d5-aadd-c8fc3d83597e",
      "flavor_ref" : "gaussdb.mysql.xlarge.x86.4",
      "max_connections" : 1500,
      "vcpus" :4,
      "ram" : 16,
      "need_restart" : false,
      "priority" : 1,
      "created" : "2022-07-14T16:26:58+0800",
      "updated" : "2022-07-18T09:36:18+0800"
    } ],
    "time_zone" : "UTC+08:00",
    "backup_used_space" : 0.24,
    "az_mode" : "single",
    "master_az_code" : "az1",
    "maintenance_window" : "18:00-22:00",
    "tags" : [ ],
    "configuration_id" : "53570e0de54e40c5a15f331aa5sd2176pr07",
    "dedicated_resource_id" : "",
    "proxies" : [ {
      "pool_id" : "dab1cfc5150c4d1ca0e8c6596bfc0d8cpo01",
      "address" : "192.168.10.76",
      "name" : "proxy-name"
    } ]
  } ]
}

Status Code

For details, see Status Codes.

Error Code

For details, see Error Codes.