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.
Namespace: Amazon.SecretsManager.Model
Assembly: AWSSDK.SecretsManager.dll
Version: 3.x.y.z
public class UpdateSecretResponse : AmazonWebServiceResponse
The UpdateSecretResponse type exposes the following members
Name | Description | |
---|---|---|
UpdateSecretResponse() |
Name | Type | Description | |
---|---|---|---|
ARN | System.String |
Gets and sets the property ARN. The ARN of the secret that was updated. |
|
ContentLength | System.Int64 | Inherited from Amazon.Runtime.AmazonWebServiceResponse. | |
HttpStatusCode | System.Net.HttpStatusCode | Inherited from Amazon.Runtime.AmazonWebServiceResponse. | |
Name | System.String |
Gets and sets the property Name. The name of the secret that was updated. |
|
ResponseMetadata | Amazon.Runtime.ResponseMetadata | Inherited from Amazon.Runtime.AmazonWebServiceResponse. | |
VersionId | System.String |
Gets and sets the property VersionId.
If Secrets Manager created a new version of the secret during this operation, then
|
The following example shows how to modify 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.
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.
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;
.NET Core App:
Supported in: 3.1
.NET Standard:
Supported in: 2.0
.NET Framework:
Supported in: 4.5, 4.0, 3.5