Class CfnResourcePolicy

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IInspectable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.98.0 (build 00b106d)", date="2024-05-08T21:35:13.749Z") @Stability(Stable) public class CfnResourcePolicy extends CfnResource implements IInspectable
Attaches a resource-based permission policy to a secret.

A resource-based policy is optional. If a secret already has a resource policy attached, you must first remove it before attaching a new policy using this CloudFormation resource. You can remove the policy using the console , CLI , or API . For more information, see Authentication and access control for Secrets Manager .

Required permissions: secretsmanager:PutResourcePolicy , secretsmanager:GetResourcePolicy . For more information, see IAM policy actions for Secrets Manager and Authentication and access control in Secrets Manager .

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.secretsmanager.*;
 Object resourcePolicy;
 CfnResourcePolicy cfnResourcePolicy = CfnResourcePolicy.Builder.create(this, "MyCfnResourcePolicy")
         .resourcePolicy(resourcePolicy)
         .secretId("secretId")
         // the properties below are optional
         .blockPublicPolicy(false)
         .build();
 

See Also:
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnResourcePolicy

      protected CfnResourcePolicy(software.amazon.jsii.JsiiObjectRef objRef)
    • CfnResourcePolicy

      protected CfnResourcePolicy(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CfnResourcePolicy

      @Stability(Stable) public CfnResourcePolicy(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnResourcePolicyProps props)
      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
      props - Resource properties. This parameter is required.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector - tree inspector to collect and process attributes. This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrId

      @Stability(Stable) @NotNull public String getAttrId()
    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getResourcePolicy

      @Stability(Stable) @NotNull public Object getResourcePolicy()
      A JSON-formatted string for an AWS resource-based policy.
    • setResourcePolicy

      @Stability(Stable) public void setResourcePolicy(@NotNull Object value)
      A JSON-formatted string for an AWS resource-based policy.
    • getSecretId

      @Stability(Stable) @NotNull public String getSecretId()
      The ARN or name of the secret to attach the resource-based policy.
    • setSecretId

      @Stability(Stable) public void setSecretId(@NotNull String value)
      The ARN or name of the secret to attach the resource-based policy.
    • getBlockPublicPolicy

      @Stability(Stable) @Nullable public Object getBlockPublicPolicy()
      Specifies whether to block resource-based policies that allow broad access to the secret.
    • setBlockPublicPolicy

      @Stability(Stable) public void setBlockPublicPolicy(@Nullable Boolean value)
      Specifies whether to block resource-based policies that allow broad access to the secret.
    • setBlockPublicPolicy

      @Stability(Stable) public void setBlockPublicPolicy(@Nullable IResolvable value)
      Specifies whether to block resource-based policies that allow broad access to the secret.