1. Packages
  2. PagerDuty
  3. API Docs
  4. getRuleset
PagerDuty v4.13.2 published on Thursday, Jun 27, 2024 by Pulumi

pagerduty.getRuleset

Explore with Pulumi AI

pagerduty logo
PagerDuty v4.13.2 published on Thursday, Jun 27, 2024 by Pulumi

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as pagerduty from "@pulumi/pagerduty";
    
    const example = pagerduty.getRuleset({
        name: "My Ruleset",
    });
    const foo = new pagerduty.RulesetRule("foo", {
        ruleset: example.then(example => example.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",
            }],
        },
    });
    
    import pulumi
    import pulumi_pagerduty as pagerduty
    
    example = pagerduty.get_ruleset(name="My Ruleset")
    foo = pagerduty.RulesetRule("foo",
        ruleset=example.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",
            )],
        ))
    
    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 {
    		example, err := pagerduty.LookupRuleset(ctx, &pagerduty.LookupRulesetArgs{
    			Name: "My Ruleset",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = pagerduty.NewRulesetRule(ctx, "foo", &pagerduty.RulesetRuleArgs{
    			Ruleset:  pulumi.String(example.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"),
    					},
    				},
    			},
    		})
    		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 example = Pagerduty.GetRuleset.Invoke(new()
        {
            Name = "My Ruleset",
        });
    
        var foo = new Pagerduty.RulesetRule("foo", new()
        {
            Ruleset = example.Apply(getRulesetResult => getRulesetResult.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",
                    },
                },
            },
        });
    
    });
    
    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.GetRulesetArgs;
    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 example = PagerdutyFunctions.getRuleset(GetRulesetArgs.builder()
                .name("My Ruleset")
                .build());
    
            var foo = new RulesetRule("foo", RulesetRuleArgs.builder()
                .ruleset(example.applyValue(getRulesetResult -> getRulesetResult.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())
                    .build())
                .build());
    
        }
    }
    
    resources:
      foo:
        type: pagerduty:RulesetRule
        properties:
          ruleset: ${example.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
    variables:
      example:
        fn::invoke:
          Function: pagerduty:getRuleset
          Arguments:
            name: My Ruleset
    

    Default Global Ruleset

    import * as pulumi from "@pulumi/pulumi";
    import * as pagerduty from "@pulumi/pagerduty";
    
    const defaultGlobal = pagerduty.getRuleset({
        name: "Default Global",
    });
    
    import pulumi
    import pulumi_pagerduty as pagerduty
    
    default_global = pagerduty.get_ruleset(name="Default Global")
    
    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 {
    		_, err := pagerduty.LookupRuleset(ctx, &pagerduty.LookupRulesetArgs{
    			Name: "Default Global",
    		}, nil)
    		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 defaultGlobal = Pagerduty.GetRuleset.Invoke(new()
        {
            Name = "Default Global",
        });
    
    });
    
    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.GetRulesetArgs;
    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 defaultGlobal = PagerdutyFunctions.getRuleset(GetRulesetArgs.builder()
                .name("Default Global")
                .build());
    
        }
    }
    
    variables:
      defaultGlobal:
        fn::invoke:
          Function: pagerduty:getRuleset
          Arguments:
            name: Default Global
    

    Using getRuleset

    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 getRuleset(args: GetRulesetArgs, opts?: InvokeOptions): Promise<GetRulesetResult>
    function getRulesetOutput(args: GetRulesetOutputArgs, opts?: InvokeOptions): Output<GetRulesetResult>
    def get_ruleset(name: Optional[str] = None,
                    opts: Optional[InvokeOptions] = None) -> GetRulesetResult
    def get_ruleset_output(name: Optional[pulumi.Input[str]] = None,
                    opts: Optional[InvokeOptions] = None) -> Output[GetRulesetResult]
    func LookupRuleset(ctx *Context, args *LookupRulesetArgs, opts ...InvokeOption) (*LookupRulesetResult, error)
    func LookupRulesetOutput(ctx *Context, args *LookupRulesetOutputArgs, opts ...InvokeOption) LookupRulesetResultOutput

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

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

    The following arguments are supported:

    Name string
    The name of the ruleset to find in the PagerDuty API.
    Name string
    The name of the ruleset to find in the PagerDuty API.
    name String
    The name of the ruleset to find in the PagerDuty API.
    name string
    The name of the ruleset to find in the PagerDuty API.
    name str
    The name of the ruleset to find in the PagerDuty API.
    name String
    The name of the ruleset to find in the PagerDuty API.

    getRuleset Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    The name of the found ruleset.
    RoutingKeys List<string>
    Routing keys routed to this ruleset.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    The name of the found ruleset.
    RoutingKeys []string
    Routing keys routed to this ruleset.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    The name of the found ruleset.
    routingKeys List<String>
    Routing keys routed to this ruleset.
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    The name of the found ruleset.
    routingKeys string[]
    Routing keys routed to this ruleset.
    id str
    The provider-assigned unique ID for this managed resource.
    name str
    The name of the found ruleset.
    routing_keys Sequence[str]
    Routing keys routed to this ruleset.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    The name of the found ruleset.
    routingKeys List<String>
    Routing keys routed to this ruleset.

    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.13.2 published on Thursday, Jun 27, 2024 by Pulumi