awssynthetics

package
v2.147.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2024 License: Apache-2.0 Imports: 12 Imported by: 2

README

Amazon CloudWatch Synthetics Construct Library

Amazon CloudWatch Synthetics allow you to monitor your application by generating synthetic traffic. The traffic is produced by a canary: a configurable script that runs on a schedule. You configure the canary script to follow the same routes and perform the same actions as a user, which allows you to continually verify your user experience even when you don't have any traffic on your applications.

Canary

To illustrate how to use a canary, assume your application defines the following endpoint:

% curl "https://api.example.com/user/books/topbook/"
The Hitchhikers Guide to the Galaxy

The below code defines a canary that will hit the books/topbook endpoint every 5 minutes:

canary := synthetics.NewCanary(this, jsii.String("MyCanary"), &CanaryProps{
	Schedule: synthetics.Schedule_Rate(awscdk.Duration_Minutes(jsii.Number(5))),
	Test: synthetics.Test_Custom(&CustomTestOptions{
		Code: synthetics.Code_FromAsset(path.join(__dirname, jsii.String("canary"))),
		Handler: jsii.String("index.handler"),
	}),
	Runtime: synthetics.Runtime_SYNTHETICS_NODEJS_PUPPETEER_6_2(),
	EnvironmentVariables: map[string]*string{
		"stage": jsii.String("prod"),
	},
})

The following is an example of an index.js file which exports the handler function:

const synthetics = require('Synthetics');
const log = require('SyntheticsLogger');

const pageLoadBlueprint = async function () {
  // Configure the stage of the API using environment variables
  const url = `https://api.example.com/${process.env.stage}/user/books/topbook/`;

  const page = await synthetics.getPage();
  const response = await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 30000 });
  // Wait for page to render. Increase or decrease wait time based on endpoint being monitored.
  await page.waitFor(15000);
  // This will take a screenshot that will be included in test output artifacts.
  await synthetics.takeScreenshot('loaded', 'loaded');
  const pageTitle = await page.title();
  log.info('Page title: ' + pageTitle);
  if (response.status() !== 200) {
    throw 'Failed to load page!';
  }
};

exports.handler = async () => {
  return await pageLoadBlueprint();
};

Note: The function must be called handler.

The canary will automatically produce a CloudWatch Dashboard:

UI Screenshot

The Canary code will be executed in a lambda function created by Synthetics on your behalf. The Lambda function includes a custom runtime provided by Synthetics. The provided runtime includes a variety of handy tools such as Puppeteer (for nodejs based one) and Chromium.

To learn more about Synthetics capabilities, check out the docs.

Canary Schedule

You can specify the schedule on which a canary runs by providing a Schedule object to the schedule property.

Configure a run rate of up to 60 minutes with Schedule.rate:

schedule := synthetics.Schedule_Rate(awscdk.Duration_Minutes(jsii.Number(5)))

You can also specify a cron expression with Schedule.cron:

schedule := synthetics.Schedule_Cron(&CronOptions{
	Hour: jsii.String("0,8,16"),
})

If you want the canary to run just once upon deployment, you can use Schedule.once().

Deleting underlying resources on canary deletion

When you delete a lambda, the following underlying resources are isolated in your AWS account:

  • Lambda Function that runs your canary script
  • S3 Bucket for artifact storage
  • IAM roles and policies
  • Log Groups in CloudWatch Logs.

To learn more about these underlying resources, see Synthetics Canaries Deletion.

In the CDK, you can configure your canary to delete the underlying lambda function when the canary is deleted. This can be provisioned by setting cleanup: Cleanup.LAMBDA. Note that this will create a custom resource under the hood that takes care of the lambda deletion for you.

canary := synthetics.NewCanary(this, jsii.String("Canary"), &CanaryProps{
	Test: synthetics.Test_Custom(&CustomTestOptions{
		Handler: jsii.String("index.handler"),
		Code: synthetics.Code_FromInline(jsii.String("/* Synthetics handler code")),
	}),
	Cleanup: synthetics.Cleanup_LAMBDA,
	Runtime: synthetics.Runtime_SYNTHETICS_NODEJS_PUPPETEER_6_2(),
})

Note: To properly clean up your canary on deletion, you still have to manually delete other resources like S3 buckets and CloudWatch logs.

Configuring the Canary Script

To configure the script the canary executes, use the test property. The test property accepts a Test instance that can be initialized by the Test class static methods. Currently, the only implemented method is Test.custom(), which allows you to bring your own code. In the future, other methods will be added. Test.custom() accepts code and handler properties -- both are required by Synthetics to create a lambda function on your behalf.

The synthetics.Code class exposes static methods to bundle your code artifacts:

  • code.fromInline(code) - specify an inline script.
  • code.fromAsset(path) - specify a .zip file or a directory in the local filesystem which will be zipped and uploaded to S3 on deployment. See the above Note for directory structure.
  • code.fromBucket(bucket, key[, objectVersion]) - specify an S3 object that contains the .zip file of your runtime code. See the above Note for directory structure.

Using the Code class static initializers:

// To supply the code from a S3 bucket:
import s3 "github.com/aws/aws-cdk-go/awscdk"
// To supply the code inline:
// To supply the code inline:
synthetics.NewCanary(this, jsii.String("Inline Canary"), &CanaryProps{
	Test: synthetics.Test_Custom(&CustomTestOptions{
		Code: synthetics.Code_FromInline(jsii.String("/* Synthetics handler code */")),
		Handler: jsii.String("index.handler"),
	}),
	Runtime: synthetics.Runtime_SYNTHETICS_NODEJS_PUPPETEER_6_2(),
})

// To supply the code from your local filesystem:
// To supply the code from your local filesystem:
synthetics.NewCanary(this, jsii.String("Asset Canary"), &CanaryProps{
	Test: synthetics.Test_*Custom(&CustomTestOptions{
		Code: synthetics.Code_FromAsset(path.join(__dirname, jsii.String("canary"))),
		Handler: jsii.String("index.handler"),
	}),
	Runtime: synthetics.Runtime_SYNTHETICS_NODEJS_PUPPETEER_6_2(),
})
bucket := s3.NewBucket(this, jsii.String("Code Bucket"))
synthetics.NewCanary(this, jsii.String("Bucket Canary"), &CanaryProps{
	Test: synthetics.Test_*Custom(&CustomTestOptions{
		Code: synthetics.Code_FromBucket(bucket, jsii.String("canary.zip")),
		Handler: jsii.String("index.handler"),
	}),
	Runtime: synthetics.Runtime_SYNTHETICS_NODEJS_PUPPETEER_6_2(),
})

Note: Synthetics have a specified folder structure for canaries. For Node scripts supplied via code.fromAsset() or code.fromBucket(), the canary resource requires the following folder structure:

canary/
├── nodejs/
   ├── node_modules/
        ├── <filename>.js

For Python scripts supplied via code.fromAsset() or code.fromBucket(), the canary resource requires the following folder structure:

canary/
├── python/
    ├── <filename>.py

See Synthetics docs.

Running a canary on a VPC

You can specify what VPC a canary executes in. This can allow for monitoring services that may be internal to a specific VPC. To place a canary within a VPC, you can specify the vpc property with the desired VPC to place then canary in. This will automatically attach the appropriate IAM permissions to attach to the VPC. This will also create a Security Group and attach to the default subnets for the VPC unless specified via vpcSubnets and securityGroups.

import ec2 "github.com/aws/aws-cdk-go/awscdk"

var vpc iVpc

synthetics.NewCanary(this, jsii.String("Vpc Canary"), &CanaryProps{
	Test: synthetics.Test_Custom(&CustomTestOptions{
		Code: synthetics.Code_FromAsset(path.join(__dirname, jsii.String("canary"))),
		Handler: jsii.String("index.handler"),
	}),
	Runtime: synthetics.Runtime_SYNTHETICS_NODEJS_PUPPETEER_6_2(),
	Vpc: Vpc,
})

Note: By default, the Synthetics runtime needs access to the S3 and CloudWatch APIs, which will fail in a private subnet without internet access enabled (e.g. an isolated subnnet).

Ensure that the Canary is placed in a VPC either with internet connectivity or with VPC Endpoints for S3 and CloudWatch enabled and configured.

See Synthetics VPC docs.

Alarms

You can configure a CloudWatch Alarm on a canary metric. Metrics are emitted by CloudWatch automatically and can be accessed by the following APIs:

  • canary.metricSuccessPercent() - percentage of successful canary runs over a given time
  • canary.metricDuration() - how much time each canary run takes, in seconds.
  • canary.metricFailed() - number of failed canary runs over a given time

Create an alarm that tracks the canary metric:

import "github.com/aws/aws-cdk-go/awscdk"

var canary canary

cloudwatch.NewAlarm(this, jsii.String("CanaryAlarm"), &AlarmProps{
	Metric: canary.MetricSuccessPercent(),
	EvaluationPeriods: jsii.Number(2),
	Threshold: jsii.Number(90),
	ComparisonOperator: cloudwatch.ComparisonOperator_LESS_THAN_THRESHOLD,
})
Artifacts

You can pass an S3 bucket to store artifacts from canary runs. If you do not, one will be auto-generated when the canary is created. You may add lifecycle rules to the auto-generated bucket.

canary := synthetics.NewCanary(this, jsii.String("MyCanary"), &CanaryProps{
	Schedule: synthetics.Schedule_Rate(awscdk.Duration_Minutes(jsii.Number(5))),
	Test: synthetics.Test_Custom(&CustomTestOptions{
		Code: synthetics.Code_FromAsset(path.join(__dirname, jsii.String("canary"))),
		Handler: jsii.String("index.handler"),
	}),
	Runtime: synthetics.Runtime_SYNTHETICS_NODEJS_PUPPETEER_6_2(),
	ArtifactsBucketLifecycleRules: []lifecycleRule{
		&lifecycleRule{
			Expiration: awscdk.Duration_Days(jsii.Number(30)),
		},
	},
})

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Canary_IsConstruct added in v2.99.0

func Canary_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.

Returns: true if `x` is an object created from a class which extends `Construct`.

func Canary_IsOwnedResource added in v2.99.0

func Canary_IsOwnedResource(construct constructs.IConstruct) *bool

Returns true if the construct was created by CDK, and false otherwise.

func Canary_IsResource added in v2.99.0

func Canary_IsResource(construct constructs.IConstruct) *bool

Check whether the given construct is a Resource.

func CfnCanary_CFN_RESOURCE_TYPE_NAME

func CfnCanary_CFN_RESOURCE_TYPE_NAME() *string

func CfnCanary_IsCfnElement

func CfnCanary_IsCfnElement(x interface{}) *bool

Returns `true` if a construct is a stack element (i.e. part of the synthesized cloudformation template).

Uses duck-typing instead of `instanceof` to allow stack elements from different versions of this library to be included in the same stack.

Returns: The construct as a stack element or undefined if it is not a stack element.

func CfnCanary_IsCfnResource

func CfnCanary_IsCfnResource(x interface{}) *bool

Check whether the given object is a CfnResource.

func CfnCanary_IsConstruct

func CfnCanary_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.

Returns: true if `x` is an object created from a class which extends `Construct`.

func CfnGroup_CFN_RESOURCE_TYPE_NAME added in v2.37.0

func CfnGroup_CFN_RESOURCE_TYPE_NAME() *string

func CfnGroup_IsCfnElement added in v2.37.0

func CfnGroup_IsCfnElement(x interface{}) *bool

Returns `true` if a construct is a stack element (i.e. part of the synthesized cloudformation template).

Uses duck-typing instead of `instanceof` to allow stack elements from different versions of this library to be included in the same stack.

Returns: The construct as a stack element or undefined if it is not a stack element.

func CfnGroup_IsCfnResource added in v2.37.0

func CfnGroup_IsCfnResource(x interface{}) *bool

Check whether the given object is a CfnResource.

func CfnGroup_IsConstruct added in v2.37.0

func CfnGroup_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.

Returns: true if `x` is an object created from a class which extends `Construct`.

func NewAssetCode_Override added in v2.99.0

func NewAssetCode_Override(a AssetCode, assetPath *string, options *awss3assets.AssetOptions)

func NewCanary_Override added in v2.99.0

func NewCanary_Override(c Canary, scope constructs.Construct, id *string, props *CanaryProps)

func NewCfnCanary_Override

func NewCfnCanary_Override(c CfnCanary, scope constructs.Construct, id *string, props *CfnCanaryProps)

func NewCfnGroup_Override added in v2.37.0

func NewCfnGroup_Override(c CfnGroup, scope constructs.Construct, id *string, props *CfnGroupProps)

func NewCode_Override added in v2.99.0

func NewCode_Override(c Code)

func NewInlineCode_Override added in v2.99.0

func NewInlineCode_Override(i InlineCode, code *string)

func NewRuntime_Override added in v2.99.0

func NewRuntime_Override(r Runtime, name *string, family RuntimeFamily)

func NewS3Code_Override added in v2.99.0

func NewS3Code_Override(s S3Code, bucket awss3.IBucket, key *string, objectVersion *string)

Types

type ArtifactsBucketLocation added in v2.99.0

type ArtifactsBucketLocation struct {
	// The s3 location that stores the data of each run.
	Bucket awss3.IBucket `field:"required" json:"bucket" yaml:"bucket"`
	// The S3 bucket prefix.
	//
	// Specify this if you want a more specific path within the artifacts bucket.
	// Default: - no prefix.
	//
	Prefix *string `field:"optional" json:"prefix" yaml:"prefix"`
}

Options for specifying the s3 location that stores the data of each canary run.

The artifacts bucket location **cannot** be updated once the canary is created.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var bucket bucket

artifactsBucketLocation := &ArtifactsBucketLocation{
	Bucket: bucket,

	// the properties below are optional
	Prefix: jsii.String("prefix"),
}

type AssetCode added in v2.99.0

type AssetCode interface {
	Code
	// Called when the canary is initialized to allow this object to bind to the stack, add resources and have fun.
	Bind(scope constructs.Construct, handler *string, family RuntimeFamily) *CodeConfig
}

Canary code from an Asset.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var dockerImage dockerImage
var grantable iGrantable
var localBundling iLocalBundling

assetCode := awscdk.Aws_synthetics.NewAssetCode(jsii.String("assetPath"), &AssetOptions{
	AssetHash: jsii.String("assetHash"),
	AssetHashType: cdk.AssetHashType_SOURCE,
	Bundling: &BundlingOptions{
		Image: dockerImage,

		// the properties below are optional
		BundlingFileAccess: cdk.BundlingFileAccess_VOLUME_COPY,
		Command: []*string{
			jsii.String("command"),
		},
		Entrypoint: []*string{
			jsii.String("entrypoint"),
		},
		Environment: map[string]*string{
			"environmentKey": jsii.String("environment"),
		},
		Local: localBundling,
		Network: jsii.String("network"),
		OutputType: cdk.BundlingOutput_ARCHIVED,
		Platform: jsii.String("platform"),
		SecurityOpt: jsii.String("securityOpt"),
		User: jsii.String("user"),
		Volumes: []dockerVolume{
			&dockerVolume{
				ContainerPath: jsii.String("containerPath"),
				HostPath: jsii.String("hostPath"),

				// the properties below are optional
				Consistency: cdk.DockerVolumeConsistency_CONSISTENT,
			},
		},
		VolumesFrom: []*string{
			jsii.String("volumesFrom"),
		},
		WorkingDirectory: jsii.String("workingDirectory"),
	},
	DeployTime: jsii.Boolean(false),
	Exclude: []*string{
		jsii.String("exclude"),
	},
	FollowSymlinks: cdk.SymlinkFollowMode_NEVER,
	IgnoreMode: cdk.IgnoreMode_GLOB,
	Readers: []*iGrantable{
		grantable,
	},
})

func AssetCode_FromAsset added in v2.99.0

func AssetCode_FromAsset(assetPath *string, options *awss3assets.AssetOptions) AssetCode

Specify code from a local path.

Path must include the folder structure `nodejs/node_modules/myCanaryFilename.js`.

Returns: `AssetCode` associated with the specified path. See: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_WritingCanary.html#CloudWatch_Synthetics_Canaries_write_from_scratch

func Code_FromAsset added in v2.99.0

func Code_FromAsset(assetPath *string, options *awss3assets.AssetOptions) AssetCode

Specify code from a local path.

Path must include the folder structure `nodejs/node_modules/myCanaryFilename.js`.

Returns: `AssetCode` associated with the specified path. See: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_WritingCanary.html#CloudWatch_Synthetics_Canaries_write_from_scratch

func InlineCode_FromAsset added in v2.99.0

func InlineCode_FromAsset(assetPath *string, options *awss3assets.AssetOptions) AssetCode

Specify code from a local path.

Path must include the folder structure `nodejs/node_modules/myCanaryFilename.js`.

Returns: `AssetCode` associated with the specified path. See: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_WritingCanary.html#CloudWatch_Synthetics_Canaries_write_from_scratch

func NewAssetCode added in v2.99.0

func NewAssetCode(assetPath *string, options *awss3assets.AssetOptions) AssetCode

func S3Code_FromAsset added in v2.99.0

func S3Code_FromAsset(assetPath *string, options *awss3assets.AssetOptions) AssetCode

Specify code from a local path.

Path must include the folder structure `nodejs/node_modules/myCanaryFilename.js`.

Returns: `AssetCode` associated with the specified path. See: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_WritingCanary.html#CloudWatch_Synthetics_Canaries_write_from_scratch

type Canary added in v2.99.0

type Canary interface {
	awscdk.Resource
	awsec2.IConnectable
	// Bucket where data from each canary run is stored.
	ArtifactsBucket() awss3.IBucket
	// The canary ID.
	CanaryId() *string
	// The canary Name.
	CanaryName() *string
	// The state of the canary.
	//
	// For example, 'RUNNING', 'STOPPED', 'NOT STARTED', or 'ERROR'.
	CanaryState() *string
	// Access the Connections object.
	//
	// Will fail if not a VPC-enabled Canary.
	Connections() awsec2.Connections
	// The environment this resource belongs to.
	//
	// For resources that are created and managed by the CDK
	// (generally, those created by creating new class instances like Role, Bucket, etc.),
	// this is always the same as the environment of the stack they belong to;
	// however, for imported resources
	// (those obtained from static methods like fromRoleArn, fromBucketName, etc.),
	// that might be different than the stack they were imported into.
	Env() *awscdk.ResourceEnvironment
	// The tree node.
	Node() constructs.Node
	// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
	//
	// This value will resolve to one of the following:
	// - a concrete value (e.g. `"my-awesome-bucket"`)
	// - `undefined`, when a name should be generated by CloudFormation
	// - a concrete name generated automatically during synthesis, in
	//   cross-environment scenarios.
	PhysicalName() *string
	// Execution role associated with this Canary.
	Role() awsiam.IRole
	// The stack in which this resource is defined.
	Stack() awscdk.Stack
	// Apply the given removal policy to this resource.
	//
	// The Removal Policy controls what happens to this resource when it stops
	// being managed by CloudFormation, either because you've removed it from the
	// CDK application or because you've made a change that requires the resource
	// to be replaced.
	//
	// The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
	// account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
	ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
	GeneratePhysicalName() *string
	// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
	//
	// Normally, this token will resolve to `arnAttr`, but if the resource is
	// referenced across environments, `arnComponents` will be used to synthesize
	// a concrete ARN with the resource's physical name. Make sure to reference
	// `this.physicalName` in `arnComponents`.
	GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
	// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
	//
	// Normally, this token will resolve to `nameAttr`, but if the resource is
	// referenced across environments, it will be resolved to `this.physicalName`,
	// which will be a concrete name.
	GetResourceNameAttribute(nameAttr *string) *string
	// Measure the Duration of a single canary run, in seconds.
	// Default: avg over 5 minutes.
	//
	MetricDuration(options *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Measure the number of failed canary runs over a given time period.
	//
	// Default: sum over 5 minutes.
	MetricFailed(options *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Measure the percentage of successful canary runs.
	// Default: avg over 5 minutes.
	//
	MetricSuccessPercent(options *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Returns a string representation of this construct.
	ToString() *string
}

Define a new Canary.

Example:

canary := synthetics.NewCanary(this, jsii.String("MyCanary"), &CanaryProps{
	Schedule: synthetics.Schedule_Rate(awscdk.Duration_Minutes(jsii.Number(5))),
	Test: synthetics.Test_Custom(&CustomTestOptions{
		Code: synthetics.Code_FromAsset(path.join(__dirname, jsii.String("canary"))),
		Handler: jsii.String("index.handler"),
	}),
	Runtime: synthetics.Runtime_SYNTHETICS_NODEJS_PUPPETEER_6_2(),
	EnvironmentVariables: map[string]*string{
		"stage": jsii.String("prod"),
	},
})

func NewCanary added in v2.99.0

func NewCanary(scope constructs.Construct, id *string, props *CanaryProps) Canary

type CanaryProps added in v2.99.0

type CanaryProps struct {
	// Specify the runtime version to use for the canary.
	// See: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_Library.html
	//
	Runtime Runtime `field:"required" json:"runtime" yaml:"runtime"`
	// The type of test that you want your canary to run.
	//
	// Use `Test.custom()` to specify the test to run.
	Test Test `field:"required" json:"test" yaml:"test"`
	// Lifecycle rules for the generated canary artifact bucket.
	//
	// Has no effect
	// if a bucket is passed to `artifactsBucketLocation`. If you pass a bucket
	// to `artifactsBucketLocation`, you can add lifecycle rules to the bucket
	// itself.
	// Default: - no rules applied to the generated bucket.
	//
	ArtifactsBucketLifecycleRules *[]*awss3.LifecycleRule `field:"optional" json:"artifactsBucketLifecycleRules" yaml:"artifactsBucketLifecycleRules"`
	// The s3 location that stores the data of the canary runs.
	// Default: - A new s3 bucket will be created without a prefix.
	//
	ArtifactsBucketLocation *ArtifactsBucketLocation `field:"optional" json:"artifactsBucketLocation" yaml:"artifactsBucketLocation"`
	// The name of the canary.
	//
	// Be sure to give it a descriptive name that distinguishes it from
	// other canaries in your account.
	//
	// Do not include secrets or proprietary information in your canary name. The canary name
	// makes up part of the canary ARN, which is included in outbound calls over the internet.
	// See: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/servicelens_canaries_security.html
	//
	// Default: - A unique name will be generated from the construct ID.
	//
	CanaryName *string `field:"optional" json:"canaryName" yaml:"canaryName"`
	// Specify the underlying resources to be cleaned up when the canary is deleted.
	//
	// Using `Cleanup.LAMBDA` will create a Custom Resource to achieve this.
	// Default: Cleanup.NOTHING
	//
	Cleanup Cleanup `field:"optional" json:"cleanup" yaml:"cleanup"`
	// Key-value pairs that the Synthetics caches and makes available for your canary scripts.
	//
	// Use environment variables
	// to apply configuration changes, such as test and production environment configurations, without changing your
	// Canary script source code.
	// Default: - No environment variables.
	//
	EnvironmentVariables *map[string]*string `field:"optional" json:"environmentVariables" yaml:"environmentVariables"`
	// How many days should failed runs be retained.
	// Default: Duration.days(31)
	//
	FailureRetentionPeriod awscdk.Duration `field:"optional" json:"failureRetentionPeriod" yaml:"failureRetentionPeriod"`
	// Canary execution role.
	//
	// This is the role that will be assumed by the canary upon execution.
	// It controls the permissions that the canary will have. The role must
	// be assumable by the AWS Lambda service principal.
	//
	// If not supplied, a role will be created with all the required permissions.
	// If you provide a Role, you must add the required permissions.
	// See: required permissions: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-executionrolearn
	//
	// Default: - A unique role will be generated for this canary.
	// You can add permissions to roles by calling 'addToRolePolicy'.
	//
	Role awsiam.IRole `field:"optional" json:"role" yaml:"role"`
	// Specify the schedule for how often the canary runs.
	//
	// For example, if you set `schedule` to `rate(10 minutes)`, then the canary will run every 10 minutes.
	// You can set the schedule with `Schedule.rate(Duration)` (recommended) or you can specify an expression using `Schedule.expression()`.
	// Default: 'rate(5 minutes)'.
	//
	Schedule Schedule `field:"optional" json:"schedule" yaml:"schedule"`
	// The list of security groups to associate with the canary's network interfaces.
	//
	// You must provide `vpc` when using this prop.
	// Default: - If the canary is placed within a VPC and a security group is
	// not specified a dedicated security group will be created for this canary.
	//
	SecurityGroups *[]awsec2.ISecurityGroup `field:"optional" json:"securityGroups" yaml:"securityGroups"`
	// Whether or not the canary should start after creation.
	// Default: true.
	//
	StartAfterCreation *bool `field:"optional" json:"startAfterCreation" yaml:"startAfterCreation"`
	// How many days should successful runs be retained.
	// Default: Duration.days(31)
	//
	SuccessRetentionPeriod awscdk.Duration `field:"optional" json:"successRetentionPeriod" yaml:"successRetentionPeriod"`
	// How long the canary will be in a 'RUNNING' state.
	//
	// For example, if you set `timeToLive` to be 1 hour and `schedule` to be `rate(10 minutes)`,
	// your canary will run at 10 minute intervals for an hour, for a total of 6 times.
	// Default: - no limit.
	//
	TimeToLive awscdk.Duration `field:"optional" json:"timeToLive" yaml:"timeToLive"`
	// The VPC where this canary is run.
	//
	// Specify this if the canary needs to access resources in a VPC.
	// Default: - Not in VPC.
	//
	Vpc awsec2.IVpc `field:"optional" json:"vpc" yaml:"vpc"`
	// Where to place the network interfaces within the VPC.
	//
	// You must provide `vpc` when using this prop.
	// Default: - the Vpc default strategy if not specified.
	//
	VpcSubnets *awsec2.SubnetSelection `field:"optional" json:"vpcSubnets" yaml:"vpcSubnets"`
}

Properties for a canary.

Example:

canary := synthetics.NewCanary(this, jsii.String("MyCanary"), &CanaryProps{
	Schedule: synthetics.Schedule_Rate(awscdk.Duration_Minutes(jsii.Number(5))),
	Test: synthetics.Test_Custom(&CustomTestOptions{
		Code: synthetics.Code_FromAsset(path.join(__dirname, jsii.String("canary"))),
		Handler: jsii.String("index.handler"),
	}),
	Runtime: synthetics.Runtime_SYNTHETICS_NODEJS_PUPPETEER_6_2(),
	EnvironmentVariables: map[string]*string{
		"stage": jsii.String("prod"),
	},
})

type CfnCanary

type CfnCanary interface {
	awscdk.CfnResource
	awscdk.IInspectable
	awscdk.ITaggable
	// A structure that contains the configuration for canary artifacts, including the encryption-at-rest settings for artifacts that the canary uploads to Amazon S3.
	ArtifactConfig() interface{}
	SetArtifactConfig(val interface{})
	// The location in Amazon S3 where Synthetics stores artifacts from the runs of this canary.
	ArtifactS3Location() *string
	SetArtifactS3Location(val *string)
	// `Ref` returns the ARN of the Lambda layer where Synthetics stores the canary script code.
	AttrCodeSourceLocationArn() *string
	// The ID of the canary.
	AttrId() *string
	// The state of the canary.
	//
	// For example, `RUNNING` .
	AttrState() *string
	// Options for this resource, such as condition, update policy etc.
	CfnOptions() awscdk.ICfnResourceOptions
	CfnProperties() *map[string]interface{}
	// AWS resource type.
	CfnResourceType() *string
	// Use this structure to input your script code for the canary.
	Code() interface{}
	SetCode(val interface{})
	// Returns: the stack trace of the point where this Resource was created from, sourced
	// from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most
	// node +internal+ entries filtered.
	CreationStack() *[]*string
	// Deletes associated lambda resources created by Synthetics if set to True.
	// Deprecated: this property has been deprecated.
	DeleteLambdaResourcesOnCanaryDeletion() interface{}
	// Deprecated: this property has been deprecated.
	SetDeleteLambdaResourcesOnCanaryDeletion(val interface{})
	// The ARN of the IAM role to be used to run the canary.
	ExecutionRoleArn() *string
	SetExecutionRoleArn(val *string)
	// The number of days to retain data about failed runs of this canary.
	FailureRetentionPeriod() *float64
	SetFailureRetentionPeriod(val *float64)
	// The logical ID for this CloudFormation stack element.
	//
	// The logical ID of the element
	// is calculated from the path of the resource node in the construct tree.
	//
	// To override this value, use `overrideLogicalId(newLogicalId)`.
	//
	// Returns: the logical ID as a stringified token. This value will only get
	// resolved during synthesis.
	LogicalId() *string
	// The name for this canary.
	Name() *string
	SetName(val *string)
	// The tree node.
	Node() constructs.Node
	// Return a string that will be resolved to a CloudFormation `{ Ref }` for this element.
	//
	// If, by any chance, the intrinsic reference of a resource is not a string, you could
	// coerce it to an IResolvable through `Lazy.any({ produce: resource.ref })`.
	Ref() *string
	// A structure that contains input information for a canary run.
	RunConfig() interface{}
	SetRunConfig(val interface{})
	// Specifies the runtime version to use for the canary.
	RuntimeVersion() *string
	SetRuntimeVersion(val *string)
	// A structure that contains information about how often the canary is to run, and when these runs are to stop.
	Schedule() interface{}
	SetSchedule(val interface{})
	// The stack in which this element is defined.
	//
	// CfnElements must be defined within a stack scope (directly or indirectly).
	Stack() awscdk.Stack
	// Specify TRUE to have the canary start making runs immediately after it is created.
	StartCanaryAfterCreation() interface{}
	SetStartCanaryAfterCreation(val interface{})
	// The number of days to retain data about successful runs of this canary.
	SuccessRetentionPeriod() *float64
	SetSuccessRetentionPeriod(val *float64)
	// Tag Manager which manages the tags for this resource.
	Tags() awscdk.TagManager
	// The list of key-value pairs that are associated with the canary.
	TagsRaw() *[]*awscdk.CfnTag
	SetTagsRaw(val *[]*awscdk.CfnTag)
	// Deprecated.
	// Deprecated: use `updatedProperties`
	//
	// Return properties modified after initiation
	//
	// Resources that expose mutable properties should override this function to
	// collect and return the properties object for this resource.
	UpdatedProperites() *map[string]interface{}
	// Return properties modified after initiation.
	//
	// Resources that expose mutable properties should override this function to
	// collect and return the properties object for this resource.
	UpdatedProperties() *map[string]interface{}
	// If this canary performs visual monitoring by comparing screenshots, this structure contains the ID of the canary run to use as the baseline for screenshots, and the coordinates of any parts of the screen to ignore during the visual monitoring comparison.
	VisualReference() interface{}
	SetVisualReference(val interface{})
	// If this canary is to test an endpoint in a VPC, this structure contains information about the subnet and security groups of the VPC endpoint.
	VpcConfig() interface{}
	SetVpcConfig(val interface{})
	// Syntactic sugar for `addOverride(path, undefined)`.
	AddDeletionOverride(path *string)
	// Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
	//
	// This can be used for resources across stacks (or nested stack) boundaries
	// and the dependency will automatically be transferred to the relevant scope.
	AddDependency(target awscdk.CfnResource)
	// Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
	// Deprecated: use addDependency.
	AddDependsOn(target awscdk.CfnResource)
	// Add a value to the CloudFormation Resource Metadata.
	// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
	//
	// Note that this is a different set of metadata from CDK node metadata; this
	// metadata ends up in the stack template under the resource, whereas CDK
	// node metadata ends up in the Cloud Assembly.
	//
	AddMetadata(key *string, value interface{})
	// Adds an override to the synthesized CloudFormation resource.
	//
	// To add a
	// property override, either use `addPropertyOverride` or prefix `path` with
	// "Properties." (i.e. `Properties.TopicName`).
	//
	// If the override is nested, separate each nested level using a dot (.) in the path parameter.
	// If there is an array as part of the nesting, specify the index in the path.
	//
	// To include a literal `.` in the property name, prefix with a `\`. In most
	// programming languages you will need to write this as `"\\."` because the
	// `\` itself will need to be escaped.
	//
	// For example,
	// “`typescript
	// cfnResource.addOverride('Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes', ['myattribute']);
	// cfnResource.addOverride('Properties.GlobalSecondaryIndexes.1.ProjectionType', 'INCLUDE');
	// “`
	// would add the overrides
	// “`json
	// "Properties": {
	//   "GlobalSecondaryIndexes": [
	//     {
	//       "Projection": {
	//         "NonKeyAttributes": [ "myattribute" ]
	//         ...
	//       }
	//       ...
	//     },
	//     {
	//       "ProjectionType": "INCLUDE"
	//       ...
	//     },
	//   ]
	//   ...
	// }
	// “`
	//
	// The `value` argument to `addOverride` will not be processed or translated
	// in any way. Pass raw JSON values in here with the correct capitalization
	// for CloudFormation. If you pass CDK classes or structs, they will be
	// rendered with lowercased key names, and CloudFormation will reject the
	// template.
	AddOverride(path *string, value interface{})
	// Adds an override that deletes the value of a property from the resource definition.
	AddPropertyDeletionOverride(propertyPath *string)
	// Adds an override to a resource property.
	//
	// Syntactic sugar for `addOverride("Properties.<...>", value)`.
	AddPropertyOverride(propertyPath *string, value interface{})
	// Sets the deletion policy of the resource based on the removal policy specified.
	//
	// The Removal Policy controls what happens to this resource when it stops
	// being managed by CloudFormation, either because you've removed it from the
	// CDK application or because you've made a change that requires the resource
	// to be replaced.
	//
	// The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
	// account for data recovery and cleanup later (`RemovalPolicy.RETAIN`). In some
	// cases, a snapshot can be taken of the resource prior to deletion
	// (`RemovalPolicy.SNAPSHOT`). A list of resources that support this policy
	// can be found in the following link:.
	// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html#aws-attribute-deletionpolicy-options
	//
	ApplyRemovalPolicy(policy awscdk.RemovalPolicy, options *awscdk.RemovalPolicyOptions)
	// Returns a token for an runtime attribute of this resource.
	//
	// Ideally, use generated attribute accessors (e.g. `resource.arn`), but this can be used for future compatibility
	// in case there is no generated attribute.
	GetAtt(attributeName *string, typeHint awscdk.ResolutionTypeHint) awscdk.Reference
	// Retrieve a value value from the CloudFormation Resource Metadata.
	// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
	//
	// Note that this is a different set of metadata from CDK node metadata; this
	// metadata ends up in the stack template under the resource, whereas CDK
	// node metadata ends up in the Cloud Assembly.
	//
	GetMetadata(key *string) interface{}
	// Examines the CloudFormation resource and discloses attributes.
	Inspect(inspector awscdk.TreeInspector)
	// Retrieves an array of resources this resource depends on.
	//
	// This assembles dependencies on resources across stacks (including nested stacks)
	// automatically.
	ObtainDependencies() *[]interface{}
	// Get a shallow copy of dependencies between this resource and other resources in the same stack.
	ObtainResourceDependencies() *[]awscdk.CfnResource
	// Overrides the auto-generated logical ID with a specific ID.
	OverrideLogicalId(newLogicalId *string)
	// Indicates that this resource no longer depends on another resource.
	//
	// This can be used for resources across stacks (including nested stacks)
	// and the dependency will automatically be removed from the relevant scope.
	RemoveDependency(target awscdk.CfnResource)
	RenderProperties(props *map[string]interface{}) *map[string]interface{}
	// Replaces one dependency with another.
	ReplaceDependency(target awscdk.CfnResource, newTarget awscdk.CfnResource)
	// Can be overridden by subclasses to determine if this resource will be rendered into the cloudformation template.
	//
	// Returns: `true` if the resource should be included or `false` is the resource
	// should be omitted.
	ShouldSynthesize() *bool
	// Returns a string representation of this construct.
	//
	// Returns: a string representation of this resource.
	ToString() *string
	ValidateProperties(_properties interface{})
}

Creates or updates a canary.

Canaries are scripts that monitor your endpoints and APIs from the outside-in. Canaries help you check the availability and latency of your web services and troubleshoot anomalies by investigating load time data, screenshots of the UI, logs, and metrics. You can set up a canary to run continuously or just once.

To create canaries, you must have the `CloudWatchSyntheticsFullAccess` policy. If you are creating a new IAM role for the canary, you also need the the `iam:CreateRole` , `iam:CreatePolicy` and `iam:AttachRolePolicy` permissions. For more information, see [Necessary Roles and Permissions](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_Roles) .

Do not include secrets or proprietary information in your canary names. The canary name makes up part of the Amazon Resource Name (ARN) for the canary, and the ARN is included in outbound calls over the internet. For more information, see [Security Considerations for Synthetics Canaries](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/servicelens_canaries_security.html) .

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

cfnCanary := awscdk.Aws_synthetics.NewCfnCanary(this, jsii.String("MyCfnCanary"), &CfnCanaryProps{
	ArtifactS3Location: jsii.String("artifactS3Location"),
	Code: &CodeProperty{
		Handler: jsii.String("handler"),

		// the properties below are optional
		S3Bucket: jsii.String("s3Bucket"),
		S3Key: jsii.String("s3Key"),
		S3ObjectVersion: jsii.String("s3ObjectVersion"),
		Script: jsii.String("script"),
		SourceLocationArn: jsii.String("sourceLocationArn"),
	},
	ExecutionRoleArn: jsii.String("executionRoleArn"),
	Name: jsii.String("name"),
	RuntimeVersion: jsii.String("runtimeVersion"),
	Schedule: &ScheduleProperty{
		Expression: jsii.String("expression"),

		// the properties below are optional
		DurationInSeconds: jsii.String("durationInSeconds"),
	},

	// the properties below are optional
	ArtifactConfig: &ArtifactConfigProperty{
		S3Encryption: &S3EncryptionProperty{
			EncryptionMode: jsii.String("encryptionMode"),
			KmsKeyArn: jsii.String("kmsKeyArn"),
		},
	},
	DeleteLambdaResourcesOnCanaryDeletion: jsii.Boolean(false),
	FailureRetentionPeriod: jsii.Number(123),
	RunConfig: &RunConfigProperty{
		ActiveTracing: jsii.Boolean(false),
		EnvironmentVariables: map[string]*string{
			"environmentVariablesKey": jsii.String("environmentVariables"),
		},
		MemoryInMb: jsii.Number(123),
		TimeoutInSeconds: jsii.Number(123),
	},
	StartCanaryAfterCreation: jsii.Boolean(false),
	SuccessRetentionPeriod: jsii.Number(123),
	Tags: []cfnTag{
		&cfnTag{
			Key: jsii.String("key"),
			Value: jsii.String("value"),
		},
	},
	VisualReference: &VisualReferenceProperty{
		BaseCanaryRunId: jsii.String("baseCanaryRunId"),

		// the properties below are optional
		BaseScreenshots: []interface{}{
			&BaseScreenshotProperty{
				ScreenshotName: jsii.String("screenshotName"),

				// the properties below are optional
				IgnoreCoordinates: []*string{
					jsii.String("ignoreCoordinates"),
				},
			},
		},
	},
	VpcConfig: &VPCConfigProperty{
		SecurityGroupIds: []*string{
			jsii.String("securityGroupIds"),
		},
		SubnetIds: []*string{
			jsii.String("subnetIds"),
		},

		// the properties below are optional
		VpcId: jsii.String("vpcId"),
	},
})

See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html

func NewCfnCanary

func NewCfnCanary(scope constructs.Construct, id *string, props *CfnCanaryProps) CfnCanary

type CfnCanaryProps

type CfnCanaryProps struct {
	// The location in Amazon S3 where Synthetics stores artifacts from the runs of this canary.
	//
	// Artifacts include the log file, screenshots, and HAR files. Specify the full location path, including `s3://` at the beginning of the path.
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-artifacts3location
	//
	ArtifactS3Location *string `field:"required" json:"artifactS3Location" yaml:"artifactS3Location"`
	// Use this structure to input your script code for the canary.
	//
	// This structure contains the Lambda handler with the location where the canary should start running the script. If the script is stored in an S3 bucket, the bucket name, key, and version are also included. If the script is passed into the canary directly, the script code is contained in the value of `Script` .
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-code
	//
	Code interface{} `field:"required" json:"code" yaml:"code"`
	// The ARN of the IAM role to be used to run the canary.
	//
	// This role must already exist, and must include `lambda.amazonaws.com` as a principal in the trust policy. The role must also have the following permissions:
	//
	// - `s3:PutObject`
	// - `s3:GetBucketLocation`
	// - `s3:ListAllMyBuckets`
	// - `cloudwatch:PutMetricData`
	// - `logs:CreateLogGroup`
	// - `logs:CreateLogStream`
	// - `logs:PutLogEvents`.
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-executionrolearn
	//
	ExecutionRoleArn *string `field:"required" json:"executionRoleArn" yaml:"executionRoleArn"`
	// The name for this canary.
	//
	// Be sure to give it a descriptive name that distinguishes it from other canaries in your account.
	//
	// Do not include secrets or proprietary information in your canary names. The canary name makes up part of the canary ARN, and the ARN is included in outbound calls over the internet. For more information, see [Security Considerations for Synthetics Canaries](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/servicelens_canaries_security.html) .
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-name
	//
	Name *string `field:"required" json:"name" yaml:"name"`
	// Specifies the runtime version to use for the canary.
	//
	// For more information about runtime versions, see [Canary Runtime Versions](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_Library.html) .
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-runtimeversion
	//
	RuntimeVersion *string `field:"required" json:"runtimeVersion" yaml:"runtimeVersion"`
	// A structure that contains information about how often the canary is to run, and when these runs are to stop.
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-schedule
	//
	Schedule interface{} `field:"required" json:"schedule" yaml:"schedule"`
	// A structure that contains the configuration for canary artifacts, including the encryption-at-rest settings for artifacts that the canary uploads to Amazon S3.
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-artifactconfig
	//
	ArtifactConfig interface{} `field:"optional" json:"artifactConfig" yaml:"artifactConfig"`
	// Deletes associated lambda resources created by Synthetics if set to True.
	//
	// Default is False.
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-deletelambdaresourcesoncanarydeletion
	//
	// Deprecated: this property has been deprecated.
	DeleteLambdaResourcesOnCanaryDeletion interface{} `field:"optional" json:"deleteLambdaResourcesOnCanaryDeletion" yaml:"deleteLambdaResourcesOnCanaryDeletion"`
	// The number of days to retain data about failed runs of this canary.
	//
	// If you omit this field, the default of 31 days is used. The valid range is 1 to 455 days.
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-failureretentionperiod
	//
	FailureRetentionPeriod *float64 `field:"optional" json:"failureRetentionPeriod" yaml:"failureRetentionPeriod"`
	// A structure that contains input information for a canary run.
	//
	// If you omit this structure, the frequency of the canary is used as canary's timeout value, up to a maximum of 900 seconds.
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-runconfig
	//
	RunConfig interface{} `field:"optional" json:"runConfig" yaml:"runConfig"`
	// Specify TRUE to have the canary start making runs immediately after it is created.
	//
	// A canary that you create using CloudFormation can't be used to monitor the CloudFormation stack that creates the canary or to roll back that stack if there is a failure.
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-startcanaryaftercreation
	//
	StartCanaryAfterCreation interface{} `field:"optional" json:"startCanaryAfterCreation" yaml:"startCanaryAfterCreation"`
	// The number of days to retain data about successful runs of this canary.
	//
	// If you omit this field, the default of 31 days is used. The valid range is 1 to 455 days.
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-successretentionperiod
	//
	SuccessRetentionPeriod *float64 `field:"optional" json:"successRetentionPeriod" yaml:"successRetentionPeriod"`
	// The list of key-value pairs that are associated with the canary.
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-tags
	//
	Tags *[]*awscdk.CfnTag `field:"optional" json:"tags" yaml:"tags"`
	// If this canary performs visual monitoring by comparing screenshots, this structure contains the ID of the canary run to use as the baseline for screenshots, and the coordinates of any parts of the screen to ignore during the visual monitoring comparison.
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-visualreference
	//
	VisualReference interface{} `field:"optional" json:"visualReference" yaml:"visualReference"`
	// If this canary is to test an endpoint in a VPC, this structure contains information about the subnet and security groups of the VPC endpoint.
	//
	// For more information, see [Running a Canary in a VPC](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_VPC.html) .
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-vpcconfig
	//
	VpcConfig interface{} `field:"optional" json:"vpcConfig" yaml:"vpcConfig"`
}

Properties for defining a `CfnCanary`.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

cfnCanaryProps := &CfnCanaryProps{
	ArtifactS3Location: jsii.String("artifactS3Location"),
	Code: &CodeProperty{
		Handler: jsii.String("handler"),

		// the properties below are optional
		S3Bucket: jsii.String("s3Bucket"),
		S3Key: jsii.String("s3Key"),
		S3ObjectVersion: jsii.String("s3ObjectVersion"),
		Script: jsii.String("script"),
		SourceLocationArn: jsii.String("sourceLocationArn"),
	},
	ExecutionRoleArn: jsii.String("executionRoleArn"),
	Name: jsii.String("name"),
	RuntimeVersion: jsii.String("runtimeVersion"),
	Schedule: &ScheduleProperty{
		Expression: jsii.String("expression"),

		// the properties below are optional
		DurationInSeconds: jsii.String("durationInSeconds"),
	},

	// the properties below are optional
	ArtifactConfig: &ArtifactConfigProperty{
		S3Encryption: &S3EncryptionProperty{
			EncryptionMode: jsii.String("encryptionMode"),
			KmsKeyArn: jsii.String("kmsKeyArn"),
		},
	},
	DeleteLambdaResourcesOnCanaryDeletion: jsii.Boolean(false),
	FailureRetentionPeriod: jsii.Number(123),
	RunConfig: &RunConfigProperty{
		ActiveTracing: jsii.Boolean(false),
		EnvironmentVariables: map[string]*string{
			"environmentVariablesKey": jsii.String("environmentVariables"),
		},
		MemoryInMb: jsii.Number(123),
		TimeoutInSeconds: jsii.Number(123),
	},
	StartCanaryAfterCreation: jsii.Boolean(false),
	SuccessRetentionPeriod: jsii.Number(123),
	Tags: []cfnTag{
		&cfnTag{
			Key: jsii.String("key"),
			Value: jsii.String("value"),
		},
	},
	VisualReference: &VisualReferenceProperty{
		BaseCanaryRunId: jsii.String("baseCanaryRunId"),

		// the properties below are optional
		BaseScreenshots: []interface{}{
			&BaseScreenshotProperty{
				ScreenshotName: jsii.String("screenshotName"),

				// the properties below are optional
				IgnoreCoordinates: []*string{
					jsii.String("ignoreCoordinates"),
				},
			},
		},
	},
	VpcConfig: &VPCConfigProperty{
		SecurityGroupIds: []*string{
			jsii.String("securityGroupIds"),
		},
		SubnetIds: []*string{
			jsii.String("subnetIds"),
		},

		// the properties below are optional
		VpcId: jsii.String("vpcId"),
	},
}

See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html

type CfnCanary_ArtifactConfigProperty

type CfnCanary_ArtifactConfigProperty struct {
	// A structure that contains the configuration of the encryption-at-rest settings for artifacts that the canary uploads to Amazon S3 .
	//
	// Artifact encryption functionality is available only for canaries that use Synthetics runtime version syn-nodejs-puppeteer-3.3 or later. For more information, see [Encrypting canary artifacts](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_artifact_encryption.html) .
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-artifactconfig.html#cfn-synthetics-canary-artifactconfig-s3encryption
	//
	S3Encryption interface{} `field:"optional" json:"s3Encryption" yaml:"s3Encryption"`
}

A structure that contains the configuration for canary artifacts, including the encryption-at-rest settings for artifacts that the canary uploads to Amazon S3 .

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

artifactConfigProperty := &ArtifactConfigProperty{
	S3Encryption: &S3EncryptionProperty{
		EncryptionMode: jsii.String("encryptionMode"),
		KmsKeyArn: jsii.String("kmsKeyArn"),
	},
}

See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-artifactconfig.html

type CfnCanary_BaseScreenshotProperty

type CfnCanary_BaseScreenshotProperty struct {
	// The name of the screenshot.
	//
	// This is generated the first time the canary is run after the `UpdateCanary` operation that specified for this canary to perform visual monitoring.
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-basescreenshot.html#cfn-synthetics-canary-basescreenshot-screenshotname
	//
	ScreenshotName *string `field:"required" json:"screenshotName" yaml:"screenshotName"`
	// Coordinates that define the part of a screen to ignore during screenshot comparisons.
	//
	// To obtain the coordinates to use here, use the CloudWatch console to draw the boundaries on the screen. For more information, see [Edit or delete a canary](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/synthetics_canaries_deletion.html) .
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-basescreenshot.html#cfn-synthetics-canary-basescreenshot-ignorecoordinates
	//
	IgnoreCoordinates *[]*string `field:"optional" json:"ignoreCoordinates" yaml:"ignoreCoordinates"`
}

A structure representing a screenshot that is used as a baseline during visual monitoring comparisons made by the canary.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

baseScreenshotProperty := &BaseScreenshotProperty{
	ScreenshotName: jsii.String("screenshotName"),

	// the properties below are optional
	IgnoreCoordinates: []*string{
		jsii.String("ignoreCoordinates"),
	},
}

See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-basescreenshot.html

type CfnCanary_CodeProperty

type CfnCanary_CodeProperty struct {
	// The entry point to use for the source code when running the canary.
	//
	// For canaries that use the `syn-python-selenium-1.0` runtime or a `syn-nodejs.puppeteer` runtime earlier than `syn-nodejs.puppeteer-3.4` , the handler must be specified as `*fileName* .handler` . For `syn-python-selenium-1.1` , `syn-nodejs.puppeteer-3.4` , and later runtimes, the handler can be specified as `*fileName* . *functionName*` , or you can specify a folder where canary scripts reside as `*folder* / *fileName* . *functionName*` .
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-code.html#cfn-synthetics-canary-code-handler
	//
	Handler *string `field:"required" json:"handler" yaml:"handler"`
	// If your canary script is located in S3, specify the bucket name here.
	//
	// The bucket must already exist.
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-code.html#cfn-synthetics-canary-code-s3bucket
	//
	S3Bucket *string `field:"optional" json:"s3Bucket" yaml:"s3Bucket"`
	// The S3 key of your script.
	//
	// For more information, see [Working with Amazon S3 Objects](https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingObjects.html) .
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-code.html#cfn-synthetics-canary-code-s3key
	//
	S3Key *string `field:"optional" json:"s3Key" yaml:"s3Key"`
	// The S3 version ID of your script.
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-code.html#cfn-synthetics-canary-code-s3objectversion
	//
	S3ObjectVersion *string `field:"optional" json:"s3ObjectVersion" yaml:"s3ObjectVersion"`
	// If you input your canary script directly into the canary instead of referring to an S3 location, the value of this parameter is the script in plain text.
	//
	// It can be up to 5 MB.
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-code.html#cfn-synthetics-canary-code-script
	//
	Script *string `field:"optional" json:"script" yaml:"script"`
	// The ARN of the Lambda layer where Synthetics stores the canary script code.
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-code.html#cfn-synthetics-canary-code-sourcelocationarn
	//
	SourceLocationArn *string `field:"optional" json:"sourceLocationArn" yaml:"sourceLocationArn"`
}

Use this structure to input your script code for the canary.

This structure contains the Lambda handler with the location where the canary should start running the script. If the script is stored in an S3 bucket, the bucket name, key, and version are also included. If the script is passed into the canary directly, the script code is contained in the value of `Script` .

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

codeProperty := &CodeProperty{
	Handler: jsii.String("handler"),

	// the properties below are optional
	S3Bucket: jsii.String("s3Bucket"),
	S3Key: jsii.String("s3Key"),
	S3ObjectVersion: jsii.String("s3ObjectVersion"),
	Script: jsii.String("script"),
	SourceLocationArn: jsii.String("sourceLocationArn"),
}

See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-code.html

type CfnCanary_RunConfigProperty

type CfnCanary_RunConfigProperty struct {
	// Specifies whether this canary is to use active AWS X-Ray tracing when it runs.
	//
	// Active tracing enables this canary run to be displayed in the ServiceLens and X-Ray service maps even if the canary does not hit an endpoint that has X-Ray tracing enabled. Using X-Ray tracing incurs charges. For more information, see [Canaries and X-Ray tracing](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_tracing.html) .
	//
	// You can enable active tracing only for canaries that use version `syn-nodejs-2.0` or later for their canary runtime.
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-runconfig.html#cfn-synthetics-canary-runconfig-activetracing
	//
	ActiveTracing interface{} `field:"optional" json:"activeTracing" yaml:"activeTracing"`
	// Specifies the keys and values to use for any environment variables used in the canary script.
	//
	// Use the following format:
	//
	// { "key1" : "value1", "key2" : "value2", ...}
	//
	// Keys must start with a letter and be at least two characters. The total size of your environment variables cannot exceed 4 KB. You can't specify any Lambda reserved environment variables as the keys for your environment variables. For more information about reserved keys, see [Runtime environment variables](https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html#configuration-envvars-runtime) .
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-runconfig.html#cfn-synthetics-canary-runconfig-environmentvariables
	//
	EnvironmentVariables interface{} `field:"optional" json:"environmentVariables" yaml:"environmentVariables"`
	// The maximum amount of memory that the canary can use while running.
	//
	// This value must be a multiple of 64. The range is 960 to 3008.
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-runconfig.html#cfn-synthetics-canary-runconfig-memoryinmb
	//
	MemoryInMb *float64 `field:"optional" json:"memoryInMb" yaml:"memoryInMb"`
	// How long the canary is allowed to run before it must stop.
	//
	// You can't set this time to be longer than the frequency of the runs of this canary.
	//
	// If you omit this field, the frequency of the canary is used as this value, up to a maximum of 900 seconds.
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-runconfig.html#cfn-synthetics-canary-runconfig-timeoutinseconds
	//
	TimeoutInSeconds *float64 `field:"optional" json:"timeoutInSeconds" yaml:"timeoutInSeconds"`
}

A structure that contains input information for a canary run.

This structure is required.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

runConfigProperty := &RunConfigProperty{
	ActiveTracing: jsii.Boolean(false),
	EnvironmentVariables: map[string]*string{
		"environmentVariablesKey": jsii.String("environmentVariables"),
	},
	MemoryInMb: jsii.Number(123),
	TimeoutInSeconds: jsii.Number(123),
}

See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-runconfig.html

type CfnCanary_S3EncryptionProperty

type CfnCanary_S3EncryptionProperty struct {
	// The encryption method to use for artifacts created by this canary.
	//
	// Specify `SSE_S3` to use server-side encryption (SSE) with an Amazon S3-managed key. Specify `SSE-KMS` to use server-side encryption with a customer-managed AWS KMS key.
	//
	// If you omit this parameter, an AWS -managed AWS KMS key is used.
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-s3encryption.html#cfn-synthetics-canary-s3encryption-encryptionmode
	//
	EncryptionMode *string `field:"optional" json:"encryptionMode" yaml:"encryptionMode"`
	// The ARN of the customer-managed AWS KMS key to use, if you specify `SSE-KMS` for `EncryptionMode`.
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-s3encryption.html#cfn-synthetics-canary-s3encryption-kmskeyarn
	//
	KmsKeyArn *string `field:"optional" json:"kmsKeyArn" yaml:"kmsKeyArn"`
}

A structure that contains the configuration of the encryption-at-rest settings for artifacts that the canary uploads to Amazon S3 .

Artifact encryption functionality is available only for canaries that use Synthetics runtime version syn-nodejs-puppeteer-3.3 or later. For more information, see [Encrypting canary artifacts](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_artifact_encryption.html) .

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

s3EncryptionProperty := &S3EncryptionProperty{
	EncryptionMode: jsii.String("encryptionMode"),
	KmsKeyArn: jsii.String("kmsKeyArn"),
}

See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-s3encryption.html

type CfnCanary_ScheduleProperty

type CfnCanary_ScheduleProperty struct {
	// A `rate` expression or a `cron` expression that defines how often the canary is to run.
	//
	// For a rate expression, The syntax is `rate( *number unit* )` . *unit* can be `minute` , `minutes` , or `hour` .
	//
	// For example, `rate(1 minute)` runs the canary once a minute, `rate(10 minutes)` runs it once every 10 minutes, and `rate(1 hour)` runs it once every hour. You can specify a frequency between `rate(1 minute)` and `rate(1 hour)` .
	//
	// Specifying `rate(0 minute)` or `rate(0 hour)` is a special value that causes the canary to run only once when it is started.
	//
	// Use `cron( *expression* )` to specify a cron expression. You can't schedule a canary to wait for more than a year before running. For information about the syntax for cron expressions, see [Scheduling canary runs using cron](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_cron.html) .
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-schedule.html#cfn-synthetics-canary-schedule-expression
	//
	Expression *string `field:"required" json:"expression" yaml:"expression"`
	// How long, in seconds, for the canary to continue making regular runs according to the schedule in the `Expression` value.
	//
	// If you specify 0, the canary continues making runs until you stop it. If you omit this field, the default of 0 is used.
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-schedule.html#cfn-synthetics-canary-schedule-durationinseconds
	//
	DurationInSeconds *string `field:"optional" json:"durationInSeconds" yaml:"durationInSeconds"`
}

This structure specifies how often a canary is to make runs and the date and time when it should stop making runs.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

scheduleProperty := &ScheduleProperty{
	Expression: jsii.String("expression"),

	// the properties below are optional
	DurationInSeconds: jsii.String("durationInSeconds"),
}

See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-schedule.html

type CfnCanary_VPCConfigProperty

type CfnCanary_VPCConfigProperty struct {
	// The IDs of the security groups for this canary.
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-vpcconfig.html#cfn-synthetics-canary-vpcconfig-securitygroupids
	//
	SecurityGroupIds *[]*string `field:"required" json:"securityGroupIds" yaml:"securityGroupIds"`
	// The IDs of the subnets where this canary is to run.
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-vpcconfig.html#cfn-synthetics-canary-vpcconfig-subnetids
	//
	SubnetIds *[]*string `field:"required" json:"subnetIds" yaml:"subnetIds"`
	// The ID of the VPC where this canary is to run.
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-vpcconfig.html#cfn-synthetics-canary-vpcconfig-vpcid
	//
	VpcId *string `field:"optional" json:"vpcId" yaml:"vpcId"`
}

If this canary is to test an endpoint in a VPC, this structure contains information about the subnet and security groups of the VPC endpoint.

For more information, see [Running a Canary in a VPC](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_VPC.html) .

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

vPCConfigProperty := &VPCConfigProperty{
	SecurityGroupIds: []*string{
		jsii.String("securityGroupIds"),
	},
	SubnetIds: []*string{
		jsii.String("subnetIds"),
	},

	// the properties below are optional
	VpcId: jsii.String("vpcId"),
}

See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-vpcconfig.html

type CfnCanary_VisualReferenceProperty

type CfnCanary_VisualReferenceProperty struct {
	// Specifies which canary run to use the screenshots from as the baseline for future visual monitoring with this canary.
	//
	// Valid values are `nextrun` to use the screenshots from the next run after this update is made, `lastrun` to use the screenshots from the most recent run before this update was made, or the value of `Id` in the [CanaryRun](https://docs.aws.amazon.com/AmazonSynthetics/latest/APIReference/API_CanaryRun.html) from any past run of this canary.
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-visualreference.html#cfn-synthetics-canary-visualreference-basecanaryrunid
	//
	BaseCanaryRunId *string `field:"required" json:"baseCanaryRunId" yaml:"baseCanaryRunId"`
	// An array of screenshots that are used as the baseline for comparisons during visual monitoring.
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-visualreference.html#cfn-synthetics-canary-visualreference-basescreenshots
	//
	BaseScreenshots interface{} `field:"optional" json:"baseScreenshots" yaml:"baseScreenshots"`
}

Defines the screenshots to use as the baseline for comparisons during visual monitoring comparisons during future runs of this canary.

If you omit this parameter, no changes are made to any baseline screenshots that the canary might be using already.

Visual monitoring is supported only on canaries running the *syn-puppeteer-node-3.2* runtime or later. For more information, see [Visual monitoring](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Library_SyntheticsLogger_VisualTesting.html) and [Visual monitoring blueprint](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_Blueprints_VisualTesting.html)

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

visualReferenceProperty := &VisualReferenceProperty{
	BaseCanaryRunId: jsii.String("baseCanaryRunId"),

	// the properties below are optional
	BaseScreenshots: []interface{}{
		&BaseScreenshotProperty{
			ScreenshotName: jsii.String("screenshotName"),

			// the properties below are optional
			IgnoreCoordinates: []*string{
				jsii.String("ignoreCoordinates"),
			},
		},
	},
}

See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-visualreference.html

type CfnGroup added in v2.37.0

type CfnGroup interface {
	awscdk.CfnResource
	awscdk.IInspectable
	awscdk.ITaggable
	// The Id of the group.
	AttrId() *string
	// Options for this resource, such as condition, update policy etc.
	CfnOptions() awscdk.ICfnResourceOptions
	CfnProperties() *map[string]interface{}
	// AWS resource type.
	CfnResourceType() *string
	// Returns: the stack trace of the point where this Resource was created from, sourced
	// from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most
	// node +internal+ entries filtered.
	CreationStack() *[]*string
	// The logical ID for this CloudFormation stack element.
	//
	// The logical ID of the element
	// is calculated from the path of the resource node in the construct tree.
	//
	// To override this value, use `overrideLogicalId(newLogicalId)`.
	//
	// Returns: the logical ID as a stringified token. This value will only get
	// resolved during synthesis.
	LogicalId() *string
	// A name for the group.
	//
	// It can include any Unicode characters.
	Name() *string
	SetName(val *string)
	// The tree node.
	Node() constructs.Node
	// Return a string that will be resolved to a CloudFormation `{ Ref }` for this element.
	//
	// If, by any chance, the intrinsic reference of a resource is not a string, you could
	// coerce it to an IResolvable through `Lazy.any({ produce: resource.ref })`.
	Ref() *string
	// The ARNs of the canaries that you want to associate with this group.
	ResourceArns() *[]*string
	SetResourceArns(val *[]*string)
	// The stack in which this element is defined.
	//
	// CfnElements must be defined within a stack scope (directly or indirectly).
	Stack() awscdk.Stack
	// Tag Manager which manages the tags for this resource.
	Tags() awscdk.TagManager
	// The list of key-value pairs that are associated with the group.
	TagsRaw() *[]*awscdk.CfnTag
	SetTagsRaw(val *[]*awscdk.CfnTag)
	// Deprecated.
	// Deprecated: use `updatedProperties`
	//
	// Return properties modified after initiation
	//
	// Resources that expose mutable properties should override this function to
	// collect and return the properties object for this resource.
	UpdatedProperites() *map[string]interface{}
	// Return properties modified after initiation.
	//
	// Resources that expose mutable properties should override this function to
	// collect and return the properties object for this resource.
	UpdatedProperties() *map[string]interface{}
	// Syntactic sugar for `addOverride(path, undefined)`.
	AddDeletionOverride(path *string)
	// Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
	//
	// This can be used for resources across stacks (or nested stack) boundaries
	// and the dependency will automatically be transferred to the relevant scope.
	AddDependency(target awscdk.CfnResource)
	// Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
	// Deprecated: use addDependency.
	AddDependsOn(target awscdk.CfnResource)
	// Add a value to the CloudFormation Resource Metadata.
	// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
	//
	// Note that this is a different set of metadata from CDK node metadata; this
	// metadata ends up in the stack template under the resource, whereas CDK
	// node metadata ends up in the Cloud Assembly.
	//
	AddMetadata(key *string, value interface{})
	// Adds an override to the synthesized CloudFormation resource.
	//
	// To add a
	// property override, either use `addPropertyOverride` or prefix `path` with
	// "Properties." (i.e. `Properties.TopicName`).
	//
	// If the override is nested, separate each nested level using a dot (.) in the path parameter.
	// If there is an array as part of the nesting, specify the index in the path.
	//
	// To include a literal `.` in the property name, prefix with a `\`. In most
	// programming languages you will need to write this as `"\\."` because the
	// `\` itself will need to be escaped.
	//
	// For example,
	// “`typescript
	// cfnResource.addOverride('Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes', ['myattribute']);
	// cfnResource.addOverride('Properties.GlobalSecondaryIndexes.1.ProjectionType', 'INCLUDE');
	// “`
	// would add the overrides
	// “`json
	// "Properties": {
	//   "GlobalSecondaryIndexes": [
	//     {
	//       "Projection": {
	//         "NonKeyAttributes": [ "myattribute" ]
	//         ...
	//       }
	//       ...
	//     },
	//     {
	//       "ProjectionType": "INCLUDE"
	//       ...
	//     },
	//   ]
	//   ...
	// }
	// “`
	//
	// The `value` argument to `addOverride` will not be processed or translated
	// in any way. Pass raw JSON values in here with the correct capitalization
	// for CloudFormation. If you pass CDK classes or structs, they will be
	// rendered with lowercased key names, and CloudFormation will reject the
	// template.
	AddOverride(path *string, value interface{})
	// Adds an override that deletes the value of a property from the resource definition.
	AddPropertyDeletionOverride(propertyPath *string)
	// Adds an override to a resource property.
	//
	// Syntactic sugar for `addOverride("Properties.<...>", value)`.
	AddPropertyOverride(propertyPath *string, value interface{})
	// Sets the deletion policy of the resource based on the removal policy specified.
	//
	// The Removal Policy controls what happens to this resource when it stops
	// being managed by CloudFormation, either because you've removed it from the
	// CDK application or because you've made a change that requires the resource
	// to be replaced.
	//
	// The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
	// account for data recovery and cleanup later (`RemovalPolicy.RETAIN`). In some
	// cases, a snapshot can be taken of the resource prior to deletion
	// (`RemovalPolicy.SNAPSHOT`). A list of resources that support this policy
	// can be found in the following link:.
	// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html#aws-attribute-deletionpolicy-options
	//
	ApplyRemovalPolicy(policy awscdk.RemovalPolicy, options *awscdk.RemovalPolicyOptions)
	// Returns a token for an runtime attribute of this resource.
	//
	// Ideally, use generated attribute accessors (e.g. `resource.arn`), but this can be used for future compatibility
	// in case there is no generated attribute.
	GetAtt(attributeName *string, typeHint awscdk.ResolutionTypeHint) awscdk.Reference
	// Retrieve a value value from the CloudFormation Resource Metadata.
	// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
	//
	// Note that this is a different set of metadata from CDK node metadata; this
	// metadata ends up in the stack template under the resource, whereas CDK
	// node metadata ends up in the Cloud Assembly.
	//
	GetMetadata(key *string) interface{}
	// Examines the CloudFormation resource and discloses attributes.
	Inspect(inspector awscdk.TreeInspector)
	// Retrieves an array of resources this resource depends on.
	//
	// This assembles dependencies on resources across stacks (including nested stacks)
	// automatically.
	ObtainDependencies() *[]interface{}
	// Get a shallow copy of dependencies between this resource and other resources in the same stack.
	ObtainResourceDependencies() *[]awscdk.CfnResource
	// Overrides the auto-generated logical ID with a specific ID.
	OverrideLogicalId(newLogicalId *string)
	// Indicates that this resource no longer depends on another resource.
	//
	// This can be used for resources across stacks (including nested stacks)
	// and the dependency will automatically be removed from the relevant scope.
	RemoveDependency(target awscdk.CfnResource)
	RenderProperties(props *map[string]interface{}) *map[string]interface{}
	// Replaces one dependency with another.
	ReplaceDependency(target awscdk.CfnResource, newTarget awscdk.CfnResource)
	// Can be overridden by subclasses to determine if this resource will be rendered into the cloudformation template.
	//
	// Returns: `true` if the resource should be included or `false` is the resource
	// should be omitted.
	ShouldSynthesize() *bool
	// Returns a string representation of this construct.
	//
	// Returns: a string representation of this resource.
	ToString() *string
	ValidateProperties(_properties interface{})
}

Creates or updates a group which you can use to associate canaries with each other, including cross-Region canaries.

Using groups can help you with managing and automating your canaries, and you can also view aggregated run results and statistics for all canaries in a group.

Groups are global resources. When you create a group, it is replicated across all AWS Regions, and you can add canaries from any Region to it, and view it in any Region. Although the group ARN format reflects the Region name where it was created, a group is not constrained to any Region. This means that you can put canaries from multiple Regions into the same group, and then use that group to view and manage all of those canaries in a single view.

Each group can contain as many as 10 canaries. You can have as many as 20 groups in your account. Any single canary can be a member of up to 10 groups.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

cfnGroup := awscdk.Aws_synthetics.NewCfnGroup(this, jsii.String("MyCfnGroup"), &CfnGroupProps{
	Name: jsii.String("name"),

	// the properties below are optional
	ResourceArns: []*string{
		jsii.String("resourceArns"),
	},
	Tags: []cfnTag{
		&cfnTag{
			Key: jsii.String("key"),
			Value: jsii.String("value"),
		},
	},
})

See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-group.html

func NewCfnGroup added in v2.37.0

func NewCfnGroup(scope constructs.Construct, id *string, props *CfnGroupProps) CfnGroup

type CfnGroupProps added in v2.37.0

type CfnGroupProps struct {
	// A name for the group. It can include any Unicode characters.
	//
	// The names for all groups in your account, across all Regions, must be unique.
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-group.html#cfn-synthetics-group-name
	//
	Name *string `field:"required" json:"name" yaml:"name"`
	// The ARNs of the canaries that you want to associate with this group.
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-group.html#cfn-synthetics-group-resourcearns
	//
	ResourceArns *[]*string `field:"optional" json:"resourceArns" yaml:"resourceArns"`
	// The list of key-value pairs that are associated with the group.
	// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-group.html#cfn-synthetics-group-tags
	//
	Tags *[]*awscdk.CfnTag `field:"optional" json:"tags" yaml:"tags"`
}

Properties for defining a `CfnGroup`.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

cfnGroupProps := &CfnGroupProps{
	Name: jsii.String("name"),

	// the properties below are optional
	ResourceArns: []*string{
		jsii.String("resourceArns"),
	},
	Tags: []cfnTag{
		&cfnTag{
			Key: jsii.String("key"),
			Value: jsii.String("value"),
		},
	},
}

See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-group.html

type Cleanup added in v2.99.0

type Cleanup string

Different ways to clean up underlying Canary resources when the Canary is deleted.

Example:

canary := synthetics.NewCanary(this, jsii.String("Canary"), &CanaryProps{
	Test: synthetics.Test_Custom(&CustomTestOptions{
		Handler: jsii.String("index.handler"),
		Code: synthetics.Code_FromInline(jsii.String("/* Synthetics handler code")),
	}),
	Cleanup: synthetics.Cleanup_LAMBDA,
	Runtime: synthetics.Runtime_SYNTHETICS_NODEJS_PUPPETEER_6_2(),
})
const (
	// Clean up nothing.
	//
	// The user is responsible for cleaning up
	// all resources left behind by the Canary.
	Cleanup_NOTHING Cleanup = "NOTHING"
	// Clean up the underlying Lambda function only.
	//
	// The user is
	// responsible for cleaning up all other resources left behind
	// by the Canary.
	Cleanup_LAMBDA Cleanup = "LAMBDA"
)

type Code added in v2.99.0

type Code interface {
	// Called when the canary is initialized to allow this object to bind to the stack, add resources and have fun.
	//
	// Returns: a bound `CodeConfig`.
	Bind(scope constructs.Construct, handler *string, family RuntimeFamily) *CodeConfig
}

The code the canary should execute.

Example:

canary := synthetics.NewCanary(this, jsii.String("MyCanary"), &CanaryProps{
	Schedule: synthetics.Schedule_Rate(awscdk.Duration_Minutes(jsii.Number(5))),
	Test: synthetics.Test_Custom(&CustomTestOptions{
		Code: synthetics.Code_FromAsset(path.join(__dirname, jsii.String("canary"))),
		Handler: jsii.String("index.handler"),
	}),
	Runtime: synthetics.Runtime_SYNTHETICS_NODEJS_PUPPETEER_6_2(),
	EnvironmentVariables: map[string]*string{
		"stage": jsii.String("prod"),
	},
})

type CodeConfig added in v2.99.0

type CodeConfig struct {
	// Inline code (mutually exclusive with `s3Location`).
	// Default: - none.
	//
	InlineCode *string `field:"optional" json:"inlineCode" yaml:"inlineCode"`
	// The location of the code in S3 (mutually exclusive with `inlineCode`).
	// Default: - none.
	//
	S3Location *awss3.Location `field:"optional" json:"s3Location" yaml:"s3Location"`
}

Configuration of the code class.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

codeConfig := &CodeConfig{
	InlineCode: jsii.String("inlineCode"),
	S3Location: &Location{
		BucketName: jsii.String("bucketName"),
		ObjectKey: jsii.String("objectKey"),

		// the properties below are optional
		ObjectVersion: jsii.String("objectVersion"),
	},
}

type CronOptions added in v2.99.0

type CronOptions struct {
	// The day of the month to run this rule at.
	// Default: - Every day of the month.
	//
	Day *string `field:"optional" json:"day" yaml:"day"`
	// The hour to run this rule at.
	// Default: - Every hour.
	//
	Hour *string `field:"optional" json:"hour" yaml:"hour"`
	// The minute to run this rule at.
	// Default: - Every minute.
	//
	Minute *string `field:"optional" json:"minute" yaml:"minute"`
	// The month to run this rule at.
	// Default: - Every month.
	//
	Month *string `field:"optional" json:"month" yaml:"month"`
	// The day of the week to run this rule at.
	// Default: - Any day of the week.
	//
	WeekDay *string `field:"optional" json:"weekDay" yaml:"weekDay"`
}

Options to configure a cron expression.

All fields are strings so you can use complex expressions. Absence of a field implies '*' or '?', whichever one is appropriate.

Example:

schedule := synthetics.Schedule_Cron(&CronOptions{
	Hour: jsii.String("0,8,16"),
})

See: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_cron.html

type CustomTestOptions added in v2.99.0

type CustomTestOptions struct {
	// The code of the canary script.
	Code Code `field:"required" json:"code" yaml:"code"`
	// The handler for the code.
	//
	// Must end with `.handler`.
	Handler *string `field:"required" json:"handler" yaml:"handler"`
}

Properties for specifying a test.

Example:

canary := synthetics.NewCanary(this, jsii.String("MyCanary"), &CanaryProps{
	Schedule: synthetics.Schedule_Rate(awscdk.Duration_Minutes(jsii.Number(5))),
	Test: synthetics.Test_Custom(&CustomTestOptions{
		Code: synthetics.Code_FromAsset(path.join(__dirname, jsii.String("canary"))),
		Handler: jsii.String("index.handler"),
	}),
	Runtime: synthetics.Runtime_SYNTHETICS_NODEJS_PUPPETEER_6_2(),
	EnvironmentVariables: map[string]*string{
		"stage": jsii.String("prod"),
	},
})

type InlineCode added in v2.99.0

type InlineCode interface {
	Code
	// Called when the canary is initialized to allow this object to bind to the stack, add resources and have fun.
	Bind(_scope constructs.Construct, handler *string, _family RuntimeFamily) *CodeConfig
}

Canary code from an inline string.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

inlineCode := awscdk.Aws_synthetics.NewInlineCode(jsii.String("code"))

func AssetCode_FromInline added in v2.99.0

func AssetCode_FromInline(code *string) InlineCode

Specify code inline.

Returns: `InlineCode` with inline code.

func Code_FromInline added in v2.99.0

func Code_FromInline(code *string) InlineCode

Specify code inline.

Returns: `InlineCode` with inline code.

func InlineCode_FromInline added in v2.99.0

func InlineCode_FromInline(code *string) InlineCode

Specify code inline.

Returns: `InlineCode` with inline code.

func NewInlineCode added in v2.99.0

func NewInlineCode(code *string) InlineCode

func S3Code_FromInline added in v2.99.0

func S3Code_FromInline(code *string) InlineCode

Specify code inline.

Returns: `InlineCode` with inline code.

type Runtime added in v2.99.0

type Runtime interface {
	// The Lambda runtime family.
	Family() RuntimeFamily
	// The name of the runtime version.
	Name() *string
}

Runtime options for a canary.

Example:

canary := synthetics.NewCanary(this, jsii.String("MyCanary"), &CanaryProps{
	Schedule: synthetics.Schedule_Rate(awscdk.Duration_Minutes(jsii.Number(5))),
	Test: synthetics.Test_Custom(&CustomTestOptions{
		Code: synthetics.Code_FromAsset(path.join(__dirname, jsii.String("canary"))),
		Handler: jsii.String("index.handler"),
	}),
	Runtime: synthetics.Runtime_SYNTHETICS_NODEJS_PUPPETEER_6_2(),
	EnvironmentVariables: map[string]*string{
		"stage": jsii.String("prod"),
	},
})

func NewRuntime added in v2.99.0

func NewRuntime(name *string, family RuntimeFamily) Runtime

func Runtime_SYNTHETICS_NODEJS_PUPPETEER_3_5 added in v2.99.0

func Runtime_SYNTHETICS_NODEJS_PUPPETEER_3_5() Runtime

func Runtime_SYNTHETICS_NODEJS_PUPPETEER_3_6 added in v2.99.0

func Runtime_SYNTHETICS_NODEJS_PUPPETEER_3_6() Runtime

func Runtime_SYNTHETICS_NODEJS_PUPPETEER_3_7 added in v2.99.0

func Runtime_SYNTHETICS_NODEJS_PUPPETEER_3_7() Runtime

func Runtime_SYNTHETICS_NODEJS_PUPPETEER_3_8 added in v2.99.0

func Runtime_SYNTHETICS_NODEJS_PUPPETEER_3_8() Runtime

func Runtime_SYNTHETICS_NODEJS_PUPPETEER_3_9 added in v2.99.0

func Runtime_SYNTHETICS_NODEJS_PUPPETEER_3_9() Runtime

func Runtime_SYNTHETICS_NODEJS_PUPPETEER_4_0 added in v2.99.0

func Runtime_SYNTHETICS_NODEJS_PUPPETEER_4_0() Runtime

func Runtime_SYNTHETICS_NODEJS_PUPPETEER_5_0 added in v2.99.0

func Runtime_SYNTHETICS_NODEJS_PUPPETEER_5_0() Runtime

func Runtime_SYNTHETICS_NODEJS_PUPPETEER_5_1 added in v2.99.0

func Runtime_SYNTHETICS_NODEJS_PUPPETEER_5_1() Runtime

func Runtime_SYNTHETICS_NODEJS_PUPPETEER_5_2 added in v2.129.0

func Runtime_SYNTHETICS_NODEJS_PUPPETEER_5_2() Runtime

func Runtime_SYNTHETICS_NODEJS_PUPPETEER_6_0 added in v2.100.0

func Runtime_SYNTHETICS_NODEJS_PUPPETEER_6_0() Runtime

func Runtime_SYNTHETICS_NODEJS_PUPPETEER_6_1 added in v2.129.0

func Runtime_SYNTHETICS_NODEJS_PUPPETEER_6_1() Runtime

func Runtime_SYNTHETICS_NODEJS_PUPPETEER_6_2 added in v2.129.0

func Runtime_SYNTHETICS_NODEJS_PUPPETEER_6_2() Runtime

func Runtime_SYNTHETICS_NODEJS_PUPPETEER_7_0 added in v2.134.0

func Runtime_SYNTHETICS_NODEJS_PUPPETEER_7_0() Runtime

func Runtime_SYNTHETICS_PYTHON_SELENIUM_1_0 added in v2.99.0

func Runtime_SYNTHETICS_PYTHON_SELENIUM_1_0() Runtime

func Runtime_SYNTHETICS_PYTHON_SELENIUM_1_1 added in v2.99.0

func Runtime_SYNTHETICS_PYTHON_SELENIUM_1_1() Runtime

func Runtime_SYNTHETICS_PYTHON_SELENIUM_1_2 added in v2.99.0

func Runtime_SYNTHETICS_PYTHON_SELENIUM_1_2() Runtime

func Runtime_SYNTHETICS_PYTHON_SELENIUM_1_3 added in v2.99.0

func Runtime_SYNTHETICS_PYTHON_SELENIUM_1_3() Runtime

func Runtime_SYNTHETICS_PYTHON_SELENIUM_2_0 added in v2.103.0

func Runtime_SYNTHETICS_PYTHON_SELENIUM_2_0() Runtime

func Runtime_SYNTHETICS_PYTHON_SELENIUM_2_1 added in v2.129.0

func Runtime_SYNTHETICS_PYTHON_SELENIUM_2_1() Runtime

func Runtime_SYNTHETICS_PYTHON_SELENIUM_3_0 added in v2.134.0

func Runtime_SYNTHETICS_PYTHON_SELENIUM_3_0() Runtime

type RuntimeFamily added in v2.99.0

type RuntimeFamily string

All known Lambda runtime families.

const (
	// All Lambda runtimes that depend on Node.js.
	RuntimeFamily_NODEJS RuntimeFamily = "NODEJS"
	// All lambda runtimes that depend on Python.
	RuntimeFamily_PYTHON RuntimeFamily = "PYTHON"
	// Any future runtime family.
	RuntimeFamily_OTHER RuntimeFamily = "OTHER"
)

type S3Code added in v2.99.0

type S3Code interface {
	Code
	// Called when the canary is initialized to allow this object to bind to the stack, add resources and have fun.
	Bind(_scope constructs.Construct, _handler *string, _family RuntimeFamily) *CodeConfig
}

S3 bucket path to the code zip file.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var bucket bucket

s3Code := awscdk.Aws_synthetics.NewS3Code(bucket, jsii.String("key"), jsii.String("objectVersion"))

func AssetCode_FromBucket added in v2.99.0

func AssetCode_FromBucket(bucket awss3.IBucket, key *string, objectVersion *string) S3Code

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`.

Returns: `S3Code` associated with the specified S3 object. See: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_WritingCanary.html#CloudWatch_Synthetics_Canaries_write_from_scratch

func Code_FromBucket added in v2.99.0

func Code_FromBucket(bucket awss3.IBucket, key *string, objectVersion *string) S3Code

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`.

Returns: `S3Code` associated with the specified S3 object. See: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_WritingCanary.html#CloudWatch_Synthetics_Canaries_write_from_scratch

func InlineCode_FromBucket added in v2.99.0

func InlineCode_FromBucket(bucket awss3.IBucket, key *string, objectVersion *string) S3Code

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`.

Returns: `S3Code` associated with the specified S3 object. See: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_WritingCanary.html#CloudWatch_Synthetics_Canaries_write_from_scratch

func NewS3Code added in v2.99.0

func NewS3Code(bucket awss3.IBucket, key *string, objectVersion *string) S3Code

func S3Code_FromBucket added in v2.99.0

func S3Code_FromBucket(bucket awss3.IBucket, key *string, objectVersion *string) S3Code

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`.

Returns: `S3Code` associated with the specified S3 object. See: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_WritingCanary.html#CloudWatch_Synthetics_Canaries_write_from_scratch

type Schedule added in v2.99.0

type Schedule interface {
	// The Schedule expression.
	ExpressionString() *string
}

Schedule for canary runs.

Example:

canary := synthetics.NewCanary(this, jsii.String("MyCanary"), &CanaryProps{
	Schedule: synthetics.Schedule_Rate(awscdk.Duration_Minutes(jsii.Number(5))),
	Test: synthetics.Test_Custom(&CustomTestOptions{
		Code: synthetics.Code_FromAsset(path.join(__dirname, jsii.String("canary"))),
		Handler: jsii.String("index.handler"),
	}),
	Runtime: synthetics.Runtime_SYNTHETICS_NODEJS_PUPPETEER_6_2(),
	EnvironmentVariables: map[string]*string{
		"stage": jsii.String("prod"),
	},
})

func Schedule_Cron added in v2.99.0

func Schedule_Cron(options *CronOptions) Schedule

Create a schedule from a set of cron fields.

func Schedule_Expression added in v2.99.0

func Schedule_Expression(expression *string) Schedule

Construct a schedule from a literal schedule expression.

The expression must be in a `rate(number units)` format. For example, `Schedule.expression('rate(10 minutes)')`

func Schedule_Once added in v2.99.0

func Schedule_Once() Schedule

The canary will be executed once.

func Schedule_Rate added in v2.99.0

func Schedule_Rate(interval awscdk.Duration) Schedule

Construct a schedule from an interval.

Allowed values: 0 (for a single run) or between 1 and 60 minutes. To specify a single run, you can use `Schedule.once()`.

type Test added in v2.99.0

type Test interface {
	// The code that the canary should run.
	Code() Code
	// The handler of the canary.
	Handler() *string
}

Specify a test that the canary should run.

Example:

canary := synthetics.NewCanary(this, jsii.String("MyCanary"), &CanaryProps{
	Schedule: synthetics.Schedule_Rate(awscdk.Duration_Minutes(jsii.Number(5))),
	Test: synthetics.Test_Custom(&CustomTestOptions{
		Code: synthetics.Code_FromAsset(path.join(__dirname, jsii.String("canary"))),
		Handler: jsii.String("index.handler"),
	}),
	Runtime: synthetics.Runtime_SYNTHETICS_NODEJS_PUPPETEER_6_2(),
	EnvironmentVariables: map[string]*string{
		"stage": jsii.String("prod"),
	},
})

func Test_Custom added in v2.99.0

func Test_Custom(options *CustomTestOptions) Test

Specify a custom test with your own code.

Returns: `Test` associated with the specified Code object.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL