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)

204 lines • 8.75 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.Canary = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * 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, * }); * * ``` */ 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, id, opts) { return new Canary(name, undefined, { ...opts, id: id }); } /** * 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) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === Canary.__pulumiType; } /** * 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, args, opts) { let resourceInputs = {}; opts = opts || {}; if (!opts.id) { if (args?.artifactS3Location === undefined && !opts.urn) { throw new Error("Missing required property 'artifactS3Location'"); } if (args?.code === undefined && !opts.urn) { throw new Error("Missing required property 'code'"); } if (args?.executionRoleArn === undefined && !opts.urn) { throw new Error("Missing required property 'executionRoleArn'"); } if (args?.runtimeVersion === undefined && !opts.urn) { throw new Error("Missing required property 'runtimeVersion'"); } if (args?.schedule === undefined && !opts.urn) { throw new Error("Missing required property 'schedule'"); } resourceInputs["artifactConfig"] = args?.artifactConfig; resourceInputs["artifactS3Location"] = args?.artifactS3Location; resourceInputs["browserConfigs"] = args?.browserConfigs; resourceInputs["code"] = args?.code; resourceInputs["deleteLambdaResourcesOnCanaryDeletion"] = args?.deleteLambdaResourcesOnCanaryDeletion; resourceInputs["dryRunAndUpdate"] = args?.dryRunAndUpdate; resourceInputs["executionRoleArn"] = args?.executionRoleArn; resourceInputs["failureRetentionPeriod"] = args?.failureRetentionPeriod; resourceInputs["name"] = args?.name; resourceInputs["provisionedResourceCleanup"] = args?.provisionedResourceCleanup; resourceInputs["resourcesToReplicateTags"] = args?.resourcesToReplicateTags; resourceInputs["runConfig"] = args?.runConfig; resourceInputs["runtimeVersion"] = args?.runtimeVersion; resourceInputs["schedule"] = args?.schedule; resourceInputs["startCanaryAfterCreation"] = args?.startCanaryAfterCreation; resourceInputs["successRetentionPeriod"] = args?.successRetentionPeriod; resourceInputs["tags"] = args?.tags; resourceInputs["visualReference"] = args?.visualReference; resourceInputs["visualReferences"] = args?.visualReferences; resourceInputs["vpcConfig"] = args?.vpcConfig; resourceInputs["awsId"] = undefined /*out*/; resourceInputs["state"] = undefined /*out*/; } else { resourceInputs["artifactConfig"] = undefined /*out*/; resourceInputs["artifactS3Location"] = undefined /*out*/; resourceInputs["awsId"] = undefined /*out*/; resourceInputs["browserConfigs"] = undefined /*out*/; resourceInputs["code"] = undefined /*out*/; resourceInputs["deleteLambdaResourcesOnCanaryDeletion"] = undefined /*out*/; resourceInputs["dryRunAndUpdate"] = undefined /*out*/; resourceInputs["executionRoleArn"] = undefined /*out*/; resourceInputs["failureRetentionPeriod"] = undefined /*out*/; resourceInputs["name"] = undefined /*out*/; resourceInputs["provisionedResourceCleanup"] = undefined /*out*/; resourceInputs["resourcesToReplicateTags"] = undefined /*out*/; resourceInputs["runConfig"] = undefined /*out*/; resourceInputs["runtimeVersion"] = undefined /*out*/; resourceInputs["schedule"] = undefined /*out*/; resourceInputs["startCanaryAfterCreation"] = undefined /*out*/; resourceInputs["state"] = undefined /*out*/; resourceInputs["successRetentionPeriod"] = undefined /*out*/; resourceInputs["tags"] = undefined /*out*/; resourceInputs["visualReference"] = undefined /*out*/; resourceInputs["visualReferences"] = undefined /*out*/; resourceInputs["vpcConfig"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const replaceOnChanges = { replaceOnChanges: ["name"] }; opts = pulumi.mergeOptions(opts, replaceOnChanges); super(Canary.__pulumiType, name, resourceInputs, opts); } } exports.Canary = Canary; /** @internal */ Canary.__pulumiType = 'aws-native:synthetics:Canary'; //# sourceMappingURL=canary.js.map