UNPKG

@pulumi/pagerduty

Version:

A Pulumi package for creating and managing pagerduty cloud resources.

130 lines 5.36 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.Extension = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * An [extension](https://developer.pagerduty.com/api-reference/b3A6Mjc0ODEzMw-create-an-extension) can be associated with a service. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pagerduty from "@pulumi/pagerduty"; * * const webhook = pagerduty.getExtensionSchema({ * name: "Generic V2 Webhook", * }); * const example = new pagerduty.User("example", { * name: "Howard James", * email: "howard.james@example.domain", * }); * const exampleEscalationPolicy = new pagerduty.EscalationPolicy("example", { * name: "Engineering Escalation Policy", * numLoops: 2, * rules: [{ * escalationDelayInMinutes: 10, * targets: [{ * type: "user", * id: example.id, * }], * }], * }); * const exampleService = new pagerduty.Service("example", { * name: "My Web App", * autoResolveTimeout: "14400", * acknowledgementTimeout: "600", * escalationPolicy: exampleEscalationPolicy.id, * }); * const slack = new pagerduty.Extension("slack", { * name: "My Web App Extension", * endpointUrl: "https://generic_webhook_url/XXXXXX/BBBBBB", * extensionSchema: webhook.then(webhook => webhook.id), * extensionObjects: [exampleService.id], * config: `{ * \x09"restrict": "any", * \x09"notify_types": { * \x09\x09\x09"resolve": false, * \x09\x09\x09"acknowledge": false, * \x09\x09\x09"assignments": false * \x09}, * \x09"access_token": "XXX" * } * `, * }); * ``` * * ## Import * * Extensions can be imported using the id.e.g. * * ```sh * $ pulumi import pagerduty:index/extension:Extension main PLBP09X * ``` */ class Extension extends pulumi.CustomResource { /** * Get an existing Extension 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 Extension(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Extension. 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'] === Extension.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["config"] = state ? state.config : undefined; resourceInputs["endpointUrl"] = state ? state.endpointUrl : undefined; resourceInputs["extensionObjects"] = state ? state.extensionObjects : undefined; resourceInputs["extensionSchema"] = state ? state.extensionSchema : undefined; resourceInputs["htmlUrl"] = state ? state.htmlUrl : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["summary"] = state ? state.summary : undefined; resourceInputs["type"] = state ? state.type : undefined; } else { const args = argsOrState; if ((!args || args.extensionObjects === undefined) && !opts.urn) { throw new Error("Missing required property 'extensionObjects'"); } if ((!args || args.extensionSchema === undefined) && !opts.urn) { throw new Error("Missing required property 'extensionSchema'"); } resourceInputs["config"] = args ? args.config : undefined; resourceInputs["endpointUrl"] = (args === null || args === void 0 ? void 0 : args.endpointUrl) ? pulumi.secret(args.endpointUrl) : undefined; resourceInputs["extensionObjects"] = args ? args.extensionObjects : undefined; resourceInputs["extensionSchema"] = args ? args.extensionSchema : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["type"] = args ? args.type : undefined; resourceInputs["htmlUrl"] = undefined /*out*/; resourceInputs["summary"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["endpointUrl"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(Extension.__pulumiType, name, resourceInputs, opts); } } exports.Extension = Extension; /** @internal */ Extension.__pulumiType = 'pagerduty:index/extension:Extension'; //# sourceMappingURL=extension.js.map