All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awscdk.services.secretsmanager.CfnResourcePolicy Maven / Gradle / Ivy

package software.amazon.awscdk.services.secretsmanager;

/**
 * A CloudFormation `AWS::SecretsManager::ResourcePolicy`.
 * 

* Attaches a resource-based permission policy to a secret. A resource-based policy is optional. For more information, see Authentication and access control for Secrets Manager *

* For information about attaching a policy in the console, see Attach a permissions policy to a secret . *

* Required permissions: secretsmanager:PutResourcePolicy . 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();
 * 
*/ @javax.annotation.Generated(value = "jsii-pacmak/1.70.0 (build 03c2f6f)", date = "2022-11-01T13:16:32.801Z") @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.secretsmanager.$Module.class, fqn = "@aws-cdk/aws-secretsmanager.CfnResourcePolicy") public class CfnResourcePolicy extends software.amazon.awscdk.core.CfnResource implements software.amazon.awscdk.core.IInspectable { protected CfnResourcePolicy(final software.amazon.jsii.JsiiObjectRef objRef) { super(objRef); } protected CfnResourcePolicy(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) { super(initializationMode); } static { CFN_RESOURCE_TYPE_NAME = software.amazon.jsii.JsiiObject.jsiiStaticGet(software.amazon.awscdk.services.secretsmanager.CfnResourcePolicy.class, "CFN_RESOURCE_TYPE_NAME", software.amazon.jsii.NativeType.forClass(java.lang.String.class)); } /** * Create a new `AWS::SecretsManager::ResourcePolicy`. *

* @param scope - scope in which this resource is defined. This parameter is required. * @param id - scoped id of the resource. This parameter is required. * @param props - resource properties. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public CfnResourcePolicy(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.core.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.secretsmanager.CfnResourcePolicyProps props) { super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required"), java.util.Objects.requireNonNull(props, "props is required") }); } /** * Examines the CloudFormation resource and discloses attributes. *

* @param inspector - tree inspector to collect and process attributes. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @Override public void inspect(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.core.TreeInspector inspector) { software.amazon.jsii.Kernel.call(this, "inspect", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(inspector, "inspector is required") }); } /** * @param props This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @Override protected @org.jetbrains.annotations.NotNull java.util.Map renderProperties(final @org.jetbrains.annotations.NotNull java.util.Map props) { return java.util.Collections.unmodifiableMap(software.amazon.jsii.Kernel.call(this, "renderProperties", software.amazon.jsii.NativeType.mapOf(software.amazon.jsii.NativeType.forClass(java.lang.Object.class)), new Object[] { java.util.Objects.requireNonNull(props, "props is required") })); } /** * The CloudFormation resource type name for this resource class. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public final static java.lang.String CFN_RESOURCE_TYPE_NAME; /** */ @Override @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) protected @org.jetbrains.annotations.NotNull java.util.Map getCfnProperties() { return java.util.Collections.unmodifiableMap(software.amazon.jsii.Kernel.get(this, "cfnProperties", software.amazon.jsii.NativeType.mapOf(software.amazon.jsii.NativeType.forClass(java.lang.Object.class)))); } /** * A JSON-formatted string for an AWS resource-based policy. *

* For example policies, see Permissions policy examples . */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public @org.jetbrains.annotations.NotNull java.lang.Object getResourcePolicy() { return software.amazon.jsii.Kernel.get(this, "resourcePolicy", software.amazon.jsii.NativeType.forClass(java.lang.Object.class)); } /** * A JSON-formatted string for an AWS resource-based policy. *

* For example policies, see Permissions policy examples . */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public void setResourcePolicy(final @org.jetbrains.annotations.NotNull java.lang.Object value) { software.amazon.jsii.Kernel.set(this, "resourcePolicy", java.util.Objects.requireNonNull(value, "resourcePolicy is required")); } /** * The ARN or name of the secret to attach the resource-based policy. *

* For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public @org.jetbrains.annotations.NotNull java.lang.String getSecretId() { return software.amazon.jsii.Kernel.get(this, "secretId", software.amazon.jsii.NativeType.forClass(java.lang.String.class)); } /** * The ARN or name of the secret to attach the resource-based policy. *

* For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public void setSecretId(final @org.jetbrains.annotations.NotNull java.lang.String value) { software.amazon.jsii.Kernel.set(this, "secretId", java.util.Objects.requireNonNull(value, "secretId is required")); } /** * Specifies whether to block resource-based policies that allow broad access to the secret. *

* By default, Secrets Manager blocks policies that allow broad access, for example those that use a wildcard for the principal. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public @org.jetbrains.annotations.Nullable java.lang.Object getBlockPublicPolicy() { return software.amazon.jsii.Kernel.get(this, "blockPublicPolicy", software.amazon.jsii.NativeType.forClass(java.lang.Object.class)); } /** * Specifies whether to block resource-based policies that allow broad access to the secret. *

* By default, Secrets Manager blocks policies that allow broad access, for example those that use a wildcard for the principal. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public void setBlockPublicPolicy(final @org.jetbrains.annotations.Nullable java.lang.Boolean value) { software.amazon.jsii.Kernel.set(this, "blockPublicPolicy", value); } /** * Specifies whether to block resource-based policies that allow broad access to the secret. *

* By default, Secrets Manager blocks policies that allow broad access, for example those that use a wildcard for the principal. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public void setBlockPublicPolicy(final @org.jetbrains.annotations.Nullable software.amazon.awscdk.core.IResolvable value) { software.amazon.jsii.Kernel.set(this, "blockPublicPolicy", value); } /** * A fluent builder for {@link software.amazon.awscdk.services.secretsmanager.CfnResourcePolicy}. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public static final class Builder implements software.amazon.jsii.Builder { /** * @return a new instance of {@link Builder}. * @param scope - scope in which this resource is defined. This parameter is required. * @param id - scoped id of the resource. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public static Builder create(final software.amazon.awscdk.core.Construct scope, final java.lang.String id) { return new Builder(scope, id); } private final software.amazon.awscdk.core.Construct scope; private final java.lang.String id; private final software.amazon.awscdk.services.secretsmanager.CfnResourcePolicyProps.Builder props; private Builder(final software.amazon.awscdk.core.Construct scope, final java.lang.String id) { this.scope = scope; this.id = id; this.props = new software.amazon.awscdk.services.secretsmanager.CfnResourcePolicyProps.Builder(); } /** * A JSON-formatted string for an AWS resource-based policy. *

* For example policies, see Permissions policy examples . *

* @return {@code this} * @param resourcePolicy A JSON-formatted string for an AWS resource-based policy. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder resourcePolicy(final java.lang.Object resourcePolicy) { this.props.resourcePolicy(resourcePolicy); return this; } /** * The ARN or name of the secret to attach the resource-based policy. *

* For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. *

* @return {@code this} * @param secretId The ARN or name of the secret to attach the resource-based policy. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder secretId(final java.lang.String secretId) { this.props.secretId(secretId); return this; } /** * Specifies whether to block resource-based policies that allow broad access to the secret. *

* By default, Secrets Manager blocks policies that allow broad access, for example those that use a wildcard for the principal. *

* @return {@code this} * @param blockPublicPolicy Specifies whether to block resource-based policies that allow broad access to the secret. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder blockPublicPolicy(final java.lang.Boolean blockPublicPolicy) { this.props.blockPublicPolicy(blockPublicPolicy); return this; } /** * Specifies whether to block resource-based policies that allow broad access to the secret. *

* By default, Secrets Manager blocks policies that allow broad access, for example those that use a wildcard for the principal. *

* @return {@code this} * @param blockPublicPolicy Specifies whether to block resource-based policies that allow broad access to the secret. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder blockPublicPolicy(final software.amazon.awscdk.core.IResolvable blockPublicPolicy) { this.props.blockPublicPolicy(blockPublicPolicy); return this; } /** * @returns a newly built instance of {@link software.amazon.awscdk.services.secretsmanager.CfnResourcePolicy}. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @Override public software.amazon.awscdk.services.secretsmanager.CfnResourcePolicy build() { return new software.amazon.awscdk.services.secretsmanager.CfnResourcePolicy( this.scope, this.id, this.props.build() ); } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy