-
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.
feat(stepfunctions): add service integrations (#1646)
Introducing the `@aws-cdk/aws-stepfunctions-tasks` package, with service integrations for ECS, SNS and SQS. Lambda and Activity integrations have been moved there as well. Add jest bindings for `haveResource` and `haveResourceLike`. Allow specifying `placementConstraints` and `placementStrategies` in the constructor of `EC2Service`. Exposing parts of `TokenMap` so that the reverse mapping of string => Token can be used by non-core libraries, if they need to embed non-literal data representation facilities into complex data structures (used in the SFN tasks to represent data that is extracted from the state JSON via a JSONPath). BREAKING CHANGES * If your using Lambdas or Activities in StepFunctions workflows, you must now instantiate `InvokeFunction` or `InvokeActivity` from the `@aws-cdk/aws-stepfunctions-tasks` package around it. * `PlacementConstraint` used in task definitions is now a union object, constructed using factory functions on the `PlacementConstraint` class. * Empty placement constraints and strategies will no longer render in the CloudFormation template. This may appear as diffs showing an empty line.
- Loading branch information
Showing
100 changed files
with
13,867 additions
and
1,231 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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { Stack } from "@aws-cdk/cdk"; | ||
import { SynthesizedStack } from "@aws-cdk/cx-api"; | ||
import { HaveResourceAssertion, ResourcePart } from "./lib/assertions/have-resource"; | ||
import { expect as ourExpect } from './lib/expect'; | ||
|
||
declare global { | ||
namespace jest { | ||
interface Matchers<R> { | ||
toHaveResource(resourceType: string, | ||
properties?: any, | ||
comparison?: ResourcePart): R; | ||
|
||
toHaveResourceLike(resourceType: string, | ||
properties?: any, | ||
comparison?: ResourcePart): R; | ||
} | ||
} | ||
} | ||
|
||
expect.extend({ | ||
toHaveResource( | ||
actual: SynthesizedStack | Stack, | ||
resourceType: string, | ||
properties?: any, | ||
comparison?: ResourcePart) { | ||
|
||
const assertion = new HaveResourceAssertion(resourceType, properties, comparison, false); | ||
return assertHaveResource(assertion, actual); | ||
}, | ||
toHaveResourceLike( | ||
actual: SynthesizedStack | Stack, | ||
resourceType: string, | ||
properties?: any, | ||
comparison?: ResourcePart) { | ||
|
||
const assertion = new HaveResourceAssertion(resourceType, properties, comparison, true); | ||
return assertHaveResource(assertion, actual); | ||
} | ||
}); | ||
|
||
function assertHaveResource(assertion: HaveResourceAssertion, actual: SynthesizedStack | Stack) { | ||
const inspector = ourExpect(actual); | ||
const pass = assertion.assertUsing(inspector); | ||
if (pass) { | ||
return { | ||
pass, | ||
message: () => `Not ` + assertion.generateErrorMessage(), | ||
}; | ||
} else { | ||
return { | ||
pass, | ||
message: () => assertion.generateErrorMessage(), | ||
}; | ||
} | ||
} |
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
Oops, something went wrong.