Add backend service nodes for application load balancing - AddTargets
Overview
Add backend service nodes to the application load balancer listener
Definition
Public Parameters
Parameter Name | Type | Description Information | Required |
---|---|---|---|
Action | string | Corresponding API command name, the current API is AddTargets . | Yes |
PublicKey | string | The user’s public key can be obtained from Console | Yes |
Signature | string | User signature generated based on public key and API command, see Signature Algorithm | Yes |
Request Parameters
Parameter Name | Type | Description Information | Required |
---|---|---|---|
Region | string | Region. See List of Regions and Availability Zones | Yes |
ProjectId | string | Project ID. If not filled in, the default project is used, sub-accounts must be filled in. Please refer to the GetProjectList interface. | Yes |
LoadBalancerId | string | ID of the Load Balancing Instance | Yes |
ListenerId | string | Listener’s ID | Yes |
Targets.N.ResourceType | string | Type of service node. Limited enumeration values: “UHost” / “UNI”/“UPM”/“IP”, default value: “UHost”; For non-IP types, if the resource has multiple IPs, only the main IP can be added; For non-IP types, related resource information will be displayed when shown, while IP types only display IP information. When the related resource is deleted, non-IP types will remove the related resource from the load balancer, but this logic is not guaranteed for IP types. | No |
Targets.N.ResourceId | string | Resource ID of the service node. Must be passed when not of IP type. | No |
Targets.N.VPCId | string | The VPC resource ID of the service node. It is required when the IP type is passed. | No |
Targets.N.SubnetId | string | The subnet resource ID of the service node. Must be passed when the IP type is used. | No |
Targets.N.ResourceIP | string | IP of the service node. Must be provided when the IP type is set. | No |
Targets.N.Port | int | Port of the service node. Limited value range: [1-65535], default value is 80 | No |
Targets.N.Weight | int | The weight of the service node. Limited value range: [1-100], default value is 1; only effective in weighted round-robin algorithm. | No |
Targets.N.Enabled | boolean | Is the service node enabled? The default value is true. | No |
Targets.N.IsBackup | boolean | Is the service node a backup node? The default value is false. | No |
Response Field
Field Name | Type | Description Information | Required |
---|---|---|---|
RetCode | int | Return status code. If it is 0, it means successful return. If it is not 0, it means failure. | Yes |
Action | string | Operation command name. | Yes |
Message | string | Returns an error message, providing detailed description when RetCode is non-zero. | No |
Targets | array[TargetSet] | Service Node Information | No |
Data Model
TargetSet
Field Name | Type | Description Information | Required |
---|---|---|---|
ResourceType | string | Type of service node. Limited enumeration values: UHost -> Cloud Host, UNI -> Virtual Network Interface, UPM -> Physical Cloud Host, IP -> IP type; Default value: “UHost”; For non-IP types, if the resource has multiple IPs, only the main IP can be added; For non-IP types, related resource information will be displayed during the presentation, while IP type only displays IP information. When the related resource is deleted, the non-IP type will remove the related resources from the lb, but the IP type does not guarantee this logic. | No |
ResourceId | string | Resource ID of the service node. Must be passed when not of IP type. | No |
VPCId | string | The VPC resource ID of the service node. It is required when the IP type is passed. | No |
SubnetId | string | The subnet resource ID of the service node. Must be passed when the IP type is used. | No |
ResourceIP | string | IP of the service node. Must be provided when the IP type is set. | No |
Port | int | Port of the service node. Limited value range: [1-65535]; Default value: 80 | No |
Weight | int | The weight of the service node. Limited value range: [1-100]; Only effective when using the weighted round-robin algorithm; Default value: 1. | No |
Enabled | boolean | Is the service node enabled? Default value: true | No |
IsBackup | boolean | Is the service node a backup node. Default value: false | No |
Id | string | Identification ID of the service node. | No |
State | string | Health check status of the service node. Limited enumeration values: Healthy -> Healthy, Unhealthy -> Unhealthy. | No |
Example
Request Example
https://api.dezai.com/?Action=AddTargets
&Region=cn-zj
&Zone=cn-zj-01
&ProjectId=tSIXzLcj
&LoadBalancerId=hWQXJvSD
&ListenerId=dxivFPkq
&Targets.n.ResourceType=rpCZGTgI
&Targets.n.ResourceId=HgfbDNGq
&Targets.n.VPCId=XvDOHmPd
&Targets.n.SubnetId=QQocJvAk
&Targets.n.ResourceIP=pbbYxWoB
&Targets.n.Port=2
&Targets.n.Weight=9
&Targets.n.Enabled=false
&Targets.n.IsBackup=false
&Targets.n.Id=OuqVYQov
Response Example
{
"Action": "AddTargetsResponse",
"RetCode": 0,
"Targets": [
{
"Enabled": true,
"Id": "aaRSmiMG",
"IsBackup": true,
"Port": 5,
"ResourceIP": "HOedmGiS",
"ResourceId": "hyLxeaCA",
"ResourceType": "xSewdOoe",
"State": "UBlOVPSH",
"SubnetId": "FllAtFNO",
"VPCId": "BdPHyavQ",
"Weight": 7
}
]
}