@aws-cdk/aws-s3
Version:
The CDK Construct Library for AWS::S3
46 lines (45 loc) • 1.57 kB
TypeScript
import { PolicyDocument } from '@aws-cdk/aws-iam';
import { RemovalPolicy, Resource } from '@aws-cdk/core';
import { Construct } from 'constructs';
import { IBucket } from './bucket';
export interface BucketPolicyProps {
/**
* The Amazon S3 bucket that the policy applies to.
*/
readonly bucket: IBucket;
/**
* Policy to apply when the policy is removed from this stack.
*
* @default - RemovalPolicy.DESTROY.
*/
readonly removalPolicy?: RemovalPolicy;
}
/**
* The bucket policy for an Amazon S3 bucket
*
* 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.
*/
export declare class BucketPolicy extends Resource {
/**
* A policy document containing permissions to add to the specified bucket.
* For more information, see Access Policy Language Overview in the Amazon
* Simple Storage Service Developer Guide.
*/
readonly document: PolicyDocument;
private resource;
constructor(scope: Construct, id: string, props: BucketPolicyProps);
/**
* Sets the removal policy for the BucketPolicy.
* @param removalPolicy the RemovalPolicy to set.
*/
applyRemovalPolicy(removalPolicy: RemovalPolicy): void;
}