UNPKG

@pulumi/pagerduty

Version:

A Pulumi package for creating and managing pagerduty cloud resources.

174 lines 6.84 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! *** var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Schedulev2 = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("./utilities")); /** * A [v3 schedule](https://developer.pagerduty.com/api-reference/d90c4c94e3ce2-create-a-schedule) determines the time periods that users are on call using flexible rotation configurations. This resource uses the PagerDuty v3 Schedules API, which supports per-event assignment strategies and RFC 5545 recurrence rules. * * > **Note:** This resource requires the `flexible-schedules-early-access` early access flag on your PagerDuty account. The required `X-Early-Access` header is sent automatically by the provider. * * ## Example Usage * * ### Rotating member assignment * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pagerduty from "@pulumi/pagerduty"; * * const example = new pagerduty.User("example", { * name: "Earline Greenholt", * email: "earline@example.com", * }); * const exampleSchedulev2 = new pagerduty.Schedulev2("example", { * name: "Engineering On-Call", * timeZone: "America/New_York", * description: "Managed by Pulumi", * rotations: [{ * events: [{ * name: "Weekday Business Hours", * startTime: "2026-06-01T09:00:00Z", * endTime: "2026-06-01T17:00:00Z", * effectiveSince: "2026-06-01T09:00:00Z", * recurrences: ["RRULE:FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR"], * assignmentStrategies: [{ * type: "rotating_member_assignment_strategy", * shiftsPerMember: 1, * members: [{ * type: "user_member", * userId: example.id, * }], * }], * }], * }], * }); * ``` * * ### Every-member assignment (all members on-call simultaneously) * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pagerduty from "@pulumi/pagerduty"; * * const primary = new pagerduty.User("primary", { * name: "Alice", * email: "alice@example.com", * }); * const secondary = new pagerduty.User("secondary", { * name: "Bob", * email: "bob@example.com", * }); * const allHands = new pagerduty.Schedulev2("all_hands", { * name: "Weekend All-Hands On-Call", * timeZone: "UTC", * rotations: [{ * events: [{ * name: "Weekend Coverage", * startTime: "2026-06-06T00:00:00Z", * endTime: "2026-06-07T23:59:00Z", * effectiveSince: "2026-06-06T00:00:00Z", * recurrences: ["RRULE:FREQ=WEEKLY;BYDAY=SA,SU"], * assignmentStrategies: [{ * type: "every_member_assignment_strategy", * members: [ * { * type: "user_member", * userId: primary.id, * }, * { * type: "user_member", * userId: secondary.id, * }, * ], * }], * }], * }], * }); * ``` * * ## Import * * Schedules can be imported using the schedule `id`, e.g. * * ```sh * $ pulumi import pagerduty:index/schedulev2:Schedulev2 example P1234AB * ``` */ class Schedulev2 extends pulumi.CustomResource { /** * Get an existing Schedulev2 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 Schedulev2(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'pagerduty:index/schedulev2:Schedulev2'; /** * Returns true if the given object is an instance of Schedulev2. 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'] === Schedulev2.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["description"] = state?.description; resourceInputs["name"] = state?.name; resourceInputs["rotations"] = state?.rotations; resourceInputs["teams"] = state?.teams; resourceInputs["timeZone"] = state?.timeZone; } else { const args = argsOrState; if (args?.timeZone === undefined && !opts.urn) { throw new Error("Missing required property 'timeZone'"); } resourceInputs["description"] = args?.description; resourceInputs["name"] = args?.name; resourceInputs["rotations"] = args?.rotations; resourceInputs["teams"] = args?.teams; resourceInputs["timeZone"] = args?.timeZone; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Schedulev2.__pulumiType, name, resourceInputs, opts); } } exports.Schedulev2 = Schedulev2; //# sourceMappingURL=schedulev2.js.map