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 ValidateResourcePolicy operation.
Namespace: Amazon.SecretsManager.Model
Assembly: AWSSDK.SecretsManager.dll
Version: 3.x.y.z
public class ValidateResourcePolicyResponse : AmazonWebServiceResponse
The ValidateResourcePolicyResponse type exposes the following members
Name | Description | |
---|---|---|
ValidateResourcePolicyResponse() |
Name | Type | Description | |
---|---|---|---|
ContentLength | System.Int64 | Inherited from Amazon.Runtime.AmazonWebServiceResponse. | |
HttpStatusCode | System.Net.HttpStatusCode | Inherited from Amazon.Runtime.AmazonWebServiceResponse. | |
PolicyValidationPassed | System.Boolean |
Gets and sets the property PolicyValidationPassed. True if your policy passes validation, otherwise false. |
|
ResponseMetadata | Amazon.Runtime.ResponseMetadata | Inherited from Amazon.Runtime.AmazonWebServiceResponse. | |
ValidationErrors | System.Collections.Generic.List<Amazon.SecretsManager.Model.ValidationErrorsEntry> |
Gets and sets the property ValidationErrors. Validation errors if your policy didn't pass validation. |
The following example shows how to validate a resource-based policy to a secret.
var client = new AmazonSecretsManagerClient(); var response = client.ValidateResourcePolicy(new ValidateResourcePolicyRequest { ResourcePolicy = "{ \"Version\":\"2012-10-17\", \"Statement\":[{ \"Effect\":\"Allow\", \"Principal\":{ \"AWS\":\"arn:aws:iam::123456789012:root\" }, \"Action\":\"secretsmanager:GetSecretValue\", \"Resource\":\"*\" }] }", SecretId = "MyTestDatabaseSecret" }); bool policyValidationPassed = response.PolicyValidationPassed; List<ValidationErrorsEntry> validationErrors = response.ValidationErrors;
.NET Core App:
Supported in: 3.1
.NET Standard:
Supported in: 2.0
.NET Framework:
Supported in: 4.5, 4.0, 3.5