List
Retrieves the list of placement groups in the specified folder.
- TypeScript
- Python
import { cloudApi, serviceClients, Session } from "@yandex-cloud/nodejs-sdk";
const ListPlacementGroupsRequest =
cloudApi.compute.placement_group_service.ListPlacementGroupsRequest;
(async () => {
const authToken = process.env["YC_OAUTH_TOKEN"];
const session = new Session({ oauthToken: authToken });
const client = session.client(serviceClients.PlacementGroupServiceClient);
const result = await client.list(
ListPlacementGroupsRequest.fromPartial({
folderId: "folderId",
// pageSize: 0,
// pageToken: "pageToken",
// filter: "filter",
// orderBy: "orderBy"
})
);
console.log(result);
})();
import os
import grpc
import yandexcloud
from yandex.cloud.compute.v1.placement_group_service_pb2 import ListPlacementGroupsRequest
from yandex.cloud.compute.v1.placement_group_service_pb2_grpc import PlacementGroupServiceStub
token = os.getenv("YC_OAUTH_TOKEN")
sdk = yandexcloud.SDK(token=token)
service = sdk.client(PlacementGroupServiceStub)
response = service.List(
ListPlacementGroupsRequest(
folder_id="folderId",
# page_size = 0,
# page_token = "pageToken",
# filter = "filter",
# order_by = "orderBy"
)
)
print(response)
ListPlacementGroupsRequest
folderId
: string
ID of the folder to list placement groups in.
To get the folder ID make a yandex.cloud.resourcemanager.v1.FolderService.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 ListPlacementGroupsResponse.next_page_token that can be used to get the next page of results in subsequent list requests.
pageToken
: string
Page token. To get the next page of results, set page_token to the ListPlacementGroupsResponse.next_page_token returned by a previous list request.
filter
: string
A filter expression that filters resources listed in the response.
The expression consists of one or more conditions united by AND
operator: <condition1> [AND <condition2> [<...> AND <conditionN>]]
.
Each condition has the form <field> <operator> <value>
, where:
<field>
is the field name. Currently you can use filtering only on the limited number of fields.<operator>
is a logical operator, one of=
,!=
,IN
,NOT IN
.<value>
represents a value. String values should be written in double ("
) or single ('
) quotes. C-style escape sequences are supported (\"
turns to"
,\'
to'
,\\
to backslash).
orderBy
: string
By which column the listing should be ordered and in which direction, format is "createdAt desc". "id asc" if omitted. The default sorting order is ascending
ListPlacementGroupsResponse
placementGroups
: PlacementGroup
Lists placement groups in the specified folder.
nextPageToken
: string
Token for getting the next page of the list. If the number of results is greater than
the specified ListPlacementGroupsRequest.page_size, use next_page_token
as the value
for the ListPlacementGroupsRequest.page_token parameter in the next list request.
Each subsequent page will have its own next_page_token
to continue paging through the results.
PlacementGroup
id
: string
ID of the placement group. Generated at creation time.
folderId
: string
ID of the folder that the placement group belongs to.
createdAt
: google.protobuf.Timestamp
Creation timestamp.
name
: string
Name of the placement group. The name is unique within the folder.
description
: string
Description of the placement group. 0-256 characters long.
labels
: string
Placement group labels as key:value
pairs.
One of placementStrategy
Placement strategy. To specify a placement strategy, send the corresponding field containing approriate structure.
spreadPlacementStrategy
: SpreadPlacementStrategyAnti-affinity placement strategy (`spread`). Instances are distributed
over distinct failure domains.
partitionPlacementStrategy
: PartitionPlacementStrategy
SpreadPlacementStrategy
This is an empty structure that must be passed to explicitly specify the required placement strategy.