PagerDuty

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

Extension

An extension can be associated with a service.

Example Usage

using Pulumi;
using Pagerduty = Pulumi.Pagerduty;

class MyStack : Stack
{
    public MyStack()
    {
        var webhook = Output.Create(Pagerduty.GetExtensionSchema.InvokeAsync(new Pagerduty.GetExtensionSchemaArgs
        {
            Name = "Generic V2 Webhook",
        }));
        var exampleUser = new Pagerduty.User("exampleUser", new Pagerduty.UserArgs
        {
            Email = "howard.james@example.domain",
        });
        var exampleEscalationPolicy = new Pagerduty.EscalationPolicy("exampleEscalationPolicy", new Pagerduty.EscalationPolicyArgs
        {
            NumLoops = 2,
            Rules = 
            {
                new Pagerduty.Inputs.EscalationPolicyRuleArgs
                {
                    EscalationDelayInMinutes = 10,
                    Targets = 
                    {
                        new Pagerduty.Inputs.EscalationPolicyRuleTargetArgs
                        {
                            Type = "user",
                            Id = exampleUser.Id,
                        },
                    },
                },
            },
        });
        var exampleService = new Pagerduty.Service("exampleService", new Pagerduty.ServiceArgs
        {
            AutoResolveTimeout = "14400",
            AcknowledgementTimeout = "600",
            EscalationPolicy = exampleEscalationPolicy.Id,
        });
        var slack = new Pagerduty.Extension("slack", new Pagerduty.ExtensionArgs
        {
            EndpointUrl = "https://generic_webhook_url/XXXXXX/BBBBBB",
            ExtensionSchema = webhook.Apply(webhook => webhook.Id),
            ExtensionObjects = 
            {
                exampleService.Id,
            },
            Config = @"{
	""restrict"": ""any"",
	""notify_types"": {
			""resolve"": false,
			""acknowledge"": false,
			""assignments"": false
	},
	""access_token"": ""XXX""
}
",
        });
    }

}
package main

import (
	"fmt"

	"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 {
		webhook, err := pagerduty.GetExtensionSchema(ctx, &GetExtensionSchemaArgs{
			Name: "Generic V2 Webhook",
		}, nil)
		if err != nil {
			return err
		}
		exampleUser, err := pagerduty.NewUser(ctx, "exampleUser", &pagerduty.UserArgs{
			Email: pulumi.String("howard.james@example.domain"),
		})
		if err != nil {
			return err
		}
		exampleEscalationPolicy, err := pagerduty.NewEscalationPolicy(ctx, "exampleEscalationPolicy", &pagerduty.EscalationPolicyArgs{
			NumLoops: pulumi.Int(2),
			Rules: EscalationPolicyRuleArray{
				&EscalationPolicyRuleArgs{
					EscalationDelayInMinutes: pulumi.Int(10),
					Targets: EscalationPolicyRuleTargetArray{
						&EscalationPolicyRuleTargetArgs{
							Type: pulumi.String("user"),
							Id:   exampleUser.ID(),
						},
					},
				},
			},
		})
		if err != nil {
			return err
		}
		exampleService, err := pagerduty.NewService(ctx, "exampleService", &pagerduty.ServiceArgs{
			AutoResolveTimeout:     pulumi.String("14400"),
			AcknowledgementTimeout: pulumi.String("600"),
			EscalationPolicy:       exampleEscalationPolicy.ID(),
		})
		if err != nil {
			return err
		}
		_, err = pagerduty.NewExtension(ctx, "slack", &pagerduty.ExtensionArgs{
			EndpointUrl:     pulumi.String("https://generic_webhook_url/XXXXXX/BBBBBB"),
			ExtensionSchema: pulumi.String(webhook.Id),
			ExtensionObjects: pulumi.StringArray{
				exampleService.ID(),
			},
			Config: pulumi.String(fmt.Sprintf(`{
	"restrict": "any",
	"notify_types": {
			"resolve": false,
			"acknowledge": false,
			"assignments": false
	},
	"access_token": "XXX"
}
`)),
		})
		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.GetExtensionSchemaArgs;
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 com.pulumi.pagerduty.Service;
import com.pulumi.pagerduty.ServiceArgs;
import com.pulumi.pagerduty.Extension;
import com.pulumi.pagerduty.ExtensionArgs;
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 webhook = PagerdutyFunctions.getExtensionSchema(GetExtensionSchemaArgs.builder()
            .name("Generic V2 Webhook")
            .build());

        var exampleUser = new User("exampleUser", UserArgs.builder()        
            .email("howard.james@example.domain")
            .build());

        var exampleEscalationPolicy = new EscalationPolicy("exampleEscalationPolicy", EscalationPolicyArgs.builder()        
            .numLoops(2)
            .rules(EscalationPolicyRuleArgs.builder()
                .escalationDelayInMinutes(10)
                .targets(EscalationPolicyRuleTargetArgs.builder()
                    .type("user")
                    .id(exampleUser.id())
                    .build())
                .build())
            .build());

        var exampleService = new Service("exampleService", ServiceArgs.builder()        
            .autoResolveTimeout(14400)
            .acknowledgementTimeout(600)
            .escalationPolicy(exampleEscalationPolicy.id())
            .build());

        var slack = new Extension("slack", ExtensionArgs.builder()        
            .endpointUrl("https://generic_webhook_url/XXXXXX/BBBBBB")
            .extensionSchema(webhook.applyValue(getExtensionSchemaResult -> getExtensionSchemaResult.id()))
            .extensionObjects(exampleService.id())
            .config("""
{
	"restrict": "any",
	"notify_types": {
			"resolve": false,
			"acknowledge": false,
			"assignments": false
	},
	"access_token": "XXX"
}
            """)
            .build());

    }
}
import pulumi
import pulumi_pagerduty as pagerduty

webhook = pagerduty.get_extension_schema(name="Generic V2 Webhook")
example_user = pagerduty.User("exampleUser", email="howard.james@example.domain")
example_escalation_policy = pagerduty.EscalationPolicy("exampleEscalationPolicy",
    num_loops=2,
    rules=[pagerduty.EscalationPolicyRuleArgs(
        escalation_delay_in_minutes=10,
        targets=[pagerduty.EscalationPolicyRuleTargetArgs(
            type="user",
            id=example_user.id,
        )],
    )])
example_service = pagerduty.Service("exampleService",
    auto_resolve_timeout="14400",
    acknowledgement_timeout="600",
    escalation_policy=example_escalation_policy.id)
slack = pagerduty.Extension("slack",
    endpoint_url="https://generic_webhook_url/XXXXXX/BBBBBB",
    extension_schema=webhook.id,
    extension_objects=[example_service.id],
    config="""{
	"restrict": "any",
	"notify_types": {
			"resolve": false,
			"acknowledge": false,
			"assignments": false
	},
	"access_token": "XXX"
}
""")
import * as pulumi from "@pulumi/pulumi";
import * as pagerduty from "@pulumi/pagerduty";

const webhook = pagerduty.getExtensionSchema({
    name: "Generic V2 Webhook",
});
const exampleUser = new pagerduty.User("exampleUser", {email: "howard.james@example.domain"});
const exampleEscalationPolicy = new pagerduty.EscalationPolicy("exampleEscalationPolicy", {
    numLoops: 2,
    rules: [{
        escalationDelayInMinutes: 10,
        targets: [{
            type: "user",
            id: exampleUser.id,
        }],
    }],
});
const exampleService = new pagerduty.Service("exampleService", {
    autoResolveTimeout: "14400",
    acknowledgementTimeout: "600",
    escalationPolicy: exampleEscalationPolicy.id,
});
const slack = new pagerduty.Extension("slack", {
    endpointUrl: "https://generic_webhook_url/XXXXXX/BBBBBB",
    extensionSchema: webhook.then(webhook => webhook.id),
    extensionObjects: [exampleService.id],
    config: `{
	"restrict": "any",
	"notify_types": {
			"resolve": false,
			"acknowledge": false,
			"assignments": false
	},
	"access_token": "XXX"
}
`,
});
resources:
  exampleUser:
    type: pagerduty:User
    properties:
      email: howard.james@example.domain
  exampleEscalationPolicy:
    type: pagerduty:EscalationPolicy
    properties:
      numLoops: 2
      rules:
        - escalationDelayInMinutes: 10
          targets:
            - type: user
              id: ${exampleUser.id}
  exampleService:
    type: pagerduty:Service
    properties:
      autoResolveTimeout: 14400
      acknowledgementTimeout: 600
      escalationPolicy: ${exampleEscalationPolicy.id}
  slack:
    type: pagerduty:Extension
    properties:
      endpointUrl: https://generic_webhook_url/XXXXXX/BBBBBB
      extensionSchema: ${webhook.id}
      extensionObjects:
        - ${exampleService.id}
      config: |
        {
        	"restrict": "any",
        	"notify_types": {
        			"resolve": false,
        			"acknowledge": false,
        			"assignments": false
        	},
        	"access_token": "XXX"
        }        
variables:
  webhook:
    Fn::Invoke:
      Function: pagerduty:getExtensionSchema
      Arguments:
        name: Generic V2 Webhook

Create a Extension Resource

new Extension(name: string, args: ExtensionArgs, opts?: CustomResourceOptions);
@overload
def Extension(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              config: Optional[str] = None,
              endpoint_url: Optional[str] = None,
              extension_objects: Optional[Sequence[str]] = None,
              extension_schema: Optional[str] = None,
              name: Optional[str] = None,
              type: Optional[str] = None)
@overload
def Extension(resource_name: str,
              args: ExtensionArgs,
              opts: Optional[ResourceOptions] = None)
func NewExtension(ctx *Context, name string, args ExtensionArgs, opts ...ResourceOption) (*Extension, error)
public Extension(string name, ExtensionArgs args, CustomResourceOptions? opts = null)
public Extension(String name, ExtensionArgs args)
public Extension(String name, ExtensionArgs args, CustomResourceOptions options)
type: pagerduty:Extension
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args ExtensionArgs
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 ExtensionArgs
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 ExtensionArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ExtensionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args ExtensionArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Extension Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The Extension resource accepts the following input properties:

ExtensionObjects List<string>

This is the objects for which the extension applies (An array of service ids).

ExtensionSchema string

This is the schema for this extension.

Config string

The configuration of the service extension as string containing plain JSON-encoded data.

EndpointUrl string

The url of the extension. Note: The endpoint URL is Optional API wise in most cases. But in some cases it is a Required parameter. For example, pagerduty.getExtensionSchema named Generic V2 Webhook doesn't accept pagerduty.Extension with no endpoint_url, but one with named Slack accepts.

Name string

The name of the service extension.

Type string
ExtensionObjects []string

This is the objects for which the extension applies (An array of service ids).

ExtensionSchema string

This is the schema for this extension.

Config string

The configuration of the service extension as string containing plain JSON-encoded data.

EndpointUrl string

The url of the extension. Note: The endpoint URL is Optional API wise in most cases. But in some cases it is a Required parameter. For example, pagerduty.getExtensionSchema named Generic V2 Webhook doesn't accept pagerduty.Extension with no endpoint_url, but one with named Slack accepts.

Name string

The name of the service extension.

Type string
extensionObjects List<String>

This is the objects for which the extension applies (An array of service ids).

extensionSchema String

This is the schema for this extension.

config String

The configuration of the service extension as string containing plain JSON-encoded data.

endpointUrl String

The url of the extension. Note: The endpoint URL is Optional API wise in most cases. But in some cases it is a Required parameter. For example, pagerduty.getExtensionSchema named Generic V2 Webhook doesn't accept pagerduty.Extension with no endpoint_url, but one with named Slack accepts.

name String

The name of the service extension.

type String
extensionObjects string[]

This is the objects for which the extension applies (An array of service ids).

extensionSchema string

This is the schema for this extension.

config string

The configuration of the service extension as string containing plain JSON-encoded data.

endpointUrl string

The url of the extension. Note: The endpoint URL is Optional API wise in most cases. But in some cases it is a Required parameter. For example, pagerduty.getExtensionSchema named Generic V2 Webhook doesn't accept pagerduty.Extension with no endpoint_url, but one with named Slack accepts.

name string

The name of the service extension.

type string
extension_objects Sequence[str]

This is the objects for which the extension applies (An array of service ids).

extension_schema str

This is the schema for this extension.

config str

The configuration of the service extension as string containing plain JSON-encoded data.

endpoint_url str

The url of the extension. Note: The endpoint URL is Optional API wise in most cases. But in some cases it is a Required parameter. For example, pagerduty.getExtensionSchema named Generic V2 Webhook doesn't accept pagerduty.Extension with no endpoint_url, but one with named Slack accepts.

name str

The name of the service extension.

type str
extensionObjects List<String>

This is the objects for which the extension applies (An array of service ids).

extensionSchema String

This is the schema for this extension.

config String

The configuration of the service extension as string containing plain JSON-encoded data.

endpointUrl String

The url of the extension. Note: The endpoint URL is Optional API wise in most cases. But in some cases it is a Required parameter. For example, pagerduty.getExtensionSchema named Generic V2 Webhook doesn't accept pagerduty.Extension with no endpoint_url, but one with named Slack accepts.

name String

The name of the service extension.

type String

Outputs

All input properties are implicitly available as output properties. Additionally, the Extension resource produces the following output properties:

HtmlUrl string

URL at which the entity is uniquely displayed in the Web app

Id string

The provider-assigned unique ID for this managed resource.

Summary string

A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to name, though it is not intended to be an identifier.

HtmlUrl string

URL at which the entity is uniquely displayed in the Web app

Id string

The provider-assigned unique ID for this managed resource.

Summary string

A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to name, though it is not intended to be an identifier.

htmlUrl String

URL at which the entity is uniquely displayed in the Web app

id String

The provider-assigned unique ID for this managed resource.

summary String

A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to name, though it is not intended to be an identifier.

htmlUrl string

URL at which the entity is uniquely displayed in the Web app

id string

The provider-assigned unique ID for this managed resource.

summary string

A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to name, though it is not intended to be an identifier.

html_url str

URL at which the entity is uniquely displayed in the Web app

id str

The provider-assigned unique ID for this managed resource.

summary str

A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to name, though it is not intended to be an identifier.

htmlUrl String

URL at which the entity is uniquely displayed in the Web app

id String

The provider-assigned unique ID for this managed resource.

summary String

A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to name, though it is not intended to be an identifier.

Look up an Existing Extension Resource

Get an existing Extension 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?: ExtensionState, opts?: CustomResourceOptions): Extension
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        config: Optional[str] = None,
        endpoint_url: Optional[str] = None,
        extension_objects: Optional[Sequence[str]] = None,
        extension_schema: Optional[str] = None,
        html_url: Optional[str] = None,
        name: Optional[str] = None,
        summary: Optional[str] = None,
        type: Optional[str] = None) -> Extension
func GetExtension(ctx *Context, name string, id IDInput, state *ExtensionState, opts ...ResourceOption) (*Extension, error)
public static Extension Get(string name, Input<string> id, ExtensionState? state, CustomResourceOptions? opts = null)
public static Extension get(String name, Output<String> id, ExtensionState 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:
Config string

The configuration of the service extension as string containing plain JSON-encoded data.

EndpointUrl string

The url of the extension. Note: The endpoint URL is Optional API wise in most cases. But in some cases it is a Required parameter. For example, pagerduty.getExtensionSchema named Generic V2 Webhook doesn't accept pagerduty.Extension with no endpoint_url, but one with named Slack accepts.

ExtensionObjects List<string>

This is the objects for which the extension applies (An array of service ids).

ExtensionSchema string

This is the schema for this extension.

HtmlUrl string

URL at which the entity is uniquely displayed in the Web app

Name string

The name of the service extension.

Summary string

A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to name, though it is not intended to be an identifier.

Type string
Config string

The configuration of the service extension as string containing plain JSON-encoded data.

EndpointUrl string

The url of the extension. Note: The endpoint URL is Optional API wise in most cases. But in some cases it is a Required parameter. For example, pagerduty.getExtensionSchema named Generic V2 Webhook doesn't accept pagerduty.Extension with no endpoint_url, but one with named Slack accepts.

ExtensionObjects []string

This is the objects for which the extension applies (An array of service ids).

ExtensionSchema string

This is the schema for this extension.

HtmlUrl string

URL at which the entity is uniquely displayed in the Web app

Name string

The name of the service extension.

Summary string

A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to name, though it is not intended to be an identifier.

Type string
config String

The configuration of the service extension as string containing plain JSON-encoded data.

endpointUrl String

The url of the extension. Note: The endpoint URL is Optional API wise in most cases. But in some cases it is a Required parameter. For example, pagerduty.getExtensionSchema named Generic V2 Webhook doesn't accept pagerduty.Extension with no endpoint_url, but one with named Slack accepts.

extensionObjects List<String>

This is the objects for which the extension applies (An array of service ids).

extensionSchema String

This is the schema for this extension.

htmlUrl String

URL at which the entity is uniquely displayed in the Web app

name String

The name of the service extension.

summary String

A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to name, though it is not intended to be an identifier.

type String
config string

The configuration of the service extension as string containing plain JSON-encoded data.

endpointUrl string

The url of the extension. Note: The endpoint URL is Optional API wise in most cases. But in some cases it is a Required parameter. For example, pagerduty.getExtensionSchema named Generic V2 Webhook doesn't accept pagerduty.Extension with no endpoint_url, but one with named Slack accepts.

extensionObjects string[]

This is the objects for which the extension applies (An array of service ids).

extensionSchema string

This is the schema for this extension.

htmlUrl string

URL at which the entity is uniquely displayed in the Web app

name string

The name of the service extension.

summary string

A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to name, though it is not intended to be an identifier.

type string
config str

The configuration of the service extension as string containing plain JSON-encoded data.

endpoint_url str

The url of the extension. Note: The endpoint URL is Optional API wise in most cases. But in some cases it is a Required parameter. For example, pagerduty.getExtensionSchema named Generic V2 Webhook doesn't accept pagerduty.Extension with no endpoint_url, but one with named Slack accepts.

extension_objects Sequence[str]

This is the objects for which the extension applies (An array of service ids).

extension_schema str

This is the schema for this extension.

html_url str

URL at which the entity is uniquely displayed in the Web app

name str

The name of the service extension.

summary str

A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to name, though it is not intended to be an identifier.

type str
config String

The configuration of the service extension as string containing plain JSON-encoded data.

endpointUrl String

The url of the extension. Note: The endpoint URL is Optional API wise in most cases. But in some cases it is a Required parameter. For example, pagerduty.getExtensionSchema named Generic V2 Webhook doesn't accept pagerduty.Extension with no endpoint_url, but one with named Slack accepts.

extensionObjects List<String>

This is the objects for which the extension applies (An array of service ids).

extensionSchema String

This is the schema for this extension.

htmlUrl String

URL at which the entity is uniquely displayed in the Web app

name String

The name of the service extension.

summary String

A short-form, server-generated string that provides succinct, important information about an object suitable for primary labeling of an entity in a client. In many cases, this will be identical to name, though it is not intended to be an identifier.

type String

Import

Extensions can be imported using the id.e.g.

 $ pulumi import pagerduty:index/extension:Extension main PLBP09X

Package Details

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

This Pulumi package is based on the pagerduty Terraform Provider.