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 ValidateResourcePolicy operation.

Inheritance Hierarchy

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

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

Syntax

C#
public class ValidateResourcePolicyResponse : AmazonWebServiceResponse

The ValidateResourcePolicyResponse type exposes the following members

Constructors

Properties

NameTypeDescription
Public Property ContentLength System.Int64 Inherited from Amazon.Runtime.AmazonWebServiceResponse.
Public Property HttpStatusCode System.Net.HttpStatusCode Inherited from Amazon.Runtime.AmazonWebServiceResponse.
Public Property PolicyValidationPassed System.Boolean

Gets and sets the property PolicyValidationPassed.

True if your policy passes validation, otherwise false.

Public Property ResponseMetadata Amazon.Runtime.ResponseMetadata Inherited from Amazon.Runtime.AmazonWebServiceResponse.
Public Property ValidationErrors System.Collections.Generic.List<Amazon.SecretsManager.Model.ValidationErrorsEntry>

Gets and sets the property ValidationErrors.

Validation errors if your policy didn't pass validation.

Examples

The following example shows how to validate a resource-based policy to a secret.

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;

            

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