@lbrlabs/pulumi-grafana
Version:
A Pulumi package for creating and managing grafana.
116 lines • 5.13 kB
JavaScript
;
// *** 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.OncallRoute = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* * [HTTP API](https://grafana.com/docs/oncall/latest/oncall-api-reference/routes/)
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as grafana from "@lbrlabs/pulumi-grafana";
* import * as grafana from "@pulumi/grafana";
*
* const exampleSlackChannel = grafana.getOnCallSlackChannel({
* name: "example_slack_channel",
* });
* const _default = new grafana.OncallEscalationChain("default", {});
* const exampleIntegration = new grafana.OncallIntegration("exampleIntegration", {type: "grafana"});
* const exampleRoute = new grafana.OncallRoute("exampleRoute", {
* integrationId: exampleIntegration.id,
* escalationChainId: _default.id,
* routingRegex: "us-(east|west)",
* position: 0,
* slack: {
* channelId: exampleSlackChannel.then(exampleSlackChannel => exampleSlackChannel.slackId),
* enabled: true,
* },
* telegram: {
* id: "ONCALLTELEGRAMID",
* enabled: true,
* },
* msteams: {
* id: "ONCALLMSTEAMSID",
* enabled: false,
* },
* });
* ```
*
* ## Import
*
* ```sh
* $ pulumi import grafana:index/oncallRoute:OncallRoute route_name {{route_id}}
* ```
*/
class OncallRoute extends pulumi.CustomResource {
/**
* Get an existing OncallRoute 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 OncallRoute(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of OncallRoute. 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'] === OncallRoute.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["escalationChainId"] = state ? state.escalationChainId : undefined;
resourceInputs["integrationId"] = state ? state.integrationId : undefined;
resourceInputs["msteams"] = state ? state.msteams : undefined;
resourceInputs["position"] = state ? state.position : undefined;
resourceInputs["routingRegex"] = state ? state.routingRegex : undefined;
resourceInputs["routingType"] = state ? state.routingType : undefined;
resourceInputs["slack"] = state ? state.slack : undefined;
resourceInputs["telegram"] = state ? state.telegram : undefined;
}
else {
const args = argsOrState;
if ((!args || args.escalationChainId === undefined) && !opts.urn) {
throw new Error("Missing required property 'escalationChainId'");
}
if ((!args || args.integrationId === undefined) && !opts.urn) {
throw new Error("Missing required property 'integrationId'");
}
if ((!args || args.position === undefined) && !opts.urn) {
throw new Error("Missing required property 'position'");
}
if ((!args || args.routingRegex === undefined) && !opts.urn) {
throw new Error("Missing required property 'routingRegex'");
}
resourceInputs["escalationChainId"] = args ? args.escalationChainId : undefined;
resourceInputs["integrationId"] = args ? args.integrationId : undefined;
resourceInputs["msteams"] = args ? args.msteams : undefined;
resourceInputs["position"] = args ? args.position : undefined;
resourceInputs["routingRegex"] = args ? args.routingRegex : undefined;
resourceInputs["routingType"] = args ? args.routingType : undefined;
resourceInputs["slack"] = args ? args.slack : undefined;
resourceInputs["telegram"] = args ? args.telegram : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(OncallRoute.__pulumiType, name, resourceInputs, opts);
}
}
exports.OncallRoute = OncallRoute;
/** @internal */
OncallRoute.__pulumiType = 'grafana:index/oncallRoute:OncallRoute';
//# sourceMappingURL=oncallRoute.js.map