-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(toolkit): pass context to cx builders (#32996)
### Issue #32994 Closes #32994 ### Reason for this change Previously it was not possible to provide external context. ### Description of changes Cloud Assembly Source Builder now optionally take a Context object that is provided to the source when the assembly is produced. ### Describe any new or updated permissions being added n/a ### Description of how you validated changes Unit tests ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
Showing
8 changed files
with
82 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
packages/@aws-cdk/toolkit/test/_fixtures/external-context/app.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import * as s3 from 'aws-cdk-lib/aws-s3'; | ||
import * as core from 'aws-cdk-lib/core'; | ||
|
||
const app = new core.App(); | ||
const stack = new core.Stack(app, 'Stack1'); | ||
new s3.Bucket(stack, 'MyBucket', { | ||
bucketName: app.node.tryGetContext('externally-provided-bucket-name') | ||
}); | ||
app.synth(); |
11 changes: 11 additions & 0 deletions
11
packages/@aws-cdk/toolkit/test/_fixtures/external-context/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import * as s3 from 'aws-cdk-lib/aws-s3'; | ||
import * as core from 'aws-cdk-lib/core'; | ||
|
||
export default async () => { | ||
const app = new core.App(); | ||
const stack = new core.Stack(app, 'Stack1'); | ||
new s3.Bucket(stack, 'MyBucket', { | ||
bucketName: app.node.tryGetContext('externally-provided-bucket-name'), | ||
}); | ||
return app.synth() as any; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters