UNPKG

@pulumi/aws-native

Version:

The Pulumi AWS Cloud Control Provider enables you to build, deploy, and manage [any AWS resource that's supported by the AWS Cloud Control API](https://github.com/pulumi/pulumi-aws-native/blob/master/provider/cmd/pulumi-gen-aws-native/supported-types.txt)

278 lines (277 loc) • 9.82 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; import * as enums from "../types/enums"; /** * Resource Type definition for AWS::Synthetics::Canary * * ## Example Usage * ### Example * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws_native from "@pulumi/aws-native"; * * const syntheticsCanary = new aws_native.synthetics.Canary("syntheticsCanary", { * name: "samplecanary", * executionRoleArn: "arn:aws:iam::123456789012:role/my-lambda-execution-role-to-run-canary", * code: { * handler: "pageLoadBlueprint.handler", * s3Bucket: "aws-synthetics-code-myaccount-canary1", * s3Key: "my-script-location", * }, * artifactS3Location: "s3://my-results-bucket", * runtimeVersion: "syn-nodejs-puppeteer-3.3", * schedule: { * expression: "rate(1 minute)", * durationInSeconds: "3600", * }, * runConfig: { * timeoutInSeconds: 60, * }, * failureRetentionPeriod: 30, * successRetentionPeriod: 30, * tags: [{ * key: "key00AtCreate", * value: "value001AtCreate", * }], * startCanaryAfterCreation: true, * }); * * ``` * ### Example * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws_native from "@pulumi/aws-native"; * * const syntheticsCanary = new aws_native.synthetics.Canary("syntheticsCanary", { * name: "samplecanary", * executionRoleArn: "arn:aws:iam::123456789012:role/my-lambda-execution-role-to-run-canary", * code: { * handler: "pageLoadBlueprint.handler", * script: `var synthetics = require('Synthetics'); * const log = require('SyntheticsLogger'); * const pageLoadBlueprint = async function () { * // INSERT URL here * const URL = "https://amazon.com"; * * let 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); * await synthetics.takeScreenshot('loaded', 'loaded'); * let pageTitle = await page.title(); * log.info('Page title: ' + pageTitle); * if (response.status() !== 200) { * throw "Failed to load page!"; * } * }; * * exports.handler = async () => { * return await pageLoadBlueprint(); * }; * `, * }, * artifactS3Location: "s3://my-results-bucket", * runtimeVersion: "syn-nodejs-puppeteer-3.3", * schedule: { * expression: "rate(1 minute)", * durationInSeconds: "3600", * }, * runConfig: { * timeoutInSeconds: 60, * }, * failureRetentionPeriod: 30, * successRetentionPeriod: 30, * tags: [{ * key: "key00AtCreate", * value: "value001AtCreate", * }], * startCanaryAfterCreation: false, * }); * * ``` */ export declare class Canary extends pulumi.CustomResource { /** * Get an existing Canary resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input<pulumi.ID>, opts?: pulumi.CustomResourceOptions): Canary; /** * Returns true if the given object is an instance of Canary. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is Canary; /** * Provide artifact configuration */ readonly artifactConfig: pulumi.Output<outputs.synthetics.CanaryArtifactConfig | undefined>; /** * Provide the s3 bucket output location for test results */ readonly artifactS3Location: pulumi.Output<string>; /** * Id of the canary */ readonly awsId: pulumi.Output<string>; /** * Provide the canary script source */ readonly code: pulumi.Output<outputs.synthetics.CanaryCode>; /** * Deletes associated lambda resources created by Synthetics if set to True. Default is False */ readonly deleteLambdaResourcesOnCanaryDeletion: pulumi.Output<boolean | undefined>; /** * Setting to control if UpdateCanary will perform a DryRun and validate it is PASSING before performing the Update. Default is FALSE. */ readonly dryRunAndUpdate: pulumi.Output<boolean | undefined>; /** * Lambda Execution role used to run your canaries */ readonly executionRoleArn: pulumi.Output<string>; /** * Retention period of failed canary runs represented in number of days */ readonly failureRetentionPeriod: pulumi.Output<number | undefined>; /** * Name of the canary. */ readonly name: pulumi.Output<string>; /** * Setting to control if provisioned resources created by Synthetics are deleted alongside the canary. Default is AUTOMATIC. */ readonly provisionedResourceCleanup: pulumi.Output<enums.synthetics.CanaryProvisionedResourceCleanup | undefined>; /** * List of resources which canary tags should be replicated to. */ readonly resourcesToReplicateTags: pulumi.Output<enums.synthetics.CanaryResourceToTag[] | undefined>; /** * Provide canary run configuration */ readonly runConfig: pulumi.Output<outputs.synthetics.CanaryRunConfig | undefined>; /** * Runtime version of Synthetics Library */ readonly runtimeVersion: pulumi.Output<string>; /** * Frequency to run your canaries */ readonly schedule: pulumi.Output<outputs.synthetics.CanarySchedule>; /** * Runs canary if set to True. Default is False */ readonly startCanaryAfterCreation: pulumi.Output<boolean | undefined>; /** * State of the canary */ readonly state: pulumi.Output<string>; /** * Retention period of successful canary runs represented in number of days */ readonly successRetentionPeriod: pulumi.Output<number | undefined>; /** * The list of key-value pairs that are associated with the canary. */ readonly tags: pulumi.Output<outputs.Tag[] | undefined>; /** * Visual reference configuration for visual testing */ readonly visualReference: pulumi.Output<outputs.synthetics.CanaryVisualReference | undefined>; /** * Provide VPC Configuration if enabled. */ readonly vpcConfig: pulumi.Output<outputs.synthetics.CanaryVpcConfig | undefined>; /** * Create a Canary resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: CanaryArgs, opts?: pulumi.CustomResourceOptions); } /** * The set of arguments for constructing a Canary resource. */ export interface CanaryArgs { /** * Provide artifact configuration */ artifactConfig?: pulumi.Input<inputs.synthetics.CanaryArtifactConfigArgs>; /** * Provide the s3 bucket output location for test results */ artifactS3Location: pulumi.Input<string>; /** * Provide the canary script source */ code: pulumi.Input<inputs.synthetics.CanaryCodeArgs>; /** * Deletes associated lambda resources created by Synthetics if set to True. Default is False */ deleteLambdaResourcesOnCanaryDeletion?: pulumi.Input<boolean>; /** * Setting to control if UpdateCanary will perform a DryRun and validate it is PASSING before performing the Update. Default is FALSE. */ dryRunAndUpdate?: pulumi.Input<boolean>; /** * Lambda Execution role used to run your canaries */ executionRoleArn: pulumi.Input<string>; /** * Retention period of failed canary runs represented in number of days */ failureRetentionPeriod?: pulumi.Input<number>; /** * Name of the canary. */ name?: pulumi.Input<string>; /** * Setting to control if provisioned resources created by Synthetics are deleted alongside the canary. Default is AUTOMATIC. */ provisionedResourceCleanup?: pulumi.Input<enums.synthetics.CanaryProvisionedResourceCleanup>; /** * List of resources which canary tags should be replicated to. */ resourcesToReplicateTags?: pulumi.Input<pulumi.Input<enums.synthetics.CanaryResourceToTag>[]>; /** * Provide canary run configuration */ runConfig?: pulumi.Input<inputs.synthetics.CanaryRunConfigArgs>; /** * Runtime version of Synthetics Library */ runtimeVersion: pulumi.Input<string>; /** * Frequency to run your canaries */ schedule: pulumi.Input<inputs.synthetics.CanaryScheduleArgs>; /** * Runs canary if set to True. Default is False */ startCanaryAfterCreation?: pulumi.Input<boolean>; /** * Retention period of successful canary runs represented in number of days */ successRetentionPeriod?: pulumi.Input<number>; /** * The list of key-value pairs that are associated with the canary. */ tags?: pulumi.Input<pulumi.Input<inputs.TagArgs>[]>; /** * Visual reference configuration for visual testing */ visualReference?: pulumi.Input<inputs.synthetics.CanaryVisualReferenceArgs>; /** * Provide VPC Configuration if enabled. */ vpcConfig?: pulumi.Input<inputs.synthetics.CanaryVpcConfigArgs>; }