Skip to main content

versions

Creates, updates, deletes, gets or lists a versions resource.

Overview

Nameversions
TypeResource
Idgoogle.secretmanager.versions

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringOutput only. The resource name of the SecretVersion in the format projects/*/secrets/*/versions/*. SecretVersion IDs in a Secret start at 1 and are incremented for each subsequent version of the secret.
clientSpecifiedPayloadChecksumbooleanOutput only. True if payload checksum specified in SecretPayload object has been received by SecretManagerService on SecretManagerService.AddSecretVersion.
createTimestring (google-datetime)Output only. The time at which the SecretVersion was created.
customerManagedEncryptionobjectOutput only. The customer-managed encryption status of the SecretVersion. Only populated if customer-managed encryption is used and Secret is a regionalized secret. (id: CustomerManagedEncryptionStatus)
destroyTimestring (google-datetime)Output only. The time this SecretVersion was destroyed. Only present if state is DESTROYED.
etagstringOutput only. Etag of the currently stored SecretVersion.
replicationStatusobjectThe replication status of the SecretVersion. (id: ReplicationStatus)
scheduledDestroyTimestring (google-datetime)Optional. Output only. Scheduled destroy time for secret version. This is a part of the Delayed secret version destroy feature. For a Secret with a valid version destroy TTL, when a secert version is destroyed, version is moved to disabled state and it is scheduled for destruction Version is destroyed only after the scheduled_destroy_time.
statestringOutput only. The current state of the SecretVersion.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, secretsId, versionsIdGets metadata for a SecretVersion. projects/*/secrets/*/versions/latest is an alias to the most recently created SecretVersion.
listselectprojectsId, secretsIdpageSize, pageToken, filterLists SecretVersions. This call does not return secret data.
destroydeleteprojectsId, secretsId, versionsIdDestroys a SecretVersion. Sets the state of the SecretVersion to DESTROYED and irrevocably destroys the secret data.
accessexecprojectsId, secretsId, versionsIdAccesses a SecretVersion. This call returns the secret data. projects/*/secrets/*/versions/latest is an alias to the most recently created SecretVersion.
disableexecprojectsId, secretsId, versionsIdDisables a SecretVersion. Sets the state of the SecretVersion to DISABLED.
enableexecprojectsId, secretsId, versionsIdEnables a SecretVersion. Sets the state of the SecretVersion to ENABLED.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
projectsIdstring
secretsIdstring
versionsIdstring
filterstring
pageSizeinteger (int32)
pageTokenstring

SELECT examples

Gets metadata for a SecretVersion. projects/*/secrets/*/versions/latest is an alias to the most recently created SecretVersion.

SELECT
name,
clientSpecifiedPayloadChecksum,
createTime,
customerManagedEncryption,
destroyTime,
etag,
replicationStatus,
scheduledDestroyTime,
state
FROM google.secretmanager.versions
WHERE projectsId = '{{ projectsId }}' -- required
AND secretsId = '{{ secretsId }}' -- required
AND versionsId = '{{ versionsId }}' -- required;

DELETE examples

Destroys a SecretVersion. Sets the state of the SecretVersion to DESTROYED and irrevocably destroys the secret data.

DELETE FROM google.secretmanager.versions
WHERE projectsId = '{{ projectsId }}' --required
AND secretsId = '{{ secretsId }}' --required
AND versionsId = '{{ versionsId }}' --required;

Lifecycle Methods

Accesses a SecretVersion. This call returns the secret data. projects/*/secrets/*/versions/latest is an alias to the most recently created SecretVersion.

EXEC google.secretmanager.versions.access 
@projectsId='{{ projectsId }}' --required,
@secretsId='{{ secretsId }}' --required,
@versionsId='{{ versionsId }}' --required;