@aws-blocks/bb-file-bucket 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cdk.js +2 -2
- package/dist/index.cdk.test.js +5 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/src/index.cdk.test.ts +5 -0
- package/src/index.cdk.ts +2 -2
- package/src/version.ts +1 -1
package/dist/index.cdk.js
CHANGED
|
@@ -29,7 +29,7 @@ export class FileBucket extends Scope {
|
|
|
29
29
|
// `fromExisting`: don't provision; bind to the pre-existing bucket and
|
|
30
30
|
// grant read/write to the Blocks runtime Lambda.
|
|
31
31
|
this.bucket = s3.Bucket.fromBucketName(this, 'bucket', options.bucket.bucketName);
|
|
32
|
-
this.bucket.grantReadWrite(this.
|
|
32
|
+
this.bucket.grantReadWrite(this.executionRole);
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
35
|
// In sandbox mode, default to DESTROY + autoDeleteObjects so
|
|
@@ -70,6 +70,6 @@ export class FileBucket extends Scope {
|
|
|
70
70
|
}] : undefined,
|
|
71
71
|
})),
|
|
72
72
|
});
|
|
73
|
-
this.bucket.grantReadWrite(this.
|
|
73
|
+
this.bucket.grantReadWrite(this.executionRole);
|
|
74
74
|
}
|
|
75
75
|
}
|
package/dist/index.cdk.test.js
CHANGED
|
@@ -15,15 +15,20 @@ import { Scope, DEFAULT_NODE_RUNTIME } from '@aws-blocks/core/cdk';
|
|
|
15
15
|
import { FileBucket } from './index.cdk.js';
|
|
16
16
|
class StubBlocksStack extends cdk.Stack {
|
|
17
17
|
handler;
|
|
18
|
+
executionRole;
|
|
18
19
|
id;
|
|
19
20
|
constructor(scope, id) {
|
|
20
21
|
super(scope, id);
|
|
21
22
|
this.id = id;
|
|
22
23
|
globalThis.CURRENT_BLOCKS_STACK = this;
|
|
24
|
+
this.executionRole = new cdk.aws_iam.Role(this, 'BlocksRole', {
|
|
25
|
+
assumedBy: new cdk.aws_iam.ServicePrincipal('lambda.amazonaws.com'),
|
|
26
|
+
});
|
|
23
27
|
this.handler = new cdk.aws_lambda.Function(this, 'StubHandler', {
|
|
24
28
|
runtime: DEFAULT_NODE_RUNTIME,
|
|
25
29
|
handler: 'index.handler',
|
|
26
30
|
code: cdk.aws_lambda.Code.fromInline('exports.handler = async () => {};'),
|
|
31
|
+
role: this.executionRole,
|
|
27
32
|
});
|
|
28
33
|
}
|
|
29
34
|
}
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-blocks/bb-file-bucket",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/aws-devtools-labs/aws-blocks.git",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"test": "node --test dist/index.test.js dist/index.cdk.test.js dist/scan.test.js dist/file-server.test.js dist/url-encoding.test.js dist/path-containment.test.js dist/bucket-name.test.js"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@aws-blocks/bb-logger": "^0.1.
|
|
54
|
-
"@aws-blocks/core": "^0.
|
|
53
|
+
"@aws-blocks/bb-logger": "^0.1.5",
|
|
54
|
+
"@aws-blocks/core": "^0.3.0",
|
|
55
55
|
"@aws-sdk/client-s3": "^3.0.0",
|
|
56
56
|
"@aws-sdk/s3-request-presigner": "^3.0.0"
|
|
57
57
|
},
|
package/src/index.cdk.test.ts
CHANGED
|
@@ -18,15 +18,20 @@ import { FileBucket } from './index.cdk.js';
|
|
|
18
18
|
|
|
19
19
|
class StubBlocksStack extends cdk.Stack {
|
|
20
20
|
public readonly handler: cdk.aws_lambda.Function;
|
|
21
|
+
public readonly executionRole: cdk.aws_iam.IRole;
|
|
21
22
|
public readonly id: string;
|
|
22
23
|
constructor(scope: Construct, id: string) {
|
|
23
24
|
super(scope, id);
|
|
24
25
|
this.id = id;
|
|
25
26
|
(globalThis as any).CURRENT_BLOCKS_STACK = this;
|
|
27
|
+
this.executionRole = new cdk.aws_iam.Role(this, 'BlocksRole', {
|
|
28
|
+
assumedBy: new cdk.aws_iam.ServicePrincipal('lambda.amazonaws.com'),
|
|
29
|
+
});
|
|
26
30
|
this.handler = new cdk.aws_lambda.Function(this, 'StubHandler', {
|
|
27
31
|
runtime: DEFAULT_NODE_RUNTIME,
|
|
28
32
|
handler: 'index.handler',
|
|
29
33
|
code: cdk.aws_lambda.Code.fromInline('exports.handler = async () => {};'),
|
|
34
|
+
role: this.executionRole,
|
|
30
35
|
});
|
|
31
36
|
}
|
|
32
37
|
}
|
package/src/index.cdk.ts
CHANGED
|
@@ -39,7 +39,7 @@ export class FileBucket<O extends FileBucketOptions = FileBucketOptions> extends
|
|
|
39
39
|
// `fromExisting`: don't provision; bind to the pre-existing bucket and
|
|
40
40
|
// grant read/write to the Blocks runtime Lambda.
|
|
41
41
|
this.bucket = s3.Bucket.fromBucketName(this, 'bucket', options.bucket.bucketName);
|
|
42
|
-
this.bucket.grantReadWrite(this.
|
|
42
|
+
this.bucket.grantReadWrite(this.executionRole);
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -84,6 +84,6 @@ export class FileBucket<O extends FileBucketOptions = FileBucketOptions> extends
|
|
|
84
84
|
})),
|
|
85
85
|
});
|
|
86
86
|
|
|
87
|
-
this.bucket.grantReadWrite(this.
|
|
87
|
+
this.bucket.grantReadWrite(this.executionRole);
|
|
88
88
|
}
|
|
89
89
|
}
|
package/src/version.ts
CHANGED