PagerDuty

Pulumi Official
Package maintained by Pulumi
v3.5.1 published on Thursday, Aug 4, 2022 by Pulumi

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/v3/go/pagerduty"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		p1, err := pagerduty.GetPriority(ctx, &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: &RulesetRuleConditionsArgs{
				Operator: pulumi.String("and"),
				Subconditions: RulesetRuleConditionsSubconditionArray{
					&RulesetRuleConditionsSubconditionArgs{
						Operator: pulumi.String("contains"),
						Parameters: RulesetRuleConditionsSubconditionParameterArray{
							&RulesetRuleConditionsSubconditionParameterArgs{
								Value: pulumi.String("disk space"),
								Path:  pulumi.String("payload.summary"),
							},
						},
					},
					&RulesetRuleConditionsSubconditionArgs{
						Operator: pulumi.String("contains"),
						Parameters: RulesetRuleConditionsSubconditionParameterArray{
							&RulesetRuleConditionsSubconditionParameterArgs{
								Value: pulumi.String("db"),
								Path:  pulumi.String("payload.source"),
							},
						},
					},
				},
			},
			Actions: &RulesetRuleActionsArgs{
				Routes: RulesetRuleActionsRouteArray{
					&RulesetRuleActionsRouteArgs{
						Value: pulumi.String("P5DTL0K"),
					},
				},
				Priorities: RulesetRuleActionsPriorityArray{
					&RulesetRuleActionsPriorityArgs{
						Value: pulumi.String(p1.Id),
					},
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
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.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 fooRuleset = new Ruleset("fooRuleset");

        var fooRulesetRule = new RulesetRule("fooRulesetRule", RulesetRuleArgs.builder()        
            .ruleset(fooRuleset.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.applyValue(getPriorityResult -> getPriorityResult.id()))
                    .build())
                .build())
            .build());

    }
}
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),
        }],
    },
});
resources:
  fooRuleset:
    type: pagerduty:Ruleset
  fooRulesetRule:
    type: pagerduty:RulesetRule
    properties:
      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.id}
variables:
  p1:
    Fn::Invoke:
      Function: pagerduty:getPriority
      Arguments:
        name: P1

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>
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]
func GetPriority(ctx *Context, args *GetPriorityArgs, opts ...InvokeOption) (*GetPriorityResult, error)
func GetPriorityOutput(ctx *Context, args *GetPriorityOutputArgs, opts ...InvokeOption) GetPriorityResultOutput

> 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)
}
public static CompletableFuture<GetPriorityResult> getPriority(GetPriorityArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: pagerduty:index/getPriority:getPriority
  Arguments:
    # Arguments dictionary

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 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.

name 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 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 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.

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.

Package Details

Repository
https://github.com/pulumi/pulumi-pagerduty
License
Apache-2.0
Notes

This Pulumi package is based on the pagerduty Terraform Provider.