@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:41.735Z") @Stability(value=Stable) 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.*;
import software.amazon.awscdk.services.s3.*;
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. |
software.amazon.jsii.JsiiObject.InitializationModeIResource.Jsii$Default| Modifier | Constructor and Description |
|---|---|
|
BucketPolicy(software.constructs.Construct scope,
String id,
BucketPolicyProps props) |
protected |
BucketPolicy(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
BucketPolicy(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
void |
applyRemovalPolicy(RemovalPolicy removalPolicy)
Sets the removal policy for the BucketPolicy.
|
static BucketPolicy |
fromCfnBucketPolicy(CfnBucketPolicy cfnBucketPolicy)
Create a mutable
BucketPolicy from a CfnBucketPolicy. |
IBucket |
getBucket()
The Bucket this Policy applies to.
|
PolicyDocument |
getDocument()
A policy document containing permissions to add to the specified bucket.
|
generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResourcejsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetprotected BucketPolicy(software.amazon.jsii.JsiiObjectRef objRef)
protected BucketPolicy(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public BucketPolicy(@NotNull
software.constructs.Construct scope,
@NotNull
String id,
@NotNull
BucketPolicyProps props)
scope - This parameter is required.id - This parameter is required.props - This parameter is required.@Stability(value=Stable) @NotNull public static BucketPolicy fromCfnBucketPolicy(@NotNull CfnBucketPolicy cfnBucketPolicy)
BucketPolicy from a CfnBucketPolicy.
cfnBucketPolicy - This parameter is required.@Stability(value=Stable)
public void applyRemovalPolicy(@NotNull
RemovalPolicy removalPolicy)
applyRemovalPolicy in interface IResourceapplyRemovalPolicy in class ResourceremovalPolicy - the RemovalPolicy to set. This parameter is required.@Stability(value=Stable) @NotNull public IBucket getBucket()
@Stability(value=Stable) @NotNull public PolicyDocument getDocument()
For more information, see Access Policy Language Overview in the Amazon Simple Storage Service Developer Guide.
Copyright © 2022. All rights reserved.