ListHosts
Lists hosts that belongs to the specified host group.
- TypeScript
- Python
import { cloudApi, serviceClients, Session } from "@yandex-cloud/nodejs-sdk";
const ListHostGroupHostsRequest =
cloudApi.compute.host_group_service.ListHostGroupHostsRequest;
(async () => {
const authToken = process.env["YC_OAUTH_TOKEN"];
const session = new Session({ oauthToken: authToken });
const client = session.client(serviceClients.HostGroupServiceClient);
const result = await client.listHosts(
ListHostGroupHostsRequest.fromPartial({
hostGroupId: "hostGroupId",
// pageSize: 0,
// pageToken: "pageToken"
})
);
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 ListHostGroupHostsRequest
token = os.getenv("YC_OAUTH_TOKEN")
sdk = yandexcloud.SDK(token=token)
service = sdk.client(HostGroupServiceStub)
response = service.ListHosts(
ListHostGroupHostsRequest(
host_group_id="hostGroupId",
# page_size = 0,
# page_token = "pageToken"
)
)
print(response)
ListHostGroupHostsRequest
hostGroupId
: string
ID of the host group to list hosts for. To get the host group ID, use HostGroupService.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 ListHostGroupHostsResponse.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 ListHostGroupHostsResponse.next_page_token returned by a previous list request.
ListHostGroupHostsResponse
hosts
: Host
Lists hosts for the specified host group.
nextPageToken
: string
This token allows you to get the next page of results for list requests. If the number of results is more than ListHostGroupHostsRequest.page_size, use next_page_token as the value for the ListHostGroupHostsRequest.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.
Host
Represents a dedicated host
Status
STATUS_UNSPECIFIED
UP
DOWN
id
: string
ID of the host.
status
: Status
Current status of the host. New instances are unable to start on host in DOWN status.
serverId
: string
ID of the physical server that the host belongs to.
replacement
: Replacement
Set temporarily if maintenance is planned for this host, and a new host was provided as a replacement.
Replacement
hostId
: string
ID of the host which replaces this one.
deadlineAt
: google.protobuf.Timestamp
The date and time when this host will be automatically freed of instances.