GetTargetStates
Returns the statuses of all targets of the specified backend group in all their availability zones.
- TypeScript
- Python
import { cloudApi, serviceClients, Session } from "@yandex-cloud/nodejs-sdk";
const GetTargetStatesRequest =
cloudApi.apploadbalancer.load_balancer_service.GetTargetStatesRequest;
(async () => {
const authToken = process.env["YC_OAUTH_TOKEN"];
const session = new Session({ oauthToken: authToken });
const client = session.client(serviceClients.LoadBalancerServiceClient);
const result = await client.getTargetStates(
GetTargetStatesRequest.fromPartial({
loadBalancerId: "loadBalancerId",
backendGroupId: "backendGroupId",
targetGroupId: "targetGroupId",
})
);
console.log(result);
})();
import os
import grpc
import yandexcloud
from yandex.cloud.apploadbalancer.v1.load_balancer_service_pb2 import GetTargetStatesRequest
from yandex.cloud.apploadbalancer.v1.load_balancer_service_pb2_grpc import LoadBalancerServiceStub
token = os.getenv("YC_OAUTH_TOKEN")
sdk = yandexcloud.SDK(token=token)
service = sdk.client(LoadBalancerServiceStub)
response = service.GetTargetStates(
GetTargetStatesRequest(
load_balancer_id="loadBalancerId",
backend_group_id="backendGroupId",
target_group_id="targetGroupId",
)
)
print(response)
GetTargetStatesRequest
loadBalancerId
: string
ID of the application load balancer that the backend group is attributed to.
backendGroupId
: string
ID of the backend group that the target group is attributed to.
targetGroupId
: string
ID of the target group to get target states of.
GetTargetStatesResponse
targetStates
: TargetState
Target states of the specified target group.
TargetState
A target state resource.
Status
Supported target statuses.
STATUS_UNSPECIFIED
Supported target statuses.
HEALTHY
All of the health checks specified in [HttpBackend.healthchecks][1] or [GrpcBackend.healthchecks][2] are passed (the number depends on the [HealthCheck.healthy_threshold][3] setting) and the target is ready to receive traffic.
PARTIALLY_HEALTHY
Some of the health checks specified in [HttpBackend.healthchecks][4] or [GrpcBackend.healthchecks][5] failed (the number depends on the [HealthCheck.unhealthy_threshold][6] setting). The target is ready to receive traffic from the load balancer nodes which, based on their health checks, consider the target healthy.
UNHEALTHY
All of the health checks specified in [HttpBackend.healthchecks][7] or [GrpcBackend.healthchecks][8] failed (the number depends on the [HealthCheck.unhealthy_threshold][9] setting) and the target is not receiving traffic.
DRAINING
Target is being deleted and the application load balancer is no longer sending traffic to this target.
TIMEOUT
Supported target statuses.
HealthcheckStatus
Health of the target.
zoneStatuses
: ZoneHealthcheckStatus
Statuses of the target in its availability zones.
ZoneHealthcheckStatus
Health of the target in the availability zone.
zoneId
: string
ID of the availability zone.
status
: Status
Status of the target in the availability zone.
failedActiveHc
: bool
Indicates whether the target has been marked UNHEALTHY
due to failing active health checks,
which determine target statuses as configured in HttpBackend.healthchecks or GrpcBackend.healthchecks.
Currently the only type of health checks is active, as described above. Passive health checks, which determine the health of a target based on its responses to production requests (HTTP 5xx status codes, connection errors etc.), are not implemented yet.
status
: HealthcheckStatus
Health of the target, i.e. its statuses in all availability zones.
target
: Target
Target.
ZoneHealthcheckStatus
Health of the target in the availability zone.
zoneId
: string
ID of the availability zone.
status
: Status
Status of the target in the availability zone.
failedActiveHc
: bool
Indicates whether the target has been marked UNHEALTHY
due to failing active health checks,
which determine target statuses as configured in HttpBackend.healthchecks or GrpcBackend.healthchecks.
Currently the only type of health checks is active, as described above. Passive health checks, which determine the health of a target based on its responses to production requests (HTTP 5xx status codes, connection errors etc.), are not implemented yet.
HealthcheckStatus
Health of the target.
zoneStatuses
: ZoneHealthcheckStatus
Statuses of the target in its availability zones.
Target
A target resource. For details about the concept, see documentation.
One of addressType
Reference to the target. As of now, targets must only be referred to by their IP addresses.
ipAddress
: stringIP address of the target.
subnetId
: string
ID of the subnet that the target is connected to.
privateIpv4Address
: bool
If set, will not require subnet_id
to validate the target.
Instead, the address should belong to one of the following ranges:
10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16
Only one of subnet_id
or private_ipv4_address
should be set.