List
Retrieves the list of NetworkLoadBalancer resources in the specified folder.
- TypeScript
- Python
import { cloudApi, serviceClients, Session } from "@yandex-cloud/nodejs-sdk";
const ListNetworkLoadBalancersRequest =
cloudApi.loadbalancer.network_load_balancer_service
.ListNetworkLoadBalancersRequest;
(async () => {
const authToken = process.env["YC_OAUTH_TOKEN"];
const session = new Session({ oauthToken: authToken });
const client = session.client(
serviceClients.NetworkLoadBalancerServiceClient
);
const result = await client.list(
ListNetworkLoadBalancersRequest.fromPartial({
folderId: "folderId",
// pageSize: 0,
// pageToken: "pageToken",
// filter: "filter"
})
);
console.log(result);
})();
import os
import grpc
import yandexcloud
from yandex.cloud.loadbalancer.v1.network_load_balancer_service_pb2 import (
ListNetworkLoadBalancersRequest,
)
from yandex.cloud.loadbalancer.v1.network_load_balancer_service_pb2_grpc import (
NetworkLoadBalancerServiceStub,
)
token = os.getenv("YC_OAUTH_TOKEN")
sdk = yandexcloud.SDK(token=token)
service = sdk.client(NetworkLoadBalancerServiceStub)
response = service.List(
ListNetworkLoadBalancersRequest(
folder_id="folderId",
# page_size = 0,
# page_token = "pageToken",
# filter = "filter"
)
)
print(response)
ListNetworkLoadBalancersRequest
folderId
: string
ID of the folder that the network load balancer belongs to. To get the folder ID, use a NetworkLoadBalancerService.List request.
pageSize
: int64
The maximum number of results per page to return. If the number of available results is larger than page_size, the service returns a ResponseMessage.next_page_token that can be used to get the next page of results in subsequent list requests. Default value: 100.
pageToken
: string
Page token. To get the next page of results, set page_token to the ListNetworkLoadBalancersResponse.next_page_token returned by a previous list request.
filter
: string
A filter expression that filters resources listed in the response. The expression must specify:
- The field name. Currently you can only filter by the NetworkLoadBalancer.name field.
- An
=
operator. - The value in double quotes (
"
). Must be 3-63 characters long and match the regular expression[a-z][-a-z0-9]{1,61}[a-z0-9]
.
ListNetworkLoadBalancersResponse
networkLoadBalancers
: NetworkLoadBalancer
List of NetworkLoadBalancer resources.
nextPageToken
: string
This token allows you to get the next page of results for list requests. If the number of results is larger than ListNetworkLoadBalancersRequest.page_size, use the next_page_token as the value for the ListNetworkLoadBalancersRequest.page_token query parameter in the next list request. Each subsequent list request will have its own next_page_token to continue paging through the results.
NetworkLoadBalancer
A NetworkLoadBalancer resource. For more information, see Network Load Balancer.
Status
STATUS_UNSPECIFIED
CREATING
Network load balancer is being created.
STARTING
Network load balancer is being started.
ACTIVE
Network load balancer is active and sends traffic to the targets.
STOPPING
Network load balancer is being stopped.
STOPPED
Network load balancer is stopped and doesn't send traffic to the targets.
DELETING
Network load balancer is being deleted.
INACTIVE
The load balancer doesn't have any listeners or target groups, or attached target groups are empty. The load balancer doesn't perform any health checks or send traffic in this state.
Type
TYPE_UNSPECIFIED
EXTERNAL
External network load balancer.
INTERNAL
Internal network load balancer.
SessionAffinity
Type of session affinity. Only 5-tuple affinity is currently available. For more information, see Load Balancer concepts.
SESSION_AFFINITY_UNSPECIFIED
Type of session affinity. Only 5-tuple affinity is currently available. For more information, see Load Balancer concepts.
CLIENT_IP_PORT_PROTO
5-tuple affinity.
id
: string
ID of the network load balancer.
folderId
: string
ID of the folder that the network load balancer belongs to.
createdAt
: google.protobuf.Timestamp
Creation timestamp in RFC3339 text format.
name
: string
Name of the network load balancer. The name is unique within the folder. 3-63 characters long.
description
: string
Optional description of the network load balancer. 0-256 characters long.
labels
: string
Resource labels as key:value
pairs. Maximum of 64 per resource.
regionId
: string
ID of the region that the network load balancer belongs to.
status
: Status
Status of the network load balancer.
type
: Type
Type of the network load balancer. Only external network load balancers are available now.
sessionAffinity
: SessionAffinity
Type of the session affinity. Only 5-tuple affinity is available now.
listeners
: Listener
List of listeners for the network load balancer.
attachedTargetGroups
: AttachedTargetGroup
List of target groups attached to the network load balancer.
deletionProtection
: bool
Specifies if network load balancer protected from deletion.
Listener
A Listener resource. For more information, see Listener
Protocol
Network protocol to use.
PROTOCOL_UNSPECIFIED
Network protocol to use.
TCP
Network protocol to use.
UDP
Network protocol to use.
name
: string
Name of the listener. The name must be unique for each listener on a single load balancer. 3-63 characters long.
address
: string
IP address for the listener.
port
: int64
Port.
protocol
: Protocol
Network protocol for incoming traffic.
targetPort
: int64
Port of a target.
subnetId
: string
ID of the subnet.
ipVersion
: IpVersion
IP version of the external address.
AttachedTargetGroup
An AttachedTargetGroup resource. For more information, see Targets and groups.
targetGroupId
: string
ID of the target group.
healthChecks
: HealthCheck
A health check to perform on the target group. For now we accept only one health check per AttachedTargetGroup.
HealthCheck
A HealthCheck resource. For more information, see Health check.
TcpOptions
Configuration option for a TCP health check.
port
: int64
Port to use for TCP health checks.
HttpOptions
Configuration option for an HTTP health check.
port
: int64
Port to use for HTTP health checks.
path
: string
URL path to set for health checking requests for every target in the target group.
For example /ping
. The default path is /
.
name
: string
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.
interval
: google.protobuf.Duration
The interval between health checks. The default is 2 seconds.
timeout
: google.protobuf.Duration
Timeout for a target to return a response for the health check. The default is 1 second.
unhealthyThreshold
: int64
Number of failed health checks before changing the status to UNHEALTHY
. The default is 2.
healthyThreshold
: int64
Number of successful health checks required in order to set the HEALTHY
status for the target. The default is 2.
One of options
Protocol to use for the health check. Either TCP or HTTP.
tcpOptions
: TcpOptionsOptions for TCP health check.
httpOptions
: HttpOptionsOptions for HTTP health check.
TcpOptions
Configuration option for a TCP health check.
port
: int64
Port to use for TCP health checks.
HttpOptions
Configuration option for an HTTP health check.
port
: int64
Port to use for HTTP health checks.
path
: string
URL path to set for health checking requests for every target in the target group.
For example /ping
. The default path is /
.