1. Packages
  2. Pagerduty Provider
  3. API Docs
  4. EscalationPolicy
PagerDuty v4.17.1 published on Thursday, Nov 21, 2024 by Pulumi

pagerduty.EscalationPolicy

Explore with Pulumi AI

pagerduty logo
PagerDuty v4.17.1 published on Thursday, Nov 21, 2024 by Pulumi

    An escalation policy determines what user or schedule will be notified first, second, and so on when an incident is triggered. Escalation policies are used by one or more services.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as pagerduty from "@pulumi/pagerduty";
    
    const example = new pagerduty.Team("example", {
        name: "Engineering",
        description: "All engineering",
    });
    const exampleUser = new pagerduty.User("example", {
        name: "Earline Greenholt",
        email: "125.greenholt.earline@graham.name",
        teams: [example.id],
    });
    const exampleEscalationPolicy = new pagerduty.EscalationPolicy("example", {
        name: "Engineering Escalation Policy",
        numLoops: 2,
        teams: example.id,
        rules: [{
            escalationDelayInMinutes: 10,
            targets: [
                {
                    type: "user_reference",
                    id: exampleUser.id,
                },
                {
                    type: "user_reference",
                    id: example2.id,
                },
            ],
        }],
    });
    
    import pulumi
    import pulumi_pagerduty as pagerduty
    
    example = pagerduty.Team("example",
        name="Engineering",
        description="All engineering")
    example_user = pagerduty.User("example",
        name="Earline Greenholt",
        email="125.greenholt.earline@graham.name",
        teams=[example.id])
    example_escalation_policy = pagerduty.EscalationPolicy("example",
        name="Engineering Escalation Policy",
        num_loops=2,
        teams=example.id,
        rules=[{
            "escalation_delay_in_minutes": 10,
            "targets": [
                {
                    "type": "user_reference",
                    "id": example_user.id,
                },
                {
                    "type": "user_reference",
                    "id": example2["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 {
    		example, err := pagerduty.NewTeam(ctx, "example", &pagerduty.TeamArgs{
    			Name:        pulumi.String("Engineering"),
    			Description: pulumi.String("All engineering"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleUser, err := pagerduty.NewUser(ctx, "example", &pagerduty.UserArgs{
    			Name:  pulumi.String("Earline Greenholt"),
    			Email: pulumi.String("125.greenholt.earline@graham.name"),
    			Teams: pulumi.StringArray{
    				example.ID(),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = pagerduty.NewEscalationPolicy(ctx, "example", &pagerduty.EscalationPolicyArgs{
    			Name:     pulumi.String("Engineering Escalation Policy"),
    			NumLoops: pulumi.Int(2),
    			Teams:    example.ID(),
    			Rules: pagerduty.EscalationPolicyRuleArray{
    				&pagerduty.EscalationPolicyRuleArgs{
    					EscalationDelayInMinutes: pulumi.Int(10),
    					Targets: pagerduty.EscalationPolicyRuleTargetArray{
    						&pagerduty.EscalationPolicyRuleTargetArgs{
    							Type: pulumi.String("user_reference"),
    							Id:   exampleUser.ID(),
    						},
    						&pagerduty.EscalationPolicyRuleTargetArgs{
    							Type: pulumi.String("user_reference"),
    							Id:   pulumi.Any(example2.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 example = new Pagerduty.Team("example", new()
        {
            Name = "Engineering",
            Description = "All engineering",
        });
    
        var exampleUser = new Pagerduty.User("example", new()
        {
            Name = "Earline Greenholt",
            Email = "125.greenholt.earline@graham.name",
            Teams = new[]
            {
                example.Id,
            },
        });
    
        var exampleEscalationPolicy = new Pagerduty.EscalationPolicy("example", new()
        {
            Name = "Engineering Escalation Policy",
            NumLoops = 2,
            Teams = example.Id,
            Rules = new[]
            {
                new Pagerduty.Inputs.EscalationPolicyRuleArgs
                {
                    EscalationDelayInMinutes = 10,
                    Targets = new[]
                    {
                        new Pagerduty.Inputs.EscalationPolicyRuleTargetArgs
                        {
                            Type = "user_reference",
                            Id = exampleUser.Id,
                        },
                        new Pagerduty.Inputs.EscalationPolicyRuleTargetArgs
                        {
                            Type = "user_reference",
                            Id = example2.Id,
                        },
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.pagerduty.Team;
    import com.pulumi.pagerduty.TeamArgs;
    import com.pulumi.pagerduty.User;
    import com.pulumi.pagerduty.UserArgs;
    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) {
            var example = new Team("example", TeamArgs.builder()
                .name("Engineering")
                .description("All engineering")
                .build());
    
            var exampleUser = new User("exampleUser", UserArgs.builder()
                .name("Earline Greenholt")
                .email("125.greenholt.earline@graham.name")
                .teams(example.id())
                .build());
    
            var exampleEscalationPolicy = new EscalationPolicy("exampleEscalationPolicy", EscalationPolicyArgs.builder()
                .name("Engineering Escalation Policy")
                .numLoops(2)
                .teams(example.id())
                .rules(EscalationPolicyRuleArgs.builder()
                    .escalationDelayInMinutes(10)
                    .targets(                
                        EscalationPolicyRuleTargetArgs.builder()
                            .type("user_reference")
                            .id(exampleUser.id())
                            .build(),
                        EscalationPolicyRuleTargetArgs.builder()
                            .type("user_reference")
                            .id(example2.id())
                            .build())
                    .build())
                .build());
    
        }
    }
    
    resources:
      example:
        type: pagerduty:Team
        properties:
          name: Engineering
          description: All engineering
      exampleUser:
        type: pagerduty:User
        name: example
        properties:
          name: Earline Greenholt
          email: 125.greenholt.earline@graham.name
          teams:
            - ${example.id}
      exampleEscalationPolicy:
        type: pagerduty:EscalationPolicy
        name: example
        properties:
          name: Engineering Escalation Policy
          numLoops: 2
          teams: ${example.id}
          rules:
            - escalationDelayInMinutes: 10
              targets:
                - type: user_reference
                  id: ${exampleUser.id}
                - type: user_reference
                  id: ${example2.id}
    

    Create EscalationPolicy Resource

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

    Constructor syntax

    new EscalationPolicy(name: string, args: EscalationPolicyArgs, opts?: CustomResourceOptions);
    @overload
    def EscalationPolicy(resource_name: str,
                         args: EscalationPolicyArgs,
                         opts: Optional[ResourceOptions] = None)
    
    @overload
    def EscalationPolicy(resource_name: str,
                         opts: Optional[ResourceOptions] = None,
                         rules: Optional[Sequence[EscalationPolicyRuleArgs]] = None,
                         description: Optional[str] = None,
                         name: Optional[str] = None,
                         num_loops: Optional[int] = None,
                         teams: Optional[str] = None)
    func NewEscalationPolicy(ctx *Context, name string, args EscalationPolicyArgs, opts ...ResourceOption) (*EscalationPolicy, error)
    public EscalationPolicy(string name, EscalationPolicyArgs args, CustomResourceOptions? opts = null)
    public EscalationPolicy(String name, EscalationPolicyArgs args)
    public EscalationPolicy(String name, EscalationPolicyArgs args, CustomResourceOptions options)
    
    type: pagerduty:EscalationPolicy
    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 EscalationPolicyArgs
    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 EscalationPolicyArgs
    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 EscalationPolicyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args EscalationPolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args EscalationPolicyArgs
    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 escalationPolicyResource = new Pagerduty.EscalationPolicy("escalationPolicyResource", new()
    {
        Rules = new[]
        {
            new Pagerduty.Inputs.EscalationPolicyRuleArgs
            {
                EscalationDelayInMinutes = 0,
                Targets = new[]
                {
                    new Pagerduty.Inputs.EscalationPolicyRuleTargetArgs
                    {
                        Id = "string",
                        Type = "string",
                    },
                },
                EscalationRuleAssignmentStrategy = new Pagerduty.Inputs.EscalationPolicyRuleEscalationRuleAssignmentStrategyArgs
                {
                    Type = "string",
                },
                Id = "string",
            },
        },
        Description = "string",
        Name = "string",
        NumLoops = 0,
        Teams = "string",
    });
    
    example, err := pagerduty.NewEscalationPolicy(ctx, "escalationPolicyResource", &pagerduty.EscalationPolicyArgs{
    	Rules: pagerduty.EscalationPolicyRuleArray{
    		&pagerduty.EscalationPolicyRuleArgs{
    			EscalationDelayInMinutes: pulumi.Int(0),
    			Targets: pagerduty.EscalationPolicyRuleTargetArray{
    				&pagerduty.EscalationPolicyRuleTargetArgs{
    					Id:   pulumi.String("string"),
    					Type: pulumi.String("string"),
    				},
    			},
    			EscalationRuleAssignmentStrategy: &pagerduty.EscalationPolicyRuleEscalationRuleAssignmentStrategyArgs{
    				Type: pulumi.String("string"),
    			},
    			Id: pulumi.String("string"),
    		},
    	},
    	Description: pulumi.String("string"),
    	Name:        pulumi.String("string"),
    	NumLoops:    pulumi.Int(0),
    	Teams:       pulumi.String("string"),
    })
    
    var escalationPolicyResource = new EscalationPolicy("escalationPolicyResource", EscalationPolicyArgs.builder()
        .rules(EscalationPolicyRuleArgs.builder()
            .escalationDelayInMinutes(0)
            .targets(EscalationPolicyRuleTargetArgs.builder()
                .id("string")
                .type("string")
                .build())
            .escalationRuleAssignmentStrategy(EscalationPolicyRuleEscalationRuleAssignmentStrategyArgs.builder()
                .type("string")
                .build())
            .id("string")
            .build())
        .description("string")
        .name("string")
        .numLoops(0)
        .teams("string")
        .build());
    
    escalation_policy_resource = pagerduty.EscalationPolicy("escalationPolicyResource",
        rules=[{
            "escalation_delay_in_minutes": 0,
            "targets": [{
                "id": "string",
                "type": "string",
            }],
            "escalation_rule_assignment_strategy": {
                "type": "string",
            },
            "id": "string",
        }],
        description="string",
        name="string",
        num_loops=0,
        teams="string")
    
    const escalationPolicyResource = new pagerduty.EscalationPolicy("escalationPolicyResource", {
        rules: [{
            escalationDelayInMinutes: 0,
            targets: [{
                id: "string",
                type: "string",
            }],
            escalationRuleAssignmentStrategy: {
                type: "string",
            },
            id: "string",
        }],
        description: "string",
        name: "string",
        numLoops: 0,
        teams: "string",
    });
    
    type: pagerduty:EscalationPolicy
    properties:
        description: string
        name: string
        numLoops: 0
        rules:
            - escalationDelayInMinutes: 0
              escalationRuleAssignmentStrategy:
                type: string
              id: string
              targets:
                - id: string
                  type: string
        teams: string
    

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

    Rules List<EscalationPolicyRule>
    An Escalation rule block. Escalation rules documented below.
    Description string
    Name string
    The name of the escalation policy.
    NumLoops int
    The number of times the escalation policy will repeat after reaching the end of its escalation.
    Teams string
    Team associated with the policy (Only 1 team can be assigned to an Escalation Policy). Account must have the teams ability to use this parameter.
    Rules []EscalationPolicyRuleArgs
    An Escalation rule block. Escalation rules documented below.
    Description string
    Name string
    The name of the escalation policy.
    NumLoops int
    The number of times the escalation policy will repeat after reaching the end of its escalation.
    Teams string
    Team associated with the policy (Only 1 team can be assigned to an Escalation Policy). Account must have the teams ability to use this parameter.
    rules List<EscalationPolicyRule>
    An Escalation rule block. Escalation rules documented below.
    description String
    name String
    The name of the escalation policy.
    numLoops Integer
    The number of times the escalation policy will repeat after reaching the end of its escalation.
    teams String
    Team associated with the policy (Only 1 team can be assigned to an Escalation Policy). Account must have the teams ability to use this parameter.
    rules EscalationPolicyRule[]
    An Escalation rule block. Escalation rules documented below.
    description string
    name string
    The name of the escalation policy.
    numLoops number
    The number of times the escalation policy will repeat after reaching the end of its escalation.
    teams string
    Team associated with the policy (Only 1 team can be assigned to an Escalation Policy). Account must have the teams ability to use this parameter.
    rules Sequence[EscalationPolicyRuleArgs]
    An Escalation rule block. Escalation rules documented below.
    description str
    name str
    The name of the escalation policy.
    num_loops int
    The number of times the escalation policy will repeat after reaching the end of its escalation.
    teams str
    Team associated with the policy (Only 1 team can be assigned to an Escalation Policy). Account must have the teams ability to use this parameter.
    rules List<Property Map>
    An Escalation rule block. Escalation rules documented below.
    description String
    name String
    The name of the escalation policy.
    numLoops Number
    The number of times the escalation policy will repeat after reaching the end of its escalation.
    teams String
    Team associated with the policy (Only 1 team can be assigned to an Escalation Policy). Account must have the teams ability to use this parameter.

    Outputs

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

    Get an existing EscalationPolicy 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?: EscalationPolicyState, opts?: CustomResourceOptions): EscalationPolicy
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            description: Optional[str] = None,
            name: Optional[str] = None,
            num_loops: Optional[int] = None,
            rules: Optional[Sequence[EscalationPolicyRuleArgs]] = None,
            teams: Optional[str] = None) -> EscalationPolicy
    func GetEscalationPolicy(ctx *Context, name string, id IDInput, state *EscalationPolicyState, opts ...ResourceOption) (*EscalationPolicy, error)
    public static EscalationPolicy Get(string name, Input<string> id, EscalationPolicyState? state, CustomResourceOptions? opts = null)
    public static EscalationPolicy get(String name, Output<String> id, EscalationPolicyState 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:
    Description string
    Name string
    The name of the escalation policy.
    NumLoops int
    The number of times the escalation policy will repeat after reaching the end of its escalation.
    Rules List<EscalationPolicyRule>
    An Escalation rule block. Escalation rules documented below.
    Teams string
    Team associated with the policy (Only 1 team can be assigned to an Escalation Policy). Account must have the teams ability to use this parameter.
    Description string
    Name string
    The name of the escalation policy.
    NumLoops int
    The number of times the escalation policy will repeat after reaching the end of its escalation.
    Rules []EscalationPolicyRuleArgs
    An Escalation rule block. Escalation rules documented below.
    Teams string
    Team associated with the policy (Only 1 team can be assigned to an Escalation Policy). Account must have the teams ability to use this parameter.
    description String
    name String
    The name of the escalation policy.
    numLoops Integer
    The number of times the escalation policy will repeat after reaching the end of its escalation.
    rules List<EscalationPolicyRule>
    An Escalation rule block. Escalation rules documented below.
    teams String
    Team associated with the policy (Only 1 team can be assigned to an Escalation Policy). Account must have the teams ability to use this parameter.
    description string
    name string
    The name of the escalation policy.
    numLoops number
    The number of times the escalation policy will repeat after reaching the end of its escalation.
    rules EscalationPolicyRule[]
    An Escalation rule block. Escalation rules documented below.
    teams string
    Team associated with the policy (Only 1 team can be assigned to an Escalation Policy). Account must have the teams ability to use this parameter.
    description str
    name str
    The name of the escalation policy.
    num_loops int
    The number of times the escalation policy will repeat after reaching the end of its escalation.
    rules Sequence[EscalationPolicyRuleArgs]
    An Escalation rule block. Escalation rules documented below.
    teams str
    Team associated with the policy (Only 1 team can be assigned to an Escalation Policy). Account must have the teams ability to use this parameter.
    description String
    name String
    The name of the escalation policy.
    numLoops Number
    The number of times the escalation policy will repeat after reaching the end of its escalation.
    rules List<Property Map>
    An Escalation rule block. Escalation rules documented below.
    teams String
    Team associated with the policy (Only 1 team can be assigned to an Escalation Policy). Account must have the teams ability to use this parameter.

    Supporting Types

    EscalationPolicyRule, EscalationPolicyRuleArgs

    EscalationDelayInMinutes int
    The number of minutes before an unacknowledged incident escalates away from this rule.
    Targets List<EscalationPolicyRuleTarget>
    EscalationRuleAssignmentStrategy EscalationPolicyRuleEscalationRuleAssignmentStrategy
    The strategy used to assign the escalation rule to an incident. Documented below.
    Id string
    The ID of the escalation policy.
    EscalationDelayInMinutes int
    The number of minutes before an unacknowledged incident escalates away from this rule.
    Targets []EscalationPolicyRuleTarget
    EscalationRuleAssignmentStrategy EscalationPolicyRuleEscalationRuleAssignmentStrategy
    The strategy used to assign the escalation rule to an incident. Documented below.
    Id string
    The ID of the escalation policy.
    escalationDelayInMinutes Integer
    The number of minutes before an unacknowledged incident escalates away from this rule.
    targets List<EscalationPolicyRuleTarget>
    escalationRuleAssignmentStrategy EscalationPolicyRuleEscalationRuleAssignmentStrategy
    The strategy used to assign the escalation rule to an incident. Documented below.
    id String
    The ID of the escalation policy.
    escalationDelayInMinutes number
    The number of minutes before an unacknowledged incident escalates away from this rule.
    targets EscalationPolicyRuleTarget[]
    escalationRuleAssignmentStrategy EscalationPolicyRuleEscalationRuleAssignmentStrategy
    The strategy used to assign the escalation rule to an incident. Documented below.
    id string
    The ID of the escalation policy.
    escalation_delay_in_minutes int
    The number of minutes before an unacknowledged incident escalates away from this rule.
    targets Sequence[EscalationPolicyRuleTarget]
    escalation_rule_assignment_strategy EscalationPolicyRuleEscalationRuleAssignmentStrategy
    The strategy used to assign the escalation rule to an incident. Documented below.
    id str
    The ID of the escalation policy.
    escalationDelayInMinutes Number
    The number of minutes before an unacknowledged incident escalates away from this rule.
    targets List<Property Map>
    escalationRuleAssignmentStrategy Property Map
    The strategy used to assign the escalation rule to an incident. Documented below.
    id String
    The ID of the escalation policy.

    EscalationPolicyRuleEscalationRuleAssignmentStrategy, EscalationPolicyRuleEscalationRuleAssignmentStrategyArgs

    Type string
    Can be round_robin or assign_to_everyone.
    Type string
    Can be round_robin or assign_to_everyone.
    type String
    Can be round_robin or assign_to_everyone.
    type string
    Can be round_robin or assign_to_everyone.
    type str
    Can be round_robin or assign_to_everyone.
    type String
    Can be round_robin or assign_to_everyone.

    EscalationPolicyRuleTarget, EscalationPolicyRuleTargetArgs

    Id string
    A target ID
    Type string
    Can be user_reference or schedule_reference. Defaults to user_reference. For multiple users as example, repeat the target.
    Id string
    A target ID
    Type string
    Can be user_reference or schedule_reference. Defaults to user_reference. For multiple users as example, repeat the target.
    id String
    A target ID
    type String
    Can be user_reference or schedule_reference. Defaults to user_reference. For multiple users as example, repeat the target.
    id string
    A target ID
    type string
    Can be user_reference or schedule_reference. Defaults to user_reference. For multiple users as example, repeat the target.
    id str
    A target ID
    type str
    Can be user_reference or schedule_reference. Defaults to user_reference. For multiple users as example, repeat the target.
    id String
    A target ID
    type String
    Can be user_reference or schedule_reference. Defaults to user_reference. For multiple users as example, repeat the target.

    Import

    Escalation policies can be imported using the id, e.g.

    $ pulumi import pagerduty:index/escalationPolicy:EscalationPolicy main PLBP09X
    

    To learn more about importing existing cloud resources, see Importing resources.

    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.17.1 published on Thursday, Nov 21, 2024 by Pulumi