Updated on 2024-08-28 GMT+08:00

Creating a Parameter Template

Function

This API is used to create a parameter template and configure the name, description, DB engine, and parameter values in the parameter template.

  • Before calling an API, you need to understand the API in Authentication.

Constraints

  • The following DB engines are supported: MySQL, PostgreSQL, and Microsoft SQL Server.
  • The new parameter template cannot have the same name as any existing parameter template.

URI

  • URI format

    POST /v3/{project_id}/configurations

  • Parameter description
    Table 1 Parameter description

    Name

    Mandatory

    Description

    project_id

    Yes

    Project ID of a tenant in a region.

    For details about how to obtain the project ID, see Obtaining a Project ID.

Request

Table 2 Parameter description

Name

Mandatory

Type

Description

name

Yes

String

Specifies the parameter template name. It contains a maximum of 64 characters and can contain only uppercase letters, lowercase letters, digits, hyphens (-), underscores (_), and periods (.).

datastore

Yes

Object

Specifies the database object.

For details, see Table 3.

description

No

String

Specifies the parameter template description. It contains a maximum of 256 characters and cannot contain the following special characters: >!<"&'= Its value is left blank by default.

values

No

Map<String,String>

Specifies the parameter values defined by users based on the default parameter templates. By default, the parameter values are not changed.

  • key: parameter name, for example, div_precision_increment or connect_timeout. If this parameter is not specified, no parameter value is to be changed.
  • value: parameter value, for example, 6 or 20. If key is not empty, the parameter value cannot be empty, either.
Table 3 datastore field data structure description

Name

Mandatory

Type

Description

type

Yes

String

Specifies the DB engine. Its value can be any of the following and is case-insensitive:

  • MySQL
  • PostgreSQL
  • SQLServer

version

Yes

String

Specifies the database version. For details, see Constraints. Example values:
  • MySQL: 5.7
  • PostgreSQL: 12
  • Microsoft SQL Server: 2014_SE

Example Request

Create a parameter template named configuration_test.

POST https://{endpoint}/v3/0483b6b16e954cb88930a360d2c4e663/configurations

{
	"name": "configuration_test",
	"description": "configuration_test",
	"values": {
                "div_precision_increment": "6",
                "connect_timeout": "20"
	},
	"datastore": {
		"type": "mysql",
		"version": "5.7"
	}
}

Response

  • Normal response
    Table 4 Parameter description

    Name

    Type

    Description

    configuration

    Object

    Indicates the parameter template information.

    For details, see Table 5.

    Table 5 configuration field data structure description

    Name

    Type

    Description

    id

    String

    Indicates the parameter template ID.

    name

    String

    Indicates the parameter template name.

    datastore_version_name

    String

    Indicates the database version name.

    datastore_name

    String

    Indicates the database name.

    description

    String

    Indicates the parameter template description.

    created

    String

    Indicates the creation time in the following format: yyyy-MM-ddTHH:mm:ssZ.

    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.

    updated

    String

    Indicates the update time in the following format: yyyy-MM-ddTHH:mm:ssZ.

    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.

  • Example normal response
    {
    	"configuration": {
    		"id": "463b4b58-d0e8-4e2b-9560-5dea4552fde9",
    		"name": "configuration_test",
    		"datastore_version_name": "5.7",
    		"datastore_name": "mysql",
    		"description": "configuration_test",
    		"created": "2017-04-09T08:27:56+0800",
    		"updated": "2017-04-09T08:27:56+0800"
                    
    	}
    }
  • Abnormal response

    For details, see Abnormal Request Results.

Status Code

Error Code

For details, see Error Codes.