Updated on 2022-12-05 GMT+08:00

Adding Backend Servers

Function

This API is used to add cloud servers to a VPC channel.

URI

POST /v2/{project_id}/apic/instances/{instance_id}/vpc-channels/{vpc_channel_id}/members

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain the project ID, see Appendix > Obtaining a Project ID in the ROMA Connect API Reference.

instance_id

Yes

String

Instance ID.

vpc_channel_id

Yes

String

VPC channel ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token, which can be obtained by calling the IAM API (value of X-Subject-Token in the response header).

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

members

Yes

Array of MemberInfo objects

Backend server list.

Table 4 MemberInfo

Parameter

Mandatory

Type

Description

host

No

String

Backend server address.

This parameter is valid when the member type is IP address.

Maximum: 64

weight

No

Integer

Backend server weight.

The higher the weight is, the more requests a cloud server will receive. The weight is only available for the WRR and WLC algorithms.

It is valid only when the VPC channel type is set to 2.

Minimum: 0

Maximum: 100

ecs_id

No

String

Backend server ID.

This parameter is valid only when the backend instance type is instance. 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 valid only when the backend instance type is instance. The value can contain 1 to 64 characters, including letters, digits, hyphens (-), underscores (_), and periods (.).

Maximum: 64

Response Parameters

Status code: 201

Table 5 Response body parameters

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.

Table 6 VpcMemberInfo

Parameter

Type

Description

host

String

Backend server address.

This parameter is valid when the member type is IP address.

Maximum: 64

weight

Integer

Backend server weight.

The higher the weight is, the more requests a cloud server will receive. The weight is only available for the WRR and WLC algorithms.

It is valid only when the VPC channel type is set to 2.

Minimum: 0

Maximum: 100

ecs_id

String

Backend server ID.

This parameter is valid only when the backend instance type is instance. 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 valid only when the backend instance type is instance. The value can contain 1 to 64 characters, including letters, digits, hyphens (-), underscores (_), and periods (.).

Maximum: 64

id

String

Backend instance object ID.

status

Number

Backend server status.

  • 1: valid

vpc_channel_id

String

VPC channel ID.

create_time

String

Time when the backend server is added to the VPC channel.

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 401

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 403

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 404

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 500

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Example Requests

  • Adding a cloud server name to a VPC channel

    {
      "members" : [ {
        "host" : "192.168.2.25",
        "weight" : 1
      } ]
    }
  • Adding a cloud server IP address to a VPC channel

    {
      "members" : [ {
        "ecs_id" : "1082720c-3c15-409c-9ae3-4983ddfb6a9d",
        "ecs_name" : "APIGtest02",
        "weight" : 2
      } ]
    }

Example Responses

Status code: 201

Created

  • Example 1

    {
      "total" : 1,
      "size" : 1,
      "members" : [ {
        "create_time" : "2020-07-23T09:13:24Z",
        "host" : "192.168.2.25",
        "id" : "683b6807cad54122a6777ad047a6178e",
        "status" : 1,
        "vpc_channel_id" : "56a7d7358e1b42459c9d730d65b14e59",
        "weight" : 1
      } ]
    }
  • Example 2

    {
      "total" : 2,
      "size" : 2,
      "members" : [ {
        "create_time" : "2020-07-23T09:03:53Z",
        "host" : "192.168.0.17",
        "id" : "5c868f0224084710a1e188b7d3057c52",
        "ecs_id" : "1082720c-3c15-409c-9ae3-4983ddfb6a9d",
        "ecs_name" : "APIGtest02",
        "status" : 1,
        "vpc_channel_id" : "105c6902457144a4820dff8b1ad63331",
        "weight" : 2
      }, {
        "create_time" : "2020-07-23T07:24:34Z",
        "host" : "192.168.0.39",
        "id" : "33ac0e39d005492eb1f4683e66d1a0d1",
        "ecs_id" : "ebe1104f-1254-4ac6-8ed7-366bec84f36e",
        "ecs_name" : "APIGtest01",
        "status" : 1,
        "vpc_channel_id" : "105c6902457144a4820dff8b1ad63331",
        "weight" : 1
      } ]
    }

Status code: 400

Bad Request

{
  "error_code" : "APIG.2004",
  "error_msg" : "The parameter value is outside the allowable range,parameterName:weight. Please refer to the support documentation"
}

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

201

Created

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

500

Internal Server Error

Error Codes

See Error Codes.