1. Packages
  2. PagerDuty
  3. API Docs
  4. getIncidentWorkflow
PagerDuty v4.11.4 published on Wednesday, Apr 17, 2024 by Pulumi

pagerduty.getIncidentWorkflow

Explore with Pulumi AI

pagerduty logo
PagerDuty v4.11.4 published on Wednesday, Apr 17, 2024 by Pulumi

    Use this data source to get information about a specific Incident Workflow so that you can create a trigger for it.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as pagerduty from "@pulumi/pagerduty";
    
    const myWorkflow = pagerduty.getIncidentWorkflow({
        name: "Some Workflow Name",
    });
    const firstService = pagerduty.getService({
        name: "My First Service",
    });
    const automaticTrigger = new pagerduty.IncidentWorkflowTrigger("automaticTrigger", {
        type: "conditional",
        workflow: myWorkflow.then(myWorkflow => myWorkflow.id),
        services: [firstService.then(firstService => firstService.id)],
        condition: "incident.priority matches 'P1'",
    });
    
    import pulumi
    import pulumi_pagerduty as pagerduty
    
    my_workflow = pagerduty.get_incident_workflow(name="Some Workflow Name")
    first_service = pagerduty.get_service(name="My First Service")
    automatic_trigger = pagerduty.IncidentWorkflowTrigger("automaticTrigger",
        type="conditional",
        workflow=my_workflow.id,
        services=[first_service.id],
        condition="incident.priority matches 'P1'")
    
    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 {
    		myWorkflow, err := pagerduty.LookupIncidentWorkflow(ctx, &pagerduty.LookupIncidentWorkflowArgs{
    			Name: "Some Workflow Name",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		firstService, err := pagerduty.LookupService(ctx, &pagerduty.LookupServiceArgs{
    			Name: "My First Service",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = pagerduty.NewIncidentWorkflowTrigger(ctx, "automaticTrigger", &pagerduty.IncidentWorkflowTriggerArgs{
    			Type:     pulumi.String("conditional"),
    			Workflow: pulumi.String(myWorkflow.Id),
    			Services: pulumi.StringArray{
    				pulumi.String(firstService.Id),
    			},
    			Condition: pulumi.String("incident.priority matches 'P1'"),
    		})
    		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 myWorkflow = Pagerduty.GetIncidentWorkflow.Invoke(new()
        {
            Name = "Some Workflow Name",
        });
    
        var firstService = Pagerduty.GetService.Invoke(new()
        {
            Name = "My First Service",
        });
    
        var automaticTrigger = new Pagerduty.IncidentWorkflowTrigger("automaticTrigger", new()
        {
            Type = "conditional",
            Workflow = myWorkflow.Apply(getIncidentWorkflowResult => getIncidentWorkflowResult.Id),
            Services = new[]
            {
                firstService.Apply(getServiceResult => getServiceResult.Id),
            },
            Condition = "incident.priority matches 'P1'",
        });
    
    });
    
    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.GetIncidentWorkflowArgs;
    import com.pulumi.pagerduty.inputs.GetServiceArgs;
    import com.pulumi.pagerduty.IncidentWorkflowTrigger;
    import com.pulumi.pagerduty.IncidentWorkflowTriggerArgs;
    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 myWorkflow = PagerdutyFunctions.getIncidentWorkflow(GetIncidentWorkflowArgs.builder()
                .name("Some Workflow Name")
                .build());
    
            final var firstService = PagerdutyFunctions.getService(GetServiceArgs.builder()
                .name("My First Service")
                .build());
    
            var automaticTrigger = new IncidentWorkflowTrigger("automaticTrigger", IncidentWorkflowTriggerArgs.builder()        
                .type("conditional")
                .workflow(myWorkflow.applyValue(getIncidentWorkflowResult -> getIncidentWorkflowResult.id()))
                .services(firstService.applyValue(getServiceResult -> getServiceResult.id()))
                .condition("incident.priority matches 'P1'")
                .build());
    
        }
    }
    
    resources:
      automaticTrigger:
        type: pagerduty:IncidentWorkflowTrigger
        properties:
          type: conditional
          workflow: ${myWorkflow.id}
          services:
            - ${firstService.id}
          condition: incident.priority matches 'P1'
    variables:
      myWorkflow:
        fn::invoke:
          Function: pagerduty:getIncidentWorkflow
          Arguments:
            name: Some Workflow Name
      firstService:
        fn::invoke:
          Function: pagerduty:getService
          Arguments:
            name: My First Service
    

    Using getIncidentWorkflow

    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 getIncidentWorkflow(args: GetIncidentWorkflowArgs, opts?: InvokeOptions): Promise<GetIncidentWorkflowResult>
    function getIncidentWorkflowOutput(args: GetIncidentWorkflowOutputArgs, opts?: InvokeOptions): Output<GetIncidentWorkflowResult>
    def get_incident_workflow(name: Optional[str] = None,
                              opts: Optional[InvokeOptions] = None) -> GetIncidentWorkflowResult
    def get_incident_workflow_output(name: Optional[pulumi.Input[str]] = None,
                              opts: Optional[InvokeOptions] = None) -> Output[GetIncidentWorkflowResult]
    func LookupIncidentWorkflow(ctx *Context, args *LookupIncidentWorkflowArgs, opts ...InvokeOption) (*LookupIncidentWorkflowResult, error)
    func LookupIncidentWorkflowOutput(ctx *Context, args *LookupIncidentWorkflowOutputArgs, opts ...InvokeOption) LookupIncidentWorkflowResultOutput

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

    public static class GetIncidentWorkflow 
    {
        public static Task<GetIncidentWorkflowResult> InvokeAsync(GetIncidentWorkflowArgs args, InvokeOptions? opts = null)
        public static Output<GetIncidentWorkflowResult> Invoke(GetIncidentWorkflowInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetIncidentWorkflowResult> getIncidentWorkflow(GetIncidentWorkflowArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: pagerduty:index/getIncidentWorkflow:getIncidentWorkflow
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    The name of the workflow.
    Name string
    The name of the workflow.
    name String
    The name of the workflow.
    name string
    The name of the workflow.
    name str
    The name of the workflow.
    name String
    The name of the workflow.

    getIncidentWorkflow Result

    The following output properties are available:

    Description string
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    Description string
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    description String
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    description string
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    description str
    id str
    The provider-assigned unique ID for this managed resource.
    name str
    description String
    id String
    The provider-assigned unique ID for this managed resource.
    name String

    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.11.4 published on Wednesday, Apr 17, 2024 by Pulumi