Get
Returns the specified MongoDB User resource.
To get the list of available MongoDB User resources, make a List request.
- TypeScript
- Python
import { cloudApi, serviceClients, Session } from "@yandex-cloud/nodejs-sdk";
const GetUserRequest = cloudApi.mdb.clickhouse_user_service.GetUserRequest;
(async () => {
const authToken = process.env["YC_OAUTH_TOKEN"];
const session = new Session({ oauthToken: authToken });
const client = session.client(serviceClients.UserServiceClient);
const result = await client.get(
GetUserRequest.fromPartial({
clusterId: "clusterId",
userName: "userName",
})
);
console.log(result);
})();
import os
import grpc
import yandexcloud
from yandex.cloud.mdb.clickhouse.v1.user_service_pb2 import GetUserRequest
from yandex.cloud.mdb.clickhouse.v1.user_service_pb2_grpc import UserServiceStub
token = os.getenv("YC_OAUTH_TOKEN")
sdk = yandexcloud.SDK(token=token)
service = sdk.client(UserServiceStub)
response = service.Get(GetUserRequest(cluster_id="clusterId", user_name="userName"))
print(response)
GetUserRequest
clusterId
: string
ID of the MongoDB cluster the user belongs to. To get the cluster ID, use a ClusterService.List request.
userName
: string
Name of the MongoDB User resource to return. To get the name of the user, use a UserService.List request.
User
A MongoDB User resource. For more information, see the Developer's Guide.
name
: string
Name of the MongoDB user.
clusterId
: string
ID of the MongoDB cluster the user belongs to.
permissions
: Permission
Set of permissions granted to the user.
Permission
databaseName
: string
Name of the database that the permission grants access to.
roles
: string
MongoDB roles for the database_name database that the permission grants.