List
Retrieves the list of secrets in the specified folder.
- TypeScript
- Python
import { cloudApi, serviceClients, Session } from "@yandex-cloud/nodejs-sdk";
const ListSecretsRequest = cloudApi.lockbox.secret_service.ListSecretsRequest;
(async () => {
const authToken = process.env["YC_OAUTH_TOKEN"];
const session = new Session({ oauthToken: authToken });
const client = session.client(serviceClients.SecretServiceClient);
const result = await client.list(
ListSecretsRequest.fromPartial({
folderId: "folderId",
// pageSize: 0,
// pageToken: "pageToken"
})
);
console.log(result);
})();
import os
import grpc
import yandexcloud
from yandex.cloud.lockbox.v1.secret_service_pb2 import ListSecretsRequest
from yandex.cloud.lockbox.v1.secret_service_pb2_grpc import SecretServiceStub
token = os.getenv("YC_OAUTH_TOKEN")
sdk = yandexcloud.SDK(token=token)
service = sdk.client(SecretServiceStub)
response = service.List(
ListSecretsRequest(
folder_id="folderId",
# page_size = 0,
# page_token = "pageToken"
)
)
print(response)
ListSecretsRequest
folderId
: string
ID of the folder to list secrets in.
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 ListSecretsRequest.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
ListSecretsRequest.next_page_token returned by a previous list request.
ListSecretsResponse
secrets
: Secret
List of secrets in the specified folder.
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 ListSecretsRequest.page_size, use
the next_page_token
as the value for the ListSecretsRequest.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.
Secret
A secret that may contain several versions of the payload.
Status
STATUS_UNSPECIFIED
CREATING
The secret is being created.
ACTIVE
The secret is active and the secret payload can be accessed. Can be set to INACTIVE using the [SecretService.Deactivate][5] method.
INACTIVE
The secret is inactive and unusable. Can be set to ACTIVE using the [SecretService.Deactivate][6] method.
id
: string
ID of the secret.
folderId
: string
ID of the folder that the secret belongs to.
createdAt
: google.protobuf.Timestamp
Creation timestamp.
name
: string
Name of the secret.
description
: string
Description of the secret.
labels
: string
Custom labels for the secret as key:value
pairs. Maximum 64 per key.
kmsKeyId
: string
Optional ID of the KMS key will be used to encrypt and decrypt the secret.
status
: Status
Status of the secret.
currentVersion
: Version
Current (i.e. the latest
) version of the secret.
deletionProtection
: bool
Flag that inhibits deletion of the secret.
One of payloadSpecification
passwordPayloadSpecification
: PasswordPayloadSpecification
Version
Status
STATUS_UNSPECIFIED
ACTIVE
The version is active and the secret payload can be accessed.
SCHEDULED_FOR_DESTRUCTION
The version is scheduled for destruction, the time when it will be destroyed is specified in the [Version.destroy_at][7] field.
DESTROYED
The version is destroyed and cannot be recovered.
id
: string
ID of the version.
secretId
: string
ID of the secret that the version belongs to.
createdAt
: google.protobuf.Timestamp
Time when the version was created.
destroyAt
: google.protobuf.Timestamp
Time when the version is going to be destroyed. Empty unless the status
is SCHEDULED_FOR_DESTRUCTION
.
description
: string
Description of the version.
status
: Status
Status of the secret.
payloadEntryKeys
: string
Keys of the entries contained in the version payload.
passwordPayloadSpecification
: PasswordPayloadSpecification
PasswordPayloadSpecification
passwordKey
: string
key of the entry to store generated password value
length
: int64
password length; by default, a reasonable length will be decided
includeUppercase
: google.protobuf.BoolValue
whether at least one A..Z character is included in the password, true by default
includeLowercase
: google.protobuf.BoolValue
whether at least one a..z character is included in the password, true by default
includeDigits
: google.protobuf.BoolValue
whether at least one 0..9 character is included in the password, true by default
includePunctuation
: google.protobuf.BoolValue
whether at least one punctuation character is included in the password, true by default punctuation characters by default (there are 32): !"#$%&'()*+,-./:;<=>?@[]8^_`{|}~ to customize the punctuation characters, see included_punctuation and excluded_punctuation below
includedPunctuation
: string
If include_punctuation is true, one of these two fields (not both) may be used optionally to customize the punctuation: a string of specific punctuation characters to use (at most, all the 32)
excludedPunctuation
: string
a string of punctuation characters to exclude from the default (at most 31, it's not allowed to exclude all the 32)