1. Packages
  2. PagerDuty
  3. API Docs
  4. getSchedule
PagerDuty v4.10.1 published on Wednesday, Mar 27, 2024 by Pulumi

pagerduty.getSchedule

Explore with Pulumi AI

pagerduty logo
PagerDuty v4.10.1 published on Wednesday, Mar 27, 2024 by Pulumi

    Use this data source to get information about a specific schedule that you can use for other PagerDuty resources.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as pagerduty from "@pulumi/pagerduty";
    
    const test = pagerduty.getSchedule({
        name: "Daily Engineering Rotation",
    });
    const foo = new pagerduty.EscalationPolicy("foo", {
        numLoops: 2,
        rules: [{
            escalationDelayInMinutes: 10,
            targets: [{
                type: "schedule",
                id: test.then(test => test.id),
            }],
        }],
    });
    
    import pulumi
    import pulumi_pagerduty as pagerduty
    
    test = pagerduty.get_schedule(name="Daily Engineering Rotation")
    foo = pagerduty.EscalationPolicy("foo",
        num_loops=2,
        rules=[pagerduty.EscalationPolicyRuleArgs(
            escalation_delay_in_minutes=10,
            targets=[pagerduty.EscalationPolicyRuleTargetArgs(
                type="schedule",
                id=test.id,
            )],
        )])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-pagerduty/sdk/v4/go/pagerduty"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		test, err := pagerduty.LookupSchedule(ctx, &pagerduty.LookupScheduleArgs{
    			Name: "Daily Engineering Rotation",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = pagerduty.NewEscalationPolicy(ctx, "foo", &pagerduty.EscalationPolicyArgs{
    			NumLoops: pulumi.Int(2),
    			Rules: pagerduty.EscalationPolicyRuleArray{
    				&pagerduty.EscalationPolicyRuleArgs{
    					EscalationDelayInMinutes: pulumi.Int(10),
    					Targets: pagerduty.EscalationPolicyRuleTargetArray{
    						&pagerduty.EscalationPolicyRuleTargetArgs{
    							Type: pulumi.String("schedule"),
    							Id:   pulumi.String(test.Id),
    						},
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Pagerduty = Pulumi.Pagerduty;
    
    return await Deployment.RunAsync(() => 
    {
        var test = Pagerduty.GetSchedule.Invoke(new()
        {
            Name = "Daily Engineering Rotation",
        });
    
        var foo = new Pagerduty.EscalationPolicy("foo", new()
        {
            NumLoops = 2,
            Rules = new[]
            {
                new Pagerduty.Inputs.EscalationPolicyRuleArgs
                {
                    EscalationDelayInMinutes = 10,
                    Targets = new[]
                    {
                        new Pagerduty.Inputs.EscalationPolicyRuleTargetArgs
                        {
                            Type = "schedule",
                            Id = test.Apply(getScheduleResult => getScheduleResult.Id),
                        },
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.pagerduty.PagerdutyFunctions;
    import com.pulumi.pagerduty.inputs.GetScheduleArgs;
    import com.pulumi.pagerduty.EscalationPolicy;
    import com.pulumi.pagerduty.EscalationPolicyArgs;
    import com.pulumi.pagerduty.inputs.EscalationPolicyRuleArgs;
    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 test = PagerdutyFunctions.getSchedule(GetScheduleArgs.builder()
                .name("Daily Engineering Rotation")
                .build());
    
            var foo = new EscalationPolicy("foo", EscalationPolicyArgs.builder()        
                .numLoops(2)
                .rules(EscalationPolicyRuleArgs.builder()
                    .escalationDelayInMinutes(10)
                    .targets(EscalationPolicyRuleTargetArgs.builder()
                        .type("schedule")
                        .id(test.applyValue(getScheduleResult -> getScheduleResult.id()))
                        .build())
                    .build())
                .build());
    
        }
    }
    
    resources:
      foo:
        type: pagerduty:EscalationPolicy
        properties:
          numLoops: 2
          rules:
            - escalationDelayInMinutes: 10
              targets:
                - type: schedule
                  id: ${test.id}
    variables:
      test:
        fn::invoke:
          Function: pagerduty:getSchedule
          Arguments:
            name: Daily Engineering Rotation
    

    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(name: Optional[str] = None,
                     opts: Optional[InvokeOptions] = None) -> GetScheduleResult
    def get_schedule_output(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)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: pagerduty:index/getSchedule:getSchedule
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    The name to use to find a schedule in the PagerDuty API.
    Name string
    The name to use to find a schedule in the PagerDuty API.
    name String
    The name to use to find a schedule in the PagerDuty API.
    name string
    The name to use to find a schedule in the PagerDuty API.
    name str
    The name to use to find a schedule in the PagerDuty API.
    name String
    The name to use to find a schedule in the PagerDuty API.

    getSchedule Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    The short name of the found schedule.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    The short name of the found schedule.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    The short name of the found schedule.
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    The short name of the found schedule.
    id str
    The provider-assigned unique ID for this managed resource.
    name str
    The short name of the found schedule.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    The short name of the found schedule.

    Package Details

    Repository
    PagerDuty pulumi/pulumi-pagerduty
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the pagerduty Terraform Provider.
    pagerduty logo
    PagerDuty v4.10.1 published on Wednesday, Mar 27, 2024 by Pulumi