getPriority

Use this data source to get information about a specific priority that you can use for other PagerDuty resources. A priority is a label representing the importance and impact of an incident. This feature is only available on Standard and Enterprise plans.

Example Usage

using Pulumi;
using Pagerduty = Pulumi.Pagerduty;

class MyStack : Stack
{
    public MyStack()
    {
        var p1 = Output.Create(Pagerduty.GetPriority.InvokeAsync(new Pagerduty.GetPriorityArgs
        {
            Name = "P1",
        }));
        var fooRuleset = new Pagerduty.Ruleset("fooRuleset", new Pagerduty.RulesetArgs
        {
        });
        var fooRulesetRule = new Pagerduty.RulesetRule("fooRulesetRule", new Pagerduty.RulesetRuleArgs
        {
            Ruleset = fooRuleset.Id,
            Position = 0,
            Disabled = false,
            Conditions = new Pagerduty.Inputs.RulesetRuleConditionsArgs
            {
                Operator = "and",
                Subconditions = 
                {
                    new Pagerduty.Inputs.RulesetRuleConditionsSubconditionArgs
                    {
                        Operator = "contains",
                        Parameters = 
                        {
                            new Pagerduty.Inputs.RulesetRuleConditionsSubconditionParameterArgs
                            {
                                Value = "disk space",
                                Path = "payload.summary",
                            },
                        },
                    },
                    new Pagerduty.Inputs.RulesetRuleConditionsSubconditionArgs
                    {
                        Operator = "contains",
                        Parameters = 
                        {
                            new Pagerduty.Inputs.RulesetRuleConditionsSubconditionParameterArgs
                            {
                                Value = "db",
                                Path = "payload.source",
                            },
                        },
                    },
                },
            },
            Actions = new Pagerduty.Inputs.RulesetRuleActionsArgs
            {
                Routes = 
                {
                    new Pagerduty.Inputs.RulesetRuleActionsRouteArgs
                    {
                        Value = "P5DTL0K",
                    },
                },
                Priorities = 
                {
                    new Pagerduty.Inputs.RulesetRuleActionsPriorityArgs
                    {
                        Value = p1.Apply(p1 => p1.Id),
                    },
                },
            },
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-pagerduty/sdk/v2/go/pagerduty"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		p1, err := pagerduty.GetPriority(ctx, &pagerduty.GetPriorityArgs{
			Name: "P1",
		}, nil)
		if err != nil {
			return err
		}
		fooRuleset, err := pagerduty.NewRuleset(ctx, "fooRuleset", nil)
		if err != nil {
			return err
		}
		_, err = pagerduty.NewRulesetRule(ctx, "fooRulesetRule", &pagerduty.RulesetRuleArgs{
			Ruleset:  fooRuleset.ID(),
			Position: pulumi.Int(0),
			Disabled: pulumi.Bool(false),
			Conditions: &pagerduty.RulesetRuleConditionsArgs{
				Operator: pulumi.String("and"),
				Subconditions: pagerduty.RulesetRuleConditionsSubconditionArray{
					&pagerduty.RulesetRuleConditionsSubconditionArgs{
						Operator: pulumi.String("contains"),
						Parameters: pagerduty.RulesetRuleConditionsSubconditionParameterArray{
							&pagerduty.RulesetRuleConditionsSubconditionParameterArgs{
								Value: pulumi.String("disk space"),
								Path:  pulumi.String("payload.summary"),
							},
						},
					},
					&pagerduty.RulesetRuleConditionsSubconditionArgs{
						Operator: pulumi.String("contains"),
						Parameters: pagerduty.RulesetRuleConditionsSubconditionParameterArray{
							&pagerduty.RulesetRuleConditionsSubconditionParameterArgs{
								Value: pulumi.String("db"),
								Path:  pulumi.String("payload.source"),
							},
						},
					},
				},
			},
			Actions: &pagerduty.RulesetRuleActionsArgs{
				Routes: pagerduty.RulesetRuleActionsRouteArray{
					&pagerduty.RulesetRuleActionsRouteArgs{
						Value: pulumi.String("P5DTL0K"),
					},
				},
				Priorities: pagerduty.RulesetRuleActionsPriorityArray{
					&pagerduty.RulesetRuleActionsPriorityArgs{
						Value: pulumi.String(p1.Id),
					},
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_pagerduty as pagerduty

p1 = pagerduty.get_priority(name="P1")
foo_ruleset = pagerduty.Ruleset("fooRuleset")
foo_ruleset_rule = pagerduty.RulesetRule("fooRulesetRule",
    ruleset=foo_ruleset.id,
    position=0,
    disabled=False,
    conditions=pagerduty.RulesetRuleConditionsArgs(
        operator="and",
        subconditions=[
            pagerduty.RulesetRuleConditionsSubconditionArgs(
                operator="contains",
                parameters=[pagerduty.RulesetRuleConditionsSubconditionParameterArgs(
                    value="disk space",
                    path="payload.summary",
                )],
            ),
            pagerduty.RulesetRuleConditionsSubconditionArgs(
                operator="contains",
                parameters=[pagerduty.RulesetRuleConditionsSubconditionParameterArgs(
                    value="db",
                    path="payload.source",
                )],
            ),
        ],
    ),
    actions=pagerduty.RulesetRuleActionsArgs(
        routes=[pagerduty.RulesetRuleActionsRouteArgs(
            value="P5DTL0K",
        )],
        priorities=[pagerduty.RulesetRuleActionsPriorityArgs(
            value=p1.id,
        )],
    ))
import * as pulumi from "@pulumi/pulumi";
import * as pagerduty from "@pulumi/pagerduty";

const p1 = pagerduty.getPriority({
    name: "P1",
});
const fooRuleset = new pagerduty.Ruleset("fooRuleset", {});
const fooRulesetRule = new pagerduty.RulesetRule("fooRulesetRule", {
    ruleset: fooRuleset.id,
    position: 0,
    disabled: "false",
    conditions: {
        operator: "and",
        subconditions: [
            {
                operator: "contains",
                parameters: [{
                    value: "disk space",
                    path: "payload.summary",
                }],
            },
            {
                operator: "contains",
                parameters: [{
                    value: "db",
                    path: "payload.source",
                }],
            },
        ],
    },
    actions: {
        routes: [{
            value: "P5DTL0K",
        }],
        priorities: [{
            value: p1.then(p1 => p1.id),
        }],
    },
});

Using getPriority

function getPriority(args: GetPriorityArgs, opts?: InvokeOptions): Promise<GetPriorityResult>
def get_priority(name: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetPriorityResult
func GetPriority(ctx *Context, args *GetPriorityArgs, opts ...InvokeOption) (*GetPriorityResult, error)

Note: This function is named GetPriority in the Go SDK.

public static class GetPriority {
    public static Task<GetPriorityResult> InvokeAsync(GetPriorityArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

Name string
The name of the priority to find in the PagerDuty API.
Name string
The name of the priority to find in the PagerDuty API.
name string
The name of the priority to find in the PagerDuty API.
name str
The name of the priority to find in the PagerDuty API.

getPriority Result

The following output properties are available:

Description string
A description of the found priority.
Id string
The provider-assigned unique ID for this managed resource.
Name string
The name of the found priority.
Description string
A description of the found priority.
Id string
The provider-assigned unique ID for this managed resource.
Name string
The name of the found priority.
description string
A description of the found priority.
id string
The provider-assigned unique ID for this managed resource.
name string
The name of the found priority.
description str
A description of the found priority.
id str
The provider-assigned unique ID for this managed resource.
name str
The name of the found priority.

Package Details

Repository
https://github.com/pulumi/pulumi-pagerduty
License
Apache-2.0
Notes
This Pulumi package is based on the pagerduty Terraform Provider.