-
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.
aws-cdk-events: jsonTemplate versus textTemplate (take 2) (#27)
Input transformers are primarily designed to allow formatting JSON documents that will be sent to the target, in which case the template will look like this: '{ "foo": <bar> }' The tokens in angle brackets are first substituted and then the string is parsed as JSON. If users want to send a string for the target input, they will need the template to look like this: '"This is a <bar> string"' (note the double quotes). To facilitate the common use case where inputs templates should resolve to a string, but also support the JSON option, `TargetInputTemplate` now accepts two mutually exclusive options: `jsonTemplate` and `textTemplate`. `jsonTemplate` is simply passed as-is. If `textTemplate` is used and a value of type string is passed in, it is `JSON.stringify`ed. If a non-string value is passed in, we assume it includes tokens, and we simply wrap with double quotes using `FnConcat`.
- Loading branch information
Showing
5 changed files
with
153 additions
and
52 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,13 +18,13 @@ const repository = new Repository(stack, 'CodeCommitRepo', { repositoryName: 'fo | |
const project = new BuildProject(stack, 'BuildProject', { source: new CodePipelineSource() }); | ||
|
||
const sourceAction = new CodeCommitSource(sourceStage, 'CodeCommitSource', { artifactName: 'Source', repository }); | ||
new CodeBuildAction(buildStage, 'CodeBuildAction', { source: sourceAction, project }); | ||
new CodeBuildAction(buildStage, 'CodeBuildAction', { inputArtifact: sourceAction.artifact, project }); | ||
|
||
const topic = new Topic(stack, 'MyTopic'); | ||
topic.subscribeEmail('benisrae', '[email protected]'); | ||
|
||
pipeline.onStateChange('OnPipelineStateChange').addTarget(topic, { | ||
template: 'Pipeline <pipeline> changed state to <state>', | ||
textTemplate: 'Pipeline <pipeline> changed state to <state>', | ||
pathsMap: { | ||
pipeline: '$.detail.pipeline', | ||
state: '$.detail.state' | ||
|
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