Creating a Proxy Instance
Function
This API is used to create a proxy instance in ELB mode. Before calling this API:
- Learn how to authenticate it.
- Obtain the required region and endpoint.
URI
POST /v3/{project_id}/instances/{instance_id}/proxy
| 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 |
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 |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| flavor_ref | Yes | String | Definition Specification code of the proxy instance. Constraints N/A Range To obtain this value, see the spec_code field returned in Querying Proxy Instance Specifications. Default Value N/A |
| node_num | Yes | Integer | Definition Number of proxy instance nodes. Constraints N/A Range 2–16 Default Value N/A |
| proxy_name | No | String | Definition Proxy instance name. Constraints Instances of the same type can have the same name under the same tenant. Range The name must start with a letter and consist of 4 to 64 characters. Only letters (case-sensitive), digits, hyphens (-), and underscores (_) are allowed. Default Value N/A |
| proxy_mode | No | String | Definition Proxy instance type. Constraints N/A Range Default Value readwrite |
| route_mode | No | Integer | Definition Routing policy of the proxy instance. Constraints N/A Range
Default Value 0 |
| nodes_read_weight | No | Array of NodesWeight objects | Definition Read weights of database nodes. Constraints If proxy_mode is set to readonly, you can only assign weights for read replicas. |
| subnet_id | No | String | Definition Subnet ID. You can obtain the value with either of the following methods:
Constraints N/A Range N/A Default Value N/A |
| new_node_auto_add_status | No | String | Definition Whether new nodes are automatically associated with proxy instances. Constraints N/A Range
Default Value OFF |
| new_node_weight | No | Integer | Definition Read weight of a new node. Constraints This parameter is mandatory when new_node_auto_add_status is set to ON. Range
Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| id | No | String | Definition Database node ID. Constraints The node ID must belong to the corresponding instance. Range The value contains 36 characters, starting with a UUID and ending with no07. Only letters and digits are allowed. Default Value N/A |
| weight | No | Integer | Definition Node weight. Constraints N/A Range |
Response Parameters
Status code: 201
| Parameter | Type | Description |
|---|---|---|
| job_id | String | Definition Task ID. 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
Creating a proxy instance (The proxy instance specifications are 2 vCPUs and 8 GB memory, and the proxy mode is read-only)
POST https://{endpoint}/v3/0483b6b16e954cb88930a360d2c4e663/instances/43e4feaab48f11e89039fa163ebaa7e4br01/proxy
{
"flavor_ref" : "gaussdb.proxy.large.x86.2",
"node_num" : 2,
"proxy_name" : "gaussdb-proxy",
"proxy_mode" : "readonly",
"route_mode" : 0,
"nodes_read_weight" : [ {
"id" : "45021bf73a244312a3f2af95092feeecno07",
"weight" : 50
}, {
"id" : "d78a65690cea4af5ad14585e110ff89bno07",
"weight" : 400
} ],
"subnet_id" : "6991d82d-9166-4aff-a1fa-d2a8748b7084"
} Example Response
Status code: 201
Success.
{
"job_id" : "04efe8e2-9255-44ae-a98b-d87cae411890"
} Status Code
For details, see Status Codes.
Error Code
For details, see Error Codes.