@pulumiverse/grafana
Version:
A Pulumi package for creating and managing grafana.
131 lines • 5.12 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.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 "@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
* terraform import grafana_oncall_user_notification_rule.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, { ...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?.duration;
resourceInputs["important"] = state?.important;
resourceInputs["position"] = state?.position;
resourceInputs["type"] = state?.type;
resourceInputs["userId"] = state?.userId;
}
else {
const args = argsOrState;
if (args?.type === undefined && !opts.urn) {
throw new Error("Missing required property 'type'");
}
if (args?.userId === undefined && !opts.urn) {
throw new Error("Missing required property 'userId'");
}
resourceInputs["duration"] = args?.duration;
resourceInputs["important"] = args?.important;
resourceInputs["position"] = args?.position;
resourceInputs["type"] = args?.type;
resourceInputs["userId"] = args?.userId;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(UserNotificationRule.__pulumiType, name, resourceInputs, opts);
}
}
exports.UserNotificationRule = UserNotificationRule;
/** @internal */
UserNotificationRule.__pulumiType = 'grafana:onCall/userNotificationRule:UserNotificationRule';
//# sourceMappingURL=userNotificationRule.js.map