@pulumi/opsgenie
Version:
A Pulumi package for creating and managing opsgenie cloud resources.
115 lines • 4.88 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.ScheduleRotation = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Manages a Schedule Rotation within Opsgenie.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as opsgenie from "@pulumi/opsgenie";
*
* const test = new opsgenie.ScheduleRotation("test", {
* scheduleId: testOpsgenieSchedule.id,
* name: "test",
* startDate: "2019-06-18T17:00:00Z",
* endDate: "2019-06-20T17:30:00Z",
* type: "hourly",
* length: 6,
* participants: [{
* type: "user",
* id: testOpsgenieUser.id,
* }],
* timeRestrictions: [{
* type: "time-of-day",
* restriction: [{
* startHour: 1,
* startMin: 1,
* endHour: 10,
* endMin: 1,
* }],
* }],
* });
* ```
*
* ## Import
*
* Schedule Rotations can be imported using the `schedule_id/rotation_id`, e.g.
*
* ```sh
* $ pulumi import opsgenie:index/scheduleRotation:ScheduleRotation * `opsgenie_schedule_rotation.test schedule_id/rotation_id`
* ```
*/
class ScheduleRotation extends pulumi.CustomResource {
/**
* Get an existing ScheduleRotation 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 ScheduleRotation(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of ScheduleRotation. 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'] === ScheduleRotation.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["endDate"] = state ? state.endDate : undefined;
resourceInputs["length"] = state ? state.length : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["participants"] = state ? state.participants : undefined;
resourceInputs["scheduleId"] = state ? state.scheduleId : undefined;
resourceInputs["startDate"] = state ? state.startDate : undefined;
resourceInputs["timeRestrictions"] = state ? state.timeRestrictions : undefined;
resourceInputs["type"] = state ? state.type : undefined;
}
else {
const args = argsOrState;
if ((!args || args.participants === undefined) && !opts.urn) {
throw new Error("Missing required property 'participants'");
}
if ((!args || args.scheduleId === undefined) && !opts.urn) {
throw new Error("Missing required property 'scheduleId'");
}
if ((!args || args.startDate === undefined) && !opts.urn) {
throw new Error("Missing required property 'startDate'");
}
if ((!args || args.type === undefined) && !opts.urn) {
throw new Error("Missing required property 'type'");
}
resourceInputs["endDate"] = args ? args.endDate : undefined;
resourceInputs["length"] = args ? args.length : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["participants"] = args ? args.participants : undefined;
resourceInputs["scheduleId"] = args ? args.scheduleId : undefined;
resourceInputs["startDate"] = args ? args.startDate : undefined;
resourceInputs["timeRestrictions"] = args ? args.timeRestrictions : undefined;
resourceInputs["type"] = args ? args.type : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(ScheduleRotation.__pulumiType, name, resourceInputs, opts);
}
}
exports.ScheduleRotation = ScheduleRotation;
/** @internal */
ScheduleRotation.__pulumiType = 'opsgenie:index/scheduleRotation:ScheduleRotation';
//# sourceMappingURL=scheduleRotation.js.map