Get
Returns the specified Key resource.
To get the list of available Key resources, make a List request.
- TypeScript
- Python
import { cloudApi, serviceClients, Session } from "@yandex-cloud/nodejs-sdk";
const GetKeyRequest = cloudApi.iam.key_service.GetKeyRequest;
const KeyFormat = cloudApi.iam.key_service.KeyFormat;
(async () => {
const authToken = process.env["YC_OAUTH_TOKEN"];
const session = new Session({ oauthToken: authToken });
const client = session.client(serviceClients.KeyServiceClient);
const result = await client.get(
GetKeyRequest.fromPartial({
keyId: "keyId",
// format: KeyFormat.undefined
})
);
console.log(result);
})();
import os
import grpc
import yandexcloud
from yandex.cloud.iam.v1.key_service_pb2 import GetKeyRequest
from yandex.cloud.iam.v1.key_service_pb2 import KeyFormat
from yandex.cloud.iam.v1.key_service_pb2_grpc import KeyServiceStub
token = os.getenv("YC_OAUTH_TOKEN")
sdk = yandexcloud.SDK(token=token)
service = sdk.client(KeyServiceStub)
response = service.Get(
GetKeyRequest(
key_id="keyId",
# format = KeyFormat.undefined
)
)
print(response)
GetKeyRequest
keyId
: string
ID of the Key resource to return. To get the ID use a KeyService.List request.
format
: KeyFormat
Output format of the key.
Key
A Key resource. For more information, see Authorized keys.
Algorithm
ALGORITHM_UNSPECIFIED
RSA_2048
RSA with a 2048-bit key size. Default value.
RSA_4096
RSA with a 4096-bit key size.
id
: string
ID of the Key resource.
One of subject
userAccountId
: stringID of the user account that the Key resource belongs to.
serviceAccountId
: stringID of the service account that the Key resource belongs to.
createdAt
: google.protobuf.Timestamp
Creation timestamp.
description
: string
Description of the Key resource. 0-256 characters long.
keyAlgorithm
: Algorithm
An algorithm used to generate a key pair of the Key resource.
publicKey
: string
A public key of the Key resource.
lastUsedAt
: google.protobuf.Timestamp
Timestamp for the last use of this key.