grafana.OncallSchedule

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 exampleUserGroup = Grafana.GetOncallUserGroup.Invoke(new()
    {
        SlackHandle = "example_slack_handle",
    });

    // ICal based schedule
    var exampleScheduleOncallSchedule = new Grafana.OncallSchedule("exampleScheduleOncallSchedule", new()
    {
        Type = "ical",
        IcalUrlPrimary = "https://example.com/example_ical.ics",
        IcalUrlOverrides = "https://example.com/example_overrides_ical.ics",
        Slack = new Grafana.Inputs.OncallScheduleSlackArgs
        {
            ChannelId = exampleSlackChannel.Apply(getOnCallSlackChannelResult => getOnCallSlackChannelResult.SlackId),
            UserGroupId = exampleUserGroup.Apply(getOncallUserGroupResult => getOncallUserGroupResult.SlackId),
        },
    });

    // Shift based schedule
    var exampleScheduleIndex_oncallScheduleOncallSchedule = new Grafana.OncallSchedule("exampleScheduleIndex/oncallScheduleOncallSchedule", new()
    {
        Type = "calendar",
        TimeZone = "America/New_York",
        Shifts = new[] {},
        IcalUrlOverrides = "https://example.com/example_overrides_ical.ics",
    });

});
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
		}
		exampleUserGroup, err := grafana.GetOncallUserGroup(ctx, &grafana.GetOncallUserGroupArgs{
			SlackHandle: "example_slack_handle",
		}, nil)
		if err != nil {
			return err
		}
		_, err = grafana.NewOncallSchedule(ctx, "exampleScheduleOncallSchedule", &grafana.OncallScheduleArgs{
			Type:             pulumi.String("ical"),
			IcalUrlPrimary:   pulumi.String("https://example.com/example_ical.ics"),
			IcalUrlOverrides: pulumi.String("https://example.com/example_overrides_ical.ics"),
			Slack: &grafana.OncallScheduleSlackArgs{
				ChannelId:   *pulumi.String(exampleSlackChannel.SlackId),
				UserGroupId: *pulumi.String(exampleUserGroup.SlackId),
			},
		})
		if err != nil {
			return err
		}
		_, err = grafana.NewOncallSchedule(ctx, "exampleScheduleIndex/oncallScheduleOncallSchedule", &grafana.OncallScheduleArgs{
			Type:             pulumi.String("calendar"),
			TimeZone:         pulumi.String("America/New_York"),
			Shifts:           pulumi.StringArray{},
			IcalUrlOverrides: pulumi.String("https://example.com/example_overrides_ical.ics"),
		})
		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.inputs.GetOncallUserGroupArgs;
import com.pulumi.grafana.OncallSchedule;
import com.pulumi.grafana.OncallScheduleArgs;
import com.pulumi.grafana.inputs.OncallScheduleSlackArgs;
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());

        final var exampleUserGroup = GrafanaFunctions.getOncallUserGroup(GetOncallUserGroupArgs.builder()
            .slackHandle("example_slack_handle")
            .build());

        var exampleScheduleOncallSchedule = new OncallSchedule("exampleScheduleOncallSchedule", OncallScheduleArgs.builder()        
            .type("ical")
            .icalUrlPrimary("https://example.com/example_ical.ics")
            .icalUrlOverrides("https://example.com/example_overrides_ical.ics")
            .slack(OncallScheduleSlackArgs.builder()
                .channelId(exampleSlackChannel.applyValue(getOnCallSlackChannelResult -> getOnCallSlackChannelResult.slackId()))
                .userGroupId(exampleUserGroup.applyValue(getOncallUserGroupResult -> getOncallUserGroupResult.slackId()))
                .build())
            .build());

        var exampleScheduleIndex_oncallScheduleOncallSchedule = new OncallSchedule("exampleScheduleIndex/oncallScheduleOncallSchedule", OncallScheduleArgs.builder()        
            .type("calendar")
            .timeZone("America/New_York")
            .shifts()
            .icalUrlOverrides("https://example.com/example_overrides_ical.ics")
            .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")
example_user_group = grafana.get_oncall_user_group(slack_handle="example_slack_handle")
# ICal based schedule
example_schedule_oncall_schedule = grafana.OncallSchedule("exampleScheduleOncallSchedule",
    type="ical",
    ical_url_primary="https://example.com/example_ical.ics",
    ical_url_overrides="https://example.com/example_overrides_ical.ics",
    slack=grafana.OncallScheduleSlackArgs(
        channel_id=example_slack_channel.slack_id,
        user_group_id=example_user_group.slack_id,
    ))
# Shift based schedule
example_schedule_index_oncall_schedule_oncall_schedule = grafana.OncallSchedule("exampleScheduleIndex/oncallScheduleOncallSchedule",
    type="calendar",
    time_zone="America/New_York",
    shifts=[],
    ical_url_overrides="https://example.com/example_overrides_ical.ics")
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 exampleUserGroup = grafana.getOncallUserGroup({
    slackHandle: "example_slack_handle",
});
// ICal based schedule
const exampleScheduleOncallSchedule = new grafana.OncallSchedule("exampleScheduleOncallSchedule", {
    type: "ical",
    icalUrlPrimary: "https://example.com/example_ical.ics",
    icalUrlOverrides: "https://example.com/example_overrides_ical.ics",
    slack: {
        channelId: exampleSlackChannel.then(exampleSlackChannel => exampleSlackChannel.slackId),
        userGroupId: exampleUserGroup.then(exampleUserGroup => exampleUserGroup.slackId),
    },
});
// Shift based schedule
const exampleScheduleIndex_oncallScheduleOncallSchedule = new grafana.OncallSchedule("exampleScheduleIndex/oncallScheduleOncallSchedule", {
    type: "calendar",
    timeZone: "America/New_York",
    shifts: [],
    icalUrlOverrides: "https://example.com/example_overrides_ical.ics",
});
resources:
  # ICal based schedule
  exampleScheduleOncallSchedule:
    type: grafana:OncallSchedule
    properties:
      type: ical
      icalUrlPrimary: https://example.com/example_ical.ics
      icalUrlOverrides: https://example.com/example_overrides_ical.ics
      slack:
        channelId: ${exampleSlackChannel.slackId}
        userGroupId: ${exampleUserGroup.slackId}
  # Shift based schedule
  exampleScheduleIndex/oncallScheduleOncallSchedule:
    type: grafana:OncallSchedule
    properties:
      type: calendar
      timeZone: America/New_York
      shifts: []
      icalUrlOverrides: https://example.com/example_overrides_ical.ics
variables:
  exampleSlackChannel:
    fn::invoke:
      Function: grafana:getOnCallSlackChannel
      Arguments:
        name: example_slack_channel
  exampleUserGroup:
    fn::invoke:
      Function: grafana:getOncallUserGroup
      Arguments:
        slackHandle: example_slack_handle

Create OncallSchedule Resource

new OncallSchedule(name: string, args: OncallScheduleArgs, opts?: CustomResourceOptions);
@overload
def OncallSchedule(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   ical_url_overrides: Optional[str] = None,
                   ical_url_primary: Optional[str] = None,
                   name: Optional[str] = None,
                   shifts: Optional[Sequence[str]] = None,
                   slack: Optional[OncallScheduleSlackArgs] = None,
                   team_id: Optional[str] = None,
                   time_zone: Optional[str] = None,
                   type: Optional[str] = None)
@overload
def OncallSchedule(resource_name: str,
                   args: OncallScheduleArgs,
                   opts: Optional[ResourceOptions] = None)
func NewOncallSchedule(ctx *Context, name string, args OncallScheduleArgs, opts ...ResourceOption) (*OncallSchedule, error)
public OncallSchedule(string name, OncallScheduleArgs args, CustomResourceOptions? opts = null)
public OncallSchedule(String name, OncallScheduleArgs args)
public OncallSchedule(String name, OncallScheduleArgs args, CustomResourceOptions options)
type: grafana:OncallSchedule
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args OncallScheduleArgs
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 OncallScheduleArgs
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 OncallScheduleArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args OncallScheduleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args OncallScheduleArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

OncallSchedule 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 OncallSchedule resource accepts the following input properties:

Type string

The schedule's type.

IcalUrlOverrides string

The URL of external iCal calendar which override primary events.

IcalUrlPrimary string

The URL of the external calendar iCal file.

Name string

The schedule's name.

Shifts List<string>

The list of ID's of on-call shifts.

Slack Lbrlabs.PulumiPackage.Grafana.Inputs.OncallScheduleSlackArgs

The Slack-specific settings for a schedule.

TeamId string

The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the grafana.getOncallTeam datasource.

TimeZone string

The schedule's time zone.

Type string

The schedule's type.

IcalUrlOverrides string

The URL of external iCal calendar which override primary events.

IcalUrlPrimary string

The URL of the external calendar iCal file.

Name string

The schedule's name.

Shifts []string

The list of ID's of on-call shifts.

Slack OncallScheduleSlackArgs

The Slack-specific settings for a schedule.

TeamId string

The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the grafana.getOncallTeam datasource.

TimeZone string

The schedule's time zone.

type String

The schedule's type.

icalUrlOverrides String

The URL of external iCal calendar which override primary events.

icalUrlPrimary String

The URL of the external calendar iCal file.

name String

The schedule's name.

shifts List<String>

The list of ID's of on-call shifts.

slack OncallScheduleSlackArgs

The Slack-specific settings for a schedule.

teamId String

The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the grafana.getOncallTeam datasource.

timeZone String

The schedule's time zone.

type string

The schedule's type.

icalUrlOverrides string

The URL of external iCal calendar which override primary events.

icalUrlPrimary string

The URL of the external calendar iCal file.

name string

The schedule's name.

shifts string[]

The list of ID's of on-call shifts.

slack OncallScheduleSlackArgs

The Slack-specific settings for a schedule.

teamId string

The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the grafana.getOncallTeam datasource.

timeZone string

The schedule's time zone.

type str

The schedule's type.

ical_url_overrides str

The URL of external iCal calendar which override primary events.

ical_url_primary str

The URL of the external calendar iCal file.

name str

The schedule's name.

shifts Sequence[str]

The list of ID's of on-call shifts.

slack OncallScheduleSlackArgs

The Slack-specific settings for a schedule.

team_id str

The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the grafana.getOncallTeam datasource.

time_zone str

The schedule's time zone.

type String

The schedule's type.

icalUrlOverrides String

The URL of external iCal calendar which override primary events.

icalUrlPrimary String

The URL of the external calendar iCal file.

name String

The schedule's name.

shifts List<String>

The list of ID's of on-call shifts.

slack Property Map

The Slack-specific settings for a schedule.

teamId String

The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the grafana.getOncallTeam datasource.

timeZone String

The schedule's time zone.

Outputs

All input properties are implicitly available as output properties. Additionally, the OncallSchedule 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 OncallSchedule Resource

Get an existing OncallSchedule 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?: OncallScheduleState, opts?: CustomResourceOptions): OncallSchedule
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        ical_url_overrides: Optional[str] = None,
        ical_url_primary: Optional[str] = None,
        name: Optional[str] = None,
        shifts: Optional[Sequence[str]] = None,
        slack: Optional[OncallScheduleSlackArgs] = None,
        team_id: Optional[str] = None,
        time_zone: Optional[str] = None,
        type: Optional[str] = None) -> OncallSchedule
func GetOncallSchedule(ctx *Context, name string, id IDInput, state *OncallScheduleState, opts ...ResourceOption) (*OncallSchedule, error)
public static OncallSchedule Get(string name, Input<string> id, OncallScheduleState? state, CustomResourceOptions? opts = null)
public static OncallSchedule get(String name, Output<String> id, OncallScheduleState 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:
IcalUrlOverrides string

The URL of external iCal calendar which override primary events.

IcalUrlPrimary string

The URL of the external calendar iCal file.

Name string

The schedule's name.

Shifts List<string>

The list of ID's of on-call shifts.

Slack Lbrlabs.PulumiPackage.Grafana.Inputs.OncallScheduleSlackArgs

The Slack-specific settings for a schedule.

TeamId string

The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the grafana.getOncallTeam datasource.

TimeZone string

The schedule's time zone.

Type string

The schedule's type.

IcalUrlOverrides string

The URL of external iCal calendar which override primary events.

IcalUrlPrimary string

The URL of the external calendar iCal file.

Name string

The schedule's name.

Shifts []string

The list of ID's of on-call shifts.

Slack OncallScheduleSlackArgs

The Slack-specific settings for a schedule.

TeamId string

The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the grafana.getOncallTeam datasource.

TimeZone string

The schedule's time zone.

Type string

The schedule's type.

icalUrlOverrides String

The URL of external iCal calendar which override primary events.

icalUrlPrimary String

The URL of the external calendar iCal file.

name String

The schedule's name.

shifts List<String>

The list of ID's of on-call shifts.

slack OncallScheduleSlackArgs

The Slack-specific settings for a schedule.

teamId String

The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the grafana.getOncallTeam datasource.

timeZone String

The schedule's time zone.

type String

The schedule's type.

icalUrlOverrides string

The URL of external iCal calendar which override primary events.

icalUrlPrimary string

The URL of the external calendar iCal file.

name string

The schedule's name.

shifts string[]

The list of ID's of on-call shifts.

slack OncallScheduleSlackArgs

The Slack-specific settings for a schedule.

teamId string

The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the grafana.getOncallTeam datasource.

timeZone string

The schedule's time zone.

type string

The schedule's type.

ical_url_overrides str

The URL of external iCal calendar which override primary events.

ical_url_primary str

The URL of the external calendar iCal file.

name str

The schedule's name.

shifts Sequence[str]

The list of ID's of on-call shifts.

slack OncallScheduleSlackArgs

The Slack-specific settings for a schedule.

team_id str

The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the grafana.getOncallTeam datasource.

time_zone str

The schedule's time zone.

type str

The schedule's type.

icalUrlOverrides String

The URL of external iCal calendar which override primary events.

icalUrlPrimary String

The URL of the external calendar iCal file.

name String

The schedule's name.

shifts List<String>

The list of ID's of on-call shifts.

slack Property Map

The Slack-specific settings for a schedule.

teamId String

The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the grafana.getOncallTeam datasource.

timeZone String

The schedule's time zone.

type String

The schedule's type.

Supporting Types

OncallScheduleSlack

ChannelId string

Slack channel id. Reminder about schedule shifts will be directed to this channel in Slack.

UserGroupId string

Slack user group id. Members of user group will be updated when on-call users change.

ChannelId string

Slack channel id. Reminder about schedule shifts will be directed to this channel in Slack.

UserGroupId string

Slack user group id. Members of user group will be updated when on-call users change.

channelId String

Slack channel id. Reminder about schedule shifts will be directed to this channel in Slack.

userGroupId String

Slack user group id. Members of user group will be updated when on-call users change.

channelId string

Slack channel id. Reminder about schedule shifts will be directed to this channel in Slack.

userGroupId string

Slack user group id. Members of user group will be updated when on-call users change.

channel_id str

Slack channel id. Reminder about schedule shifts will be directed to this channel in Slack.

user_group_id str

Slack user group id. Members of user group will be updated when on-call users change.

channelId String

Slack channel id. Reminder about schedule shifts will be directed to this channel in Slack.

userGroupId String

Slack user group id. Members of user group will be updated when on-call users change.

Import

 $ pulumi import grafana:index/oncallSchedule:OncallSchedule schedule_name {{schedule_id}}

Package Details

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

This Pulumi package is based on the grafana Terraform Provider.