@Generated(value="jsii-pacmak/1.74.0 (build 6d08790)", date="2023-03-28T21:34:20.699Z") public class BucketPolicy extends Resource
Policies define the operations that are allowed on this resource.
You almost never need to define this construct directly.
All AWS resources that support resource policies have a method called
addToResourcePolicy()
, which will automatically create a new resource
policy if one doesn't exist yet, otherwise it will add to the existing
policy.
Prefer to use addToResourcePolicy()
instead.
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.s3.*; import software.amazon.awscdk.core.*; Bucket bucket; BucketPolicy bucketPolicy = BucketPolicy.Builder.create(this, "MyBucketPolicy") .bucket(bucket) // the properties below are optional .removalPolicy(RemovalPolicy.DESTROY) .build();
Modifier and Type | Class and Description |
---|---|
static class |
BucketPolicy.Builder
A fluent builder for
BucketPolicy . |
IResource.Jsii$Default
Modifier | Constructor and Description |
---|---|
protected |
BucketPolicy(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
BucketPolicy(software.amazon.jsii.JsiiObjectRef objRef) |
|
BucketPolicy(software.constructs.Construct scope,
java.lang.String id,
BucketPolicyProps props) |
Modifier and Type | Method and Description |
---|---|
void |
applyRemovalPolicy(RemovalPolicy removalPolicy)
Sets the removal policy for the BucketPolicy.
|
PolicyDocument |
getDocument()
A policy document containing permissions to add to the specified bucket.
|
generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResource
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getNode
protected BucketPolicy(software.amazon.jsii.JsiiObjectRef objRef)
protected BucketPolicy(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public BucketPolicy(software.constructs.Construct scope, java.lang.String id, BucketPolicyProps props)
scope
- This parameter is required.id
- This parameter is required.props
- This parameter is required.public void applyRemovalPolicy(RemovalPolicy removalPolicy)
applyRemovalPolicy
in interface IResource
applyRemovalPolicy
in class Resource
removalPolicy
- the RemovalPolicy to set. This parameter is required.public PolicyDocument getDocument()
For more information, see Access Policy Language Overview in the Amazon Simple Storage Service Developer Guide.