更新时间:2024-05-31 GMT+08:00
分享

查询实例详情信息

功能介绍

查询实例详情信息。

调用方法

请参见如何调用API

URI

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

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

租户在某一Region下的project ID。

获取方法请参见获取项目ID

instance_id

String

实例ID,严格匹配UUID规则。

请求参数

表2 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

用户Token。

通过调用IAM服务获取用户Token接口获取。

请求响应成功后在响应消息头中包含的“X-Subject-Token”的值即为Token值。

X-Language

String

请求语言类型。默认en-us。 取值范围:

  • en-us

  • zh-cn

响应参数

状态码: 200

表3 响应Body参数

参数

参数类型

描述

instance

MysqlInstanceInfoDetailUnifyStatus object

实例信息。

表4 MysqlInstanceInfoDetailUnifyStatus

参数

参数类型

描述

id

String

实例ID,严格匹配UUID规则。

name

String

创建的实例名称。

project_id

String

租户在某一Region下的project ID。

status

String

实例状态。

取值:

  • 值为“creating”,表示实例正在创建。

  • 值为“normal”,表示实例正常。

  • 值为“abnormal”,表示实例异常。

  • 值为“createfail”,表示实例创建失败。

port

String

数据库端口号。

alias

String

实例备注

type

String

实例类型,取值为“Cluster”。

charge_info

MysqlInstanceChargeInfo object

计费类型信息,支持包年包月和按需,默认为按需。

node_count

Integer

节点个数。

datastore

MysqlDatastoreWithKernelVersion object

数据库信息。

backup_used_space

Double

备份空间使用大小,单位为GB。

created

String

创建时间,格式为"yyyy-mm-ddThh:mm:ssZ"。

其中,T指某个时间的开始;Z指时区偏移量,例如偏移1个小时显示为+0100。

updated

String

更新时间,格式与"created"字段对应格式完全相同。

private_write_ips

Array of strings

实例的写内网IP地址。

private_dns_names

Array of strings

实例内网域名列表。实例创建成功后,需要手动申请内网域名,否则查询内网域名为空。

public_ips

String

实例的公网IP地址。

db_user_name

String

默认用户名。

vpc_id

String

虚拟私有云ID。

subnet_id

String

子网的网络ID信息。

security_group_id

String

安全组ID。

configuration_id

String

实例创建的模板ID,或者应用到实例的最新参数组模板ID。

backup_strategy

MysqlBackupStrategy object

自动备份策略。

nodes

Array of MysqlInstanceNodeInfo objects

节点信息。

enterprise_project_id

String

企业项目ID。

time_zone

String

时区。

az_mode

String

可用区模式。

取值范围:

  • single:单可用区。

  • multi:多可用区。

master_az_code

String

主可用区。

maintenance_window

String

可维护时间窗,为UTC时间。

tags

Array of MysqlTags objects

实例标签。

dedicated_resource_id

String

专属资源池ID,只有数据库实例属于专属资源池才会返回该参数。

proxies

Array of MysqlProxyInfo objects

代理信息。

tde_info

MysqlTdeInfo object

透明数据加密配置信息,支持AES256、SM4加密算法。

透明加密功能目前处于公测阶段,如需使用,请提交工单联系客服人员申请权限。

表5 MysqlInstanceChargeInfo

参数

参数类型

描述

charge_mode

String

计费模式。

order_id

String

订单号。仅包年包月返回。

表6 MysqlDatastoreWithKernelVersion

参数

参数类型

描述

type

String

数据库引擎,现在只支持gaussdb-mysql。

version

String

数据库版本。

kernel_version

String

数据库内核版本。

表7 MysqlBackupStrategy

参数

参数类型

描述

start_time

String

自动备份开始时间段。自动备份将在该时间一个小时内触发。

取值范围:非空,格式必须为hh:mm-HH:MM且有效,当前时间指UTC时间。

  1. HH取值必须比hh大1。

  2. mm和MM取值必须相同,且取值必须为00。

keep_days

String

自动备份保留天数,取值范围:1-732。

表8 MysqlInstanceNodeInfo

参数

参数类型

描述

id

String

实例ID,严格匹配UUID规则。

name

String

节点名称。

type

String

节点类型。

取值范围:

  • master:主节点。

  • slave:只读节点。

status

String

节点状态。

port

Integer

数据库端口号。

private_read_ips

Array of strings

节点的读内网地址。

volume

MysqlInstanceNodeVolumeInfo object

存储盘信息。

az_code

String

可用区。

region_code

String

实例所在的区域。

created

String

创建时间,格式为"yyyy-mm-ddThh:mm:ssZ"。

其中,T指某个时间的开始;Z指时区偏移量,例如偏移1个小时显示为+0100。

updated

String

更新时间,格式与"created"字段对应格式完全相同。

flavor_id

String

规格ID。

flavor_ref

String

规格码。

max_connections

String

允许的最大连接数。

vcpus

String

CPU核数。

ram

String

内存大小,单位为GB。

need_restart

Boolean

是否需要重启使修改的参数生效。

priority

Integer

主备倒换优先级。

表9 MysqlInstanceNodeVolumeInfo

参数

参数类型

描述

type

String

磁盘类型。

used

String

已使用磁盘大小,单位GB。

size

Long

包年/包月实例购买的存储空间大小,单位GB。

表10 MysqlTags

参数

参数类型

描述

key

String

标签键。最大长度36个unicode字符。key不能为空或者空字符串,不能为空格。

字符集:A-Z,a-z ,0-9,‘-’,‘_’,UNICODE字符(\u4E00-\u9FFF)。

value

String

标签值。最大长度43个unicode字符。可以为空字符串。

字符集:A-Z,a-z ,0-9,‘.’,‘-’,‘_’,UNICODE字符(\u4E00-\u9FFF)。

表11 MysqlProxyInfo

参数

参数类型

描述

pool_id

String

数据库代理ID。

name

String

数据库代理名称。

address

String

Proxy读写分离地址。

表12 MysqlTdeInfo

参数

参数类型

描述

enable_tde

Boolean

是否打开透明加密功能。

encryption_type

String

透明加密算法,支持AES256、SM4加密算法。

状态码: 400

表13 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误消息。

状态码: 500

表14 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误消息。

请求示例

查询指定实例的详细信息。

GET https://{endpoint}/v3.1/3cedfc54-b105-4652-a4e0-847b11576628/instances/d738399de028480fabb2b8120d4e01a4in07

响应示例

状态码: 200

Success.

{
  "instance" : {
    "id" : "d738399de028480fabb2b8120d4e01a4in07",
    "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.154.219.187",
    "private_write_ips" : [ "192.168.0.142" ],
    "private_dns_names" : [ "d738399de028480fabb2b8120d4e01a4in07.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" : "normal",
      "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.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.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.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.168.10.76",
      "name" : "proxy-name"
    } ]
  }
}

SDK代码示例

SDK代码示例如下。

 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
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 ShowGaussMySqlInstanceInfoUnifyStatusSolution {

    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");

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

        GaussDBClient client = GaussDBClient.newBuilder()
                .withCredential(auth)
                .withRegion(GaussDBRegion.valueOf("<YOUR REGION>"))
                .build();
        ShowGaussMySqlInstanceInfoUnifyStatusRequest request = new ShowGaussMySqlInstanceInfoUnifyStatusRequest();
        try {
            ShowGaussMySqlInstanceInfoUnifyStatusResponse response = client.showGaussMySqlInstanceInfoUnifyStatus(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
# coding: utf-8

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 = __import__('os').getenv("CLOUD_SDK_AK")
    sk = __import__('os').getenv("CLOUD_SDK_SK")

    credentials = BasicCredentials(ak, sk) \

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

    try:
        request = ShowGaussMySqlInstanceInfoUnifyStatusRequest()
        response = client.show_gauss_my_sql_instance_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
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")

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

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

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

更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。

状态码

状态码

描述

200

Success.

400

Client error.

500

Server error.

错误码

请参见错误码

分享:

    相关文档

    相关产品