@lbrlabs/pulumi-grafana
Version:
A Pulumi package for creating and managing grafana.
187 lines (186 loc) • 7.42 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "./types/input";
import * as outputs from "./types/output";
/**
* Sets the global notification policy for Grafana.
*
* !> This resource manages the entire notification policy tree, and will overwrite any existing policies.
*
* * [Official documentation](https://grafana.com/docs/grafana/latest/alerting/manage-notifications/)
* * [HTTP API](https://grafana.com/docs/grafana/latest/developers/http_api/alerting_provisioning/)
*
* This resource requires Grafana 9.1.0 or later.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as grafana from "@lbrlabs/pulumi-grafana";
*
* const aContactPoint = new grafana.ContactPoint("aContactPoint", {emails: [{
* addresses: [
* "one@company.org",
* "two@company.org",
* ],
* message: "{{ len .Alerts.Firing }} firing.",
* }]});
* const aMuteTiming = new grafana.MuteTiming("aMuteTiming", {intervals: [{
* weekdays: ["monday"],
* }]});
* const myNotificationPolicy = new grafana.NotificationPolicy("myNotificationPolicy", {
* groupBies: ["..."],
* contactPoint: aContactPoint.name,
* groupWait: "45s",
* groupInterval: "6m",
* repeatInterval: "3h",
* policies: [
* {
* matchers: [{
* label: "mylabel",
* match: "=",
* value: "myvalue",
* }],
* contactPoint: aContactPoint.name,
* "continue": true,
* muteTimings: [aMuteTiming.name],
* groupWait: "45s",
* groupInterval: "6m",
* repeatInterval: "3h",
* policies: [{
* matchers: [{
* label: "sublabel",
* match: "=",
* value: "subvalue",
* }],
* contactPoint: aContactPoint.name,
* groupBies: ["..."],
* }],
* },
* {
* matchers: [{
* label: "anotherlabel",
* match: "=~",
* value: "another value.*",
* }],
* contactPoint: aContactPoint.name,
* groupBies: ["..."],
* },
* ],
* });
* ```
*
* ## Import
*
* The policy is a singleton, so the ID is a constant "policy" value.
*
* ```sh
* $ pulumi import grafana:index/notificationPolicy:NotificationPolicy notification_policy_name "policy"
* ```
*/
export declare class NotificationPolicy extends pulumi.CustomResource {
/**
* Get an existing NotificationPolicy 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: string, id: pulumi.Input<pulumi.ID>, state?: NotificationPolicyState, opts?: pulumi.CustomResourceOptions): NotificationPolicy;
/**
* Returns true if the given object is an instance of NotificationPolicy. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is NotificationPolicy;
/**
* The contact point to route notifications that match this rule to.
*/
readonly contactPoint: pulumi.Output<string>;
/**
* A list of alert labels to group alerts into notifications by. Use the special label `...` to group alerts by all labels, effectively disabling grouping. Required for root policy only. If empty, the parent grouping is used.
*/
readonly groupBies: pulumi.Output<string[]>;
/**
* Minimum time interval between two notifications for the same group. Default is 5 minutes.
*/
readonly groupInterval: pulumi.Output<string | undefined>;
/**
* Time to wait to buffer alerts of the same group before sending a notification. Default is 30 seconds.
*/
readonly groupWait: pulumi.Output<string | undefined>;
/**
* Routing rules for specific label sets.
*/
readonly policies: pulumi.Output<outputs.NotificationPolicyPolicy[] | undefined>;
/**
* Minimum time interval for re-sending a notification if an alert is still firing. Default is 4 hours.
*/
readonly repeatInterval: pulumi.Output<string | undefined>;
/**
* Create a NotificationPolicy resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: NotificationPolicyArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering NotificationPolicy resources.
*/
export interface NotificationPolicyState {
/**
* The contact point to route notifications that match this rule to.
*/
contactPoint?: pulumi.Input<string>;
/**
* A list of alert labels to group alerts into notifications by. Use the special label `...` to group alerts by all labels, effectively disabling grouping. Required for root policy only. If empty, the parent grouping is used.
*/
groupBies?: pulumi.Input<pulumi.Input<string>[]>;
/**
* Minimum time interval between two notifications for the same group. Default is 5 minutes.
*/
groupInterval?: pulumi.Input<string>;
/**
* Time to wait to buffer alerts of the same group before sending a notification. Default is 30 seconds.
*/
groupWait?: pulumi.Input<string>;
/**
* Routing rules for specific label sets.
*/
policies?: pulumi.Input<pulumi.Input<inputs.NotificationPolicyPolicy>[]>;
/**
* Minimum time interval for re-sending a notification if an alert is still firing. Default is 4 hours.
*/
repeatInterval?: pulumi.Input<string>;
}
/**
* The set of arguments for constructing a NotificationPolicy resource.
*/
export interface NotificationPolicyArgs {
/**
* The contact point to route notifications that match this rule to.
*/
contactPoint: pulumi.Input<string>;
/**
* A list of alert labels to group alerts into notifications by. Use the special label `...` to group alerts by all labels, effectively disabling grouping. Required for root policy only. If empty, the parent grouping is used.
*/
groupBies: pulumi.Input<pulumi.Input<string>[]>;
/**
* Minimum time interval between two notifications for the same group. Default is 5 minutes.
*/
groupInterval?: pulumi.Input<string>;
/**
* Time to wait to buffer alerts of the same group before sending a notification. Default is 30 seconds.
*/
groupWait?: pulumi.Input<string>;
/**
* Routing rules for specific label sets.
*/
policies?: pulumi.Input<pulumi.Input<inputs.NotificationPolicyPolicy>[]>;
/**
* Minimum time interval for re-sending a notification if an alert is still firing. Default is 4 hours.
*/
repeatInterval?: pulumi.Input<string>;
}