Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(events): better modeling of CW Event Targets #2576

Merged
merged 37 commits into from
May 20, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
7112f84
WIP
rix0rrr May 8, 2019
065d4fe
Merge remote-tracking branch 'origin/master' into huijbers/ecs-events
rix0rrr May 8, 2019
fffe4ad
Trying to abstract over CWE input
rix0rrr May 9, 2019
ddc7584
Make resolve framework to more general, get rid of global options
rix0rrr May 9, 2019
a397a2e
asEventRuleTarget => bind
rix0rrr May 9, 2019
9c0f3bf
Group CloudFormation aware routines together
rix0rrr May 10, 2019
2e717ad
WIP
rix0rrr May 10, 2019
43e01d6
Rewrite toJSON() in terms of new resolver mechanisms
rix0rrr May 10, 2019
16d74a9
Merge commit 'fffe4ad' into huijbers/ecs-events
rix0rrr May 10, 2019
32a56e7
Using new Token mechanisms to implement EventField substitution
rix0rrr May 10, 2019
e50265a
Fix JSII complaints by reodering exports
rix0rrr May 10, 2019
4b1d82a
Object-scoped path replacement works
rix0rrr May 10, 2019
2343be8
Mass implement tasks
rix0rrr May 14, 2019
ef204ac
Fix some more build issues
rix0rrr May 14, 2019
08a444a
Improve error message for string key resolve
rix0rrr May 14, 2019
46725eb
Fix a bad bug about cross-stack references in a lazy context
rix0rrr May 15, 2019
e01e3bc
Make the API of resolving jsii-exportable
rix0rrr May 15, 2019
066c521
Add in awsvpcconfig, state machine
rix0rrr May 15, 2019
0405f41
Get rid of premature resolution during toCloudFormation()
rix0rrr May 15, 2019
c5d7446
Fix API gateway token issues
rix0rrr May 16, 2019
b9ad058
Add tests
rix0rrr May 16, 2019
2d000d5
Remove AssignPublicIp default in test
rix0rrr May 17, 2019
52377d9
Don't use overrides during rendering in Pipeline
rix0rrr May 17, 2019
8e7e480
Centralize role creation, update integ tests
rix0rrr May 17, 2019
f8ba529
Update another expectation
rix0rrr May 17, 2019
fa04166
Token JSONification no longer fails
rix0rrr May 17, 2019
4ccf95b
Undo default change
rix0rrr May 17, 2019
02a1451
Also undo S3Selector change
rix0rrr May 17, 2019
22e588c
Undo test change
rix0rrr May 17, 2019
f79599c
ID rename back to plural
rix0rrr May 17, 2019
dd8322f
Update decdk snapshot
rix0rrr May 19, 2019
e0302ce
Merge remote-tracking branch 'origin/master' into huijbers/ecs-events
rix0rrr May 20, 2019
42673c0
Fix some build
rix0rrr May 20, 2019
5127d22
Update ECS README
rix0rrr May 20, 2019
a745c73
Merge branch 'huijbers/ecs-events' of github.com:awslabs/aws-cdk into…
rix0rrr May 20, 2019
c55c048
Simplify names
rix0rrr May 20, 2019
80f020e
Fix integ test
rix0rrr May 20, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
WIP
  • Loading branch information
rix0rrr committed May 10, 2019
commit 2e717ad6ea502fa98e4eb1b39a0993782c6e17b3
1 change: 0 additions & 1 deletion packages/@aws-cdk/aws-events/test/test.rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ export = {
test.done();
},


'rule can be disabled'(test: Test) {
// GIVEN
const stack = new cdk.Stack();
Expand Down
18 changes: 18 additions & 0 deletions packages/@aws-cdk/cdk/lib/cloudformation-lang.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,24 @@ export class CloudFormationLang {
* @param context The Construct from which to resolve any Tokens found in the object
*/
public static toJSON(obj: any): string {
// This works in two stages:
//
// First, resolve everything. This gets rid of the lazy evaluations, evaluation
// to the real types of things (for example, would a function return a string, an
// intrinsic, or a number? We have to resolve to know).
//
// We then to through the returned result, identify things that evaluated to
// CloudFormation intrinsics, and re-wrap those in Tokens that have a
// toJSON() method returning their string representation. If we then call
// JSON.stringify() on that result, that gives us essentially the same
// string that we started with, except with the non-token characters quoted.
//
// {"field": "${TOKEN}"} --> {\"field\": \"${TOKEN}\"}
//
// A final resolve() on that string (done by the framework) will yield the string
// we're after.


return new Token((ctx: IResolveContext) => {
// Resolve inner value first so that if they evaluate to literals, we
// maintain the type (and discard 'undefined's).
Expand Down
5 changes: 5 additions & 0 deletions packages/@aws-cdk/cdk/lib/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ export class Token {
* it's not possible to do this properly, so we just throw an error here.
*/
public toJSON(): any {
// We can't do the right work here because in case we contain a function, we
// won't know the type of value that function represents (in the simplest
// case, string or number), and we can't know that without an
// IResolveContext to actually do the resolution, which we don't have.

// tslint:disable-next-line:max-line-length
throw new Error('JSON.stringify() cannot be applied to structure with a Token in it. Use this.node.stringifyJson() instead.');
}
Expand Down