Docs
api
Load Balance(ULB)
AddTargets

Add backend service nodes for application load balancing - AddTargets

Overview

Add backend service nodes to the application load balancer listener

Definition

Public Parameters

Parameter NameTypeDescription InformationRequired
ActionstringCorresponding API command name, the current API is AddTargets.Yes
PublicKeystringThe user’s public key can be obtained from ConsoleYes
SignaturestringUser signature generated based on public key and API command, see Signature AlgorithmYes

Request Parameters

Parameter NameTypeDescription InformationRequired
RegionstringRegion. See List of Regions and Availability ZonesYes
ProjectIdstringProject ID. If not filled in, the default project is used, sub-accounts must be filled in. Please refer to the GetProjectList interface.Yes
LoadBalancerIdstringID of the Load Balancing InstanceYes
ListenerIdstringListener’s IDYes
Targets.N.ResourceTypestringType 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.ResourceIdstringResource ID of the service node. Must be passed when not of IP type.No
Targets.N.VPCIdstringThe VPC resource ID of the service node. It is required when the IP type is passed.No
Targets.N.SubnetIdstringThe subnet resource ID of the service node. Must be passed when the IP type is used.No
Targets.N.ResourceIPstringIP of the service node. Must be provided when the IP type is set.No
Targets.N.PortintPort of the service node. Limited value range: [1-65535], default value is 80No
Targets.N.WeightintThe weight of the service node. Limited value range: [1-100], default value is 1; only effective in weighted round-robin algorithm.No
Targets.N.EnabledbooleanIs the service node enabled? The default value is true.No
Targets.N.IsBackupbooleanIs the service node a backup node? The default value is false.No

Response Field

Field NameTypeDescription InformationRequired
RetCodeintReturn status code. If it is 0, it means successful return. If it is not 0, it means failure.Yes
ActionstringOperation command name.Yes
MessagestringReturns an error message, providing detailed description when RetCode is non-zero.No
Targetsarray[TargetSet]Service Node InformationNo

Data Model

TargetSet

Field NameTypeDescription InformationRequired
ResourceTypestringType 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
ResourceIdstringResource ID of the service node. Must be passed when not of IP type.No
VPCIdstringThe VPC resource ID of the service node. It is required when the IP type is passed.No
SubnetIdstringThe subnet resource ID of the service node. Must be passed when the IP type is used.No
ResourceIPstringIP of the service node. Must be provided when the IP type is set.No
PortintPort of the service node. Limited value range: [1-65535]; Default value: 80No
WeightintThe weight of the service node. Limited value range: [1-100]; Only effective when using the weighted round-robin algorithm; Default value: 1.No
EnabledbooleanIs the service node enabled? Default value: trueNo
IsBackupbooleanIs the service node a backup node. Default value: falseNo
IdstringIdentification ID of the service node.No
StatestringHealth 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
    }
  ]
}