1. Packages
  2. Pagerduty Provider
  3. API Docs
  4. getPriority
PagerDuty v4.23.2 published on Wednesday, Apr 23, 2025 by Pulumi

pagerduty.getPriority

Explore with Pulumi AI

PagerDuty v4.23.2 published on Wednesday, Apr 23, 2025 by Pulumi

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

import * as pulumi from "@pulumi/pulumi";
import * as pagerduty from "@pulumi/pagerduty";

const p1 = pagerduty.getPriority({
    name: "P1",
});
const foo = new pagerduty.Ruleset("foo", {name: "Primary Ruleset"});
const fooRulesetRule = new pagerduty.RulesetRule("foo", {
    ruleset: foo.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),
        }],
    },
});
Copy
import pulumi
import pulumi_pagerduty as pagerduty

p1 = pagerduty.get_priority(name="P1")
foo = pagerduty.Ruleset("foo", name="Primary Ruleset")
foo_ruleset_rule = pagerduty.RulesetRule("foo",
    ruleset=foo.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.id,
        }],
    })
Copy
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 {
		p1, err := pagerduty.GetPriority(ctx, &pagerduty.GetPriorityArgs{
			Name: "P1",
		}, nil)
		if err != nil {
			return err
		}
		foo, err := pagerduty.NewRuleset(ctx, "foo", &pagerduty.RulesetArgs{
			Name: pulumi.String("Primary Ruleset"),
		})
		if err != nil {
			return err
		}
		_, err = pagerduty.NewRulesetRule(ctx, "foo", &pagerduty.RulesetRuleArgs{
			Ruleset:  foo.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
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Pagerduty = Pulumi.Pagerduty;

return await Deployment.RunAsync(() => 
{
    var p1 = Pagerduty.GetPriority.Invoke(new()
    {
        Name = "P1",
    });

    var foo = new Pagerduty.Ruleset("foo", new()
    {
        Name = "Primary Ruleset",
    });

    var fooRulesetRule = new Pagerduty.RulesetRule("foo", new()
    {
        Ruleset = foo.Id,
        Position = 0,
        Disabled = false,
        Conditions = new Pagerduty.Inputs.RulesetRuleConditionsArgs
        {
            Operator = "and",
            Subconditions = new[]
            {
                new Pagerduty.Inputs.RulesetRuleConditionsSubconditionArgs
                {
                    Operator = "contains",
                    Parameters = new[]
                    {
                        new Pagerduty.Inputs.RulesetRuleConditionsSubconditionParameterArgs
                        {
                            Value = "disk space",
                            Path = "payload.summary",
                        },
                    },
                },
                new Pagerduty.Inputs.RulesetRuleConditionsSubconditionArgs
                {
                    Operator = "contains",
                    Parameters = new[]
                    {
                        new Pagerduty.Inputs.RulesetRuleConditionsSubconditionParameterArgs
                        {
                            Value = "db",
                            Path = "payload.source",
                        },
                    },
                },
            },
        },
        Actions = new Pagerduty.Inputs.RulesetRuleActionsArgs
        {
            Routes = new[]
            {
                new Pagerduty.Inputs.RulesetRuleActionsRouteArgs
                {
                    Value = "P5DTL0K",
                },
            },
            Priorities = new[]
            {
                new Pagerduty.Inputs.RulesetRuleActionsPriorityArgs
                {
                    Value = p1.Apply(getPriorityResult => getPriorityResult.Id),
                },
            },
        },
    });

});
Copy
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.GetPriorityArgs;
import com.pulumi.pagerduty.Ruleset;
import com.pulumi.pagerduty.RulesetArgs;
import com.pulumi.pagerduty.RulesetRule;
import com.pulumi.pagerduty.RulesetRuleArgs;
import com.pulumi.pagerduty.inputs.RulesetRuleConditionsArgs;
import com.pulumi.pagerduty.inputs.RulesetRuleActionsArgs;
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 p1 = PagerdutyFunctions.getPriority(GetPriorityArgs.builder()
            .name("P1")
            .build());

        var foo = new Ruleset("foo", RulesetArgs.builder()
            .name("Primary Ruleset")
            .build());

        var fooRulesetRule = new RulesetRule("fooRulesetRule", RulesetRuleArgs.builder()
            .ruleset(foo.id())
            .position(0)
            .disabled(false)
            .conditions(RulesetRuleConditionsArgs.builder()
                .operator("and")
                .subconditions(                
                    RulesetRuleConditionsSubconditionArgs.builder()
                        .operator("contains")
                        .parameters(RulesetRuleConditionsSubconditionParameterArgs.builder()
                            .value("disk space")
                            .path("payload.summary")
                            .build())
                        .build(),
                    RulesetRuleConditionsSubconditionArgs.builder()
                        .operator("contains")
                        .parameters(RulesetRuleConditionsSubconditionParameterArgs.builder()
                            .value("db")
                            .path("payload.source")
                            .build())
                        .build())
                .build())
            .actions(RulesetRuleActionsArgs.builder()
                .routes(RulesetRuleActionsRouteArgs.builder()
                    .value("P5DTL0K")
                    .build())
                .priorities(RulesetRuleActionsPriorityArgs.builder()
                    .value(p1.id())
                    .build())
                .build())
            .build());

    }
}
Copy
resources:
  foo:
    type: pagerduty:Ruleset
    properties:
      name: Primary Ruleset
  fooRulesetRule:
    type: pagerduty:RulesetRule
    name: foo
    properties:
      ruleset: ${foo.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.id}
variables:
  p1:
    fn::invoke:
      function: pagerduty:getPriority
      arguments:
        name: P1
Copy

Using getPriority

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 getPriority(args: GetPriorityArgs, opts?: InvokeOptions): Promise<GetPriorityResult>
function getPriorityOutput(args: GetPriorityOutputArgs, opts?: InvokeOptions): Output<GetPriorityResult>
Copy
def get_priority(name: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetPriorityResult
def get_priority_output(name: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetPriorityResult]
Copy
func GetPriority(ctx *Context, args *GetPriorityArgs, opts ...InvokeOption) (*GetPriorityResult, error)
func GetPriorityOutput(ctx *Context, args *GetPriorityOutputArgs, opts ...InvokeOption) GetPriorityResultOutput
Copy

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

public static class GetPriority 
{
    public static Task<GetPriorityResult> InvokeAsync(GetPriorityArgs args, InvokeOptions? opts = null)
    public static Output<GetPriorityResult> Invoke(GetPriorityInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetPriorityResult> getPriority(GetPriorityArgs args, InvokeOptions options)
public static Output<GetPriorityResult> getPriority(GetPriorityArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: pagerduty:index/getPriority:getPriority
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name This property is required. string
The name of the priority to find in the PagerDuty API.
Name This property is required. string
The name of the priority to find in the PagerDuty API.
name This property is required. String
The name of the priority to find in the PagerDuty API.
name This property is required. string
The name of the priority to find in the PagerDuty API.
name This property is required. str
The name of the priority to find in the PagerDuty API.
name This property is required. String
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 ID of the found priority.
Name string
The name of the found priority.
Description string
A description of the found priority.
Id string
The ID of the found priority.
Name string
The name of the found priority.
description String
A description of the found priority.
id String
The ID of the found priority.
name String
The name of the found priority.
description string
A description of the found priority.
id string
The ID of the found priority.
name string
The name of the found priority.
description str
A description of the found priority.
id str
The ID of the found priority.
name str
The name of the found priority.
description String
A description of the found priority.
id String
The ID of the found priority.
name String
The name of the found priority.

Package Details

Repository
PagerDuty pulumi/pulumi-pagerduty
License
Apache-2.0
Notes
This Pulumi package is based on the pagerduty Terraform Provider.
PagerDuty v4.23.2 published on Wednesday, Apr 23, 2025 by Pulumi