Help Center/ TaurusDB/ API Reference/ APIs (Recommended)/ Instance Management/ Querying Details of DB Instances in Batches
Updated on 2026-01-05 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:

Calling Method

For details, see Calling APIs.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependency

    gaussdbformysql:instance:get

    Read

    instance *

    • g:EnterpriseProjectId

    • g:ResourceTag/<tag-key>

    gaussdb:instance:list

    -

URI

GET /v3.1/{project_id}/instances/details

Table 1 URI parameter

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID of a tenant in a region.

To obtain this value, see Obtaining a Project ID.

Constraints

N/A

Range

The value contains 32 characters. Only letters and digits are allowed.

Default Value

N/A

Table 2 Query parameter

Parameter

Mandatory

Type

Description

instance_ids

Yes

String

Definition

List of instance IDs.

Constraints

The list can contain a maximum of 20 instance IDs.

Range

An instance ID can contain 36 characters with a suffix of in07. Only letters and digits are allowed.

Default Value

N/A

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token. To obtain this value, call the IAM API for obtaining a user token.

The value of X-Subject-Token in the response header is the token value.

Constraints

N/A

Range

N/A

Default Value

N/A

X-Language

No

String

Definition

Request language type.

Constraints

N/A

Range

  • en-us

  • zh-cn

Default Value

en-us

Response Parameters

Status code: 200

Table 4 Response body parameter

Parameter

Type

Description

instances

Array of MysqlInstanceInfoDetailUnifyStatus objects

Definition

Instance details.

Table 5 MysqlInstanceInfoDetailUnifyStatus

Parameter

Type

Description

id

String

Definition

Instance ID.

Range

The value contains 36 characters with a suffix of in07. Only letters and digits are allowed.

name

String

Definition

Instance name.

Range

N/A

project_id

String

Definition

Project ID of a tenant in a region.

Range

N/A

status

String

Definition

Instance status.

Range

  • creating: An instance is being created.

  • normal: An instance is normal.

  • abnormal: An instance is abnormal.

  • createfail: An instance failed to be created.

port

String

Definition

Database port.

Range

N/A

alias

String

Definition

Instance description.

Range

N/A

type

String

Definition

Instance type.

Range

  • Cluster: cluster instance

  • MultiMaster: multi-primary instance

  • StandSingle: single-node instance

  • GdbReplicaCluster: instance in a RegionlessDB cluster

charge_info

MysqlInstanceChargeInfo object

Definition

Billing information.

node_count

Integer

Definition

Number of nodes.

Range

N/A

datastore

MysqlDatastoreWithKernelVersion object

Definition

Database information.

backup_used_space

Double

Definition

Used backup space, in GB.

Range

N/A

created

String

Definition

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, if the time zone offset is one hour, the value of Z is +0100.

Range

N/A

updated

String

Definition

Update 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, if the time zone offset is one hour, the value of Z is +0100.

Range

N/A

private_write_ips

Array of strings

Definition

Private IP addresses for write of instances.

Range

N/A

private_dns_names

Array of strings

Definition

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

Range

N/A

public_ips

String

Definition

EIPs.

Range

N/A

db_user_name

String

Definition

Default username.

Range

N/A

vpc_id

String

Definition

VPC ID.

Range

N/A

subnet_id

String

Definition

Network ID of the subnet.

Range

N/A

security_group_id

String

Definition

Security group ID.

Range

N/A

configuration_id

String

Definition

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

Range

N/A

backup_strategy

MysqlBackupStrategy object

Definition

Automated backup policy.

Constraints

N/A

nodes

Array of MysqlInstanceNodeInfo objects

Definition

Node information.

enterprise_project_id

String

Definition

Enterprise project ID.

Range

N/A

time_zone

String

Definition

Time zone.

Range

N/A

az_mode

String

Definition

AZ type.

Range

  • single: single AZ

  • multi: multiple AZs

master_az_code

String

Definition

Primary AZ.

Range

N/A

maintenance_window

String

Definition

Maintenance window in the UTC format.

Range

N/A

tags

Array of MysqlTags objects

Definition

Instance tags.

Range

N/A

dedicated_resource_id

String

Definition

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

Range

N/A

proxies

Array of MysqlProxyInfo objects

Definition

Proxy information.

tde_info

MysqlTdeInfo object

Definition

TDE configuration. The AES-256 and SM4 algorithms are supported.

TDE is in the OBT phase. To use it, submit a service ticket.

Table 6 MysqlInstanceChargeInfo

Parameter

Type

Description

charge_mode

String

Definition

Billing mode.

Range

  • prePaid: yearly/monthly

  • postPaid: pay-per-use

order_id

String

Definition

Order ID. This parameter is only returned for yearly/monthly instances.

Range

N/A

Table 7 MysqlDatastoreWithKernelVersion

Parameter

Type

Description

type

String

Definition

DB engine.

Range

gaussdb-mysql

version

String

Definition

DB version.

Range

N/A

kernel_version

String

Definition

DB kernel version.

Range

N/A

Table 8 MysqlBackupStrategy

Parameter

Type

Description

start_time

String

Definition

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

Constraints

N/A

Range

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

  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.

Default Value

N/A

keep_days

String

Definition

Retention period of automated backups.

Constraints

The value must be a positive integer.

Range

1–732

Default Value

N/A

Table 9 MysqlInstanceNodeInfo

Parameter

Type

Description

id

String

Definition

Instance ID, which is compliant with the UUID format.

Range

The value contains 36 characters with a suffix of in07. Only letters and digits are allowed.

name

String

Definition

Node name.

Range

N/A

type

String

Definition

Node type.

Range

  • master: primary node

  • slave: read replica

status

String

Definition

Node status.

Range

  • creating: A node is being created.

  • normal: A node is available.

  • abnormal: A node is abnormal.

  • createfail: A node failed to be created.

port

Integer

Definition

Database port.

Range

N/A

private_read_ips

Array of strings

Definition

Private IP addresses for read of nodes.

Range

N/A

volume

MysqlInstanceNodeVolumeInfo object

Definition

Storage disk information.

Range

N/A

az_code

String

Definition

AZ.

Range

N/A

region_code

String

Definition

Region where an instance is deployed.

Range

N/A

created

String

Definition

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, if the time zone offset is one hour, the value of Z is +0100.

Range

N/A

updated

String

Definition

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

Range

N/A

flavor_id

String

Definition

Specification ID.

Range

N/A

flavor_ref

String

Definition

Specification code.

Range

N/A

max_connections

String

Definition

Maximum number of connections.

Range

N/A

vcpus

String

Definition

Number of vCPUs.

Range

N/A

ram

String

Definition

Memory size, in GB.

Range

N/A

need_restart

Boolean

Definition

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

Range

N/A

priority

Integer

Definition

Failover priority.

Range

–1 or 1–16

Table 10 MysqlInstanceNodeVolumeInfo

Parameter

Type

Description

type

String

Definition

Disk type.

Range

  • POOL: DL6

  • STANDARDPOOL: DL5

  • NORMALPOOL: DL4

used

String

Definition

Used disk size, in GB.

Range

N/A

size

Long

Definition

Storage space of a yearly/monthly instance, in GB.

Range

N/A

Table 11 MysqlTags

Parameter

Type

Description

key

String

Definition

Tag key.

Constraints

It cannot be an empty string, a space, or left blank.

Range

The value contains a maximum of 36 Unicode characters. Only uppercase letters, lowercase letters, digits, hyphens (-), and underscores (_) are allowed.

Default Value

N/A

value

String

Definition

Tag value.

Constraints

It can be an empty string.

Range

The value contains a maximum of 43 Unicode characters. Only uppercase letters, lowercase letters, digits, hyphens (-), and underscores (_) are allowed.

Default Value

N/A

Table 12 MysqlProxyInfo

Parameter

Type

Description

pool_id

String

Definition

Proxy instance ID.

Range

N/A

name

String

Definition

Proxy instance name.

Range

N/A

address

String

Definition

Proxy address.

Range

N/A

Table 13 MysqlTdeInfo

Parameter

Type

Description

enable_tde

Boolean

Definition

Whether to enable TDE.

Constraints

N/A

Range

  • true: TDE is enabled.

  • false: TDE is disabled.

Default Value

N/A

encryption_type

String

Definition

TDE algorithm.

Constraints

N/A

Range

  • AES256

  • SM4

Default Value

N/A

Status code: 400

Table 14 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 500

Table 15 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.1/97b026aa9cc4417888c14c84a1ad9860/instances/details?instance_ids=11684a0e59e94bceba7880d58cfb07b5in07

Example Response

Status code: 200

Success.

{
  "instances" : [ {
    "id" : "11684a0e59e94bceba7880d58cfb07b5in07",
    "name" : "gaussdb-mysql-instance01",
    "alias" : "",
    "status" : "normal",
    "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.*.*.*",
    "private_write_ips" : [ "192.*.*.*" ],
    "private_dns_names" : [ "11684a0e59e94bceba7880d58cfb07b5in07.internal.xxxxxx.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" : "normal",
      "port" : 3306,
      "private_read_ips" : [ "192.*.*.*" ],
      "volume" : {
        "type" : "POOL",
        "used" : 0.07
      },
      "az_code" : "az1xahz",
      "region_code" : "region-1",
      "flavor_id" : "3169caaf-6c2f-41d5-aadd-c8fc3d83597e",
      "flavor_ref" : "gaussdb.mysql.xlarge.arm.4",
      "max_connections" : 1500,
      "vcpus" : 1,
      "ram" : 4,
      "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" : "normal",
      "port" : 3306,
      "private_read_ips" : [ "192.*.*.*" ],
      "volume" : {
        "type" : "POOL",
        "used" : 0.07
      },
      "az_code" : "az1",
      "region_code" : "region-1",
      "flavor_id" : "3169caaf-6c2f-41d5-aadd-c8fc3d83597e",
      "flavor_ref" : "gaussdb.mysql.xlarge.arm.4",
      "max_connections" : 1500,
      "vcpus" : 1,
      "ram" : 4,
      "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.*.*.*",
      "name" : "proxy-name"
    } ]
  } ]
}

SDK Sample Code

The SDK sample code is as follows.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.huaweicloud.sdk.test;

import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.BasicCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.gaussdb.v3.region.GaussDBRegion;
import com.huaweicloud.sdk.gaussdb.v3.*;
import com.huaweicloud.sdk.gaussdb.v3.model.*;


public class ListGaussMySqlInstanceDetailInfoUnifyStatusSolution {

    public static void main(String[] args) {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        String ak = System.getenv("CLOUD_SDK_AK");
        String sk = System.getenv("CLOUD_SDK_SK");
        String projectId = "{project_id}";

        ICredential auth = new BasicCredentials()
                .withProjectId(projectId)
                .withAk(ak)
                .withSk(sk);

        GaussDBClient client = GaussDBClient.newBuilder()
                .withCredential(auth)
                .withRegion(GaussDBRegion.valueOf("<YOUR REGION>"))
                .build();
        ListGaussMySqlInstanceDetailInfoUnifyStatusRequest request = new ListGaussMySqlInstanceDetailInfoUnifyStatusRequest();
        try {
            ListGaussMySqlInstanceDetailInfoUnifyStatusResponse response = client.listGaussMySqlInstanceDetailInfoUnifyStatus(request);
            System.out.println(response.toString());
        } catch (ConnectionException e) {
            e.printStackTrace();
        } catch (RequestTimeoutException e) {
            e.printStackTrace();
        } catch (ServiceResponseException e) {
            e.printStackTrace();
            System.out.println(e.getHttpStatusCode());
            System.out.println(e.getRequestId());
            System.out.println(e.getErrorCode());
            System.out.println(e.getErrorMsg());
        }
    }
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkgaussdb.v3.region.gaussdb_region import GaussDBRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkgaussdb.v3 import *

if __name__ == "__main__":
    # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak = os.environ["CLOUD_SDK_AK"]
    sk = os.environ["CLOUD_SDK_SK"]
    projectId = "{project_id}"

    credentials = BasicCredentials(ak, sk, projectId)

    client = GaussDBClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(GaussDBRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ListGaussMySqlInstanceDetailInfoUnifyStatusRequest()
        response = client.list_gauss_my_sql_instance_detail_info_unify_status(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    gaussdb "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/gaussdb/v3"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/gaussdb/v3/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/gaussdb/v3/region"
)

func main() {
    // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak := os.Getenv("CLOUD_SDK_AK")
    sk := os.Getenv("CLOUD_SDK_SK")
    projectId := "{project_id}"

    auth := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        WithProjectId(projectId).
        Build()

    client := gaussdb.NewGaussDBClient(
        gaussdb.GaussDBClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.ListGaussMySqlInstanceDetailInfoUnifyStatusRequest{}
	response, err := client.ListGaussMySqlInstanceDetailInfoUnifyStatus(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.

Status Code

For details, see Status Codes.

Error Code

For details, see Error Codes.