@Generated(value="jsii-pacmak/1.74.0 (build 6d08790)",
date="2023-03-22T19:35:43.939Z")
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_1) .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,
java.lang.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(java.lang.String assetPath)
(experimental) Specify code from a local path.
|
static AssetCode |
fromAsset(java.lang.String assetPath,
AssetOptions options)
(experimental) Specify code from a local path.
|
static S3Code |
fromBucket(IBucket bucket,
java.lang.String key)
(experimental) Specify code from an s3 bucket.
|
static S3Code |
fromBucket(IBucket bucket,
java.lang.String key,
java.lang.String objectVersion)
(experimental) Specify code from an s3 bucket.
|
static InlineCode |
fromInline(java.lang.String code)
(experimental) Specify code inline.
|
protected Code(software.amazon.jsii.JsiiObjectRef objRef)
protected Code(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
protected Code()
public static AssetCode fromAsset(java.lang.String assetPath, 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
- public static AssetCode fromAsset(java.lang.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.public static S3Code fromBucket(IBucket bucket, java.lang.String key, java.lang.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.public static S3Code fromBucket(IBucket bucket, java.lang.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.public static InlineCode fromInline(java.lang.String code)
code
- The actual handler code (limited to 4KiB). This parameter is required.public abstract CodeConfig bind(software.constructs.Construct scope, java.lang.String handler, RuntimeFamily family)
scope
- The binding scope. This parameter is required.handler
- This parameter is required.family
- This parameter is required.