Class BucketPolicy
The bucket policy for an Amazon S3 bucket.
Inherited Members
Namespace: Amazon.CDK.AWS.S3
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class BucketPolicy : Resource, IResource
Syntax (vb)
Public Class BucketPolicy
Inherits Resource
Implements IResource
Remarks
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.
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;
using Amazon.CDK.AWS.S3;
Bucket bucket;
var bucketPolicy = new BucketPolicy(this, "MyBucketPolicy", new BucketPolicyProps {
Bucket = bucket,
// the properties below are optional
RemovalPolicy = RemovalPolicy.DESTROY
});
Synopsis
Constructors
BucketPolicy(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
BucketPolicy(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
BucketPolicy(Construct, String, IBucketPolicyProps) |
Properties
Bucket | The Bucket this Policy applies to. |
Document | A policy document containing permissions to add to the specified bucket. |
Methods
ApplyRemovalPolicy(RemovalPolicy) | Sets the removal policy for the BucketPolicy. |
FromCfnBucketPolicy(CfnBucketPolicy) | Create a mutable |
Constructors
BucketPolicy(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected BucketPolicy(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
BucketPolicy(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected BucketPolicy(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
BucketPolicy(Construct, String, IBucketPolicyProps)
public BucketPolicy(Construct scope, string id, IBucketPolicyProps props)
Parameters
- scope Constructs.Construct
- id System.String
- props IBucketPolicyProps
Properties
Bucket
Document
A policy document containing permissions to add to the specified bucket.
public virtual PolicyDocument Document { get; }
Property Value
Remarks
For more information, see Access Policy Language Overview in the Amazon Simple Storage Service Developer Guide.
Methods
ApplyRemovalPolicy(RemovalPolicy)
Sets the removal policy for the BucketPolicy.
public override void ApplyRemovalPolicy(RemovalPolicy removalPolicy)
Parameters
- removalPolicy RemovalPolicy
the RemovalPolicy to set.
Overrides
FromCfnBucketPolicy(CfnBucketPolicy)
Create a mutable BucketPolicy
from a CfnBucketPolicy
.
public static BucketPolicy FromCfnBucketPolicy(CfnBucketPolicy cfnBucketPolicy)
Parameters
- cfnBucketPolicy CfnBucketPolicy
Returns