Skip to main content

GetTargetStates

Gets states of target resources in the attached target group.

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.NetworkLoadBalancerServiceClient
);

const result = await client.getTargetStates(
GetTargetStatesRequest.fromPartial({
loadBalancerId: "loadBalancerId",
backendGroupId: "backendGroupId",
targetGroupId: "targetGroupId",
})
);
console.log(result);
})();

GetTargetStatesRequest​

networkLoadBalancerId : string​

ID of the NetworkLoadBalancer resource with an attached target group.

targetGroupId : string​

ID of the target group to get states of resources from.

GetTargetStatesResponse​

targetStates : TargetState​

List of states of targets within the target group that is specified in the GetTargetStatesRequest message.

TargetState​

State of the target that was returned after the last health check.

Status​

Status of the target.

  • STATUS_UNSPECIFIED

    Status of the target.

  • INITIAL

    The network load balancer is setting up health checks for this target.

  • HEALTHY

    Health check passed and the target is ready to receive traffic.

  • UNHEALTHY

    Health check failed and the target is not receiving traffic.

  • DRAINING

    Target is being deleted and the network load balancer is no longer sending traffic to this target.

  • INACTIVE

    The network load balancer is stopped and not performing health checks on this target.

subnetId : string​

ID of the subnet that the target is connected to.

address : string​

IP address of the target.

status : Status​

Status of the target.