1. Packages
  2. Incident Provider
  3. API Docs
  4. Schedule
incident 5.3.2 published on Tuesday, Apr 1, 2025 by incident-io

incident.Schedule

Explore with Pulumi AI

View and manage schedules. Manage your full schedule of on-call rotations, including the users and rotation configuration.

Example Usage

Coming soon!
Coming soon!
Coming soon!
Coming soon!
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.incident.IncidentFunctions;
import com.pulumi.incident.inputs.GetUserArgs;
import com.pulumi.incident.Schedule;
import com.pulumi.incident.ScheduleArgs;
import com.pulumi.incident.inputs.ScheduleRotationArgs;
import com.pulumi.incident.inputs.ScheduleHolidaysPublicConfigArgs;
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 rory = IncidentFunctions.getUser(GetUserArgs.builder()
            .id("01HPFH8T92MPGSQS5C1SPAF4V0")
            .build());

        final var martha = IncidentFunctions.getUser(GetUserArgs.builder()
            .slackUserId("U01HJ1J2Z6Z")
            .build());

        final var roryb = IncidentFunctions.getUser(GetUserArgs.builder()
            .email("rory@incident.io")
            .build());

        // This is exportable from the incident.io dashboard as a Terraform configuration
        var primaryOnCall = new Schedule("primaryOnCall", ScheduleArgs.builder()
            .timezone("Europe/London")
            .rotations(ScheduleRotationArgs.builder()
                .id("testing-terraform")
                .name("Testing Terraform")
                .versions(                
                    ScheduleRotationVersionArgs.builder()
                        .handoverStartAt("2024-05-01T12:54:13Z")
                        .users(martha.applyValue(getUserResult -> getUserResult.id()))
                        .layers(ScheduleRotationVersionLayerArgs.builder()
                            .id("primary")
                            .name("Primary")
                            .build())
                        .handovers(ScheduleRotationVersionHandoverArgs.builder()
                            .intervalType("daily")
                            .interval(1)
                            .build())
                        .build(),
                    ScheduleRotationVersionArgs.builder()
                        .effectiveFrom("2024-05-14T12:54:13Z")
                        .handoverStartAt("2024-05-01T12:54:13Z")
                        .users(                        
                            martha.applyValue(getUserResult -> getUserResult.id()),
                            rory.applyValue(getUserResult -> getUserResult.id()))
                        .layers(ScheduleRotationVersionLayerArgs.builder()
                            .id("primary")
                            .name("Primary")
                            .build())
                        .handovers(ScheduleRotationVersionHandoverArgs.builder()
                            .intervalType("weekly")
                            .interval(1)
                            .build())
                        .build())
                .build())
            .holidaysPublicConfig(ScheduleHolidaysPublicConfigArgs.builder()
                .country_codes(                
                    "GB",
                    "FR")
                .build())
            .build());

    }
}
Copy
resources:
  # This is exportable from the incident.io dashboard as a Terraform configuration
  primaryOnCall:
    type: incident:Schedule
    properties:
      # This is a valid value from the tz database
      #   # https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
      timezone: Europe/London
      rotations:
        - id: testing-terraform
          name: Testing Terraform
          versions:
            - handoverStartAt: 2024-05-01T12:54:13Z
              users:
                - ${martha.id}
              layers:
                - id: primary
                  name: Primary
              handovers:
                - intervalType: daily
                  interval: 1
            - effectiveFrom: 2024-05-14T12:54:13Z
              handoverStartAt: 2024-05-01T12:54:13Z
              users:
                - ${martha.id}
                - ${rory.id}
              layers:
                - id: primary
                  name: Primary
              handovers:
                - intervalType: weekly
                  interval: 1
      # If you want to show a country's public holidays on your schedule, use a list of alpha-2 country codes.
      holidaysPublicConfig:
        country_codes:
          - GB
          - FR
variables:
  rory:
    fn::invoke:
      function: incident:getUser
      arguments:
        id: 01HPFH8T92MPGSQS5C1SPAF4V0
  martha:
    fn::invoke:
      function: incident:getUser
      arguments:
        slackUserId: U01HJ1J2Z6Z
  roryb:
    fn::invoke:
      function: incident:getUser
      arguments:
        email: rory@incident.io
Copy

Create Schedule Resource

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

Constructor syntax

new Schedule(name: string, args: ScheduleArgs, opts?: CustomResourceOptions);
@overload
def Schedule(resource_name: str,
             args: ScheduleArgs,
             opts: Optional[ResourceOptions] = None)

@overload
def Schedule(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             rotations: Optional[Sequence[ScheduleRotationArgs]] = None,
             timezone: Optional[str] = None,
             holidays_public_config: Optional[ScheduleHolidaysPublicConfigArgs] = None,
             name: Optional[str] = None,
             team_ids: Optional[Sequence[str]] = None)
func NewSchedule(ctx *Context, name string, args ScheduleArgs, opts ...ResourceOption) (*Schedule, error)
public Schedule(string name, ScheduleArgs args, CustomResourceOptions? opts = null)
public Schedule(String name, ScheduleArgs args)
public Schedule(String name, ScheduleArgs args, CustomResourceOptions options)
type: incident:Schedule
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

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

Constructor example

The following reference example uses placeholder values for all input properties.

var scheduleResource = new Incident.Schedule("scheduleResource", new()
{
    Rotations = new[]
    {
        new Incident.Inputs.ScheduleRotationArgs
        {
            Id = "string",
            Name = "string",
            Versions = new[]
            {
                new Incident.Inputs.ScheduleRotationVersionArgs
                {
                    HandoverStartAt = "string",
                    Layers = new[]
                    {
                        new Incident.Inputs.ScheduleRotationVersionLayerArgs
                        {
                            Id = "string",
                            Name = "string",
                        },
                    },
                    Users = new[]
                    {
                        "string",
                    },
                    EffectiveFrom = "string",
                    Handovers = new[]
                    {
                        new Incident.Inputs.ScheduleRotationVersionHandoverArgs
                        {
                            Interval = 0,
                            IntervalType = "string",
                        },
                    },
                    WorkingIntervals = new[]
                    {
                        new Incident.Inputs.ScheduleRotationVersionWorkingIntervalArgs
                        {
                            EndTime = "string",
                            StartTime = "string",
                            Weekday = "string",
                        },
                    },
                },
            },
        },
    },
    Timezone = "string",
    HolidaysPublicConfig = new Incident.Inputs.ScheduleHolidaysPublicConfigArgs
    {
        CountryCodes = new[]
        {
            "string",
        },
    },
    Name = "string",
    TeamIds = new[]
    {
        "string",
    },
});
Copy
example, err := incident.NewSchedule(ctx, "scheduleResource", &incident.ScheduleArgs{
Rotations: .ScheduleRotationArray{
&.ScheduleRotationArgs{
Id: pulumi.String("string"),
Name: pulumi.String("string"),
Versions: .ScheduleRotationVersionArray{
&.ScheduleRotationVersionArgs{
HandoverStartAt: pulumi.String("string"),
Layers: .ScheduleRotationVersionLayerArray{
&.ScheduleRotationVersionLayerArgs{
Id: pulumi.String("string"),
Name: pulumi.String("string"),
},
},
Users: pulumi.StringArray{
pulumi.String("string"),
},
EffectiveFrom: pulumi.String("string"),
Handovers: .ScheduleRotationVersionHandoverArray{
&.ScheduleRotationVersionHandoverArgs{
Interval: pulumi.Float64(0),
IntervalType: pulumi.String("string"),
},
},
WorkingIntervals: .ScheduleRotationVersionWorkingIntervalArray{
&.ScheduleRotationVersionWorkingIntervalArgs{
EndTime: pulumi.String("string"),
StartTime: pulumi.String("string"),
Weekday: pulumi.String("string"),
},
},
},
},
},
},
Timezone: pulumi.String("string"),
HolidaysPublicConfig: &.ScheduleHolidaysPublicConfigArgs{
CountryCodes: pulumi.StringArray{
pulumi.String("string"),
},
},
Name: pulumi.String("string"),
TeamIds: pulumi.StringArray{
pulumi.String("string"),
},
})
Copy
var scheduleResource = new Schedule("scheduleResource", ScheduleArgs.builder()
    .rotations(ScheduleRotationArgs.builder()
        .id("string")
        .name("string")
        .versions(ScheduleRotationVersionArgs.builder()
            .handoverStartAt("string")
            .layers(ScheduleRotationVersionLayerArgs.builder()
                .id("string")
                .name("string")
                .build())
            .users("string")
            .effectiveFrom("string")
            .handovers(ScheduleRotationVersionHandoverArgs.builder()
                .interval(0)
                .intervalType("string")
                .build())
            .workingIntervals(ScheduleRotationVersionWorkingIntervalArgs.builder()
                .endTime("string")
                .startTime("string")
                .weekday("string")
                .build())
            .build())
        .build())
    .timezone("string")
    .holidaysPublicConfig(ScheduleHolidaysPublicConfigArgs.builder()
        .countryCodes("string")
        .build())
    .name("string")
    .teamIds("string")
    .build());
Copy
schedule_resource = incident.Schedule("scheduleResource",
    rotations=[{
        "id": "string",
        "name": "string",
        "versions": [{
            "handover_start_at": "string",
            "layers": [{
                "id": "string",
                "name": "string",
            }],
            "users": ["string"],
            "effective_from": "string",
            "handovers": [{
                "interval": 0,
                "interval_type": "string",
            }],
            "working_intervals": [{
                "end_time": "string",
                "start_time": "string",
                "weekday": "string",
            }],
        }],
    }],
    timezone="string",
    holidays_public_config={
        "country_codes": ["string"],
    },
    name="string",
    team_ids=["string"])
Copy
const scheduleResource = new incident.Schedule("scheduleResource", {
    rotations: [{
        id: "string",
        name: "string",
        versions: [{
            handoverStartAt: "string",
            layers: [{
                id: "string",
                name: "string",
            }],
            users: ["string"],
            effectiveFrom: "string",
            handovers: [{
                interval: 0,
                intervalType: "string",
            }],
            workingIntervals: [{
                endTime: "string",
                startTime: "string",
                weekday: "string",
            }],
        }],
    }],
    timezone: "string",
    holidaysPublicConfig: {
        countryCodes: ["string"],
    },
    name: "string",
    teamIds: ["string"],
});
Copy
type: incident:Schedule
properties:
    holidaysPublicConfig:
        countryCodes:
            - string
    name: string
    rotations:
        - id: string
          name: string
          versions:
            - effectiveFrom: string
              handoverStartAt: string
              handovers:
                - interval: 0
                  intervalType: string
              layers:
                - id: string
                  name: string
              users:
                - string
              workingIntervals:
                - endTime: string
                  startTime: string
                  weekday: string
    teamIds:
        - string
    timezone: string
Copy

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

Rotations This property is required. List<ScheduleRotation>
Timezone This property is required. string
HolidaysPublicConfig ScheduleHolidaysPublicConfig
Name string
Human readable name synced from external provider
TeamIds List<string>
IDs of teams that own this schedule
Rotations This property is required. []ScheduleRotationArgs
Timezone This property is required. string
HolidaysPublicConfig ScheduleHolidaysPublicConfigArgs
Name string
Human readable name synced from external provider
TeamIds []string
IDs of teams that own this schedule
rotations This property is required. List<ScheduleRotation>
timezone This property is required. String
holidaysPublicConfig ScheduleHolidaysPublicConfig
name String
Human readable name synced from external provider
teamIds List<String>
IDs of teams that own this schedule
rotations This property is required. ScheduleRotation[]
timezone This property is required. string
holidaysPublicConfig ScheduleHolidaysPublicConfig
name string
Human readable name synced from external provider
teamIds string[]
IDs of teams that own this schedule
rotations This property is required. Sequence[ScheduleRotationArgs]
timezone This property is required. str
holidays_public_config ScheduleHolidaysPublicConfigArgs
name str
Human readable name synced from external provider
team_ids Sequence[str]
IDs of teams that own this schedule
rotations This property is required. List<Property Map>
timezone This property is required. String
holidaysPublicConfig Property Map
name String
Human readable name synced from external provider
teamIds List<String>
IDs of teams that own this schedule

Outputs

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

Get an existing Schedule 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?: ScheduleState, opts?: CustomResourceOptions): Schedule
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        holidays_public_config: Optional[ScheduleHolidaysPublicConfigArgs] = None,
        name: Optional[str] = None,
        rotations: Optional[Sequence[ScheduleRotationArgs]] = None,
        team_ids: Optional[Sequence[str]] = None,
        timezone: Optional[str] = None) -> Schedule
func GetSchedule(ctx *Context, name string, id IDInput, state *ScheduleState, opts ...ResourceOption) (*Schedule, error)
public static Schedule Get(string name, Input<string> id, ScheduleState? state, CustomResourceOptions? opts = null)
public static Schedule get(String name, Output<String> id, ScheduleState state, CustomResourceOptions options)
resources:  _:    type: incident:Schedule    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
HolidaysPublicConfig ScheduleHolidaysPublicConfig
Name string
Human readable name synced from external provider
Rotations List<ScheduleRotation>
TeamIds List<string>
IDs of teams that own this schedule
Timezone string
HolidaysPublicConfig ScheduleHolidaysPublicConfigArgs
Name string
Human readable name synced from external provider
Rotations []ScheduleRotationArgs
TeamIds []string
IDs of teams that own this schedule
Timezone string
holidaysPublicConfig ScheduleHolidaysPublicConfig
name String
Human readable name synced from external provider
rotations List<ScheduleRotation>
teamIds List<String>
IDs of teams that own this schedule
timezone String
holidaysPublicConfig ScheduleHolidaysPublicConfig
name string
Human readable name synced from external provider
rotations ScheduleRotation[]
teamIds string[]
IDs of teams that own this schedule
timezone string
holidays_public_config ScheduleHolidaysPublicConfigArgs
name str
Human readable name synced from external provider
rotations Sequence[ScheduleRotationArgs]
team_ids Sequence[str]
IDs of teams that own this schedule
timezone str
holidaysPublicConfig Property Map
name String
Human readable name synced from external provider
rotations List<Property Map>
teamIds List<String>
IDs of teams that own this schedule
timezone String

Supporting Types

ScheduleHolidaysPublicConfig
, ScheduleHolidaysPublicConfigArgs

CountryCodes This property is required. List<string>
ISO 3166-1 alpha-2 country codes for the countries that this schedule is configured to view holidays for
CountryCodes This property is required. []string
ISO 3166-1 alpha-2 country codes for the countries that this schedule is configured to view holidays for
countryCodes This property is required. List<String>
ISO 3166-1 alpha-2 country codes for the countries that this schedule is configured to view holidays for
countryCodes This property is required. string[]
ISO 3166-1 alpha-2 country codes for the countries that this schedule is configured to view holidays for
country_codes This property is required. Sequence[str]
ISO 3166-1 alpha-2 country codes for the countries that this schedule is configured to view holidays for
countryCodes This property is required. List<String>
ISO 3166-1 alpha-2 country codes for the countries that this schedule is configured to view holidays for

ScheduleRotation
, ScheduleRotationArgs

Id This property is required. string
Unique internal ID of the rotation
Name This property is required. string
Human readable name synced from external provider
Versions This property is required. List<ScheduleRotationVersion>
Id This property is required. string
Unique internal ID of the rotation
Name This property is required. string
Human readable name synced from external provider
Versions This property is required. []ScheduleRotationVersion
id This property is required. String
Unique internal ID of the rotation
name This property is required. String
Human readable name synced from external provider
versions This property is required. List<ScheduleRotationVersion>
id This property is required. string
Unique internal ID of the rotation
name This property is required. string
Human readable name synced from external provider
versions This property is required. ScheduleRotationVersion[]
id This property is required. str
Unique internal ID of the rotation
name This property is required. str
Human readable name synced from external provider
versions This property is required. Sequence[ScheduleRotationVersion]
id This property is required. String
Unique internal ID of the rotation
name This property is required. String
Human readable name synced from external provider
versions This property is required. List<Property Map>

ScheduleRotationVersion
, ScheduleRotationVersionArgs

HandoverStartAt This property is required. string
Defines the next moment we'll trigger a handover
Layers This property is required. List<ScheduleRotationVersionLayer>
Controls how many people are on-call concurrently
Users This property is required. List<string>
The incident.io ID of a user
EffectiveFrom string
When this rotation config will be effective from
Handovers List<ScheduleRotationVersionHandover>
Defines the handover intervals for this rota, in order they should apply
WorkingIntervals List<ScheduleRotationVersionWorkingInterval>
Optional restrictions that define when to schedule people for this rota
HandoverStartAt This property is required. string
Defines the next moment we'll trigger a handover
Layers This property is required. []ScheduleRotationVersionLayer
Controls how many people are on-call concurrently
Users This property is required. []string
The incident.io ID of a user
EffectiveFrom string
When this rotation config will be effective from
Handovers []ScheduleRotationVersionHandover
Defines the handover intervals for this rota, in order they should apply
WorkingIntervals []ScheduleRotationVersionWorkingInterval
Optional restrictions that define when to schedule people for this rota
handoverStartAt This property is required. String
Defines the next moment we'll trigger a handover
layers This property is required. List<ScheduleRotationVersionLayer>
Controls how many people are on-call concurrently
users This property is required. List<String>
The incident.io ID of a user
effectiveFrom String
When this rotation config will be effective from
handovers List<ScheduleRotationVersionHandover>
Defines the handover intervals for this rota, in order they should apply
workingIntervals List<ScheduleRotationVersionWorkingInterval>
Optional restrictions that define when to schedule people for this rota
handoverStartAt This property is required. string
Defines the next moment we'll trigger a handover
layers This property is required. ScheduleRotationVersionLayer[]
Controls how many people are on-call concurrently
users This property is required. string[]
The incident.io ID of a user
effectiveFrom string
When this rotation config will be effective from
handovers ScheduleRotationVersionHandover[]
Defines the handover intervals for this rota, in order they should apply
workingIntervals ScheduleRotationVersionWorkingInterval[]
Optional restrictions that define when to schedule people for this rota
handover_start_at This property is required. str
Defines the next moment we'll trigger a handover
layers This property is required. Sequence[ScheduleRotationVersionLayer]
Controls how many people are on-call concurrently
users This property is required. Sequence[str]
The incident.io ID of a user
effective_from str
When this rotation config will be effective from
handovers Sequence[ScheduleRotationVersionHandover]
Defines the handover intervals for this rota, in order they should apply
working_intervals Sequence[ScheduleRotationVersionWorkingInterval]
Optional restrictions that define when to schedule people for this rota
handoverStartAt This property is required. String
Defines the next moment we'll trigger a handover
layers This property is required. List<Property Map>
Controls how many people are on-call concurrently
users This property is required. List<String>
The incident.io ID of a user
effectiveFrom String
When this rotation config will be effective from
handovers List<Property Map>
Defines the handover intervals for this rota, in order they should apply
workingIntervals List<Property Map>
Optional restrictions that define when to schedule people for this rota

ScheduleRotationVersionHandover
, ScheduleRotationVersionHandoverArgs

Interval This property is required. double
IntervalType This property is required. string
Interval This property is required. float64
IntervalType This property is required. string
interval This property is required. Double
intervalType This property is required. String
interval This property is required. number
intervalType This property is required. string
interval This property is required. float
interval_type This property is required. str
interval This property is required. Number
intervalType This property is required. String

ScheduleRotationVersionLayer
, ScheduleRotationVersionLayerArgs

Id This property is required. string
Name This property is required. string
Id This property is required. string
Name This property is required. string
id This property is required. String
name This property is required. String
id This property is required. string
name This property is required. string
id This property is required. str
name This property is required. str
id This property is required. String
name This property is required. String

ScheduleRotationVersionWorkingInterval
, ScheduleRotationVersionWorkingIntervalArgs

EndTime This property is required. string
StartTime This property is required. string
Weekday This property is required. string
EndTime This property is required. string
StartTime This property is required. string
Weekday This property is required. string
endTime This property is required. String
startTime This property is required. String
weekday This property is required. String
endTime This property is required. string
startTime This property is required. string
weekday This property is required. string
end_time This property is required. str
start_time This property is required. str
weekday This property is required. str
endTime This property is required. String
startTime This property is required. String
weekday This property is required. String

Package Details

Repository
incident incident-io/terraform-provider-incident
License
Notes
This Pulumi package is based on the incident Terraform Provider.