@pulumi/pagerduty
Version:
A Pulumi package for creating and managing pagerduty cloud resources.
117 lines • 5.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.IncidentWorkflowTrigger = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* An [Incident Workflow Trigger](https://support.pagerduty.com/docs/incident-workflows#triggers) defines when and if an [Incident Workflow](https://support.pagerduty.com/docs/incident-workflows) will be triggered.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pagerduty from "@pulumi/pagerduty";
*
* const myFirstWorkflow = new pagerduty.IncidentWorkflow("my_first_workflow", {
* name: "Example Incident Workflow",
* description: "This Incident Workflow is an example",
* steps: [{
* name: "Send Status Update",
* action: "pagerduty.com:incident-workflows:send-status-update:1",
* inputs: [{
* name: "Message",
* value: "Example status message sent on {{current_date}}",
* }],
* }],
* });
* const firstService = pagerduty.getService({
* name: "My First Service",
* });
* const automaticTrigger = new pagerduty.IncidentWorkflowTrigger("automatic_trigger", {
* type: "conditional",
* workflow: myFirstWorkflow.id,
* services: [firstServicePagerdutyService.id],
* condition: "incident.priority matches 'P1'",
* subscribedToAllServices: false,
* });
* const devops = pagerduty.getTeam({
* name: "devops",
* });
* const manualTrigger = new pagerduty.IncidentWorkflowTrigger("manual_trigger", {
* type: "manual",
* workflow: myFirstWorkflow.id,
* services: [firstServicePagerdutyService.id],
* });
* ```
*
* ## Import
*
* Incident workflows can be imported using the `id`, e.g.
*
* ```sh
* $ pulumi import pagerduty:index/incidentWorkflowTrigger:IncidentWorkflowTrigger pagerduty_incident_workflow_trigger PLBP09X
* ```
*/
class IncidentWorkflowTrigger extends pulumi.CustomResource {
/**
* Get an existing IncidentWorkflowTrigger 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 IncidentWorkflowTrigger(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of IncidentWorkflowTrigger. 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'] === IncidentWorkflowTrigger.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["condition"] = state ? state.condition : undefined;
resourceInputs["permissions"] = state ? state.permissions : undefined;
resourceInputs["services"] = state ? state.services : undefined;
resourceInputs["subscribedToAllServices"] = state ? state.subscribedToAllServices : undefined;
resourceInputs["type"] = state ? state.type : undefined;
resourceInputs["workflow"] = state ? state.workflow : undefined;
}
else {
const args = argsOrState;
if ((!args || args.subscribedToAllServices === undefined) && !opts.urn) {
throw new Error("Missing required property 'subscribedToAllServices'");
}
if ((!args || args.type === undefined) && !opts.urn) {
throw new Error("Missing required property 'type'");
}
if ((!args || args.workflow === undefined) && !opts.urn) {
throw new Error("Missing required property 'workflow'");
}
resourceInputs["condition"] = args ? args.condition : undefined;
resourceInputs["permissions"] = args ? args.permissions : undefined;
resourceInputs["services"] = args ? args.services : undefined;
resourceInputs["subscribedToAllServices"] = args ? args.subscribedToAllServices : undefined;
resourceInputs["type"] = args ? args.type : undefined;
resourceInputs["workflow"] = args ? args.workflow : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(IncidentWorkflowTrigger.__pulumiType, name, resourceInputs, opts);
}
}
exports.IncidentWorkflowTrigger = IncidentWorkflowTrigger;
/** @internal */
IncidentWorkflowTrigger.__pulumiType = 'pagerduty:index/incidentWorkflowTrigger:IncidentWorkflowTrigger';
//# sourceMappingURL=incidentWorkflowTrigger.js.map