Updated on 2024-04-02 GMT+08:00

Creating a Parameter Template

Description

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

Restrictions

  • This API applies only to DDS Community Edition.
  • The name of the custom parameter template is case-sensitive and must be different from the name of an existing or a default parameter template.
  • The value of parameter_values in the parameter template must be within the default value range of the specified database version. For details about the range of parameter values, see Editing a Parameter Template in Document Database Service User Guide.

URI

  • URI format

    POST https://{Endpoint}/v3/{project_id}/configurations

  • URI example

    https://dds.ap-southeast-1.myhuaweicloud.com/v3/056538411200d4cd2f79c003c7606412/configurations

Table 1 Request parameters

Name

Type

IN

Mandatory

Description

X-Auth-Token

string

header

Yes

User token obtained from IAM. For details, see Authentication.

project_id

string

path

Yes

Project ID of a tenant in a region. To obtain the project ID, see Obtaining a Project ID.

Requests

  • Parameter description
    Table 2 Request body parameters

    Parameter

    Type

    Mandatory

    Description

    name

    String

    Yes

    Parameter template name.

    Value range: a string of 1 to 64 characters, which can contain only letters, digits, hyphens (-), underscores (_), and periods (.).

    description

    String

    Yes

    Parameter template description. This parameter is left blank by default.

    The description must consist of a maximum of 256 characters and cannot contain the carriage return character or the following special characters: >!<"&'=

    parameter_values

    Map<String,String>

    Yes

    Mapping between parameter names and parameter values. You can customize parameter values based on the parameters in the default parameter template.

    datastore

    Object

    Yes

    Database object.

    For details, see Table 3.

    Table 3 Data structure description of the datastore field

    Name

    Type

    Mandatory

    Description

    node_type

    String

    Yes

    Node type of parameter template node_type. Valid value:
    • mongos: the mongos node type.
    • shard: the shard node type.
    • config: the config node type.
    • replica: the replica set type.
    • readonly: the read replica type of a replica set instance.
    • shard_readonly: the read replica type of a cluster instance.
    • single: the single node type.

    version

    String

    Yes

    Database version. Versions 4.4, 4.2, 4.0, and 3.4 are supported. The value can be 4.4, 4.2, 4.0, or 3.4.

Example Request

Creating a parameter template in which name is set to myparameter, node_type is set to shard, version is set to 3.4, and the maximum number of connections is set to 10
{ 
  "name" : "myparameter", 
  "description" : "parameter1", 
  "datastore" : { 
    "node_type" : "shard", 
    "version" : "3.4" 
  }, 
  "parameter_values" : { 
    "max_connections" : "10" 
  } 
}

Responses

  • Parameter description
    Table 4 Response body parameters

    Name

    Type

    Description

    configuration

    ParamGroupInfoResult object

    The parameter template list.

    Table 5 configuration field data structure description

    Name

    Type

    Description

    id

    String

    Parameter template ID

    name

    String

    Parameter template name

    description

    String

    Parameter template description.

    datastore_version

    String

    Database version.

    datastore_name

    String

    Database type.

    created

    String

    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.

    updated

    String

    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.

  • Response example
    {
      "configuration": {
        "id": "7b4e07852bd54016906e89461b3182cdpr02",
        "name": "myparameter",
        "description": "parameter1",
        "datastore_version": "3.4",
        "datastore_name": "mongodb",
        "created": "2018-09-19T02:54:21",
        "updated": "2018-09-19T02:54:21"
      }
    }

SDK

Click Document Database Service DDS SDK to download the SDK or view the SDK document. To learn how to install and authenticate an SDK, read the Usage section.

Status Code

For more information, see Status Code.

Error Code

For more information, see Error Code.