All Products
Search
Document Center

Key Management Service:UpdateSecretVersionStage

Last Updated:May 16, 2024

Updates the stage label of a generic secret.

Only generic secrets support the API operation. The following operations are supported:

  • Add a stage label to a secret version.

  • Remove a stage label of a secret version.

  • Remove a stage label of a secret version and add the stage label to a different secret version.

In this example, the stage label that marks the version of the secret001 secret is updated. The stage label ACSCurrent is used to mark the 002 version.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter

Type

Required

Example

Description

Action

String

Yes

UpdateSecretVersionStage

The operation that you want to perform. Set the value to UpdateSecretVersionStage.

SecretName

String

Yes

secret001

The Alibaba Cloud Resource Name (ARN) of the secret or secret resource.

Note

When you access a secret within another Alibaba Cloud account, you must enter the ARN of the secret. The ARN is in the acs:kms:${region}:${account}:secret/${secret-name} format.

VersionStage

String

Yes

ACSCurrent

The stage label of the secret.

Scenario 1: Add a stage label to a secret version

Configure the parameter and MoveToVersion. Do not configure RemoveFromVersion. Configure VersionStage to ACSCurrent, ACSPrevious, or a custom stage label.

Scenario 2: Remove a stage label of a secret version

Configure the parameter and RemoveFromVersion. Do not configure MoveToVersion. Configure VersionStage to a custom stage label.

Note

ACSCurrent and ACSPrevious are system stage labels and cannot be directly removed. They can only be removed from one secret version and added to another secret version.

Scenario 3: Remove a stage label of a secret version and add the stage label to a different secret version

Configure the parameter, MoveToVersion, and MoveToVersion. Configure VersionStage to ACSCurrent, ACSPrevious, or a custom stage label.

RemoveFromVersion

String

No

001

The version number of the secret. The parameter specifies that the stage label specified by the input parameter VersionStage is removed from the version.

Note

You must specify at least one of RemoveFromVersion and MoveToVersion.

MoveToVersion

String

No

002

The version number of the secret. The parameter specifies that the stage label specified by the input parameter VersionStage is added to the version.

Note
  • You must specify at least one of RemoveFromVersion and MoveToVersion.

  • This parameter is required if you set VersionStage to ACSCurrent or ACSPrevious.

Response parameters

Parameter

Type

Example

Description

SecretName

String

secret001

The secret name.

RequestId

String

8cad259f-4d77-40ec-bbd7-b9c47a423bb9

The ID of the request, which is used to locate and troubleshoot issues.

Examples

Sample requests

http(s)://[Endpoint]/?Action=UpdateSecretVersionStage
&SecretName=secret001
&VersionStage=ACSCurrent
&RemoveFromVersion=001
&MoveToVersion=002
&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<UpdateSecretVersionStageResponse>
    <SecretName>secret001</SecretName>
    <RequestId>8cad259f-4d77-40ec-bbd7-b9c47a423bb9</RequestId>
</UpdateSecretVersionStageResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "SecretName" : "secret001",
  "RequestId" : "8cad259f-4d77-40ec-bbd7-b9c47a423bb9"
}

Error codes

For a list of error codes, see Service error codes.