@pulumi/fastly
Version:
A Pulumi package for creating and managing fastly cloud resources.. Based on terraform-provider-fastly: version v4
117 lines • 4.51 kB
JavaScript
;
// *** 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",
* domains: [{
* name: "demo.notexample.com",
* comment: "demo",
* }],
* });
* const exampleIntegration = new fastly.Integration("example", {
* name: "my_integration",
* type: "a_valid_type",
* config: {
* webhook: "some_webhook",
* },
* });
* 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, { ...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?.description;
resourceInputs["dimensions"] = state?.dimensions;
resourceInputs["evaluationStrategy"] = state?.evaluationStrategy;
resourceInputs["integrationIds"] = state?.integrationIds;
resourceInputs["metric"] = state?.metric;
resourceInputs["name"] = state?.name;
resourceInputs["serviceId"] = state?.serviceId;
resourceInputs["source"] = state?.source;
}
else {
const args = argsOrState;
if (args?.evaluationStrategy === undefined && !opts.urn) {
throw new Error("Missing required property 'evaluationStrategy'");
}
if (args?.metric === undefined && !opts.urn) {
throw new Error("Missing required property 'metric'");
}
if (args?.source === undefined && !opts.urn) {
throw new Error("Missing required property 'source'");
}
resourceInputs["description"] = args?.description;
resourceInputs["dimensions"] = args?.dimensions;
resourceInputs["evaluationStrategy"] = args?.evaluationStrategy;
resourceInputs["integrationIds"] = args?.integrationIds;
resourceInputs["metric"] = args?.metric;
resourceInputs["name"] = args?.name;
resourceInputs["serviceId"] = args?.serviceId;
resourceInputs["source"] = args?.source;
}
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