UNPKG

1.57 kBTypeScriptView Raw
1import { PolicyDocument } from '@aws-cdk/aws-iam';
2import { RemovalPolicy, Resource } from '@aws-cdk/core';
3import { Construct } from 'constructs';
4import { IBucket } from './bucket';
5export interface BucketPolicyProps {
6 /**
7 * The Amazon S3 bucket that the policy applies to.
8 */
9 readonly bucket: IBucket;
10 /**
11 * Policy to apply when the policy is removed from this stack.
12 *
13 * @default - RemovalPolicy.DESTROY.
14 */
15 readonly removalPolicy?: RemovalPolicy;
16}
17/**
18 * The bucket policy for an Amazon S3 bucket
19 *
20 * Policies define the operations that are allowed on this resource.
21 *
22 * You almost never need to define this construct directly.
23 *
24 * All AWS resources that support resource policies have a method called
25 * `addToResourcePolicy()`, which will automatically create a new resource
26 * policy if one doesn't exist yet, otherwise it will add to the existing
27 * policy.
28 *
29 * Prefer to use `addToResourcePolicy()` instead.
30 */
31export declare class BucketPolicy extends Resource {
32 /**
33 * A policy document containing permissions to add to the specified bucket.
34 * For more information, see Access Policy Language Overview in the Amazon
35 * Simple Storage Service Developer Guide.
36 */
37 readonly document: PolicyDocument;
38 private resource;
39 constructor(scope: Construct, id: string, props: BucketPolicyProps);
40 /**
41 * Sets the removal policy for the BucketPolicy.
42 * @param removalPolicy the RemovalPolicy to set.
43 */
44 applyRemovalPolicy(removalPolicy: RemovalPolicy): void;
45}