更新时间:2024-09-12 GMT+08:00
分享

获取参数模板详情

功能介绍

获取指定参数模板的参数信息。

接口约束

该接口支持GaussDB(for MySQL)主备-独享版。

调用方法

请参见如何调用API

URI

GET /v3/{project_id}/configurations/{configuration_id}

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

租户在某一Region下的project ID。

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

configuration_id

String

参数模板ID。

获取方法参见查询参数模板

请求参数

表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参数

参数

参数类型

描述

configurations

ConfigurationSummary2 object

参数模板信息。

parameter_values

Map<String,String>

参数名和参数值映射关系。用户可以基于默认参数模板的参数,自定义的参数值。

表4 ConfigurationSummary2

参数

参数类型

描述

id

String

参数组ID。

name

String

参数组名称。

description

String

参数组描述。

datastore

DatastoreResult object

数据库对象。

created

String

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

其中,T指某个时间的开始;Z指时区偏移量。

updated

String

更新时间,格式为"yyyy-MM-ddTHH:mm:ssZ"。

其中,T指某个时间的开始;Z指时区偏移量。

表5 DatastoreResult

参数

参数类型

描述

type

String

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

version

String

数据库版本。数据库支持的详细版本信息,可调用查询数据库引擎的版本接口获取。

状态码: 400

表6 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误消息。

状态码: 500

表7 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误消息。

请求示例

获取参数模板详情。

GET https://{endpoint}/v3/0549b4a43100d4f32f51c01c2fe4acdb/configurations/43570e0de32e40c5a15f831aa5ce4176pr07

响应示例

状态码: 200

Success.

{
  "configurations" : {
    "id" : "43570e0de32e40c5a15f831aa5ce4176pr07",
    "name" : "myparameter",
    "description" : "parameter1",
    "datastore" : {
      "type" : "gaussdb-mysql",
      "version" : "8.0"
    },
    "created" : "2022-05-15T11:53:34+0000",
    "updated" : "2022-05-15T11:53:34+0000"
  },
  "parameter_values" : {
    "auto_increment_increment" : "1",
    "auto_increment_offset" : 1,
    "binlog_checksum" : "CRC32",
    "character_set_server" : "utf8",
    "connect_timeout" : 10,
    "default_authentication_plugin" : "mysql_native_password",
    "default_week_format" : 0,
    "div_precision_increment" : 4,
    "end_markers_in_json" : "OFF",
    "innodb_autoextend_increment" : 64,
    "innodb_autoinc_lock_mode" : 2,
    "innodb_concurrency_tickets" : 5000,
    "innodb_default_row_format" : "DYNAMIC",
    "innodb_flush_log_at_timeout" : 1,
    "innodb_flush_log_at_trx_commit" : 1,
    "innodb_flush_neighbors" : 0,
    "innodb_max_undo_log_size" : 1073741824,
    "innodb_optimize_fulltext_only" : "OFF",
    "innodb_purge_batch_size" : 300,
    "innodb_purge_threads" : 4,
    "innodb_sort_buffer_size" : 1048576,
    "innodb_spin_wait_delay" : 6,
    "innodb_status_output" : "OFF",
    "innodb_status_output_locks" : "OFF",
    "innodb_strict_mode" : "OFF",
    "innodb_sync_array_size" : 1,
    "innodb_sync_spin_loops" : 30,
    "innodb_thread_concurrency" : 0,
    "innodb_thread_sleep_delay" : 10000,
    "interactive_timeout" : 28800,
    "local_infile" : "OFF",
    "lock_wait_timeout" : 31536000,
    "log_queries_not_using_indexes" : "OFF",
    "log_throttle_queries_not_using_indexes" : 0,
    "long_query_time" : 10,
    "low_priority_updates" : "OFF",
    "max_connect_errors" : 100,
    "max_error_count" : 1024,
    "max_prepared_stmt_count" : 16382,
    "max_sp_recursion_depth" : 0,
    "max_user_connections" : 0,
    "max_write_lock_count" : 102400,
    "net_buffer_length" : 16384,
    "net_read_timeout" : 30,
    "net_retry_count" : 10,
    "net_write_timeout" : 60,
    "password_history" : 0,
    "password_require_current" : "OFF",
    "password_reuse_interval" : 0,
    "performance_schema" : "OFF",
    "profiling_history_size" : 15,
    "query_prealloc_size" : 8192,
    "read_buffer_size" : 131072,
    "read_rnd_buffer_size" : 262144,
    "show_old_temporals" : "OFF",
    "skip_name_resolve" : "ON",
    "slow_launch_time" : 2,
    "sql_mode" : null,
    "table_open_cache" : 8192,
    "table_open_cache_instances" : 16,
    "thread_cache_size" : 1024,
    "thread_stack" : 286720,
    "transaction_isolation" : "REPEATABLE-READ",
    "updatable_views_with_limit" : "YES",
    "wait_timeout" : 28800,
    "temptable_max_mmap" : 1073741824,
    "default_password_lifetime" : 0,
    "max_allowed_packet" : 1073741824,
    "binlog_expire_logs_seconds" : 3600,
    "max_binlog_cache_size" : 18446744073709547520,
    "binlog_cache_size" : 32768,
    "group_concat_max_len" : 1024,
    "max_binlog_size" : 67108864,
    "log_bin_trust_function_creators" : "ON",
    "explicit_defaults_for_timestamp" : "ON",
    "threadpool_stall_limit" : 50,
    "time_zone" : "SYSTEM",
    "rds_warn_max_binlog_cache_size" : 18446744073709547520,
    "default_collation_for_utf8mb4" : "utf8mb4_0900_ai_ci",
    "idle_transaction_timeout" : 0,
    "idle_readonly_transaction_timeout" : 0,
    "idle_write_transaction_timeout" : 0,
    "block_encryption_mode" : "aes-256-cbc",
    "innodb_lock_wait_timeout" : 50,
    "collation_server" : "utf8_general_ci",
    "innodb_read_ahead_threshold" : 56,
    "innodb_random_read_ahead" : "OFF",
    "eq_range_index_dive_limit" : 10,
    "sort_buffer_size" : 1048576,
    "join_buffer_size" : 524288,
    "range_optimizer_max_mem_size" : 16777216,
    "strict_status_check_RTO_time" : 30,
    "long_trx_decision_time" : 300,
    "mount_vip_when_failover" : "ON",
    "force_parallel_execute" : "OFF",
    "parallel_cost_threshold" : 1000,
    "parallel_default_dop" : 4,
    "parallel_max_threads" : 64,
    "parallel_memory_limit" : 104857600,
    "parallel_queue_timeout" : 0,
    "threadpool_oversubscribe" : 3,
    "binlog_gtid_simple_recovery" : "ON",
    "log_slave_updates" : "ON",
    "binlog_rows_query_log_events" : "OFF",
    "log-bin" : "ON",
    "gtid_mode" : "ON",
    "enforce_gtid_consistency" : "ON",
    "innodb_online_alter_log_max_size" : 134217728,
    "rds_sql_tracer_max_record_size" : 4096,
    "innodb_parallel_select_count" : "ON",
    "max_execution_time" : 0,
    "rds_sqlfilter_case_sensitive" : "OFF",
    "strict_status_check" : "ON",
    "rds_ddl_lock_wait_timeout" : 31536000
  }
}

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

    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();
        ShowGaussMySqlConfigurationRequest request = new ShowGaussMySqlConfigurationRequest();
        request.withConfigurationId("{configuration_id}");
        try {
            ShowGaussMySqlConfigurationResponse response = client.showGaussMySqlConfiguration(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 = ShowGaussMySqlConfigurationRequest()
        request.configuration_id = "{configuration_id}"
        response = client.show_gauss_my_sql_configuration(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.ShowGaussMySqlConfigurationRequest{}
	request.ConfigurationId = "{configuration_id}"
	response, err := client.ShowGaussMySqlConfiguration(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.

错误码

请参见错误码

相关文档