grafana logo
Grafana v0.0.10, May 21 23

grafana.OncallRoute

Explore with Pulumi AI

Example Usage

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Grafana = Lbrlabs.PulumiPackage.Grafana;
using Grafana = Pulumi.Grafana;

return await Deployment.RunAsync(() => 
{
    var exampleSlackChannel = Grafana.GetOnCallSlackChannel.Invoke(new()
    {
        Name = "example_slack_channel",
    });

    var @default = new Grafana.OncallEscalationChain("default");

    var exampleIntegration = new Grafana.OncallIntegration("exampleIntegration", new()
    {
        Type = "grafana",
    });

    var exampleRoute = new Grafana.OncallRoute("exampleRoute", new()
    {
        IntegrationId = exampleIntegration.Id,
        EscalationChainId = @default.Id,
        RoutingRegex = "us-(east|west)",
        Position = 0,
        Slack = new Grafana.Inputs.OncallRouteSlackArgs
        {
            ChannelId = exampleSlackChannel.Apply(getOnCallSlackChannelResult => getOnCallSlackChannelResult.SlackId),
            Enabled = true,
        },
        Telegram = new Grafana.Inputs.OncallRouteTelegramArgs
        {
            Id = "ONCALLTELEGRAMID",
            Enabled = true,
        },
        Msteams = new Grafana.Inputs.OncallRouteMsteamsArgs
        {
            Id = "ONCALLMSTEAMSID",
            Enabled = false,
        },
    });

});
package main

import (
	"github.com/lbrlabs/pulumi-grafana/sdk/go/grafana"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleSlackChannel, err := grafana.GetOnCallSlackChannel(ctx, &grafana.GetOnCallSlackChannelArgs{
			Name: "example_slack_channel",
		}, nil)
		if err != nil {
			return err
		}
		_, err = grafana.NewOncallEscalationChain(ctx, "default", nil)
		if err != nil {
			return err
		}
		exampleIntegration, err := grafana.NewOncallIntegration(ctx, "exampleIntegration", &grafana.OncallIntegrationArgs{
			Type: pulumi.String("grafana"),
		})
		if err != nil {
			return err
		}
		_, err = grafana.NewOncallRoute(ctx, "exampleRoute", &grafana.OncallRouteArgs{
			IntegrationId:     exampleIntegration.ID(),
			EscalationChainId: _default.ID(),
			RoutingRegex:      pulumi.String("us-(east|west)"),
			Position:          pulumi.Int(0),
			Slack: &grafana.OncallRouteSlackArgs{
				ChannelId: *pulumi.String(exampleSlackChannel.SlackId),
				Enabled:   pulumi.Bool(true),
			},
			Telegram: &grafana.OncallRouteTelegramArgs{
				Id:      pulumi.String("ONCALLTELEGRAMID"),
				Enabled: pulumi.Bool(true),
			},
			Msteams: &grafana.OncallRouteMsteamsArgs{
				Id:      pulumi.String("ONCALLMSTEAMSID"),
				Enabled: pulumi.Bool(false),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.grafana.GrafanaFunctions;
import com.pulumi.grafana.inputs.GetOnCallSlackChannelArgs;
import com.pulumi.grafana.OncallEscalationChain;
import com.pulumi.grafana.OncallIntegration;
import com.pulumi.grafana.OncallIntegrationArgs;
import com.pulumi.grafana.OncallRoute;
import com.pulumi.grafana.OncallRouteArgs;
import com.pulumi.grafana.inputs.OncallRouteSlackArgs;
import com.pulumi.grafana.inputs.OncallRouteTelegramArgs;
import com.pulumi.grafana.inputs.OncallRouteMsteamsArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var exampleSlackChannel = GrafanaFunctions.getOnCallSlackChannel(GetOnCallSlackChannelArgs.builder()
            .name("example_slack_channel")
            .build());

        var default_ = new OncallEscalationChain("default");

        var exampleIntegration = new OncallIntegration("exampleIntegration", OncallIntegrationArgs.builder()        
            .type("grafana")
            .build());

        var exampleRoute = new OncallRoute("exampleRoute", OncallRouteArgs.builder()        
            .integrationId(exampleIntegration.id())
            .escalationChainId(default_.id())
            .routingRegex("us-(east|west)")
            .position(0)
            .slack(OncallRouteSlackArgs.builder()
                .channelId(exampleSlackChannel.applyValue(getOnCallSlackChannelResult -> getOnCallSlackChannelResult.slackId()))
                .enabled(true)
                .build())
            .telegram(OncallRouteTelegramArgs.builder()
                .id("ONCALLTELEGRAMID")
                .enabled(true)
                .build())
            .msteams(OncallRouteMsteamsArgs.builder()
                .id("ONCALLMSTEAMSID")
                .enabled(false)
                .build())
            .build());

    }
}
import pulumi
import lbrlabs_pulumi_grafana as grafana
import pulumi_grafana as grafana

example_slack_channel = grafana.get_on_call_slack_channel(name="example_slack_channel")
default = grafana.OncallEscalationChain("default")
example_integration = grafana.OncallIntegration("exampleIntegration", type="grafana")
example_route = grafana.OncallRoute("exampleRoute",
    integration_id=example_integration.id,
    escalation_chain_id=default.id,
    routing_regex="us-(east|west)",
    position=0,
    slack=grafana.OncallRouteSlackArgs(
        channel_id=example_slack_channel.slack_id,
        enabled=True,
    ),
    telegram=grafana.OncallRouteTelegramArgs(
        id="ONCALLTELEGRAMID",
        enabled=True,
    ),
    msteams=grafana.OncallRouteMsteamsArgs(
        id="ONCALLMSTEAMSID",
        enabled=False,
    ))
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,
    },
});
resources:
  default:
    type: grafana:OncallEscalationChain
  exampleIntegration:
    type: grafana:OncallIntegration
    properties:
      type: grafana
  exampleRoute:
    type: grafana:OncallRoute
    properties:
      integrationId: ${exampleIntegration.id}
      escalationChainId: ${default.id}
      routingRegex: us-(east|west)
      position: 0
      slack:
        channelId: ${exampleSlackChannel.slackId}
        enabled: true
      telegram:
        id: ONCALLTELEGRAMID
        enabled: true
      msteams:
        id: ONCALLMSTEAMSID
        enabled: false
variables:
  exampleSlackChannel:
    fn::invoke:
      Function: grafana:getOnCallSlackChannel
      Arguments:
        name: example_slack_channel

Create OncallRoute Resource

new OncallRoute(name: string, args: OncallRouteArgs, opts?: CustomResourceOptions);
@overload
def OncallRoute(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                escalation_chain_id: Optional[str] = None,
                integration_id: Optional[str] = None,
                msteams: Optional[OncallRouteMsteamsArgs] = None,
                position: Optional[int] = None,
                routing_regex: Optional[str] = None,
                slack: Optional[OncallRouteSlackArgs] = None,
                telegram: Optional[OncallRouteTelegramArgs] = None)
@overload
def OncallRoute(resource_name: str,
                args: OncallRouteArgs,
                opts: Optional[ResourceOptions] = None)
func NewOncallRoute(ctx *Context, name string, args OncallRouteArgs, opts ...ResourceOption) (*OncallRoute, error)
public OncallRoute(string name, OncallRouteArgs args, CustomResourceOptions? opts = null)
public OncallRoute(String name, OncallRouteArgs args)
public OncallRoute(String name, OncallRouteArgs args, CustomResourceOptions options)
type: grafana:OncallRoute
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args OncallRouteArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args OncallRouteArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args OncallRouteArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args OncallRouteArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args OncallRouteArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

OncallRoute Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The OncallRoute resource accepts the following input properties:

EscalationChainId string

The ID of the escalation chain.

IntegrationId string

The ID of the integration.

Position int

The position of the route (starts from 0).

RoutingRegex string

Python Regex query. Route is chosen for an alert if there is a match inside the alert payload.

Msteams Lbrlabs.PulumiPackage.Grafana.Inputs.OncallRouteMsteamsArgs

MS teams-specific settings for a route.

Slack Lbrlabs.PulumiPackage.Grafana.Inputs.OncallRouteSlackArgs

Slack-specific settings for a route.

Telegram Lbrlabs.PulumiPackage.Grafana.Inputs.OncallRouteTelegramArgs

Telegram-specific settings for a route.

EscalationChainId string

The ID of the escalation chain.

IntegrationId string

The ID of the integration.

Position int

The position of the route (starts from 0).

RoutingRegex string

Python Regex query. Route is chosen for an alert if there is a match inside the alert payload.

Msteams OncallRouteMsteamsArgs

MS teams-specific settings for a route.

Slack OncallRouteSlackArgs

Slack-specific settings for a route.

Telegram OncallRouteTelegramArgs

Telegram-specific settings for a route.

escalationChainId String

The ID of the escalation chain.

integrationId String

The ID of the integration.

position Integer

The position of the route (starts from 0).

routingRegex String

Python Regex query. Route is chosen for an alert if there is a match inside the alert payload.

msteams OncallRouteMsteamsArgs

MS teams-specific settings for a route.

slack OncallRouteSlackArgs

Slack-specific settings for a route.

telegram OncallRouteTelegramArgs

Telegram-specific settings for a route.

escalationChainId string

The ID of the escalation chain.

integrationId string

The ID of the integration.

position number

The position of the route (starts from 0).

routingRegex string

Python Regex query. Route is chosen for an alert if there is a match inside the alert payload.

msteams OncallRouteMsteamsArgs

MS teams-specific settings for a route.

slack OncallRouteSlackArgs

Slack-specific settings for a route.

telegram OncallRouteTelegramArgs

Telegram-specific settings for a route.

escalation_chain_id str

The ID of the escalation chain.

integration_id str

The ID of the integration.

position int

The position of the route (starts from 0).

routing_regex str

Python Regex query. Route is chosen for an alert if there is a match inside the alert payload.

msteams OncallRouteMsteamsArgs

MS teams-specific settings for a route.

slack OncallRouteSlackArgs

Slack-specific settings for a route.

telegram OncallRouteTelegramArgs

Telegram-specific settings for a route.

escalationChainId String

The ID of the escalation chain.

integrationId String

The ID of the integration.

position Number

The position of the route (starts from 0).

routingRegex String

Python Regex query. Route is chosen for an alert if there is a match inside the alert payload.

msteams Property Map

MS teams-specific settings for a route.

slack Property Map

Slack-specific settings for a route.

telegram Property Map

Telegram-specific settings for a route.

Outputs

All input properties are implicitly available as output properties. Additionally, the OncallRoute resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing OncallRoute Resource

Get an existing OncallRoute resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: OncallRouteState, opts?: CustomResourceOptions): OncallRoute
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        escalation_chain_id: Optional[str] = None,
        integration_id: Optional[str] = None,
        msteams: Optional[OncallRouteMsteamsArgs] = None,
        position: Optional[int] = None,
        routing_regex: Optional[str] = None,
        slack: Optional[OncallRouteSlackArgs] = None,
        telegram: Optional[OncallRouteTelegramArgs] = None) -> OncallRoute
func GetOncallRoute(ctx *Context, name string, id IDInput, state *OncallRouteState, opts ...ResourceOption) (*OncallRoute, error)
public static OncallRoute Get(string name, Input<string> id, OncallRouteState? state, CustomResourceOptions? opts = null)
public static OncallRoute get(String name, Output<String> id, OncallRouteState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
EscalationChainId string

The ID of the escalation chain.

IntegrationId string

The ID of the integration.

Msteams Lbrlabs.PulumiPackage.Grafana.Inputs.OncallRouteMsteamsArgs

MS teams-specific settings for a route.

Position int

The position of the route (starts from 0).

RoutingRegex string

Python Regex query. Route is chosen for an alert if there is a match inside the alert payload.

Slack Lbrlabs.PulumiPackage.Grafana.Inputs.OncallRouteSlackArgs

Slack-specific settings for a route.

Telegram Lbrlabs.PulumiPackage.Grafana.Inputs.OncallRouteTelegramArgs

Telegram-specific settings for a route.

EscalationChainId string

The ID of the escalation chain.

IntegrationId string

The ID of the integration.

Msteams OncallRouteMsteamsArgs

MS teams-specific settings for a route.

Position int

The position of the route (starts from 0).

RoutingRegex string

Python Regex query. Route is chosen for an alert if there is a match inside the alert payload.

Slack OncallRouteSlackArgs

Slack-specific settings for a route.

Telegram OncallRouteTelegramArgs

Telegram-specific settings for a route.

escalationChainId String

The ID of the escalation chain.

integrationId String

The ID of the integration.

msteams OncallRouteMsteamsArgs

MS teams-specific settings for a route.

position Integer

The position of the route (starts from 0).

routingRegex String

Python Regex query. Route is chosen for an alert if there is a match inside the alert payload.

slack OncallRouteSlackArgs

Slack-specific settings for a route.

telegram OncallRouteTelegramArgs

Telegram-specific settings for a route.

escalationChainId string

The ID of the escalation chain.

integrationId string

The ID of the integration.

msteams OncallRouteMsteamsArgs

MS teams-specific settings for a route.

position number

The position of the route (starts from 0).

routingRegex string

Python Regex query. Route is chosen for an alert if there is a match inside the alert payload.

slack OncallRouteSlackArgs

Slack-specific settings for a route.

telegram OncallRouteTelegramArgs

Telegram-specific settings for a route.

escalation_chain_id str

The ID of the escalation chain.

integration_id str

The ID of the integration.

msteams OncallRouteMsteamsArgs

MS teams-specific settings for a route.

position int

The position of the route (starts from 0).

routing_regex str

Python Regex query. Route is chosen for an alert if there is a match inside the alert payload.

slack OncallRouteSlackArgs

Slack-specific settings for a route.

telegram OncallRouteTelegramArgs

Telegram-specific settings for a route.

escalationChainId String

The ID of the escalation chain.

integrationId String

The ID of the integration.

msteams Property Map

MS teams-specific settings for a route.

position Number

The position of the route (starts from 0).

routingRegex String

Python Regex query. Route is chosen for an alert if there is a match inside the alert payload.

slack Property Map

Slack-specific settings for a route.

telegram Property Map

Telegram-specific settings for a route.

Supporting Types

OncallRouteMsteams

Enabled bool

Enable notification in MS teams. Defaults to true.

Id string

MS teams channel id. Alerts will be directed to this channel in Microsoft teams.

Enabled bool

Enable notification in MS teams. Defaults to true.

Id string

MS teams channel id. Alerts will be directed to this channel in Microsoft teams.

enabled Boolean

Enable notification in MS teams. Defaults to true.

id String

MS teams channel id. Alerts will be directed to this channel in Microsoft teams.

enabled boolean

Enable notification in MS teams. Defaults to true.

id string

MS teams channel id. Alerts will be directed to this channel in Microsoft teams.

enabled bool

Enable notification in MS teams. Defaults to true.

id str

MS teams channel id. Alerts will be directed to this channel in Microsoft teams.

enabled Boolean

Enable notification in MS teams. Defaults to true.

id String

MS teams channel id. Alerts will be directed to this channel in Microsoft teams.

OncallRouteSlack

ChannelId string

Slack channel id. Alerts will be directed to this channel in Slack.

Enabled bool

Enable notification in Slack. Defaults to true.

ChannelId string

Slack channel id. Alerts will be directed to this channel in Slack.

Enabled bool

Enable notification in Slack. Defaults to true.

channelId String

Slack channel id. Alerts will be directed to this channel in Slack.

enabled Boolean

Enable notification in Slack. Defaults to true.

channelId string

Slack channel id. Alerts will be directed to this channel in Slack.

enabled boolean

Enable notification in Slack. Defaults to true.

channel_id str

Slack channel id. Alerts will be directed to this channel in Slack.

enabled bool

Enable notification in Slack. Defaults to true.

channelId String

Slack channel id. Alerts will be directed to this channel in Slack.

enabled Boolean

Enable notification in Slack. Defaults to true.

OncallRouteTelegram

Enabled bool

Enable notification in Telegram. Defaults to true.

Id string

Telegram channel id. Alerts will be directed to this channel in Telegram.

Enabled bool

Enable notification in Telegram. Defaults to true.

Id string

Telegram channel id. Alerts will be directed to this channel in Telegram.

enabled Boolean

Enable notification in Telegram. Defaults to true.

id String

Telegram channel id. Alerts will be directed to this channel in Telegram.

enabled boolean

Enable notification in Telegram. Defaults to true.

id string

Telegram channel id. Alerts will be directed to this channel in Telegram.

enabled bool

Enable notification in Telegram. Defaults to true.

id str

Telegram channel id. Alerts will be directed to this channel in Telegram.

enabled Boolean

Enable notification in Telegram. Defaults to true.

id String

Telegram channel id. Alerts will be directed to this channel in Telegram.

Import

 $ pulumi import grafana:index/oncallRoute:OncallRoute route_name {{route_id}}

Package Details

Repository
grafana lbrlabs/pulumi-grafana
License
Apache-2.0
Notes

This Pulumi package is based on the grafana Terraform Provider.