1. Packages
  2. PagerDuty
  3. API Docs
  4. Extension
PagerDuty v4.12.3 published on Tuesday, May 21, 2024 by Pulumi

pagerduty.Extension

Explore with Pulumi AI

pagerduty logo
PagerDuty v4.12.3 published on Tuesday, May 21, 2024 by Pulumi

    An extension can be associated with a service.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as pagerduty from "@pulumi/pagerduty";
    
    const webhook = pagerduty.getExtensionSchema({
        name: "Generic V2 Webhook",
    });
    const example = new pagerduty.User("example", {
        name: "Howard James",
        email: "howard.james@example.domain",
    });
    const exampleEscalationPolicy = new pagerduty.EscalationPolicy("example", {
        name: "Engineering Escalation Policy",
        numLoops: 2,
        rules: [{
            escalationDelayInMinutes: 10,
            targets: [{
                type: "user",
                id: example.id,
            }],
        }],
    });
    const exampleService = new pagerduty.Service("example", {
        name: "My Web App",
        autoResolveTimeout: "14400",
        acknowledgementTimeout: "600",
        escalationPolicy: exampleEscalationPolicy.id,
    });
    const slack = new pagerduty.Extension("slack", {
        name: "My Web App Extension",
        endpointUrl: "https://generic_webhook_url/XXXXXX/BBBBBB",
        extensionSchema: webhook.then(webhook => webhook.id),
        extensionObjects: [exampleService.id],
        config: `{
    \x09"restrict": "any",
    \x09"notify_types": {
    \x09\x09\x09"resolve": false,
    \x09\x09\x09"acknowledge": false,
    \x09\x09\x09"assignments": false
    \x09},
    \x09"access_token": "XXX"
    }
    `,
    });
    
    import pulumi
    import pulumi_pagerduty as pagerduty
    
    webhook = pagerduty.get_extension_schema(name="Generic V2 Webhook")
    example = pagerduty.User("example",
        name="Howard James",
        email="howard.james@example.domain")
    example_escalation_policy = pagerduty.EscalationPolicy("example",
        name="Engineering Escalation Policy",
        num_loops=2,
        rules=[pagerduty.EscalationPolicyRuleArgs(
            escalation_delay_in_minutes=10,
            targets=[pagerduty.EscalationPolicyRuleTargetArgs(
                type="user",
                id=example.id,
            )],
        )])
    example_service = pagerduty.Service("example",
        name="My Web App",
        auto_resolve_timeout="14400",
        acknowledgement_timeout="600",
        escalation_policy=example_escalation_policy.id)
    slack = pagerduty.Extension("slack",
        name="My Web App Extension",
        endpoint_url="https://generic_webhook_url/XXXXXX/BBBBBB",
        extension_schema=webhook.id,
        extension_objects=[example_service.id],
        config="""{
    \x09"restrict": "any",
    \x09"notify_types": {
    \x09\x09\x09"resolve": false,
    \x09\x09\x09"acknowledge": false,
    \x09\x09\x09"assignments": false
    \x09},
    \x09"access_token": "XXX"
    }
    """)
    
    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 {
    		webhook, err := pagerduty.GetExtensionSchema(ctx, &pagerduty.GetExtensionSchemaArgs{
    			Name: "Generic V2 Webhook",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		example, err := pagerduty.NewUser(ctx, "example", &pagerduty.UserArgs{
    			Name:  pulumi.String("Howard James"),
    			Email: pulumi.String("howard.james@example.domain"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleEscalationPolicy, err := pagerduty.NewEscalationPolicy(ctx, "example", &pagerduty.EscalationPolicyArgs{
    			Name:     pulumi.String("Engineering Escalation Policy"),
    			NumLoops: pulumi.Int(2),
    			Rules: pagerduty.EscalationPolicyRuleArray{
    				&pagerduty.EscalationPolicyRuleArgs{
    					EscalationDelayInMinutes: pulumi.Int(10),
    					Targets: pagerduty.EscalationPolicyRuleTargetArray{
    						&pagerduty.EscalationPolicyRuleTargetArgs{
    							Type: pulumi.String("user"),
    							Id:   example.ID(),
    						},
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		exampleService, err := pagerduty.NewService(ctx, "example", &pagerduty.ServiceArgs{
    			Name:                   pulumi.String("My Web App"),
    			AutoResolveTimeout:     pulumi.String("14400"),
    			AcknowledgementTimeout: pulumi.String("600"),
    			EscalationPolicy:       exampleEscalationPolicy.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = pagerduty.NewExtension(ctx, "slack", &pagerduty.ExtensionArgs{
    			Name:            pulumi.String("My Web App Extension"),
    			EndpointUrl:     pulumi.String("https://generic_webhook_url/XXXXXX/BBBBBB"),
    			ExtensionSchema: pulumi.String(webhook.Id),
    			ExtensionObjects: pulumi.StringArray{
    				exampleService.ID(),
    			},
    			Config: pulumi.String(`{
    	"restrict": "any",
    	"notify_types": {
    			"resolve": false,
    			"acknowledge": false,
    			"assignments": false
    	},
    	"access_token": "XXX"
    }
    `),
    		})
    		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 webhook = Pagerduty.GetExtensionSchema.Invoke(new()
        {
            Name = "Generic V2 Webhook",
        });
    
        var example = new Pagerduty.User("example", new()
        {
            Name = "Howard James",
            Email = "howard.james@example.domain",
        });
    
        var exampleEscalationPolicy = new Pagerduty.EscalationPolicy("example", new()
        {
            Name = "Engineering Escalation Policy",
            NumLoops = 2,
            Rules = new[]
            {
                new Pagerduty.Inputs.EscalationPolicyRuleArgs
                {
                    EscalationDelayInMinutes = 10,
                    Targets = new[]
                    {
                        new Pagerduty.Inputs.EscalationPolicyRuleTargetArgs
                        {
                            Type = "user",
                            Id = example.Id,
                        },
                    },
                },
            },
        });
    
        var exampleService = new Pagerduty.Service("example", new()
        {
            Name = "My Web App",
            AutoResolveTimeout = "14400",
            AcknowledgementTimeout = "600",
            EscalationPolicy = exampleEscalationPolicy.Id,
        });
    
        var slack = new Pagerduty.Extension("slack", new()
        {
            Name = "My Web App Extension",
            EndpointUrl = "https://generic_webhook_url/XXXXXX/BBBBBB",
            ExtensionSchema = webhook.Apply(getExtensionSchemaResult => getExtensionSchemaResult.Id),
            ExtensionObjects = new[]
            {
                exampleService.Id,
            },
            Config = @"{
    	""restrict"": ""any"",
    	""notify_types"": {
    			""resolve"": false,
    			""acknowledge"": false,
    			""assignments"": false
    	},
    	""access_token"": ""XXX""
    }
    ",
        });
    
    });
    
    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 example = new User("example", UserArgs.builder()        
                .name("Howard James")
                .email("howard.james@example.domain")
                .build());
    
            var exampleEscalationPolicy = new EscalationPolicy("exampleEscalationPolicy", EscalationPolicyArgs.builder()        
                .name("Engineering Escalation Policy")
                .numLoops(2)
                .rules(EscalationPolicyRuleArgs.builder()
                    .escalationDelayInMinutes(10)
                    .targets(EscalationPolicyRuleTargetArgs.builder()
                        .type("user")
                        .id(example.id())
                        .build())
                    .build())
                .build());
    
            var exampleService = new Service("exampleService", ServiceArgs.builder()        
                .name("My Web App")
                .autoResolveTimeout(14400)
                .acknowledgementTimeout(600)
                .escalationPolicy(exampleEscalationPolicy.id())
                .build());
    
            var slack = new Extension("slack", ExtensionArgs.builder()        
                .name("My Web App Extension")
                .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());
    
        }
    }
    
    resources:
      example:
        type: pagerduty:User
        properties:
          name: Howard James
          email: howard.james@example.domain
      exampleEscalationPolicy:
        type: pagerduty:EscalationPolicy
        name: example
        properties:
          name: Engineering Escalation Policy
          numLoops: 2
          rules:
            - escalationDelayInMinutes: 10
              targets:
                - type: user
                  id: ${example.id}
      exampleService:
        type: pagerduty:Service
        name: example
        properties:
          name: My Web App
          autoResolveTimeout: 14400
          acknowledgementTimeout: 600
          escalationPolicy: ${exampleEscalationPolicy.id}
      slack:
        type: pagerduty:Extension
        properties:
          name: My Web App Extension
          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 Extension Resource

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

    Constructor syntax

    new Extension(name: string, args: ExtensionArgs, opts?: CustomResourceOptions);
    @overload
    def Extension(resource_name: str,
                  args: ExtensionArgs,
                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def Extension(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  extension_objects: Optional[Sequence[str]] = None,
                  extension_schema: Optional[str] = None,
                  config: Optional[str] = None,
                  endpoint_url: Optional[str] = None,
                  name: Optional[str] = None,
                  type: Optional[str] = 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.
    
    

    Parameters

    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.

    Example

    The following reference example uses placeholder values for all input properties.

    var extensionResource = new Pagerduty.Extension("extensionResource", new()
    {
        ExtensionObjects = new[]
        {
            "string",
        },
        ExtensionSchema = "string",
        Config = "string",
        EndpointUrl = "string",
        Name = "string",
        Type = "string",
    });
    
    example, err := pagerduty.NewExtension(ctx, "extensionResource", &pagerduty.ExtensionArgs{
    	ExtensionObjects: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	ExtensionSchema: pulumi.String("string"),
    	Config:          pulumi.String("string"),
    	EndpointUrl:     pulumi.String("string"),
    	Name:            pulumi.String("string"),
    	Type:            pulumi.String("string"),
    })
    
    var extensionResource = new Extension("extensionResource", ExtensionArgs.builder()
        .extensionObjects("string")
        .extensionSchema("string")
        .config("string")
        .endpointUrl("string")
        .name("string")
        .type("string")
        .build());
    
    extension_resource = pagerduty.Extension("extensionResource",
        extension_objects=["string"],
        extension_schema="string",
        config="string",
        endpoint_url="string",
        name="string",
        type="string")
    
    const extensionResource = new pagerduty.Extension("extensionResource", {
        extensionObjects: ["string"],
        extensionSchema: "string",
        config: "string",
        endpointUrl: "string",
        name: "string",
        type: "string",
    });
    
    type: pagerduty:Extension
    properties:
        config: string
        endpointUrl: string
        extensionObjects:
            - string
        extensionSchema: string
        name: string
        type: string
    

    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>
    ExtensionSchema string
    Config string
    EndpointUrl string
    Name string
    Type string
    ExtensionObjects []string
    ExtensionSchema string
    Config string
    EndpointUrl string
    Name string
    Type string
    extensionObjects List<String>
    extensionSchema String
    config String
    endpointUrl String
    name String
    type String
    extensionObjects string[]
    extensionSchema string
    config string
    endpointUrl string
    name string
    type string
    extensionObjects List<String>
    extensionSchema String
    config String
    endpointUrl String
    name String
    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
    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
    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
    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
    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
    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

    Look up 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
    EndpointUrl string
    ExtensionObjects List<string>
    ExtensionSchema string
    HtmlUrl string
    URL at which the entity is uniquely displayed in the Web app
    Name string
    Summary string
    Type string
    Config string
    EndpointUrl string
    ExtensionObjects []string
    ExtensionSchema string
    HtmlUrl string
    URL at which the entity is uniquely displayed in the Web app
    Name string
    Summary string
    Type string
    config String
    endpointUrl String
    extensionObjects List<String>
    extensionSchema String
    htmlUrl String
    URL at which the entity is uniquely displayed in the Web app
    name String
    summary String
    type String
    config string
    endpointUrl string
    extensionObjects string[]
    extensionSchema string
    htmlUrl string
    URL at which the entity is uniquely displayed in the Web app
    name string
    summary string
    type string
    config str
    endpoint_url str
    extension_objects Sequence[str]
    extension_schema str
    html_url str
    URL at which the entity is uniquely displayed in the Web app
    name str
    summary str
    type str
    config String
    endpointUrl String
    extensionObjects List<String>
    extensionSchema String
    htmlUrl String
    URL at which the entity is uniquely displayed in the Web app
    name String
    summary String
    type String

    Import

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

    $ pulumi import pagerduty:index/extension:Extension 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.12.3 published on Tuesday, May 21, 2024 by Pulumi