UNPKG

@pulumiverse/grafana

Version:

A Pulumi package for creating and managing grafana.

134 lines 5.61 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.UserNotificationRule = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * * [HTTP API](https://grafana.com/docs/oncall/latest/oncall-api-reference/personal_notification_rules/) * * **Note**: you must be running Grafana OnCall >= v1.8.0 to use this resource. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as grafana from "@pulumi/grafana"; * import * as grafana from "@pulumiverse/grafana"; * * const myUser = grafana.onCall.getUser({ * username: "my_username", * }); * const myUserStep1 = new grafana.oncall.UserNotificationRule("my_user_step_1", { * userId: myUser.then(myUser => myUser.id), * position: 0, * type: "notify_by_mobile_app", * }); * const myUserStep2 = new grafana.oncall.UserNotificationRule("my_user_step_2", { * userId: myUser.then(myUser => myUser.id), * position: 1, * duration: 600, * type: "wait", * }); * const myUserStep3 = new grafana.oncall.UserNotificationRule("my_user_step_3", { * userId: myUser.then(myUser => myUser.id), * position: 2, * type: "notify_by_phone_call", * }); * const myUserStep4 = new grafana.oncall.UserNotificationRule("my_user_step_4", { * userId: myUser.then(myUser => myUser.id), * position: 3, * duration: 300, * type: "wait", * }); * const myUserStep5 = new grafana.oncall.UserNotificationRule("my_user_step_5", { * userId: myUser.then(myUser => myUser.id), * position: 4, * type: "notify_by_slack", * }); * const myUserImportantStep1 = new grafana.oncall.UserNotificationRule("my_user_important_step_1", { * userId: myUser.then(myUser => myUser.id), * important: true, * position: 0, * type: "notify_by_mobile_app_critical", * }); * const myUserImportantStep2 = new grafana.oncall.UserNotificationRule("my_user_important_step_2", { * userId: myUser.then(myUser => myUser.id), * important: true, * position: 1, * duration: 300, * type: "wait", * }); * const myUserImportantStep3 = new grafana.oncall.UserNotificationRule("my_user_important_step_3", { * userId: myUser.then(myUser => myUser.id), * important: true, * position: 2, * type: "notify_by_mobile_app_critical", * }); * ``` * * ## Import * * ```sh * $ pulumi import grafana:onCall/userNotificationRule:UserNotificationRule name "{{ id }}" * ``` */ class UserNotificationRule extends pulumi.CustomResource { /** * Get an existing UserNotificationRule 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 UserNotificationRule(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of UserNotificationRule. 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'] === UserNotificationRule.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["duration"] = state ? state.duration : undefined; resourceInputs["important"] = state ? state.important : undefined; resourceInputs["position"] = state ? state.position : undefined; resourceInputs["type"] = state ? state.type : undefined; resourceInputs["userId"] = state ? state.userId : undefined; } else { const args = argsOrState; if ((!args || args.type === undefined) && !opts.urn) { throw new Error("Missing required property 'type'"); } if ((!args || args.userId === undefined) && !opts.urn) { throw new Error("Missing required property 'userId'"); } resourceInputs["duration"] = args ? args.duration : undefined; resourceInputs["important"] = args ? args.important : undefined; resourceInputs["position"] = args ? args.position : undefined; resourceInputs["type"] = args ? args.type : undefined; resourceInputs["userId"] = args ? args.userId : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const aliasOpts = { aliases: [{ type: "grafana:index/oncallUserNotificationRule:OncallUserNotificationRule" }] }; opts = pulumi.mergeOptions(opts, aliasOpts); super(UserNotificationRule.__pulumiType, name, resourceInputs, opts); } } exports.UserNotificationRule = UserNotificationRule; /** @internal */ UserNotificationRule.__pulumiType = 'grafana:onCall/userNotificationRule:UserNotificationRule'; //# sourceMappingURL=userNotificationRule.js.map