Method attachTargetGroup

Attaches a target group to the specified network load balancer.

HTTP request

POST https://load-balancer.api.cloud.yandex.net/load-balancer/v1/networkLoadBalancers/{networkLoadBalancerId}:attachTargetGroup

Path parameters

Parameter Description
networkLoadBalancerId Required. ID of the network load balancer to attach the target group to. To get the network load balancer ID, use a list request. The maximum string length in characters is 50.

Body parameters

{
  "attachedTargetGroup": {
    "targetGroupId": "string",
    "healthChecks": [
      {
        "name": "string",
        "interval": "string",
        "timeout": "string",
        "unhealthyThreshold": "string",
        "healthyThreshold": "string",

        // `attachedTargetGroup.healthChecks[]` includes only one of the fields `tcpOptions`, `httpOptions`
        "tcpOptions": {
          "port": "string"
        },
        "httpOptions": {
          "port": "string",
          "path": "string"
        },
        // end of the list of possible fields`attachedTargetGroup.healthChecks[]`

      }
    ]
  }
}
Field Description
attachedTargetGroup object

Required. ID of the attached target group to attach to the network load balancer. To get the network load balancer ID, use a list request.

An AttachedTargetGroup resource. For more information, see Targets and groups.

attachedTargetGroup.
targetGroupId
string

Required. ID of the target group.

The maximum string length in characters is 50.

attachedTargetGroup.
healthChecks[]
object

A HealthCheck resource. For more information, see Health check.

attachedTargetGroup.
healthChecks[].
name
string

Required. Name of the health check. The name must be unique for each target group that attached to a single load balancer. 3-63 characters long.

Value must match the regular expression |[a-z][-a-z0-9]{1,61}[a-z0-9].

attachedTargetGroup.
healthChecks[].
interval
string

The interval between health checks. The default is 2 seconds.

attachedTargetGroup.
healthChecks[].
timeout
string

Timeout for a target to return a response for the health check. The default is 1 second.

attachedTargetGroup.
healthChecks[].
unhealthyThreshold
string (int64)

Number of failed health checks before changing the status to UNHEALTHY. The default is 2.

Acceptable values are 2 to 10, inclusive.

attachedTargetGroup.
healthChecks[].
healthyThreshold
string (int64)

Number of successful health checks required in order to set the HEALTHY status for the target. The default is 2.

Acceptable values are 2 to 10, inclusive.

attachedTargetGroup.
healthChecks[].
tcpOptions
object
Options for TCP health check.
attachedTargetGroup.healthChecks[] includes only one of the fields tcpOptions, httpOptions

Configuration option for a TCP health check.

attachedTargetGroup.
healthChecks[].
tcpOptions.
port
string (int64)

Port to use for TCP health checks.

Acceptable values are 1 to 32767, inclusive.

attachedTargetGroup.
healthChecks[].
httpOptions
object
Options for HTTP health check.
attachedTargetGroup.healthChecks[] includes only one of the fields tcpOptions, httpOptions

Configuration option for an HTTP health check.

attachedTargetGroup.
healthChecks[].
httpOptions.
port
string (int64)

Port to use for HTTP health checks.

Acceptable values are 1 to 32767, inclusive.

attachedTargetGroup.
healthChecks[].
httpOptions.
path
string

URL path to set for health checking requests for every target in the target group. For example /ping. The default path is /.

Response

HTTP Code: 200 - OK

{
  "id": "string",
  "description": "string",
  "createdAt": "string",
  "createdBy": "string",
  "modifiedAt": "string",
  "done": true,
  "metadata": "object",

  //  includes only one of the fields `error`, `response`
  "error": {
    "code": "integer",
    "message": "string",
    "details": [
      "object"
    ]
  },
  "response": "object",
  // end of the list of possible fields

}

An Operation resource. For more information, see Operation.

Field Description
id string

ID of the operation.

description string

Description of the operation. 0-256 characters long.

createdAt string (date-time)

Creation timestamp.

String in RFC3339 text format.

createdBy string

ID of the user or service account who initiated the operation.

modifiedAt string (date-time)

The time when the Operation resource was last modified.

String in RFC3339 text format.

done boolean (boolean)

If the value is false, it means the operation is still in progress. If true, the operation is completed, and either error or response is available.

metadata object

Service-specific metadata associated with the operation. It typically contains the ID of the target resource that the operation is performed on. Any method that returns a long-running operation should document the metadata type, if any.

error object
The error result of the operation in case of failure or cancellation.
includes only one of the fields error, response

The error result of the operation in case of failure or cancellation.

error.
code
integer (int32)

Error code. An enum value of google.rpc.Code.

error.
message
string

An error message.

error.
details[]
object

A list of messages that carry the error details.

response object
includes only one of the fields error, response

The normal response of the operation in case of success. If the original method returns no data on success, such as Delete, the response is google.protobuf.Empty. If the original method is the standard Create/Update, the response should be the target resource of the operation. Any method that returns a long-running operation should document the response type, if any.