Querying Proxy Instances
Function
This API is used to query proxy instances. Before calling this API:
- Learn how to authorize and authenticate it.
- Obtain the required region and endpoint.
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.
URI
GET /v3/{project_id}/instances/{instance_id}/proxies
|
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 |
|
instance_id |
Yes |
String |
Definition Instance ID, which uniquely identifies an instance. Constraints N/A Range The value contains 36 characters with a suffix of in07. Only letters and digits are allowed. Default Value N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
offset |
No |
Integer |
Definition Index offset. The query starts from the next piece of data indexed by this parameter. Constraints The value must be an integer and cannot be a negative number. Range ≥ 0 Default Value 0 |
|
limit |
No |
Integer |
Definition Number of records to be queried. Constraints The value must be an integer and cannot be a negative number. Range 1–100 Default Value 100 |
Request 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
Default Value en-us |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
proxy_list |
Array of MysqlShowProxyResponseV3 objects |
Definition Proxy instances. |
|
Parameter |
Type |
Description |
|---|---|---|
|
proxy |
MysqlProxyV3 object |
Definition Proxy instance information. |
|
master_node |
MysqlProxyNodeV3 object |
Definition Primary node information. |
|
readonly_nodes |
Array of MysqlProxyNodeV3 objects |
Definition Read replica information. |
|
htap_nodes |
Array of MysqlProxyNodeV3 objects |
Definition HTAP node information. |
|
Parameter |
Type |
Description |
|---|---|---|
|
pool_id |
String |
Definition Proxy instance ID. Range The value contains 36 characters with a suffix of po01. Only letters and digits are allowed. |
|
status |
String |
Definition Status of a proxy instance. Range
|
|
address |
String |
Definition Proxy IP address. Range N/A |
|
port |
Integer |
Definition Port of a proxy instance. Range N/A |
|
pool_status |
String |
Definition Status of a proxy instance. Range
|
|
delay_threshold_in_seconds |
Integer |
Definition Delay threshold in seconds. Range N/A |
|
elb_vip |
String |
Definition Virtual IP address in ELB mode. Range N/A |
|
eip |
String |
Definition EIP. Range N/A |
|
vcpus |
String |
Definition vCPUs of a proxy instance. Range N/A |
|
ram |
String |
Definition Memory size of a proxy instance. Range N/A |
|
node_num |
Integer |
Definition Number of proxy instance nodes. Range N/A |
|
type |
String |
Definition Read/Write mode of a proxy instance. Range |
|
created_at |
String |
Definition Time when a proxy instance was created. Range N/A |
|
updated_at |
String |
Definition Time when a proxy instance was updated. Range N/A |
|
support_ap_node |
Boolean |
Definition Whether HTAP nodes are supported. Range
|
|
mode |
String |
Definition Proxy instance mode. Range Cluster |
|
nodes |
Array of MysqlProxyNodes objects |
Definition Database proxy nodes. |
|
flavor_ref |
String |
Definition Proxy instance specifications. Range N/A |
|
name |
String |
Definition Proxy instance name. Range N/A |
|
transaction_split |
String |
Definition Status of transaction splitting for the proxy instance. Range
|
|
connection_pool_type |
String |
Definition Connection pool type. Range
|
|
switch_connection_pool_type_enabled |
Boolean |
Definition Whether the proxy instance version supports session-level connection pool. Range
|
|
route_mode |
Integer |
Definition Routing policy of the proxy instance. Range
|
|
balance_route_mode_enabled |
Boolean |
Definition Whether the proxy instance version supports load balancing. Range
|
|
consistence_mode |
String |
Definition Consistency level. The parameter is left blank by default. Range
|
|
subnet_id |
String |
Definition ID of the subnet that the proxy instance belongs to. Range N/A |
|
ssl_option |
String |
Definition Whether to enable SSL. Range
|
|
new_node_auto_add_status |
String |
Definition Whether new nodes are automatically associated with proxy instances. Range
|
|
new_node_weight |
Integer |
Definition Read weight of a new node. Range 1–1000 |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
Definition Proxy node ID. |
|
status |
String |
Definition Status of the proxy instance node. Range
|
|
name |
String |
Definition Name of the proxy instance node. Range N/A |
|
role |
String |
Definition Role of the proxy instance node. Range
|
|
az_code |
String |
Definition AZ. Range N/A |
|
frozen_flag |
Integer |
Definition Whether the proxy instance node is frozen. Range
|
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
Definition ID of the proxy instance node. Range The value contains 36 characters with a suffix of no07. Only letters and digits are allowed. |
|
instance_id |
String |
Definition Instance ID, which uniquely identifies an instance. Range The value contains 36 characters with a suffix of in07. Only letters and digits are allowed. |
|
status |
String |
Definition Node status. Range
|
|
name |
String |
Definition Node name. Range N/A |
|
weight |
Integer |
Definition Read weight of the node. Range 1–1000 |
|
availability_zone |
Array of MysqlProxyAvailable objects |
Definition AZ information. |
|
Parameter |
Type |
Description |
|---|---|---|
|
code |
String |
Definition AZ code. Range N/A |
|
description |
String |
Definition AZ description. Range N/A |
Status code: 400
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Error code. |
|
error_msg |
String |
Error message. |
Status code: 500
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Error code. |
|
error_msg |
String |
Error message. |
Example Request
Querying proxy instances
GET https://{endpoint}/v3/054e292c9880d4992f02c0196d3ea468/instances/096c0fc43e804757b59946b80dc27f8bin07/proxies?offset=0&limit=10
Example Response
Status code: 200
Success.
{
"proxy_list" : [ {
"proxy" : {
"pool_id" : "2e7cf21d14794bafab623a334efd9ad8po01",
"status" : "ACTIVE",
"address" : "192.168.125.69",
"port" : 3306,
"pool_status" : "ACTIVE",
"delay_threshold_in_seconds" : 30,
"elb_vip" : "192.168.125.60",
"eip" : "192.168.125.50",
"vcpus" : 4,
"ram" : 8,
"node_num" : 2,
"type" : "readwrite",
"mode" : "Cluster",
"created" : "2022-07-14T16:26:58+0800",
"updated" : "2022-07-18T09:24:18+0800",
"support_ap_node" : "false;",
"nodes" : [ {
"id" : "db53a238a02240c49365e72e284a4890pn01",
"name" : "PROXY-2e7cf21d14794bafab623a334efd9ad8po01_0",
"role" : "master",
"az_code" : "az1xahz",
"status" : "ACTIVE",
"frozen_flag" : 0
} ],
"name" : "proxy-name",
"connection_pool_type" : "SESSION",
"switch_connection_pool_type_enabled" : true ,
"subnet_id" : "6991d82d-9166-4aff-a1fa-d2a8748b7084"
},
"master_node" : {
"id" : "c01a5645eb2c4fb6a9373542f5366e50no07",
"instance_id" : "7a871d6d494e4327ad2e326afb591108in07",
"status" : "ACTIVE",
"name" : "taurus_mysql80_x86-ondemand-2-1U4G_1_202103070251274842281_node01",
"weight" : 0,
"availability_zone" : [{
"code" : "az1",
"description": "AZ1"
}]
},
"readonly_nodes" : {
"id" : "d23535333138462880bfa1838fdfced2no07",
"instance_id" : "7a871d6d494e4327ad2e326afb591108in07",
"status" : "ACTIVE",
"name" : "taurus_mysql80_x86-ondemand-2-1U4G_1_202103070251274842281_node02",
"weight" : 100,
"availability_zone" : [{
"code" : "az1",
"description": "AZ1"
}]
},
"htap_nodes" : {
"id" : "d23535333138462880bfa1838fdfced2no17",
"instance_id" : "517ea793ab91438cbfcd9c4b1c958b1ein17",
"status" : "ACTIVE",
"name" : "taurus_mysql80_x86-ondemand-2-1U4G_1_202103070251274842281_node03",
"weight" : 100,
"availability_zone" : [ {
"code" : "az1",
"description" : "AZ1"
} ]
}
} ]
}
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 48 |
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 ShowGaussMySqlProxyListSolution { 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(); ShowGaussMySqlProxyListRequest request = new ShowGaussMySqlProxyListRequest(); request.withInstanceId("{instance_id}"); try { ShowGaussMySqlProxyListResponse response = client.showGaussMySqlProxyList(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 32 |
# 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 = ShowGaussMySqlProxyListRequest() request.instance_id = "{instance_id}" response = client.show_gauss_my_sql_proxy_list(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 38 |
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.ShowGaussMySqlProxyListRequest{} request.InstanceId = "{instance_id}" response, err := client.ShowGaussMySqlProxyList(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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot