1. Packages
  2. Grafana Cloud
  3. API Docs
  4. OncallRoute
Grafana v0.7.0 published on Tuesday, Nov 5, 2024 by pulumiverse

grafana.OncallRoute

Explore with Pulumi AI

grafana logo
Grafana v0.7.0 published on Tuesday, Nov 5, 2024 by pulumiverse
    Deprecated: grafana.index/oncallroute.OncallRoute has been deprecated in favor of grafana.oncall/route.Route

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as grafana from "@pulumi/grafana";
    import * as grafana from "@pulumiverse/grafana";
    
    const exampleSlackChannel = grafana.onCall.getSlackChannel({
        name: "example_slack_channel",
    });
    const _default = new grafana.oncall.EscalationChain("default", {name: "default"});
    const exampleIntegration = new grafana.oncall.Integration("example_integration", {
        name: "Grafana Integration",
        type: "grafana",
        defaultRoute: {},
    });
    const exampleRoute = new grafana.oncall.Route("example_route", {
        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 pulumi
    import pulumi_grafana as grafana
    import pulumiverse_grafana as grafana
    
    example_slack_channel = grafana.onCall.get_slack_channel(name="example_slack_channel")
    default = grafana.on_call.EscalationChain("default", name="default")
    example_integration = grafana.on_call.Integration("example_integration",
        name="Grafana Integration",
        type="grafana",
        default_route={})
    example_route = grafana.on_call.Route("example_route",
        integration_id=example_integration.id,
        escalation_chain_id=default.id,
        routing_regex="us-(east|west)",
        position=0,
        slack={
            "channel_id": example_slack_channel.slack_id,
            "enabled": True,
        },
        telegram={
            "id": "ONCALLTELEGRAMID",
            "enabled": True,
        },
        msteams={
            "id": "ONCALLMSTEAMSID",
            "enabled": False,
        })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-grafana/sdk/go/grafana/onCall"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleSlackChannel, err := onCall.GetSlackChannel(ctx, &oncall.GetSlackChannelArgs{
    			Name: "example_slack_channel",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = onCall.NewEscalationChain(ctx, "default", &onCall.EscalationChainArgs{
    			Name: pulumi.String("default"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleIntegration, err := onCall.NewIntegration(ctx, "example_integration", &onCall.IntegrationArgs{
    			Name:         pulumi.String("Grafana Integration"),
    			Type:         pulumi.String("grafana"),
    			DefaultRoute: &oncall.IntegrationDefaultRouteArgs{},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = onCall.NewRoute(ctx, "example_route", &onCall.RouteArgs{
    			IntegrationId:     exampleIntegration.ID(),
    			EscalationChainId: _default.ID(),
    			RoutingRegex:      pulumi.String("us-(east|west)"),
    			Position:          pulumi.Int(0),
    			Slack: &oncall.RouteSlackArgs{
    				ChannelId: pulumi.String(exampleSlackChannel.SlackId),
    				Enabled:   pulumi.Bool(true),
    			},
    			Telegram: &oncall.RouteTelegramArgs{
    				Id:      pulumi.String("ONCALLTELEGRAMID"),
    				Enabled: pulumi.Bool(true),
    			},
    			Msteams: &oncall.RouteMsteamsArgs{
    				Id:      pulumi.String("ONCALLMSTEAMSID"),
    				Enabled: pulumi.Bool(false),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Grafana = Pulumi.Grafana;
    using Grafana = Pulumiverse.Grafana;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleSlackChannel = Grafana.OnCall.GetSlackChannel.Invoke(new()
        {
            Name = "example_slack_channel",
        });
    
        var @default = new Grafana.OnCall.EscalationChain("default", new()
        {
            Name = "default",
        });
    
        var exampleIntegration = new Grafana.OnCall.Integration("example_integration", new()
        {
            Name = "Grafana Integration",
            Type = "grafana",
            DefaultRoute = null,
        });
    
        var exampleRoute = new Grafana.OnCall.Route("example_route", new()
        {
            IntegrationId = exampleIntegration.Id,
            EscalationChainId = @default.Id,
            RoutingRegex = "us-(east|west)",
            Position = 0,
            Slack = new Grafana.OnCall.Inputs.RouteSlackArgs
            {
                ChannelId = exampleSlackChannel.Apply(getSlackChannelResult => getSlackChannelResult.SlackId),
                Enabled = true,
            },
            Telegram = new Grafana.OnCall.Inputs.RouteTelegramArgs
            {
                Id = "ONCALLTELEGRAMID",
                Enabled = true,
            },
            Msteams = new Grafana.OnCall.Inputs.RouteMsteamsArgs
            {
                Id = "ONCALLMSTEAMSID",
                Enabled = false,
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.grafana.onCall.OnCallFunctions;
    import com.pulumi.grafana.onCall.inputs.GetSlackChannelArgs;
    import com.pulumi.grafana.onCall.EscalationChain;
    import com.pulumi.grafana.onCall.EscalationChainArgs;
    import com.pulumi.grafana.onCall.Integration;
    import com.pulumi.grafana.onCall.IntegrationArgs;
    import com.pulumi.grafana.onCall.inputs.IntegrationDefaultRouteArgs;
    import com.pulumi.grafana.onCall.Route;
    import com.pulumi.grafana.onCall.RouteArgs;
    import com.pulumi.grafana.onCall.inputs.RouteSlackArgs;
    import com.pulumi.grafana.onCall.inputs.RouteTelegramArgs;
    import com.pulumi.grafana.onCall.inputs.RouteMsteamsArgs;
    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 = OnCallFunctions.getSlackChannel(GetSlackChannelArgs.builder()
                .name("example_slack_channel")
                .build());
    
            var default_ = new EscalationChain("default", EscalationChainArgs.builder()
                .name("default")
                .build());
    
            var exampleIntegration = new Integration("exampleIntegration", IntegrationArgs.builder()
                .name("Grafana Integration")
                .type("grafana")
                .defaultRoute()
                .build());
    
            var exampleRoute = new Route("exampleRoute", RouteArgs.builder()
                .integrationId(exampleIntegration.id())
                .escalationChainId(default_.id())
                .routingRegex("us-(east|west)")
                .position(0)
                .slack(RouteSlackArgs.builder()
                    .channelId(exampleSlackChannel.applyValue(getSlackChannelResult -> getSlackChannelResult.slackId()))
                    .enabled(true)
                    .build())
                .telegram(RouteTelegramArgs.builder()
                    .id("ONCALLTELEGRAMID")
                    .enabled(true)
                    .build())
                .msteams(RouteMsteamsArgs.builder()
                    .id("ONCALLMSTEAMSID")
                    .enabled(false)
                    .build())
                .build());
    
        }
    }
    
    resources:
      default:
        type: grafana:onCall:EscalationChain
        properties:
          name: default
      exampleIntegration:
        type: grafana:onCall:Integration
        name: example_integration
        properties:
          name: Grafana Integration
          type: grafana
          defaultRoute: {}
      exampleRoute:
        type: grafana:onCall:Route
        name: example_route
        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:onCall:getSlackChannel
          Arguments:
            name: example_slack_channel
    

    Create OncallRoute Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new OncallRoute(name: string, args: OncallRouteArgs, opts?: CustomResourceOptions);
    @overload
    def OncallRoute(resource_name: str,
                    args: OncallRouteArgs,
                    opts: Optional[ResourceOptions] = None)
    
    @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,
                    routing_type: Optional[str] = None,
                    slack: Optional[OncallRouteSlackArgs] = None,
                    telegram: Optional[OncallRouteTelegramArgs] = 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.
    
    

    Parameters

    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

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    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 Pulumiverse.Grafana.Inputs.OncallRouteMsteams
    MS teams-specific settings for a route.
    RoutingType string
    The type of route. Can be jinja2, regex Defaults to regex.
    Slack Pulumiverse.Grafana.Inputs.OncallRouteSlack
    Slack-specific settings for a route.
    Telegram Pulumiverse.Grafana.Inputs.OncallRouteTelegram
    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.
    RoutingType string
    The type of route. Can be jinja2, regex Defaults to regex.
    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 OncallRouteMsteams
    MS teams-specific settings for a route.
    routingType String
    The type of route. Can be jinja2, regex Defaults to regex.
    slack OncallRouteSlack
    Slack-specific settings for a route.
    telegram OncallRouteTelegram
    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 OncallRouteMsteams
    MS teams-specific settings for a route.
    routingType string
    The type of route. Can be jinja2, regex Defaults to regex.
    slack OncallRouteSlack
    Slack-specific settings for a route.
    telegram OncallRouteTelegram
    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.
    routing_type str
    The type of route. Can be jinja2, regex Defaults to regex.
    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.
    routingType String
    The type of route. Can be jinja2, regex Defaults to regex.
    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,
            routing_type: 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 Pulumiverse.Grafana.Inputs.OncallRouteMsteams
    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.
    RoutingType string
    The type of route. Can be jinja2, regex Defaults to regex.
    Slack Pulumiverse.Grafana.Inputs.OncallRouteSlack
    Slack-specific settings for a route.
    Telegram Pulumiverse.Grafana.Inputs.OncallRouteTelegram
    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.
    RoutingType string
    The type of route. Can be jinja2, regex Defaults to regex.
    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 OncallRouteMsteams
    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.
    routingType String
    The type of route. Can be jinja2, regex Defaults to regex.
    slack OncallRouteSlack
    Slack-specific settings for a route.
    telegram OncallRouteTelegram
    Telegram-specific settings for a route.
    escalationChainId string
    The ID of the escalation chain.
    integrationId string
    The ID of the integration.
    msteams OncallRouteMsteams
    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.
    routingType string
    The type of route. Can be jinja2, regex Defaults to regex.
    slack OncallRouteSlack
    Slack-specific settings for a route.
    telegram OncallRouteTelegram
    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.
    routing_type str
    The type of route. Can be jinja2, regex Defaults to regex.
    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.
    routingType String
    The type of route. Can be jinja2, regex Defaults to regex.
    slack Property Map
    Slack-specific settings for a route.
    telegram Property Map
    Telegram-specific settings for a route.

    Supporting Types

    OncallRouteMsteams, OncallRouteMsteamsArgs

    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, OncallRouteSlackArgs

    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, OncallRouteTelegramArgs

    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 name "{{ id }}"
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    grafana pulumiverse/pulumi-grafana
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the grafana Terraform Provider.
    grafana logo
    Grafana v0.7.0 published on Tuesday, Nov 5, 2024 by pulumiverse