-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(synthetics): support canary environment variables (#15082)
Add support for canary environment variables that will be threaded to the underlying Lambda function. This allows multiple canaries to use the same source code by extracting configuration to the resource specification. Also makes the README snippets compile since it was hard to tell whether my changes were correct. closes #10515 refer #9300 Co-authored-by: Florian Chazal <[email protected]> ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
1 parent
dc3cf13
commit df9f13f
Showing
5 changed files
with
140 additions
and
42 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
21 changes: 21 additions & 0 deletions
21
packages/@aws-cdk/aws-synthetics/rosetta/canary.ts-fixture
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,21 @@ | ||
// Fixture with a canary already created, named `canary` | ||
import { Construct, Duration, Stack } from '@aws-cdk/core'; | ||
import * as synthetics from '@aws-cdk/aws-synthetics'; | ||
import * as path from 'path'; | ||
|
||
class Fixture extends Stack { | ||
constructor(scope: Construct, id: string) { | ||
super(scope, id); | ||
|
||
const canary = new synthetics.Canary(this, 'MyCanary', { | ||
schedule: synthetics.Schedule.rate(Duration.minutes(5)), | ||
test: synthetics.Test.custom({ | ||
code: synthetics.Code.fromAsset(path.join(__dirname, 'canary')), | ||
handler: 'index.handler', | ||
}), | ||
runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_1, | ||
}); | ||
|
||
/// here | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
packages/@aws-cdk/aws-synthetics/rosetta/default.ts-fixture
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,12 @@ | ||
// Fixture with packages imported, but nothing else | ||
import { Construct, Duration, Stack } from '@aws-cdk/core'; | ||
import * as synthetics from '@aws-cdk/aws-synthetics'; | ||
import * as path from 'path'; | ||
|
||
class Fixture extends Stack { | ||
constructor(scope: Construct, id: string) { | ||
super(scope, id); | ||
|
||
/// here | ||
} | ||
} |
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