List
Retrieves the list of host groups in the specified folder.
- TypeScript
- Python
import { cloudApi, serviceClients, Session } from "@yandex-cloud/nodejs-sdk";
const ListHostGroupsRequest =
cloudApi.compute.host_group_service.ListHostGroupsRequest;
(async () => {
const authToken = process.env["YC_OAUTH_TOKEN"];
const session = new Session({ oauthToken: authToken });
const client = session.client(serviceClients.HostGroupServiceClient);
const result = await client.list(
ListHostGroupsRequest.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.host_group_service_pb2_grpc import HostGroupServiceStub
from yandex.cloud.compute.v1.host_group_service_pb2 import ListHostGroupsRequest
token = os.getenv("YC_OAUTH_TOKEN")
sdk = yandexcloud.SDK(token=token)
service = sdk.client(HostGroupServiceStub)
response = service.List(
ListHostGroupsRequest(
folder_id="folderId",
# page_size = 0,
# page_token = "pageToken",
# filter = "filter",
# order_by = "orderBy"
)
)
print(response)
ListHostGroupsRequest
folderId
: string
ID of the folder to list host groups in. To get the folder ID, use 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 ListHostGroupsResponse.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 ListHostGroupsResponse.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
ListHostGroupsResponse
hostGroups
: HostGroup
Lists host groups for the specified folder.
nextPageToken
: string
This token allows you to get the next page of results for list requests. If the number of results is larger than ListHostGroupsRequest.page_size, use next_page_token as the value for the ListHostGroupsRequest.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.
HostGroup
Represents group of dedicated hosts
Status
STATUS_UNSPECIFIED
CREATING
READY
UPDATING
DELETING
id
: string
ID of the group.
folderId
: string
ID of the folder that the group belongs to.
createdAt
: google.protobuf.Timestamp
Creation timestamp in RFC3339 text format.
name
: string
Name of the group. The name is unique within the folder.
description
: string
Description of the group.
labels
: string
Resource labels as key:value
pairs.
zoneId
: string
Availability zone where all dedicated hosts are allocated.
status
: Status
Status of the group.
typeId
: string
ID of host type. Resources provided by each host of the group.
maintenancePolicy
: MaintenancePolicy
Behaviour on maintenance events.
scalePolicy
: ScalePolicy
Scale policy. Only fixed number of hosts are supported at this moment.
ScalePolicy
FixedScale
size
: int64
One of scaleType
fixedScale
: FixedScale