@Generated(value="jsii-pacmak/1.74.0 (build 6d08790)", date="2023-02-09T02:01:26.354Z") @Stability(value=Experimental) public abstract class Code extends software.amazon.jsii.JsiiObject
Example:
Canary canary = Canary.Builder.create(this, "MyCanary")
.schedule(Schedule.rate(Duration.minutes(5)))
.test(Test.custom(CustomTestOptions.builder()
.code(Code.fromAsset(join(__dirname, "canary")))
.handler("index.handler")
.build()))
.runtime(Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_8)
.environmentVariables(Map.of(
"stage", "prod"))
.build();
| Modifier | Constructor and Description |
|---|---|
protected |
Code() |
protected |
Code(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
Code(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
abstract CodeConfig |
bind(software.constructs.Construct scope,
String handler,
RuntimeFamily family)
(experimental) Called when the canary is initialized to allow this object to bind to the stack, add resources and have fun.
|
static AssetCode |
fromAsset(String assetPath)
(experimental) Specify code from a local path.
|
static AssetCode |
fromAsset(String assetPath,
AssetOptions options)
(experimental) Specify code from a local path.
|
static S3Code |
fromBucket(IBucket bucket,
String key)
(experimental) Specify code from an s3 bucket.
|
static S3Code |
fromBucket(IBucket bucket,
String key,
String objectVersion)
(experimental) Specify code from an s3 bucket.
|
static InlineCode |
fromInline(String code)
(experimental) Specify code inline.
|
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetprotected Code(software.amazon.jsii.JsiiObjectRef objRef)
protected Code(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Experimental) protected Code()
@Stability(value=Experimental) @NotNull public static AssetCode fromAsset(@NotNull String assetPath, @Nullable AssetOptions options)
Path must include the folder structure nodejs/node_modules/myCanaryFilename.js.
assetPath - Either a directory or a .zip file. This parameter is required.options - @Stability(value=Experimental) @NotNull public static AssetCode fromAsset(@NotNull String assetPath)
Path must include the folder structure nodejs/node_modules/myCanaryFilename.js.
assetPath - Either a directory or a .zip file. This parameter is required.@Stability(value=Experimental) @NotNull public static S3Code fromBucket(@NotNull IBucket bucket, @NotNull String key, @Nullable String objectVersion)
The object in the s3 bucket must be a .zip file that contains
the structure nodejs/node_modules/myCanaryFilename.js.
bucket - The S3 bucket. This parameter is required.key - The object key. This parameter is required.objectVersion - Optional S3 object version.@Stability(value=Experimental) @NotNull public static S3Code fromBucket(@NotNull IBucket bucket, @NotNull String key)
The object in the s3 bucket must be a .zip file that contains
the structure nodejs/node_modules/myCanaryFilename.js.
bucket - The S3 bucket. This parameter is required.key - The object key. This parameter is required.@Stability(value=Experimental) @NotNull public static InlineCode fromInline(@NotNull String code)
code - The actual handler code (limited to 5MB). This parameter is required.@Stability(value=Experimental) @NotNull public abstract CodeConfig bind(@NotNull software.constructs.Construct scope, @NotNull String handler, @NotNull RuntimeFamily family)
scope - The binding scope. This parameter is required.handler - This parameter is required.family - This parameter is required.Copyright © 2023. All rights reserved.