List
Retrieves the list of databases in a cluster.
- TypeScript
- Python
import { cloudApi, serviceClients, Session } from "@yandex-cloud/nodejs-sdk";
const ListDatabasesRequest =
cloudApi.mdb.clickhouse_database_service.ListDatabasesRequest;
(async () => {
const authToken = process.env["YC_OAUTH_TOKEN"];
const session = new Session({ oauthToken: authToken });
const client = session.client(serviceClients.DatabaseServiceClient);
const result = await client.list(
ListDatabasesRequest.fromPartial({
clusterId: "clusterId",
// pageSize: 0,
// pageToken: "pageToken"
})
);
console.log(result);
})();
import os
import grpc
import yandexcloud
from yandex.cloud.mdb.clickhouse.v1.database_service_pb2_grpc import DatabaseServiceStub
from yandex.cloud.mdb.clickhouse.v1.database_service_pb2 import ListDatabasesRequest
token = os.getenv("YC_OAUTH_TOKEN")
sdk = yandexcloud.SDK(token=token)
service = sdk.client(DatabaseServiceStub)
response = service.List(
ListDatabasesRequest(
cluster_id="clusterId",
# page_size = 0,
# page_token = "pageToken"
)
)
print(response)
ListDatabasesRequest
clusterId
: string
ID of the cluster to list databases in.
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 ListDatabasesResponse.next_page_token that can be used to get the next page of results in the subsequent DatabaseService.List 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 ListDatabasesResponse.next_page_token returned by the previous DatabaseService.List request.
ListDatabasesResponse
databases
: Database
List of databases.
nextPageToken
: string
The token that can be used to get the next page of results.
If the number of results is larger than ListDatabasesRequest.page_size, use the next_page_token as the value for the ListDatabasesRequest.page_token in the subsequent DatabaseService.List request to iterate through multiple pages of results.
Each of the subsequent DatabaseService.List requests should use the next_page_token value returned by the previous request to continue paging through the results.
Database
An object that represents MySQL database.
See the documentation for details.
name
: string
Name of the database.
clusterId
: string
ID of the cluster that the database belongs to.