List
Retrieves the list of TargetGroup resources in the specified folder.
- TypeScript
- Python
import { cloudApi, serviceClients, Session } from "@yandex-cloud/nodejs-sdk";
const ListTargetGroupsRequest =
cloudApi.apploadbalancer.target_group_service.ListTargetGroupsRequest;
(async () => {
const authToken = process.env["YC_OAUTH_TOKEN"];
const session = new Session({ oauthToken: authToken });
const client = session.client(serviceClients.TargetGroupServiceClient);
const result = await client.list(
ListTargetGroupsRequest.fromPartial({
folderId: "folderId",
// pageSize: 0,
// pageToken: "pageToken",
// filter: "filter"
})
);
console.log(result);
})();
import os
import grpc
import yandexcloud
from yandex.cloud.apploadbalancer.v1.target_group_service_pb2 import ListTargetGroupsRequest
from yandex.cloud.apploadbalancer.v1.target_group_service_pb2_grpc import TargetGroupServiceStub
token = os.getenv("YC_OAUTH_TOKEN")
sdk = yandexcloud.SDK(token=token)
service = sdk.client(TargetGroupServiceStub)
response = service.List(
ListTargetGroupsRequest(
folder_id="folderId",
# page_size = 0,
# page_token = "pageToken",
# filter = "filter"
)
)
print(response)
ListTargetGroupsRequest
folderId
: string
ID of the folder to list target groups in. To get the folder ID, use a TargetGroupService.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 ListTargetGroupsResponse.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 ListTargetGroupsResponse.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 TargetGroup.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]
.
ListTargetGroupsResponse
targetGroups
: TargetGroup
List of TargetGroup 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 ListTargetGroupsRequest.page_size, use the next_page_token as the value for the ListTargetGroupsRequest.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.
TargetGroup
A TargetGroup resource. For more information, see Target groups and resources.
id
: string
Output only. ID of the target group.
folderId
: string
ID of the folder that the target group belongs to.
createdAt
: google.protobuf.Timestamp
Output only. Creation timestamp in RFC3339 text format.
name
: string
Name of the target group. The name is unique within the folder. 3-63 characters long.
description
: string
Description of the target group. 0-256 characters long.
labels
: string
Resource labels as key:value
pairs. Maximum of 64 per resource.
regionId
: string
ID of the region where the target group resides.
targets
: Target
A list of targets in the target group.
Target
A Target resource. For more information, see Target groups and resources.
subnetId
: string
ID of the subnet that targets are connected to. All targets in the target group must be connected to the same subnet within a single availability zone.
address
: string
IP address of the target.