Class Code
java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.synthetics.Code
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable
- Direct Known Subclasses:
AssetCode
,InlineCode
,S3Code
@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)",
date="2023-06-19T16:30:40.468Z")
@Stability(Experimental)
public abstract class Code
extends software.amazon.jsii.JsiiObject
(experimental) The code the canary should execute.
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();
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract 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
(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.Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
Code
protected Code(software.amazon.jsii.JsiiObjectRef objRef) -
Code
protected Code(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
Code
@Stability(Experimental) protected Code()
-
-
Method Details
-
fromAsset
@Stability(Experimental) @NotNull public static AssetCode fromAsset(@NotNull String assetPath, @Nullable AssetOptions options) (experimental) Specify code from a local path.Path must include the folder structure
nodejs/node_modules/myCanaryFilename.js
.- Parameters:
assetPath
- Either a directory or a .zip file. This parameter is required.options
-- Returns:
AssetCode
associated with the specified path.- See Also:
-
fromAsset
(experimental) Specify code from a local path.Path must include the folder structure
nodejs/node_modules/myCanaryFilename.js
.- Parameters:
assetPath
- Either a directory or a .zip file. This parameter is required.- Returns:
AssetCode
associated with the specified path.- See Also:
-
fromBucket
@Stability(Experimental) @NotNull public static S3Code fromBucket(@NotNull IBucket bucket, @NotNull String key, @Nullable String objectVersion) (experimental) Specify code from an s3 bucket.The object in the s3 bucket must be a .zip file that contains the structure
nodejs/node_modules/myCanaryFilename.js
.- Parameters:
bucket
- The S3 bucket. This parameter is required.key
- The object key. This parameter is required.objectVersion
- Optional S3 object version.- Returns:
S3Code
associated with the specified S3 object.- See Also:
-
fromBucket
@Stability(Experimental) @NotNull public static S3Code fromBucket(@NotNull IBucket bucket, @NotNull String key) (experimental) Specify code from an s3 bucket.The object in the s3 bucket must be a .zip file that contains the structure
nodejs/node_modules/myCanaryFilename.js
.- Parameters:
bucket
- The S3 bucket. This parameter is required.key
- The object key. This parameter is required.- Returns:
S3Code
associated with the specified S3 object.- See Also:
-
fromInline
(experimental) Specify code inline.- Parameters:
code
- The actual handler code (limited to 4KiB). This parameter is required.- Returns:
InlineCode
with inline code.
-
bind
@Stability(Experimental) @NotNull public abstract CodeConfig bind(@NotNull software.constructs.Construct scope, @NotNull String handler, @NotNull RuntimeFamily family) (experimental) Called when the canary is initialized to allow this object to bind to the stack, add resources and have fun.- Parameters:
scope
- The binding scope. This parameter is required.handler
- This parameter is required.family
- This parameter is required.- Returns:
- a bound
CodeConfig
.
-