Updating Backend Instances¶
Function¶
This API is used to update the backend instances of a specified VPC channel. During the update, the request parameters overwrite the backend instances of the corresponding cloud server group. If no cloud server group is specified, all cloud server groups are overwritten.
Calling Method¶
For details, see Calling APIs.
URI¶
PUT /v2/{project_id}/apigw/instances/{instance_id}/vpc-channels/{vpc_channel_id}/members
Parameter | Mandatory | Type | Description |
---|---|---|---|
project_id | Yes | String | Project ID. For details about how to obtain it, see Obtaining a Project ID. |
instance_id | Yes | String | Gateway ID, which can be obtained from the gateway information on the APIG console. |
vpc_channel_id | Yes | String | VPC channel ID. |
Request Parameters¶
Parameter | Mandatory | Type | Description |
---|---|---|---|
X-Auth-Token | Yes | String | User token. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is a token. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
members | No | Array of MemberInfo objects | Backend instances. |
member_group_name | No | String | Backend server group to be modified. If this parameter is not specified, all backends defined by members for the VPC channel are modified. If this parameter is specified, only the backend instances in the backend server group defined by members are modified. Input parameters of other backend server groups are ignored. For example, if member_group_name=primary is passed, only backend instances of backend server group 105c6902457144a4820dff8b1ad63331 in members are modified. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
host | No | String | Backend server address. This parameter is required when the member type is IP address. Maximum: 64 |
weight | No | Integer | Weight. The higher the weight is, the more requests a backend service will receive. Minimum: 0 Maximum: 10000 |
is_backup | No | Boolean | Indicates whether the backend service is a standby node. After you enable this function, the backend service serves as a standby node. It works only when all non-standby nodes are faulty. This function is supported only when your gateway has been upgraded to the corresponding version. If your gateway does not support this function, contact technical support. Default: false |
member_group_name | No | String | Backend server group name. The server group facilitates backend service address modification. |
status | No | Integer | Backend server status.
Enumeration values:
|
port | No | Integer | Backend server port. Minimum: 0 Maximum: 65535 |
ecs_id | No | String | Backend server ID. This parameter is required if the backend instance type is ecs. The value can contain 1 to 64 characters, including letters, digits, hyphens (-), and underscores (_). Maximum: 255 |
ecs_name | No | String | Backend server name. This parameter is required if the backend instance type is ecs. The value can contain 1 to 64 characters, including letters, digits, hyphens (-), underscores (_), and periods (.). Maximum: 64 |
Response Parameters¶
Status code: 200
Parameter | Type | Description |
---|---|---|
size | Integer | Length of the returned resource list. |
total | Long | Number of resources that match the query conditions. |
members | Array of VpcMemberInfo objects | Cloud server list. |
Parameter | Type | Description |
---|---|---|
host | String | Backend server address. This parameter is required when the member type is IP address. Maximum: 64 |
weight | Integer | Weight. The higher the weight is, the more requests a backend service will receive. Minimum: 0 Maximum: 10000 |
is_backup | Boolean | Indicates whether the backend service is a standby node. After you enable this function, the backend service serves as a standby node. It works only when all non-standby nodes are faulty. This function is supported only when your gateway has been upgraded to the corresponding version. If your gateway does not support this function, contact technical support. Default: false |
member_group_name | String | Backend server group name. The server group facilitates backend service address modification. |
status | Integer | Backend server status.
Enumeration values:
|
port | Integer | Backend server port. Minimum: 0 Maximum: 65535 |
ecs_id | String | Backend server ID. This parameter is required if the backend instance type is ecs. The value can contain 1 to 64 characters, including letters, digits, hyphens (-), and underscores (_). Maximum: 255 |
ecs_name | String | Backend server name. This parameter is required if the backend instance type is ecs. The value can contain 1 to 64 characters, including letters, digits, hyphens (-), underscores (_), and periods (.). Maximum: 64 |
id | String | Backend instance ID. |
vpc_channel_id | String | VPC channel ID. |
create_time | String | Time when the backend server is added to the VPC channel. |
member_group_id | String | Backend server group ID. |
Status code: 400
Parameter | Type | Description |
---|---|---|
error_code | String | Error code. |
error_msg | String | Error message. |
Status code: 401
Parameter | Type | Description |
---|---|---|
error_code | String | Error code. |
error_msg | String | Error message. |
Status code: 403
Parameter | Type | Description |
---|---|---|
error_code | String | Error code. |
error_msg | String | Error message. |
Status code: 404
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 Requests¶
Updating non-standby backend instances of a VPC channel
{ "member_group_name" : "primary", "members" : [ { "host" : "192.168.2.25", "weight" : 1, "is_backup" : false, "member_group_name" : "primary" } ] }
Updating all backend instances of a VPC channel
{ "members" : [ { "ecs_id" : "1082720c-3c15-409c-9ae3-4983ddfb6a9d", "ecs_name" : "APIGtest02", "weight" : 2 } ] }
Example Responses¶
Status code: 200
OK
Example 1
{ "total" : 1, "size" : 1, "members" : [ { "host" : "192.168.2.25", "weight" : 1, "is_backup" : false, "member_group_name" : "primary", "port" : 22, "status" : 1, "ecs_id" : "192.168.2.25", "ecs_name" : "192.168.2.25", "id" : "683b6807cad54122a6777ad047a6178e", "vpc_channel_id" : "56a7d7358e1b42459c9d730d65b14e59", "create_time" : "2020-07-23T09:13:24Z", "member_group_id" : "631b551cddda40478ef720163a9412ed" } ] }
Example 2
{ "total" : 1, "size" : 1, "members" : [ { "host" : "192.168.0.17", "weight" : 2, "is_backup" : false, "member_group_name" : "primary", "port" : 22, "status" : 1, "ecs_id" : "1082720c-3c15-409c-9ae3-4983ddfb6a9d", "ecs_name" : "APIGtest02", "id" : "5c868f0224084710a1e188b7d3057c52", "vpc_channel_id" : "105c6902457144a4820dff8b1ad63331", "create_time" : "2020-07-23T09:03:53Z", "member_group_id" : "631b551cddda40478ef720163a9412ed" } ] }
Status code: 400
Bad Request
{
"error_code" : "APIG.2001",
"error_msg" : "The request parameters must be specified, parameter name:members"
}
Status code: 401
Unauthorized
{
"error_code" : "APIG.1002",
"error_msg" : "Incorrect token or token resolution failed"
}
Status code: 403
Forbidden
{
"error_code" : "APIG.1005",
"error_msg" : "No permissions to request this method"
}
Status code: 404
Not Found
{
"error_code" : "APIG.3023",
"error_msg" : "The VPC channel does not exist,id:56a7d7358e1b42459c9d730d65b14e59"
}
Status code: 500
Internal Server Error
{
"error_code" : "APIG.9999",
"error_msg" : "System error"
}
Status Codes¶
Status Code | Description |
---|---|
200 | OK |
400 | Bad Request |
401 | Unauthorized |
403 | Forbidden |
404 | Not Found |
500 | Internal Server Error |
Error Codes¶
See Error Codes.