UNPKG

@pulumi/fastly

Version:

A Pulumi package for creating and managing fastly cloud resources.. Based on terraform-provider-fastly: version v4

105 lines 4.65 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.Alert = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Provides a Fastly Alert. Alerts send notifications to custom integrations (e.g., Slack channels, PagerDuty, Microsoft Teams and New Relic) when an observed metric either exceeds or falls below a threshold. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as fastly from "@pulumi/fastly"; * * const example = new fastly.ServiceVcl("example", {name: "my_vcl_service"}); * const exampleIntegration = new fastly.Integration("example", {name: "my_integration"}); * const exampleAlert = new fastly.Alert("example", { * name: "my_vcl_service errors", * serviceId: example.id, * source: "stats", * metric: "status_5xx", * evaluationStrategy: { * type: "above_threshold", * period: "5m", * threshold: 10, * }, * integrationIds: [exampleIntegration.id], * }); * ``` * * ## Import * * Fastly Alerts can be imported using their ID, e.g. * * ```sh * $ pulumi import fastly:index/alert:Alert example xxxxxxxxxxxxxxxxxxxx * ``` */ class Alert extends pulumi.CustomResource { /** * Get an existing Alert 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 state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new Alert(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Alert. 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'] === Alert.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["dimensions"] = state ? state.dimensions : undefined; resourceInputs["evaluationStrategy"] = state ? state.evaluationStrategy : undefined; resourceInputs["integrationIds"] = state ? state.integrationIds : undefined; resourceInputs["metric"] = state ? state.metric : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["serviceId"] = state ? state.serviceId : undefined; resourceInputs["source"] = state ? state.source : undefined; } else { const args = argsOrState; if ((!args || args.evaluationStrategy === undefined) && !opts.urn) { throw new Error("Missing required property 'evaluationStrategy'"); } if ((!args || args.metric === undefined) && !opts.urn) { throw new Error("Missing required property 'metric'"); } if ((!args || args.source === undefined) && !opts.urn) { throw new Error("Missing required property 'source'"); } resourceInputs["description"] = args ? args.description : undefined; resourceInputs["dimensions"] = args ? args.dimensions : undefined; resourceInputs["evaluationStrategy"] = args ? args.evaluationStrategy : undefined; resourceInputs["integrationIds"] = args ? args.integrationIds : undefined; resourceInputs["metric"] = args ? args.metric : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["serviceId"] = args ? args.serviceId : undefined; resourceInputs["source"] = args ? args.source : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Alert.__pulumiType, name, resourceInputs, opts); } } exports.Alert = Alert; /** @internal */ Alert.__pulumiType = 'fastly:index/alert:Alert'; //# sourceMappingURL=alert.js.map