@aws-cdk/aws-s3
Advanced tools
Comparing version 0.27.0 to 0.28.0
@@ -7,3 +7,2 @@ import events = require('@aws-cdk/aws-events'); | ||
import { BucketPolicy } from './bucket-policy'; | ||
import { CommonPipelineDeployActionProps, CommonPipelineSourceActionProps, PipelineDeployAction, PipelineSourceAction } from './pipeline-actions'; | ||
import { LifecycleRule } from './rule'; | ||
@@ -45,16 +44,2 @@ export interface IBucket extends cdk.IConstruct { | ||
/** | ||
* Convenience method for creating a new {@link PipelineSourceAction}. | ||
* | ||
* @param props the construction properties of the new Action | ||
* @returns the newly created {@link PipelineSourceAction} | ||
*/ | ||
toCodePipelineSourceAction(props: CommonPipelineSourceActionProps): PipelineSourceAction; | ||
/** | ||
* Convenience method for creating a new {@link PipelineDeployAction}. | ||
* | ||
* @param props the construction properties of the new Action | ||
* @returns the newly created {@link PipelineDeployAction} | ||
*/ | ||
toCodePipelineDeployAction(props: CommonPipelineDeployActionProps): PipelineDeployAction; | ||
/** | ||
* Adds a statement to the resource policy for a principal (i.e. | ||
@@ -96,3 +81,3 @@ * account/role/service) to perform actions on this bucket and/or it's | ||
*/ | ||
grantRead(identity?: iam.IPrincipal, objectsKeyPattern?: any): void; | ||
grantRead(identity: iam.IGrantable, objectsKeyPattern?: any): iam.Grant; | ||
/** | ||
@@ -107,3 +92,3 @@ * Grant write permissions to this bucket to an IAM principal. | ||
*/ | ||
grantWrite(identity?: iam.IPrincipal, objectsKeyPattern?: any): void; | ||
grantWrite(identity: iam.IGrantable, objectsKeyPattern?: any): iam.Grant; | ||
/** | ||
@@ -117,3 +102,3 @@ * Grants s3:PutObject* and s3:Abort* permissions for this bucket to an IAM principal. | ||
*/ | ||
grantPut(identity?: iam.IPrincipal, objectsKeyPattern?: any): void; | ||
grantPut(identity: iam.IGrantable, objectsKeyPattern?: any): iam.Grant; | ||
/** | ||
@@ -126,3 +111,3 @@ * Grants s3:DeleteObject* permission to an IAM pricipal for objects | ||
*/ | ||
grantDelete(identity?: iam.IPrincipal, objectsKeyPattern?: any): void; | ||
grantDelete(identity: iam.IGrantable, objectsKeyPattern?: any): iam.Grant; | ||
/** | ||
@@ -138,3 +123,3 @@ * Grants read/write permissions for this bucket and it's contents to an IAM | ||
*/ | ||
grantReadWrite(identity?: iam.IPrincipal, objectsKeyPattern?: any): void; | ||
grantReadWrite(identity: iam.IGrantable, objectsKeyPattern?: any): iam.Grant; | ||
/** | ||
@@ -163,3 +148,3 @@ * Allows unrestricted access to objects from this bucket. | ||
*/ | ||
grantPublicAccess(keyPrefix?: string, ...allowedActions: string[]): iam.PolicyStatement; | ||
grantPublicAccess(keyPrefix?: string, ...allowedActions: string[]): iam.Grant; | ||
/** | ||
@@ -267,4 +252,2 @@ * Defines a CloudWatch Event Rule that triggers upon putting an object into the Bucket. | ||
abstract export(): BucketImportProps; | ||
toCodePipelineSourceAction(props: CommonPipelineSourceActionProps): PipelineSourceAction; | ||
toCodePipelineDeployAction(props: CommonPipelineDeployActionProps): PipelineDeployAction; | ||
onPutObject(name: string, target?: events.IEventRuleTarget, path?: string): events.EventRule; | ||
@@ -314,3 +297,3 @@ /** | ||
*/ | ||
grantRead(identity?: iam.IPrincipal, objectsKeyPattern?: any): void; | ||
grantRead(identity: iam.IGrantable, objectsKeyPattern?: any): iam.Grant; | ||
/** | ||
@@ -325,3 +308,3 @@ * Grant write permissions to this bucket to an IAM principal. | ||
*/ | ||
grantWrite(identity?: iam.IPrincipal, objectsKeyPattern?: any): void; | ||
grantWrite(identity: iam.IGrantable, objectsKeyPattern?: any): iam.Grant; | ||
/** | ||
@@ -335,3 +318,3 @@ * Grants s3:PutObject* and s3:Abort* permissions for this bucket to an IAM principal. | ||
*/ | ||
grantPut(identity?: iam.IPrincipal, objectsKeyPattern?: any): void; | ||
grantPut(identity: iam.IGrantable, objectsKeyPattern?: any): iam.Grant; | ||
/** | ||
@@ -344,3 +327,3 @@ * Grants s3:DeleteObject* permission to an IAM pricipal for objects | ||
*/ | ||
grantDelete(identity?: iam.IPrincipal, objectsKeyPattern?: any): void; | ||
grantDelete(identity: iam.IGrantable, objectsKeyPattern?: any): iam.Grant; | ||
/** | ||
@@ -356,3 +339,3 @@ * Grants read/write permissions for this bucket and it's contents to an IAM | ||
*/ | ||
grantReadWrite(identity?: iam.IPrincipal, objectsKeyPattern?: any): void; | ||
grantReadWrite(identity: iam.IGrantable, objectsKeyPattern?: any): iam.Grant; | ||
/** | ||
@@ -379,5 +362,4 @@ * Allows unrestricted access to objects from this bucket. | ||
* @param allowedActions the set of S3 actions to allow. Default is "s3:GetObject". | ||
* @returns The `iam.PolicyStatement` object, which can be used to apply e.g. conditions. | ||
*/ | ||
grantPublicAccess(keyPrefix?: string, ...allowedActions: string[]): iam.PolicyStatement; | ||
grantPublicAccess(keyPrefix?: string, ...allowedActions: string[]): iam.Grant; | ||
private grant; | ||
@@ -384,0 +366,0 @@ } |
export * from './bucket'; | ||
export * from './bucket-policy'; | ||
export * from './pipeline-actions'; | ||
export * from './rule'; | ||
export * from './s3.generated'; |
@@ -8,6 +8,5 @@ "use strict"; | ||
__export(require("./bucket-policy")); | ||
__export(require("./pipeline-actions")); | ||
__export(require("./rule")); | ||
// AWS::S3 CloudFormation Resources: | ||
__export(require("./s3.generated")); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLDhCQUF5QjtBQUN6QixxQ0FBZ0M7QUFDaEMsd0NBQW1DO0FBQ25DLDRCQUF1QjtBQUV2QixvQ0FBb0M7QUFDcEMsb0NBQStCIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogZnJvbSAnLi9idWNrZXQnO1xuZXhwb3J0ICogZnJvbSAnLi9idWNrZXQtcG9saWN5JztcbmV4cG9ydCAqIGZyb20gJy4vcGlwZWxpbmUtYWN0aW9ucyc7XG5leHBvcnQgKiBmcm9tICcuL3J1bGUnO1xuXG4vLyBBV1M6OlMzIENsb3VkRm9ybWF0aW9uIFJlc291cmNlczpcbmV4cG9ydCAqIGZyb20gJy4vczMuZ2VuZXJhdGVkJztcbiJdfQ== | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLDhCQUF5QjtBQUN6QixxQ0FBZ0M7QUFDaEMsNEJBQXVCO0FBRXZCLG9DQUFvQztBQUNwQyxvQ0FBK0IiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL2J1Y2tldCc7XG5leHBvcnQgKiBmcm9tICcuL2J1Y2tldC1wb2xpY3knO1xuZXhwb3J0ICogZnJvbSAnLi9ydWxlJztcblxuLy8gQVdTOjpTMyBDbG91ZEZvcm1hdGlvbiBSZXNvdXJjZXM6XG5leHBvcnQgKiBmcm9tICcuL3MzLmdlbmVyYXRlZCc7XG4iXX0= |
{ | ||
"name": "@aws-cdk/aws-s3", | ||
"version": "0.27.0", | ||
"version": "0.28.0", | ||
"description": "CDK Constructs for AWS S3", | ||
@@ -61,24 +61,22 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@aws-cdk/assert": "^0.27.0", | ||
"cdk-build-tools": "^0.27.0", | ||
"cdk-integ-tools": "^0.27.0", | ||
"cfn2ts": "^0.27.0", | ||
"pkglint": "^0.27.0" | ||
"@aws-cdk/assert": "^0.28.0", | ||
"cdk-build-tools": "^0.28.0", | ||
"cdk-integ-tools": "^0.28.0", | ||
"cfn2ts": "^0.28.0", | ||
"pkglint": "^0.28.0" | ||
}, | ||
"dependencies": { | ||
"@aws-cdk/aws-codepipeline-api": "^0.27.0", | ||
"@aws-cdk/aws-events": "^0.27.0", | ||
"@aws-cdk/aws-iam": "^0.27.0", | ||
"@aws-cdk/aws-kms": "^0.27.0", | ||
"@aws-cdk/aws-s3-notifications": "^0.27.0", | ||
"@aws-cdk/cdk": "^0.27.0" | ||
"@aws-cdk/aws-events": "^0.28.0", | ||
"@aws-cdk/aws-iam": "^0.28.0", | ||
"@aws-cdk/aws-kms": "^0.28.0", | ||
"@aws-cdk/aws-s3-notifications": "^0.28.0", | ||
"@aws-cdk/cdk": "^0.28.0" | ||
}, | ||
"homepage": "https://github.com/awslabs/aws-cdk", | ||
"peerDependencies": { | ||
"@aws-cdk/aws-codepipeline-api": "^0.27.0", | ||
"@aws-cdk/aws-events": "^0.27.0", | ||
"@aws-cdk/aws-iam": "^0.27.0", | ||
"@aws-cdk/aws-kms": "^0.27.0", | ||
"@aws-cdk/aws-s3-notifications": "^0.27.0", | ||
"@aws-cdk/cdk": "^0.27.0" | ||
"@aws-cdk/aws-events": "^0.28.0", | ||
"@aws-cdk/aws-iam": "^0.28.0", | ||
"@aws-cdk/aws-kms": "^0.28.0", | ||
"@aws-cdk/aws-s3-notifications": "^0.28.0", | ||
"@aws-cdk/cdk": "^0.28.0" | ||
}, | ||
@@ -85,0 +83,0 @@ "engines": { |
@@ -85,94 +85,2 @@ ## AWS S3 Construct Library | ||
### Buckets as sources in CodePipeline | ||
This package also defines an Action that allows you to use a | ||
Bucket as a source in CodePipeline: | ||
```ts | ||
import codepipeline = require('@aws-cdk/aws-codepipeline'); | ||
import s3 = require('@aws-cdk/aws-s3'); | ||
const sourceBucket = new s3.Bucket(this, 'MyBucket', { | ||
versioned: true, // a Bucket used as a source in CodePipeline must be versioned | ||
}); | ||
const pipeline = new codepipeline.Pipeline(this, 'MyPipeline'); | ||
const sourceAction = new s3.PipelineSourceAction({ | ||
actionName: 'S3Source', | ||
bucket: sourceBucket, | ||
bucketKey: 'path/to/file.zip', | ||
}); | ||
pipeline.addStage({ | ||
name: 'Source', | ||
actions: [sourceAction], | ||
}); | ||
``` | ||
You can also create the action from the Bucket directly: | ||
```ts | ||
// equivalent to the code above: | ||
const sourceAction = sourceBucket.toCodePipelineSourceAction({ | ||
actionName: 'S3Source', | ||
bucketKey: 'path/to/file.zip', | ||
}); | ||
``` | ||
By default, the Pipeline will poll the Bucket to detect changes. | ||
You can change that behavior to use CloudWatch Events by setting the `pollForSourceChanges` | ||
property to `false` (it's `true` by default). | ||
If you do that, make sure the source Bucket is part of an AWS CloudTrail Trail - | ||
otherwise, the CloudWatch Events will not be emitted, | ||
and your Pipeline will not react to changes in the Bucket. | ||
You can do it through the CDK: | ||
```typescript | ||
import cloudtrail = require('@aws-cdk/aws-cloudtrail'); | ||
const key = 'some/key.zip'; | ||
const trail = new cloudtrail.CloudTrail(this, 'CloudTrail'); | ||
trail.addS3EventSelector([sourceBucket.arnForObjects(key)], cloudtrail.ReadWriteType.WriteOnly); | ||
const sourceAction = sourceBucket.toCodePipelineSourceAction({ | ||
actionName: 'S3Source', | ||
bucketKey: key, | ||
pollForSourceChanges: false, // default: true | ||
}); | ||
``` | ||
### Buckets as deploy targets in CodePipeline | ||
This package also defines an Action that allows you to use a | ||
Bucket as a deployment target in CodePipeline: | ||
```ts | ||
import codepipeline = require('@aws-cdk/aws-codepipeline'); | ||
import s3 = require('@aws-cdk/aws-s3'); | ||
const targetBucket = new s3.Bucket(this, 'MyBucket', {}); | ||
const pipeline = new codepipeline.Pipeline(this, 'MyPipeline'); | ||
const deployAction = new s3.PipelineDeployAction({ | ||
actionName: 'S3Deploy', | ||
stage: deployStage, | ||
bucket: targetBucket, | ||
inputArtifact: sourceAction.outputArtifact, | ||
}); | ||
const deployStage = pipeline.addStage({ | ||
name: 'Deploy', | ||
actions: [deployAction], | ||
}); | ||
``` | ||
You can also create the action from the Bucket directly: | ||
```ts | ||
// equivalent to the code above: | ||
const deployAction = targetBucket.toCodePipelineDeployAction({ | ||
actionName: 'S3Deploy', | ||
extract: false, // default: true | ||
objectKey: 'path/in/bucket', // required if extract is false | ||
inputArtifact: sourceAction.outputArtifact, | ||
}); | ||
``` | ||
### Sharing buckets between stacks | ||
@@ -179,0 +87,0 @@ |
@@ -30,2 +30,3 @@ import { Test } from 'nodeunit'; | ||
'can be used to grant reciprocal permissions to an identity'(test: Test): void; | ||
'grant permissions to non-identity principal'(test: Test): void; | ||
'if an encryption key is included, encrypt/decrypt permissions are also added both ways'(test: Test): void; | ||
@@ -32,0 +33,0 @@ }; |
@@ -37,5 +37,2 @@ { | ||
{ | ||
"path": "../aws-codepipeline-api" | ||
}, | ||
{ | ||
"path": "../aws-events" | ||
@@ -42,0 +39,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10
1053189
56
7407
171
+ Added@aws-cdk/aws-events@0.28.0(transitive)
+ Added@aws-cdk/aws-iam@0.28.0(transitive)
+ Added@aws-cdk/aws-kms@0.28.0(transitive)
+ Added@aws-cdk/aws-s3-notifications@0.28.0(transitive)
+ Added@aws-cdk/cdk@0.28.0(transitive)
+ Added@aws-cdk/cx-api@0.28.0(transitive)
+ Added@aws-cdk/region-info@0.28.0(transitive)
- Removed@aws-cdk/aws-codepipeline-api@0.27.0(transitive)
- Removed@aws-cdk/aws-events@0.27.0(transitive)
- Removed@aws-cdk/aws-iam@0.27.0(transitive)
- Removed@aws-cdk/aws-kms@0.27.0(transitive)
- Removed@aws-cdk/aws-s3-notifications@0.27.0(transitive)
- Removed@aws-cdk/cdk@0.27.0(transitive)
- Removed@aws-cdk/cx-api@0.27.0(transitive)
- Removed@aws-cdk/region-info@0.27.0(transitive)
Updated@aws-cdk/aws-events@^0.28.0
Updated@aws-cdk/aws-iam@^0.28.0
Updated@aws-cdk/aws-kms@^0.28.0
Updated@aws-cdk/cdk@^0.28.0