ListVersions
Returns the list of versions of the specified symmetric KMS key.
- TypeScript
- Python
import { cloudApi, serviceClients, Session } from "@yandex-cloud/nodejs-sdk";
const ListSymmetricKeyVersionsRequest =
cloudApi.kms.symmetric_key_service.ListSymmetricKeyVersionsRequest;
(async () => {
const authToken = process.env["YC_OAUTH_TOKEN"];
const session = new Session({ oauthToken: authToken });
const client = session.client(serviceClients.SymmetricKeyServiceClient);
const result = await client.listVersions(
ListSymmetricKeyVersionsRequest.fromPartial({
keyId: "keyId",
// pageSize: 0,
// pageToken: "pageToken"
})
);
console.log(result);
})();
import os
import grpc
import yandexcloud
from yandex.cloud.kms.v1.symmetric_key_service_pb2 import ListSymmetricKeyVersionsRequest
from yandex.cloud.kms.v1.symmetric_key_service_pb2_grpc import SymmetricKeyServiceStub
token = os.getenv("YC_OAUTH_TOKEN")
sdk = yandexcloud.SDK(token=token)
service = sdk.client(SymmetricKeyServiceStub)
response = service.ListVersions(
ListSymmetricKeyVersionsRequest(
key_id="keyId",
# page_size = 0,
# page_token = "pageToken"
)
)
print(response)
ListSymmetricKeyVersionsRequest
keyId
: string
ID of the symmetric KMS key to list versions for.
pageSize
: int64
The maximum number of results per page to return. If the number of available results is larger than page_size, the service returns a ListSymmetricKeyVersionsResponse.next_page_token that can be used to get the next page of results in subsequent list requests. Default value: 100.
pageToken
: string
Page token. To get the next page of results, set page_token to the ListSymmetricKeyVersionsResponse.next_page_token returned by a previous list request.
ListSymmetricKeyVersionsResponse
keyVersions
: SymmetricKeyVersion
List of versions for the specified symmetric KMS key.
nextPageToken
: string
This token allows you to get the next page of results for list requests. If the number of results is greater than the specified ListSymmetricKeyVersionsRequest.page_size, use the next_page_token as the value for the ListSymmetricKeyVersionsRequest.page_token query parameter in the next list request. Each subsequent list request will have its own next_page_token to continue paging through the results.
SymmetricKeyVersion
Symmetric KMS key version: metadata about actual cryptographic data.
Status
Possible version status.
STATUS_UNSPECIFIED
Possible version status.
ACTIVE
The version is active and can be used for encryption and decryption.
SCHEDULED_FOR_DESTRUCTION
The version is scheduled for destruction, the time when it will be destroyed is specified in the [SymmetricKeyVersion.destroy_at][9] field.
DESTROYED
The version is destroyed and cannot be recovered.
id
: string
ID of the key version.
keyId
: string
ID of the symmetric KMS key that the version belongs to.
status
: Status
Status of the key version.
algorithm
: SymmetricAlgorithm
Encryption algorithm that should be used when using the key version to encrypt plaintext.
createdAt
: google.protobuf.Timestamp
Time when the key version was created.
primary
: bool
Indication of a primary version, that is to be used by default for all cryptographic operations that don't have a key version explicitly specified.
destroyAt
: google.protobuf.Timestamp
Time when the key version is going to be destroyed. Empty unless the status
is SCHEDULED_FOR_DESTRUCTION
.
hostedByHsm
: bool
Indication of the version that is hosted by HSM.