ListHosts
Retrieves a list of hosts for a cluster.
- TypeScript
- Python
import { cloudApi, serviceClients, Session } from "@yandex-cloud/nodejs-sdk";
const ListClusterHostsRequest =
cloudApi.dataproc.cluster_service.ListClusterHostsRequest;
(async () => {
const authToken = process.env["YC_OAUTH_TOKEN"];
const session = new Session({ oauthToken: authToken });
const client = session.client(serviceClients.ClusterServiceClient);
const result = await client.listHosts(
ListClusterHostsRequest.fromPartial({
// clusterId: "clusterId",
// pageSize: 0,
// pageToken: "pageToken",
// filter: "filter"
})
);
console.log(result);
})();
import os
import grpc
import yandexcloud
from yandex.cloud.dataproc.v1.cluster_service_pb2_grpc import ClusterServiceStub
from yandex.cloud.dataproc.v1.cluster_service_pb2 import ListClusterHostsRequest
token = os.getenv("YC_OAUTH_TOKEN")
sdk = yandexcloud.SDK(token=token)
service = sdk.client(ClusterServiceStub)
response = service.ListHosts(
ListClusterHostsRequest(
# cluster_id = "clusterId",
# page_size = 0,
# page_token = "pageToken",
# filter = "filter"
)
)
print(response)
ListClusterHostsRequest
clusterId
: string
ID of the cluster to list hosts for.
To get this ID, make a ClusterService.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 API returns a ListClusterHostsResponse.next_page_token that can be used to get the next page of results in the subsequent ClusterService.ListHosts requests.
pageToken
: string
Page token that can be used to iterate through multiple pages of results.
To get the next page of results, set page_token to the ListClusterHostsResponse.next_page_token returned by the previous ClusterService.ListHosts request.
ListClusterHostsResponse
hosts
: Host
List of hosts in the cluster.
nextPageToken
: string
The token that can be used to get the next page of results.
If the number of results is larger than ListClusterHostsRequest.page_size, use the next_page_token as the value for the ListClusterHostsRequest.page_token in the subsequent ClusterService.ListHosts request to iterate through multiple pages of results.
Each of the subsequent ClusterService.ListHosts requests should use the next_page_token value returned by the previous request to continue paging through the results.
Host
Role
ROLE_UNKNOWN
Role of the host is unknown. Default value.
MASTER
Host is the master.
REPLICA
Host is a replica.
Health
HEALTH_UNKNOWN
Health of the host is unknown. Default value.
ALIVE
Host is performing all its functions normally.
DEAD
Host is inoperable, and cannot perform any of its essential functions.
DEGRADED
Host is degraded, and can perform only some of its essential functions.
READONLY
Host is alive, but in read-only mode.
name
: string
Name of the host.
This name is assigned by the platform at the time of creation. The name is unique across all MDB hosts that exist on the platform, as it defines the FQDN of the host.
clusterId
: string
ID of the cluster the host belongs to.
zoneId
: string
ID of the availability zone where the host resides.
resources
: Resources
Resources allocated to the host.
role
: Role
Role of the host in the cluster. If the field has default value, it is not returned in the response.
health
: Health
Aggregated health of the host. If the field has default value, it is not returned in the response.
services
: Service
List of services provided by the host.
subnetId
: string
ID of the subnet that the host belongs to.
assignPublicIp
: bool
Flag that shows if public IP address is assigned to the host so that the host can be accessed from the internet.
replicationSource
: string
Name of the host to be used as the replication source for cascading replication.
backupPriority
: int64
Host backup priority.
priority
: int64
Host master promotion priority.
Resources
Cluster resource preset.
resourcePresetId
: string
ID of the resource preset that defines available computational resources (vCPU, RAM, etc.) for a cluster host.
All available presets are listed in the documentation.
diskSize
: int64
Volume of the storage (for each cluster host, in bytes).
diskTypeId
: string
Type of the storage.
Possible values:
network-hdd
- standard network storagenetwork-ssd
- fast network storagenetwork-ssd-nonreplicated
- fast network nonreplicated storagelocal-ssd
- fast local storage.
See the documentation for details.
Service
Type
TYPE_UNSPECIFIED
Service type of the host is unspecified. Default value.
MYSQL
The host is a MySQL server.
Health
HEALTH_UNKNOWN
Health of the service is unknown. Default value.
ALIVE
The service is working normally.
DEAD
The service is dead or unresponsive.
READONLY
The service is in read-only mode.
type
: Type
Type of the service provided by the host. If the field has default value, it is not returned in the response.
health
: Health
Aggregated health of the service. If the field has default value, it is not returned in the response.