@pulumi/pagerduty
Version:
A Pulumi package for creating and managing pagerduty cloud resources.
153 lines • 7.28 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.ExtensionServiceNow = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* A special case for [extension](https://developer.pagerduty.com/api-reference/b3A6Mjc0ODEzMw-create-an-extension) for ServiceNow.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pagerduty from "@pulumi/pagerduty";
*
* const servicenow = pagerduty.getExtensionSchema({
* name: "ServiceNow (v7)",
* });
* 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 snow = new pagerduty.ExtensionServiceNow("snow", {
* name: "My Web App Extension",
* extensionSchema: servicenow.then(servicenow => servicenow.id),
* extensionObjects: [exampleService.id],
* snowUser: "meeps",
* snowPassword: "zorz",
* syncOptions: "manual_sync",
* target: "https://foo.servicenow.com/webhook_foo",
* taskType: "incident",
* referer: "None",
* });
* ```
*
* ## Import
*
* Extensions can be imported using the id.e.g.
*
* ```sh
* $ pulumi import pagerduty:index/extensionServiceNow:ExtensionServiceNow main PLBP09X
* ```
*/
class ExtensionServiceNow extends pulumi.CustomResource {
/**
* Get an existing ExtensionServiceNow 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 ExtensionServiceNow(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of ExtensionServiceNow. 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'] === ExtensionServiceNow.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
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["referer"] = state ? state.referer : undefined;
resourceInputs["snowPassword"] = state ? state.snowPassword : undefined;
resourceInputs["snowUser"] = state ? state.snowUser : undefined;
resourceInputs["summary"] = state ? state.summary : undefined;
resourceInputs["syncOptions"] = state ? state.syncOptions : undefined;
resourceInputs["target"] = state ? state.target : undefined;
resourceInputs["taskType"] = state ? state.taskType : 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'");
}
if ((!args || args.referer === undefined) && !opts.urn) {
throw new Error("Missing required property 'referer'");
}
if ((!args || args.snowPassword === undefined) && !opts.urn) {
throw new Error("Missing required property 'snowPassword'");
}
if ((!args || args.snowUser === undefined) && !opts.urn) {
throw new Error("Missing required property 'snowUser'");
}
if ((!args || args.syncOptions === undefined) && !opts.urn) {
throw new Error("Missing required property 'syncOptions'");
}
if ((!args || args.target === undefined) && !opts.urn) {
throw new Error("Missing required property 'target'");
}
if ((!args || args.taskType === undefined) && !opts.urn) {
throw new Error("Missing required property 'taskType'");
}
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["referer"] = args ? args.referer : undefined;
resourceInputs["snowPassword"] = (args === null || args === void 0 ? void 0 : args.snowPassword) ? pulumi.secret(args.snowPassword) : undefined;
resourceInputs["snowUser"] = args ? args.snowUser : undefined;
resourceInputs["summary"] = args ? args.summary : undefined;
resourceInputs["syncOptions"] = args ? args.syncOptions : undefined;
resourceInputs["target"] = args ? args.target : undefined;
resourceInputs["taskType"] = args ? args.taskType : undefined;
resourceInputs["type"] = args ? args.type : undefined;
resourceInputs["htmlUrl"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["endpointUrl", "snowPassword"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(ExtensionServiceNow.__pulumiType, name, resourceInputs, opts);
}
}
exports.ExtensionServiceNow = ExtensionServiceNow;
/** @internal */
ExtensionServiceNow.__pulumiType = 'pagerduty:index/extensionServiceNow:ExtensionServiceNow';
//# sourceMappingURL=extensionServiceNow.js.map