1. Packages
  2. Incident Provider
  3. API Docs
  4. getSchedule
incident 5.12.0 published on Friday, Jul 25, 2025 by incident-io

incident.getSchedule

Explore with Pulumi AI

incident logo
incident 5.12.0 published on Friday, Jul 25, 2025 by incident-io

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

    Use this data source to retrieve information about an existing schedule.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as incident from "@pulumi/incident";
    
    const byId = incident.getSchedule({
        id: "01HPFH8T92MPGSQS5C1SPAF4V0",
    });
    const byName = incident.getSchedule({
        name: "Primary On-call",
    });
    export const scheduleId = byName.then(byName => byName.id);
    export const scheduleTimezone = byName.then(byName => byName.timezone);
    export const scheduleTeamIds = byName.then(byName => byName.teamIds);
    
    import pulumi
    import pulumi_incident as incident
    
    by_id = incident.get_schedule(id="01HPFH8T92MPGSQS5C1SPAF4V0")
    by_name = incident.get_schedule(name="Primary On-call")
    pulumi.export("scheduleId", by_name.id)
    pulumi.export("scheduleTimezone", by_name.timezone)
    pulumi.export("scheduleTeamIds", by_name.team_ids)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/incident/v5/incident"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := incident.LookupSchedule(ctx, &incident.LookupScheduleArgs{
    			Id: pulumi.StringRef("01HPFH8T92MPGSQS5C1SPAF4V0"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		byName, err := incident.LookupSchedule(ctx, &incident.LookupScheduleArgs{
    			Name: pulumi.StringRef("Primary On-call"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("scheduleId", byName.Id)
    		ctx.Export("scheduleTimezone", byName.Timezone)
    		ctx.Export("scheduleTeamIds", byName.TeamIds)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Incident = Pulumi.Incident;
    
    return await Deployment.RunAsync(() => 
    {
        var byId = Incident.GetSchedule.Invoke(new()
        {
            Id = "01HPFH8T92MPGSQS5C1SPAF4V0",
        });
    
        var byName = Incident.GetSchedule.Invoke(new()
        {
            Name = "Primary On-call",
        });
    
        return new Dictionary<string, object?>
        {
            ["scheduleId"] = byName.Apply(getScheduleResult => getScheduleResult.Id),
            ["scheduleTimezone"] = byName.Apply(getScheduleResult => getScheduleResult.Timezone),
            ["scheduleTeamIds"] = byName.Apply(getScheduleResult => getScheduleResult.TeamIds),
        };
    });
    
    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.GetScheduleArgs;
    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 byId = IncidentFunctions.getSchedule(GetScheduleArgs.builder()
                .id("01HPFH8T92MPGSQS5C1SPAF4V0")
                .build());
    
            final var byName = IncidentFunctions.getSchedule(GetScheduleArgs.builder()
                .name("Primary On-call")
                .build());
    
            ctx.export("scheduleId", byName.applyValue(getScheduleResult -> getScheduleResult.id()));
            ctx.export("scheduleTimezone", byName.applyValue(getScheduleResult -> getScheduleResult.timezone()));
            ctx.export("scheduleTeamIds", byName.applyValue(getScheduleResult -> getScheduleResult.teamIds()));
        }
    }
    
    variables:
      byId:
        fn::invoke:
          function: incident:getSchedule
          arguments:
            id: 01HPFH8T92MPGSQS5C1SPAF4V0
      byName:
        fn::invoke:
          function: incident:getSchedule
          arguments:
            name: Primary On-call
    outputs:
      # Output the schedule details
      scheduleId: ${byName.id}
      scheduleTimezone: ${byName.timezone}
      scheduleTeamIds: ${byName.teamIds}
    

    Using getSchedule

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getSchedule(args: GetScheduleArgs, opts?: InvokeOptions): Promise<GetScheduleResult>
    function getScheduleOutput(args: GetScheduleOutputArgs, opts?: InvokeOptions): Output<GetScheduleResult>
    def get_schedule(id: Optional[str] = None,
                     name: Optional[str] = None,
                     opts: Optional[InvokeOptions] = None) -> GetScheduleResult
    def get_schedule_output(id: Optional[pulumi.Input[str]] = None,
                     name: Optional[pulumi.Input[str]] = None,
                     opts: Optional[InvokeOptions] = None) -> Output[GetScheduleResult]
    func LookupSchedule(ctx *Context, args *LookupScheduleArgs, opts ...InvokeOption) (*LookupScheduleResult, error)
    func LookupScheduleOutput(ctx *Context, args *LookupScheduleOutputArgs, opts ...InvokeOption) LookupScheduleResultOutput

    > Note: This function is named LookupSchedule in the Go SDK.

    public static class GetSchedule 
    {
        public static Task<GetScheduleResult> InvokeAsync(GetScheduleArgs args, InvokeOptions? opts = null)
        public static Output<GetScheduleResult> Invoke(GetScheduleInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetScheduleResult> getSchedule(GetScheduleArgs args, InvokeOptions options)
    public static Output<GetScheduleResult> getSchedule(GetScheduleArgs args, InvokeOptions options)
    
    fn::invoke:
      function: incident:index/getSchedule:getSchedule
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Id string
    Unique internal ID of the schedule
    Name string
    Human readable name synced from external provider
    Id string
    Unique internal ID of the schedule
    Name string
    Human readable name synced from external provider
    id String
    Unique internal ID of the schedule
    name String
    Human readable name synced from external provider
    id string
    Unique internal ID of the schedule
    name string
    Human readable name synced from external provider
    id str
    Unique internal ID of the schedule
    name str
    Human readable name synced from external provider
    id String
    Unique internal ID of the schedule
    name String
    Human readable name synced from external provider

    getSchedule Result

    The following output properties are available:

    Id string
    Unique internal ID of the schedule
    Name string
    Human readable name synced from external provider
    TeamIds List<string>
    IDs of teams that own this schedule
    Timezone string
    Timezone of the schedule, as interpreted at the point of generating the report
    Id string
    Unique internal ID of the schedule
    Name string
    Human readable name synced from external provider
    TeamIds []string
    IDs of teams that own this schedule
    Timezone string
    Timezone of the schedule, as interpreted at the point of generating the report
    id String
    Unique internal ID of the schedule
    name String
    Human readable name synced from external provider
    teamIds List<String>
    IDs of teams that own this schedule
    timezone String
    Timezone of the schedule, as interpreted at the point of generating the report
    id string
    Unique internal ID of the schedule
    name string
    Human readable name synced from external provider
    teamIds string[]
    IDs of teams that own this schedule
    timezone string
    Timezone of the schedule, as interpreted at the point of generating the report
    id str
    Unique internal ID of the schedule
    name str
    Human readable name synced from external provider
    team_ids Sequence[str]
    IDs of teams that own this schedule
    timezone str
    Timezone of the schedule, as interpreted at the point of generating the report
    id String
    Unique internal ID of the schedule
    name String
    Human readable name synced from external provider
    teamIds List<String>
    IDs of teams that own this schedule
    timezone String
    Timezone of the schedule, as interpreted at the point of generating the report

    Package Details

    Repository
    incident incident-io/terraform-provider-incident
    License
    Notes
    This Pulumi package is based on the incident Terraform Provider.
    incident logo
    incident 5.12.0 published on Friday, Jul 25, 2025 by incident-io