Updated on 2025-12-09 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.

Constraints

  • 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.

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 Policies 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.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    dds:configuration:create

    write

    -

    -

    dds:param:create

    -

URI

  • URI format

    POST /v3/{project_id}/configurations

  • URI example

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

Table 1 Path parameters

Name

Mandatory

Type

IN

Description

project_id

Yes

string

path

Definition

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

Constraints

N/A

Range

N/A

Default Value

N/A

Request Parameters

Table 2 Request parameters

Name

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

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

Constraints

N/A

Range

N/A

Default Value

N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Definition

Parameter template name.

Constraints

The template name can contain 1 to 64 characters. Only letters (case-sensitive), digits, hyphens (-), underscores (_), and periods (.) are allowed.

Range

N/A

Default Value

N/A

description

No

String

Definition

Parameter template description.

Constraints

The description can consist of up to 256 characters. It cannot contain carriage returns or any of the following special characters: >!<"&'=

Range

N/A

Default Value

The value is left blank by default.

parameter_values

No

Map<String,String>

Definition

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

Constraints

This parameter is mandatory when entity_id is not transferred.

Range

N/A

Default Value

N/A

datastore

No

Object

Definition

Database object. For details, see Table 4.

Constraints

This parameter is mandatory when entity_id is not transferred.

Range

N/A

Default Value

N/A

entity_id

No

String

Definition

Instance ID, group ID, or node ID. You can call the API used for querying instances and details to obtain the value. If you do not have an instance, you can call the API used for creating a DB instance.

If this parameter is specified, the parameter template is created based on the parameter information of the instance, group, or node. The parameter_values and datastore parameters are ignored.

Constraints

N/A

Range

If the instance type is cluster, the value is the ID of the shard or config group, ID of the mongos node, or ID of the read replica.

If the instance type is replica set, the value is the instance ID or ID of the read replica.

If the instance type is single node, the value is the instance ID.

Default Value

N/A

Table 4 Data structure description of the datastore field

Name

Mandatory

Type

Description

node_type

Yes

String

Definition

Node type of parameter template node_type.

Constraints

N/A

Range
  • 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.

Default Value

N/A

version

Yes

String

Definition

Database version.

Constraints

N/A

Range

The value can be 5.0, 4.4, 4.2, 4.0, or 3.4.

Default Value

N/A

Response Parameters

Table 5 Response body parameters

Name

Type

Description

configuration

ParamGroupInfoResult object

Definition

The parameter template list.

Range

N/A

Table 6 configuration field data structure description

Name

Type

Description

id

String

Definition

Parameter template ID.

Range

N/A

name

String

Definition

Parameter template name.

Range

N/A

description

String

Definition

Parameter template description.

Range

N/A

datastore_version

String

Definition

Database version.

Range

N/A

datastore_name

String

Definition

Database type.

Range

N/A

created

String

Definition

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.

Range

N/A

updated

String

Definition

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.

Range

N/A

Example Requests

  • 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" 
      } 
    }
  • Creating a parameter template based on the parameter information of an existing shard or config group
    POST https://{endpoint}/v3/056538411200d4cd2f79c003c7606412/configuration
    
    {    
      "name" : "myparameter_for_shard",  
      "description" : "parameter1", 
      "entity_id" : "9136fd2a9fcd405ea4674276ce36dae8gr02"  
    }
  • Creating a parameter template based on the parameter information of an existing replica set or single node instance
    POST https://{endpoint}/v3/056538411200d4cd2f79c003c7606412/configuration 
       
    {    
      "name" : "myparameter_for_replica",  
      "description" : "parameter1",  
      "entity_id" : "9136fd2a9fcd405ea4674276ce36dae8in02"  
    }
  • Creating a parameter template based on the parameter information of an existing mongos node or read replica
    POST https://{endpoint}/v3/056538411200d4cd2f79c003c7606412/configuration    
    
    {    
      "name" : "myparameter_for_mongos",  
      "description" : "parameter1",  
      "entity_id" : "321fc68d814d498a82d651812ed7c712no02"  
    }

Example Responses

{
  "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.