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());
}
}
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
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 string
- The unique name of the resource.
- args ScheduleArgs
- 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 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 string
- The unique name of the resource.
- args ScheduleArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ScheduleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args 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",
},
});
example, err := incident.NewSchedule(ctx, "scheduleResource", &incident.ScheduleArgs{
Rotations: incident.ScheduleRotationArray{
&incident.ScheduleRotationArgs{
Id: pulumi.String("string"),
Name: pulumi.String("string"),
Versions: incident.ScheduleRotationVersionArray{
&incident.ScheduleRotationVersionArgs{
HandoverStartAt: pulumi.String("string"),
Layers: incident.ScheduleRotationVersionLayerArray{
&incident.ScheduleRotationVersionLayerArgs{
Id: pulumi.String("string"),
Name: pulumi.String("string"),
},
},
Users: pulumi.StringArray{
pulumi.String("string"),
},
EffectiveFrom: pulumi.String("string"),
Handovers: incident.ScheduleRotationVersionHandoverArray{
&incident.ScheduleRotationVersionHandoverArgs{
Interval: pulumi.Float64(0),
IntervalType: pulumi.String("string"),
},
},
WorkingIntervals: incident.ScheduleRotationVersionWorkingIntervalArray{
&incident.ScheduleRotationVersionWorkingIntervalArgs{
EndTime: pulumi.String("string"),
StartTime: pulumi.String("string"),
Weekday: pulumi.String("string"),
},
},
},
},
},
},
Timezone: pulumi.String("string"),
HolidaysPublicConfig: &incident.ScheduleHolidaysPublicConfigArgs{
CountryCodes: pulumi.StringArray{
pulumi.String("string"),
},
},
Name: pulumi.String("string"),
TeamIds: pulumi.StringArray{
pulumi.String("string"),
},
})
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());
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"])
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"],
});
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
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
List<Schedule
Rotation> - Timezone string
- Holidays
Public ScheduleConfig Holidays Public Config - Name string
- Human readable name synced from external provider
- Team
Ids List<string> - IDs of teams that own this schedule
- Rotations
[]Schedule
Rotation Args - Timezone string
- Holidays
Public ScheduleConfig Holidays Public Config Args - Name string
- Human readable name synced from external provider
- Team
Ids []string - IDs of teams that own this schedule
- rotations
List<Schedule
Rotation> - timezone String
- holidays
Public ScheduleConfig Holidays Public Config - name String
- Human readable name synced from external provider
- team
Ids List<String> - IDs of teams that own this schedule
- rotations
Schedule
Rotation[] - timezone string
- holidays
Public ScheduleConfig Holidays Public Config - name string
- Human readable name synced from external provider
- team
Ids string[] - IDs of teams that own this schedule
- rotations
Sequence[Schedule
Rotation Args] - timezone str
- holidays_
public_ Scheduleconfig Holidays Public Config Args - name str
- Human readable name synced from external provider
- team_
ids Sequence[str] - IDs of teams that own this schedule
- rotations List<Property Map>
- timezone String
- holidays
Public Property MapConfig - name String
- Human readable name synced from external provider
- team
Ids 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
- 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.
- Holidays
Public ScheduleConfig Holidays Public Config - Name string
- Human readable name synced from external provider
- Rotations
List<Schedule
Rotation> - Team
Ids List<string> - IDs of teams that own this schedule
- Timezone string
- Holidays
Public ScheduleConfig Holidays Public Config Args - Name string
- Human readable name synced from external provider
- Rotations
[]Schedule
Rotation Args - Team
Ids []string - IDs of teams that own this schedule
- Timezone string
- holidays
Public ScheduleConfig Holidays Public Config - name String
- Human readable name synced from external provider
- rotations
List<Schedule
Rotation> - team
Ids List<String> - IDs of teams that own this schedule
- timezone String
- holidays
Public ScheduleConfig Holidays Public Config - name string
- Human readable name synced from external provider
- rotations
Schedule
Rotation[] - team
Ids string[] - IDs of teams that own this schedule
- timezone string
- holidays_
public_ Scheduleconfig Holidays Public Config Args - name str
- Human readable name synced from external provider
- rotations
Sequence[Schedule
Rotation Args] - team_
ids Sequence[str] - IDs of teams that own this schedule
- timezone str
- holidays
Public Property MapConfig - name String
- Human readable name synced from external provider
- rotations List<Property Map>
- team
Ids List<String> - IDs of teams that own this schedule
- timezone String
Supporting Types
ScheduleHolidaysPublicConfig, ScheduleHolidaysPublicConfigArgs
- Country
Codes List<string> - ISO 3166-1 alpha-2 country codes for the countries that this schedule is configured to view holidays for
- Country
Codes []string - ISO 3166-1 alpha-2 country codes for the countries that this schedule is configured to view holidays for
- country
Codes List<String> - ISO 3166-1 alpha-2 country codes for the countries that this schedule is configured to view holidays for
- country
Codes string[] - ISO 3166-1 alpha-2 country codes for the countries that this schedule is configured to view holidays for
- country_
codes Sequence[str] - ISO 3166-1 alpha-2 country codes for the countries that this schedule is configured to view holidays for
- country
Codes List<String> - ISO 3166-1 alpha-2 country codes for the countries that this schedule is configured to view holidays for
ScheduleRotation, ScheduleRotationArgs
- Id string
- Unique internal ID of the rotation
- Name string
- Human readable name synced from external provider
- Versions
List<Schedule
Rotation Version>
- Id string
- Unique internal ID of the rotation
- Name string
- Human readable name synced from external provider
- Versions
[]Schedule
Rotation Version
- id String
- Unique internal ID of the rotation
- name String
- Human readable name synced from external provider
- versions
List<Schedule
Rotation Version>
- id string
- Unique internal ID of the rotation
- name string
- Human readable name synced from external provider
- versions
Schedule
Rotation Version[]
- id str
- Unique internal ID of the rotation
- name str
- Human readable name synced from external provider
- versions
Sequence[Schedule
Rotation Version]
- id String
- Unique internal ID of the rotation
- name String
- Human readable name synced from external provider
- versions List<Property Map>
ScheduleRotationVersion, ScheduleRotationVersionArgs
- Handover
Start stringAt - Defines the next moment we'll trigger a handover
- Layers
List<Schedule
Rotation Version Layer> - Controls how many people are on-call concurrently
- Users List<string>
- The incident.io ID of a user
- Effective
From string - When this rotation config will be effective from
- Handovers
List<Schedule
Rotation Version Handover> - Defines the handover intervals for this rota, in order they should apply
- Working
Intervals List<ScheduleRotation Version Working Interval> - Optional restrictions that define when to schedule people for this rota
- Handover
Start stringAt - Defines the next moment we'll trigger a handover
- Layers
[]Schedule
Rotation Version Layer - Controls how many people are on-call concurrently
- Users []string
- The incident.io ID of a user
- Effective
From string - When this rotation config will be effective from
- Handovers
[]Schedule
Rotation Version Handover - Defines the handover intervals for this rota, in order they should apply
- Working
Intervals []ScheduleRotation Version Working Interval - Optional restrictions that define when to schedule people for this rota
- handover
Start StringAt - Defines the next moment we'll trigger a handover
- layers
List<Schedule
Rotation Version Layer> - Controls how many people are on-call concurrently
- users List<String>
- The incident.io ID of a user
- effective
From String - When this rotation config will be effective from
- handovers
List<Schedule
Rotation Version Handover> - Defines the handover intervals for this rota, in order they should apply
- working
Intervals List<ScheduleRotation Version Working Interval> - Optional restrictions that define when to schedule people for this rota
- handover
Start stringAt - Defines the next moment we'll trigger a handover
- layers
Schedule
Rotation Version Layer[] - Controls how many people are on-call concurrently
- users string[]
- The incident.io ID of a user
- effective
From string - When this rotation config will be effective from
- handovers
Schedule
Rotation Version Handover[] - Defines the handover intervals for this rota, in order they should apply
- working
Intervals ScheduleRotation Version Working Interval[] - Optional restrictions that define when to schedule people for this rota
- handover_
start_ strat - Defines the next moment we'll trigger a handover
- layers
Sequence[Schedule
Rotation Version Layer] - Controls how many people are on-call concurrently
- users Sequence[str]
- The incident.io ID of a user
- effective_
from str - When this rotation config will be effective from
- handovers
Sequence[Schedule
Rotation Version Handover] - Defines the handover intervals for this rota, in order they should apply
- working_
intervals Sequence[ScheduleRotation Version Working Interval] - Optional restrictions that define when to schedule people for this rota
- handover
Start StringAt - Defines the next moment we'll trigger a handover
- layers List<Property Map>
- Controls how many people are on-call concurrently
- users List<String>
- The incident.io ID of a user
- effective
From 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
- working
Intervals List<Property Map> - Optional restrictions that define when to schedule people for this rota
ScheduleRotationVersionHandover, ScheduleRotationVersionHandoverArgs
- Interval double
- Interval
Type string
- Interval float64
- Interval
Type string
- interval Double
- interval
Type String
- interval number
- interval
Type string
- interval float
- interval_
type str
- interval Number
- interval
Type String
ScheduleRotationVersionLayer, ScheduleRotationVersionLayerArgs
ScheduleRotationVersionWorkingInterval, ScheduleRotationVersionWorkingIntervalArgs
- end_
time str - start_
time str - weekday str
Import
#!/bin/bash
Import a schedule using its ID
Replace the ID with a real ID from your incident.io organization
$ pulumi import incident:index/schedule:Schedule example 01ABC123DEF456GHI789JKL
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- incident incident-io/terraform-provider-incident
- License
- Notes
- This Pulumi package is based on the
incident
Terraform Provider.