Skip to main content

Get

Returns the specified Key resource.

To get the list of available Key resources, make a List request.

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);
})();

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 : string

    ID of the user account that the Key resource belongs to.

  • serviceAccountId : string

    ID 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.