# AddNLBTargets - AddNLBTargets

## Overview

add NLB targets






## Definition

### Public Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Action**     | string  | Corresponding API command name, the current API is `AddNLBTargets`.                      | **Yes** |
| **PublicKey**  | string  | The user's public key can be obtained from [Console](https://console.genesissai.com/uaccount/api_manage)                                             | **Yes** |
| **Signature**  | string  | User signature generated based on public key and API command, see [Signature Algorithm](/docs/api/summary/signature.md)  | **Yes** |

### Request Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Region** | string | Region. See [Region and Zone List](/docs/api/summary/regionlist) |**Yes**|
| **ProjectId** | string | Project ID. Leave it blank for the default project. Sub-accounts must fill in. Please refer to the [GetProjectList API](/docs/api/summary/get_project_list) |No|
| **NLBId** | string | ID of the load balancing instance. |**Yes**|
| **ListenerId** | string | The ID of the listener. |**Yes**|
| **Targets.N.ResourceType** | string | The type of service node. Limited enumeration values: "UHost" / "UNI"/"UPM"/"IP", default value: "UHost"; |No|
| **Targets.N.ResourceId** | string | Resource ID of the service node. Must be passed when not of IP type. |No|
| **Targets.N.ResourceName** | string | Resource name of the service node |No|
| **Targets.N.VPCId** | string | The VPC resource ID of the service node. Must be passed when the IP type is used. |No|
| **Targets.N.SubnetId** | string | The resource ID of the service node's subnet. It is required when the IP type is used. |No|
| **Targets.N.ResourceIP** | string | IP of the service node. Must be passed when the IP type is set. |No|
| **Targets.N.Port** | int | Port of the service node |No|
| **Targets.N.Weight** | int | Weight of the service node. Support for updates. |No|
| **Targets.N.Enabled** | boolean | Is the node enabled? |No|
| **Targets.N.Region** | string | Service Node Location |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[[*Target*](#target)] |  |**Yes**|

#### Data Model


#### Target

| Field Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Region** | string | Service Node Location |No|
| **ResourceType** | string | Type of service node |No|
| **ResourceId** | string | Resource ID of the service node. Must be passed when not of IP type. |No|
| **ResourceName** | string | Resource Name of Service Node |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 |No|
| **Weight** | int | The weight of the service node. Support for updates. |No|
| **Enabled** | boolean | Is the service node enabled? |No|
| **Id** | string | Service node identification ID<br />Description:<br />No need to pass when adding a service node<br />Must pass when updating service node attributes |No|
| **State** | string | Health check status of the service node<br />Note:<br />Displayed when describing service node information<br />Limited enumeration values: "Healthy"/"Unhealthy". |No|

## Example

### Request Example
    
```
https://api.genesissai.com/?Action=AddNLBTargets
&Region=cn-zj
&Zone=cn-zj-01
&ProjectId=uxOCbBUU
&NLBId=UnhYzuYf
&ListenerId=IShmtmhn
&Targets=pGKemNMo
&Targets.n.ResourceId=lTXwhUoW
&Targets.n.ResourceName=RSMxnGlA
&Targets.n.VPCId=IvTAXOkH
&Targets.n.SubnetId=XyBZrEjL
&Targets.n.ResourceIP=zsAVZQWG
&Targets.n.Port=thIdtrsC
&Targets.n.Weight=gHrJImio
&Targets.n.Enabled=true
&Targets.n.Region=wHRTiRhi
```

### Response Example
    
```json
{
  "Action": "AddNLBTargetsResponse",
  "RetCode": 0,
  "Targets": [
    {
      "Id": "LMVtHghN",
      "Port": 1,
      "ResourceIP": "kQHmnadz",
      "ResourceId": "aEEHbHSB",
      "ResourceName": "LwwGwBev",
      "ResourceType": "RwgIAUHV",
      "State": "kvujNDos",
      "SubnetId": "PuxrjzqU",
      "VPCId": "WZFfrwoe",
      "Weight": 7
    }
  ]
}
```





