UNPKG

@pulumiverse/sentry

Version:

A Pulumi package for creating and managing Sentry resources.

168 lines 7.38 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.SentryMetricAlert = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Sentry Metric Alert resource. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as sentry from "@pulumi/sentry"; * import * as sentry from "@pulumiverse/sentry"; * * const slack = sentry.getSentryOrganizationIntegration({ * organization: mainSentryProject.organization, * providerKey: "slack", * name: "Slack Workspace", * }); * const main = new sentry.SentryMetricAlert("main", { * organization: mainSentryProject.organization, * project: mainSentryProject.id, * name: "My metric alert", * dataset: "events", * query: "", * aggregate: "count()", * timeWindow: 60, * thresholdType: 0, * resolveThreshold: 0, * triggers: [ * { * actions: [{ * type: "email", * targetType: "team", * targetIdentifier: mainSentryTeam.teamId, * }], * alertThreshold: 300, * label: "critical", * thresholdType: 0, * }, * { * actions: [{ * type: "slack", * targetType: "specific", * targetIdentifier: "#slack-channel", * integrationId: slack.then(slack => slack.id), * }], * alertThreshold: 300, * label: "critical", * thresholdType: 0, * }, * { * alertThreshold: 100, * label: "warning", * thresholdType: 0, * }, * ], * }); * ``` * * ## Import * * import using the organization, project slugs and rule id from the URL: * * https://sentry.io/organizations/[org-slug]/projects/[project-slug]/ * * https://sentry.io/organizations/[org-slug]/alerts/rules/details/[rule-id]/ * * or * * https://sentry.io/organizations/[org-slug]/alerts/metric-rules/[project-slug]/[rule-id]/ * * ```sh * $ pulumi import sentry:index/sentryMetricAlert:SentryMetricAlert default org-slug/project-slug/rule-id * ``` */ class SentryMetricAlert extends pulumi.CustomResource { /** * Get an existing SentryMetricAlert 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 SentryMetricAlert(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of SentryMetricAlert. 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'] === SentryMetricAlert.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["aggregate"] = state ? state.aggregate : undefined; resourceInputs["dataset"] = state ? state.dataset : undefined; resourceInputs["environment"] = state ? state.environment : undefined; resourceInputs["eventTypes"] = state ? state.eventTypes : undefined; resourceInputs["internalId"] = state ? state.internalId : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["organization"] = state ? state.organization : undefined; resourceInputs["owner"] = state ? state.owner : undefined; resourceInputs["project"] = state ? state.project : undefined; resourceInputs["query"] = state ? state.query : undefined; resourceInputs["resolveThreshold"] = state ? state.resolveThreshold : undefined; resourceInputs["thresholdType"] = state ? state.thresholdType : undefined; resourceInputs["timeWindow"] = state ? state.timeWindow : undefined; resourceInputs["triggers"] = state ? state.triggers : undefined; } else { const args = argsOrState; if ((!args || args.aggregate === undefined) && !opts.urn) { throw new Error("Missing required property 'aggregate'"); } if ((!args || args.organization === undefined) && !opts.urn) { throw new Error("Missing required property 'organization'"); } if ((!args || args.project === undefined) && !opts.urn) { throw new Error("Missing required property 'project'"); } if ((!args || args.query === undefined) && !opts.urn) { throw new Error("Missing required property 'query'"); } if ((!args || args.thresholdType === undefined) && !opts.urn) { throw new Error("Missing required property 'thresholdType'"); } if ((!args || args.timeWindow === undefined) && !opts.urn) { throw new Error("Missing required property 'timeWindow'"); } if ((!args || args.triggers === undefined) && !opts.urn) { throw new Error("Missing required property 'triggers'"); } resourceInputs["aggregate"] = args ? args.aggregate : undefined; resourceInputs["dataset"] = args ? args.dataset : undefined; resourceInputs["environment"] = args ? args.environment : undefined; resourceInputs["eventTypes"] = args ? args.eventTypes : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["organization"] = args ? args.organization : undefined; resourceInputs["owner"] = args ? args.owner : undefined; resourceInputs["project"] = args ? args.project : undefined; resourceInputs["query"] = args ? args.query : undefined; resourceInputs["resolveThreshold"] = args ? args.resolveThreshold : undefined; resourceInputs["thresholdType"] = args ? args.thresholdType : undefined; resourceInputs["timeWindow"] = args ? args.timeWindow : undefined; resourceInputs["triggers"] = args ? args.triggers : undefined; resourceInputs["internalId"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(SentryMetricAlert.__pulumiType, name, resourceInputs, opts); } } exports.SentryMetricAlert = SentryMetricAlert; /** @internal */ SentryMetricAlert.__pulumiType = 'sentry:index/sentryMetricAlert:SentryMetricAlert'; //# sourceMappingURL=sentryMetricAlert.js.map