@pulumi/pagerduty
Version:
A Pulumi package for creating and managing pagerduty cloud resources.
259 lines • 12.6 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "./types/input";
import * as outputs from "./types/output";
/**
* A [Service Orchestration](https://support.pagerduty.com/docs/event-orchestration#service-orchestrations) allows you to create a set of Event Rules. The Service Orchestration evaluates Events sent to this Service against each of its rules, beginning with the rules in the "start" set. When a matching rule is found, it can modify and enhance the event and can route the event to another set of rules within this Service Orchestration for further processing.
*
* > If you have a Service that uses [Service Event Rules](https://support.pagerduty.com/docs/rulesets#service-event-rules), you can switch to [Service Orchestrations](https://support.pagerduty.com/docs/event-orchestration#service-orchestrations) at any time setting the attribute `enableEventOrchestrationForService` to `true`. Please read the [Switch to Service Orchestrations](https://support.pagerduty.com/docs/event-orchestration#switch-to-service-orchestrations) instructions for more information.
*
* ## Example of configuring a Service Orchestration
*
* This example shows creating `Team`, `User`, `Escalation Policy`, and `Service` resources followed by creating a Service Orchestration to handle Events sent to that Service.
*
* This example also shows using the pagerduty.getPriority and pagerduty.EscalationPolicy data sources to configure `priority` and `escalationPolicy` actions for a rule.
*
* This example shows a Service Orchestration that has nested sets: a rule in the "start" set has a `routeTo` action pointing at the "step-two" set.
*
* The `catchAll` actions will be applied if an Event reaches the end of any set without matching any rules in that set. In this example the `catchAll` doesn't have any `actions` so it'll leave events as-is.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pagerduty from "@pulumi/pagerduty";
*
* const engineering = new pagerduty.Team("engineering", {name: "Engineering"});
* const example = new pagerduty.User("example", {
* name: "Earline Greenholt",
* email: "125.greenholt.earline@graham.name",
* });
* const foo = new pagerduty.TeamMembership("foo", {
* userId: example.id,
* teamId: engineering.id,
* role: "manager",
* });
* const exampleEscalationPolicy = new pagerduty.EscalationPolicy("example", {
* name: "Engineering Escalation Policy",
* numLoops: 2,
* rules: [{
* escalationDelayInMinutes: 10,
* targets: [{
* type: "user_reference",
* id: example.id,
* }],
* }],
* });
* const exampleService = new pagerduty.Service("example", {
* name: "My Web App",
* autoResolveTimeout: "14400",
* acknowledgementTimeout: "600",
* escalationPolicy: exampleEscalationPolicy.id,
* alertCreation: "create_alerts_and_incidents",
* });
* const csImpact = new pagerduty.IncidentCustomField("cs_impact", {
* name: "impact",
* dataType: "string",
* fieldType: "single_value",
* });
* const p1 = pagerduty.getPriority({
* name: "P1",
* });
* const sreEscPolicy = pagerduty.getEscalationPolicy({
* name: "SRE Escalation Policy",
* });
* const www = new pagerduty.EventOrchestrationService("www", {
* service: exampleService.id,
* enableEventOrchestrationForService: true,
* sets: [
* {
* id: "start",
* rules: [{
* label: "Always apply some consistent event transformations to all events",
* actions: {
* variables: [{
* name: "hostname",
* path: "event.component",
* value: "hostname: (.*)",
* type: "regex",
* }],
* extractions: [
* {
* template: "{{variables.hostname}}",
* target: "event.custom_details.hostname",
* },
* {
* source: "event.source",
* regex: "www (.*) service",
* target: "event.source",
* },
* ],
* routeTo: "step-two",
* },
* }],
* },
* {
* id: "step-two",
* rules: [
* {
* label: "All critical alerts should be treated as P1 incident",
* conditions: [{
* expression: "event.severity matches 'critical'",
* }],
* actions: {
* annotate: "Please use our P1 runbook: https://docs.test/p1-runbook",
* priority: p1.then(p1 => p1.id),
* incidentCustomFieldUpdates: [{
* id: csImpact.id,
* value: "High Impact",
* }],
* },
* },
* {
* label: "If any of the API apps are unavailable, page the SRE team",
* conditions: [{
* expression: "event.custom_details.service_name matches part '-api' and event.custom_details.status_code matches '502'",
* }],
* actions: {
* escalationPolicy: sreEscPolicy.then(sreEscPolicy => sreEscPolicy.id),
* },
* },
* {
* label: "If there's something wrong on the canary let the team know about it in our deployments Slack channel",
* conditions: [{
* expression: "event.custom_details.hostname matches part 'canary'",
* }],
* actions: {
* automationAction: {
* name: "Canary Slack Notification",
* url: "https://our-slack-listerner.test/canary-notification",
* autoSend: true,
* triggerTypes: "alert_triggered",
* parameters: [
* {
* key: "channel",
* value: "#my-team-channel",
* },
* {
* key: "message",
* value: "something is wrong with the canary deployment",
* },
* ],
* headers: [{
* key: "X-Notification-Source",
* value: "PagerDuty Incident Webhook",
* }],
* },
* },
* },
* {
* label: "Never bother the on-call for info-level events outside of work hours, and let an Automation Action fix it instead",
* conditions: [{
* expression: "event.severity matches 'info' and not (now in Mon,Tue,Wed,Thu,Fri 09:00:00 to 17:00:00 America/Los_Angeles)",
* }],
* actions: {
* suppress: true,
* pagerdutyAutomationAction: {
* actionId: "01FJV5A8OA5MKHOYFHV35SM2Z0",
* triggerTypes: "alert_suppressed",
* },
* },
* },
* ],
* },
* ],
* catchAll: {
* actions: {},
* },
* });
* ```
*
* ## Import
*
* Service Orchestration can be imported using the `id` of the Service, e.g.
*
* ```sh
* $ pulumi import pagerduty:index/eventOrchestrationService:EventOrchestrationService service PFEODA7
* ```
*/
export declare class EventOrchestrationService extends pulumi.CustomResource {
/**
* Get an existing EventOrchestrationService 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: string, id: pulumi.Input<pulumi.ID>, state?: EventOrchestrationServiceState, opts?: pulumi.CustomResourceOptions): EventOrchestrationService;
/**
* Returns true if the given object is an instance of EventOrchestrationService. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is EventOrchestrationService;
/**
* the `catchAll` actions will be applied if an Event reaches the end of any set without matching any rules in that set.
*/
readonly catchAll: pulumi.Output<outputs.EventOrchestrationServiceCatchAll>;
/**
* Opt-in/out for switching the Service to [Service Orchestrations](https://support.pagerduty.com/docs/event-orchestration#service-orchestrations).
*/
readonly enableEventOrchestrationForService: pulumi.Output<boolean>;
/**
* ID of the Service to which this Service Orchestration belongs to.
*/
readonly service: pulumi.Output<string>;
/**
* A Service Orchestration must contain at least a "start" set, but can contain any number of additional sets that are routed to by other rules to form a directional graph.
*/
readonly sets: pulumi.Output<outputs.EventOrchestrationServiceSet[]>;
/**
* Create a EventOrchestrationService resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: EventOrchestrationServiceArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering EventOrchestrationService resources.
*/
export interface EventOrchestrationServiceState {
/**
* the `catchAll` actions will be applied if an Event reaches the end of any set without matching any rules in that set.
*/
catchAll?: pulumi.Input<inputs.EventOrchestrationServiceCatchAll | undefined>;
/**
* Opt-in/out for switching the Service to [Service Orchestrations](https://support.pagerduty.com/docs/event-orchestration#service-orchestrations).
*/
enableEventOrchestrationForService?: pulumi.Input<boolean | undefined>;
/**
* ID of the Service to which this Service Orchestration belongs to.
*/
service?: pulumi.Input<string | undefined>;
/**
* A Service Orchestration must contain at least a "start" set, but can contain any number of additional sets that are routed to by other rules to form a directional graph.
*/
sets?: pulumi.Input<pulumi.Input<inputs.EventOrchestrationServiceSet>[] | undefined>;
}
/**
* The set of arguments for constructing a EventOrchestrationService resource.
*/
export interface EventOrchestrationServiceArgs {
/**
* the `catchAll` actions will be applied if an Event reaches the end of any set without matching any rules in that set.
*/
catchAll: pulumi.Input<inputs.EventOrchestrationServiceCatchAll>;
/**
* Opt-in/out for switching the Service to [Service Orchestrations](https://support.pagerduty.com/docs/event-orchestration#service-orchestrations).
*/
enableEventOrchestrationForService?: pulumi.Input<boolean | undefined>;
/**
* ID of the Service to which this Service Orchestration belongs to.
*/
service: pulumi.Input<string>;
/**
* A Service Orchestration must contain at least a "start" set, but can contain any number of additional sets that are routed to by other rules to form a directional graph.
*/
sets: pulumi.Input<pulumi.Input<inputs.EventOrchestrationServiceSet>[]>;
}
//# sourceMappingURL=eventOrchestrationService.d.ts.map