AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

This is the response object from the UpdateSecret operation.

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonWebServiceResponse
    Amazon.SecretsManager.Model.UpdateSecretResponse

Namespace: Amazon.SecretsManager.Model
Assembly: AWSSDK.SecretsManager.dll
Version: 3.x.y.z

Syntax

C#
public class UpdateSecretResponse : AmazonWebServiceResponse

The UpdateSecretResponse type exposes the following members

Constructors

NameDescription
Public Method UpdateSecretResponse()

Properties

NameTypeDescription
Public Property ARN System.String

Gets and sets the property ARN.

The ARN of the secret that was updated.

Public Property ContentLength System.Int64 Inherited from Amazon.Runtime.AmazonWebServiceResponse.
Public Property HttpStatusCode System.Net.HttpStatusCode Inherited from Amazon.Runtime.AmazonWebServiceResponse.
Public Property Name System.String

Gets and sets the property Name.

The name of the secret that was updated.

Public Property ResponseMetadata Amazon.Runtime.ResponseMetadata Inherited from Amazon.Runtime.AmazonWebServiceResponse.
Public Property VersionId System.String

Gets and sets the property VersionId.

If Secrets Manager created a new version of the secret during this operation, then VersionId contains the unique identifier of the new version.

Examples

The following example shows how to modify the description of a secret.

To update the description of a secret


var client = new AmazonSecretsManagerClient();
var response = client.UpdateSecret(new UpdateSecretRequest 
{
    ClientRequestToken = "EXAMPLE1-90ab-cdef-fedc-ba987EXAMPLE",
    Description = "This is a new description for the secret.",
    SecretId = "MyTestDatabaseSecret"
});

string arn = response.ARN;
string name = response.Name;

            

This example shows how to update the KMS customer managed key (CMK) used to encrypt the secret value. The KMS CMK must be in the same region as the secret.

To update the KMS key associated with a secret


var client = new AmazonSecretsManagerClient();
var response = client.UpdateSecret(new UpdateSecretRequest 
{
    KmsKeyId = "arn:aws:kms:us-west-2:123456789012:key/EXAMPLE2-90ab-cdef-fedc-ba987EXAMPLE",
    SecretId = "MyTestDatabaseSecret"
});

string arn = response.ARN;
string name = response.Name;

            

The following example shows how to create a new version of the secret by updating the SecretString field. Alternatively, you can use the put-secret-value operation.

To create a new version of the encrypted secret value


var client = new AmazonSecretsManagerClient();
var response = client.UpdateSecret(new UpdateSecretRequest 
{
    SecretId = "MyTestDatabaseSecret",
    SecretString = "{JSON STRING WITH CREDENTIALS}"
});

string arn = response.ARN;
string name = response.Name;
string versionId = response.VersionId;

            

Version Information

.NET Core App:
Supported in: 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.5, 4.0, 3.5