pagerduty.EventRule
Explore with Pulumi AI
NOTE: The pagerduty.EventRule
resource has been deprecated in favor of the pagerduty.Ruleset and pagerduty.RulesetRule resources. Please use the ruleset
based resources for working with Event Rules.
An event rule determines what happens to an event that is sent to PagerDuty by monitoring tools and other integrations.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as pagerduty from "@pulumi/pagerduty";
const second = new pagerduty.EventRule("second", {
actionJson: JSON.stringify([
[
"route",
"P5DTL0K",
],
[
"severity",
"warning",
],
[
"annotate",
"2 Managed by terraform",
],
[
"priority",
"PL451DT",
],
]),
conditionJson: JSON.stringify([
"and",
[
"contains",
[
"path",
"payload",
"source",
],
"website",
],
[
"contains",
[
"path",
"headers",
"from",
"0",
"address",
],
"homer",
],
]),
advancedConditionJson: JSON.stringify([[
"scheduled-weekly",
1565392127032,
3600000,
"America/Los_Angeles",
[
1,
2,
3,
5,
7,
],
]]),
});
const third = new pagerduty.EventRule("third", {
actionJson: JSON.stringify([
[
"route",
"P5DTL0K",
],
[
"severity",
"warning",
],
[
"annotate",
"3 Managed by terraform",
],
[
"priority",
"PL451DT",
],
]),
conditionJson: JSON.stringify([
"and",
[
"contains",
[
"path",
"payload",
"source",
],
"website",
],
[
"contains",
[
"path",
"headers",
"from",
"0",
"address",
],
"homer",
],
]),
}, {
dependsOn: [two],
});
import pulumi
import json
import pulumi_pagerduty as pagerduty
second = pagerduty.EventRule("second",
action_json=json.dumps([
[
"route",
"P5DTL0K",
],
[
"severity",
"warning",
],
[
"annotate",
"2 Managed by terraform",
],
[
"priority",
"PL451DT",
],
]),
condition_json=json.dumps([
"and",
[
"contains",
[
"path",
"payload",
"source",
],
"website",
],
[
"contains",
[
"path",
"headers",
"from",
"0",
"address",
],
"homer",
],
]),
advanced_condition_json=json.dumps([[
"scheduled-weekly",
1565392127032,
3600000,
"America/Los_Angeles",
[
1,
2,
3,
5,
7,
],
]]))
third = pagerduty.EventRule("third",
action_json=json.dumps([
[
"route",
"P5DTL0K",
],
[
"severity",
"warning",
],
[
"annotate",
"3 Managed by terraform",
],
[
"priority",
"PL451DT",
],
]),
condition_json=json.dumps([
"and",
[
"contains",
[
"path",
"payload",
"source",
],
"website",
],
[
"contains",
[
"path",
"headers",
"from",
"0",
"address",
],
"homer",
],
]),
opts = pulumi.ResourceOptions(depends_on=[two]))
package main
import (
"encoding/json"
"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 {
tmpJSON0, err := json.Marshal([][]string{
[]string{
"route",
"P5DTL0K",
},
[]string{
"severity",
"warning",
},
[]string{
"annotate",
"2 Managed by terraform",
},
[]string{
"priority",
"PL451DT",
},
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
tmpJSON1, err := json.Marshal([]interface{}{
"and",
[]interface{}{
"contains",
[]string{
"path",
"payload",
"source",
},
"website",
},
[]interface{}{
"contains",
[]string{
"path",
"headers",
"from",
"0",
"address",
},
"homer",
},
})
if err != nil {
return err
}
json1 := string(tmpJSON1)
tmpJSON2, err := json.Marshal([][]interface{}{
[]interface{}{
"scheduled-weekly",
1565392127032,
3600000,
"America/Los_Angeles",
[]float64{
1,
2,
3,
5,
7,
},
},
})
if err != nil {
return err
}
json2 := string(tmpJSON2)
_, err = pagerduty.NewEventRule(ctx, "second", &pagerduty.EventRuleArgs{
ActionJson: pulumi.String(json0),
ConditionJson: pulumi.String(json1),
AdvancedConditionJson: pulumi.String(json2),
})
if err != nil {
return err
}
tmpJSON3, err := json.Marshal([][]string{
[]string{
"route",
"P5DTL0K",
},
[]string{
"severity",
"warning",
},
[]string{
"annotate",
"3 Managed by terraform",
},
[]string{
"priority",
"PL451DT",
},
})
if err != nil {
return err
}
json3 := string(tmpJSON3)
tmpJSON4, err := json.Marshal([]interface{}{
"and",
[]interface{}{
"contains",
[]string{
"path",
"payload",
"source",
},
"website",
},
[]interface{}{
"contains",
[]string{
"path",
"headers",
"from",
"0",
"address",
},
"homer",
},
})
if err != nil {
return err
}
json4 := string(tmpJSON4)
_, err = pagerduty.NewEventRule(ctx, "third", &pagerduty.EventRuleArgs{
ActionJson: pulumi.String(json3),
ConditionJson: pulumi.String(json4),
}, pulumi.DependsOn([]pulumi.Resource{
two,
}))
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Pagerduty = Pulumi.Pagerduty;
return await Deployment.RunAsync(() =>
{
var second = new Pagerduty.EventRule("second", new()
{
ActionJson = JsonSerializer.Serialize(new[]
{
new[]
{
"route",
"P5DTL0K",
},
new[]
{
"severity",
"warning",
},
new[]
{
"annotate",
"2 Managed by terraform",
},
new[]
{
"priority",
"PL451DT",
},
}),
ConditionJson = JsonSerializer.Serialize(new object?[]
{
"and",
new object?[]
{
"contains",
new[]
{
"path",
"payload",
"source",
},
"website",
},
new object?[]
{
"contains",
new[]
{
"path",
"headers",
"from",
"0",
"address",
},
"homer",
},
}),
AdvancedConditionJson = JsonSerializer.Serialize(new[]
{
new object?[]
{
"scheduled-weekly",
1565392127032,
3600000,
"America/Los_Angeles",
new object?[]
{
1,
2,
3,
5,
7,
},
},
}),
});
var third = new Pagerduty.EventRule("third", new()
{
ActionJson = JsonSerializer.Serialize(new[]
{
new[]
{
"route",
"P5DTL0K",
},
new[]
{
"severity",
"warning",
},
new[]
{
"annotate",
"3 Managed by terraform",
},
new[]
{
"priority",
"PL451DT",
},
}),
ConditionJson = JsonSerializer.Serialize(new object?[]
{
"and",
new object?[]
{
"contains",
new[]
{
"path",
"payload",
"source",
},
"website",
},
new object?[]
{
"contains",
new[]
{
"path",
"headers",
"from",
"0",
"address",
},
"homer",
},
}),
}, new CustomResourceOptions
{
DependsOn =
{
two,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.pagerduty.EventRule;
import com.pulumi.pagerduty.EventRuleArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import com.pulumi.resources.CustomResourceOptions;
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) {
var second = new EventRule("second", EventRuleArgs.builder()
.actionJson(serializeJson(
jsonArray(
jsonArray(
"route",
"P5DTL0K"
),
jsonArray(
"severity",
"warning"
),
jsonArray(
"annotate",
"2 Managed by terraform"
),
jsonArray(
"priority",
"PL451DT"
)
)))
.conditionJson(serializeJson(
jsonArray(
"and",
jsonArray(
"contains",
jsonArray(
"path",
"payload",
"source"
),
"website"
),
jsonArray(
"contains",
jsonArray(
"path",
"headers",
"from",
"0",
"address"
),
"homer"
)
)))
.advancedConditionJson(serializeJson(
jsonArray(jsonArray(
"scheduled-weekly",
1565392127032,
3600000,
"America/Los_Angeles",
jsonArray(
1,
2,
3,
5,
7
)
))))
.build());
var third = new EventRule("third", EventRuleArgs.builder()
.actionJson(serializeJson(
jsonArray(
jsonArray(
"route",
"P5DTL0K"
),
jsonArray(
"severity",
"warning"
),
jsonArray(
"annotate",
"3 Managed by terraform"
),
jsonArray(
"priority",
"PL451DT"
)
)))
.conditionJson(serializeJson(
jsonArray(
"and",
jsonArray(
"contains",
jsonArray(
"path",
"payload",
"source"
),
"website"
),
jsonArray(
"contains",
jsonArray(
"path",
"headers",
"from",
"0",
"address"
),
"homer"
)
)))
.build(), CustomResourceOptions.builder()
.dependsOn(two)
.build());
}
}
resources:
second:
type: pagerduty:EventRule
properties:
actionJson:
fn::toJSON:
- - route
- P5DTL0K
- - severity
- warning
- - annotate
- 2 Managed by terraform
- - priority
- PL451DT
conditionJson:
fn::toJSON:
- and
- - contains
- - path
- payload
- source
- website
- - contains
- - path
- headers
- from
- '0'
- address
- homer
advancedConditionJson:
fn::toJSON:
- - scheduled-weekly
- 1.565392127032e+12
- 3.6e+06
- America/Los_Angeles
- - 1
- 2
- 3
- 5
- 7
third:
type: pagerduty:EventRule
properties:
actionJson:
fn::toJSON:
- - route
- P5DTL0K
- - severity
- warning
- - annotate
- 3 Managed by terraform
- - priority
- PL451DT
conditionJson:
fn::toJSON:
- and
- - contains
- - path
- payload
- source
- website
- - contains
- - path
- headers
- from
- '0'
- address
- homer
options:
dependson:
- ${two}
Create EventRule Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new EventRule(name: string, args: EventRuleArgs, opts?: CustomResourceOptions);
@overload
def EventRule(resource_name: str,
args: EventRuleArgs,
opts: Optional[ResourceOptions] = None)
@overload
def EventRule(resource_name: str,
opts: Optional[ResourceOptions] = None,
action_json: Optional[str] = None,
condition_json: Optional[str] = None,
advanced_condition_json: Optional[str] = None)
func NewEventRule(ctx *Context, name string, args EventRuleArgs, opts ...ResourceOption) (*EventRule, error)
public EventRule(string name, EventRuleArgs args, CustomResourceOptions? opts = null)
public EventRule(String name, EventRuleArgs args)
public EventRule(String name, EventRuleArgs args, CustomResourceOptions options)
type: pagerduty:EventRule
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 EventRuleArgs
- 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 EventRuleArgs
- 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 EventRuleArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args EventRuleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args EventRuleArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var eventRuleResource = new Pagerduty.EventRule("eventRuleResource", new()
{
ActionJson = "string",
ConditionJson = "string",
AdvancedConditionJson = "string",
});
example, err := pagerduty.NewEventRule(ctx, "eventRuleResource", &pagerduty.EventRuleArgs{
ActionJson: pulumi.String("string"),
ConditionJson: pulumi.String("string"),
AdvancedConditionJson: pulumi.String("string"),
})
var eventRuleResource = new EventRule("eventRuleResource", EventRuleArgs.builder()
.actionJson("string")
.conditionJson("string")
.advancedConditionJson("string")
.build());
event_rule_resource = pagerduty.EventRule("eventRuleResource",
action_json="string",
condition_json="string",
advanced_condition_json="string")
const eventRuleResource = new pagerduty.EventRule("eventRuleResource", {
actionJson: "string",
conditionJson: "string",
advancedConditionJson: "string",
});
type: pagerduty:EventRule
properties:
actionJson: string
advancedConditionJson: string
conditionJson: string
EventRule Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The EventRule resource accepts the following input properties:
- Action
Json string - A list of one or more actions for each rule. Each action within the list is itself a list.
- Condition
Json string - Contains a list of conditions. The first field in the list is
and
oror
, followed by a list of operators and values. - Advanced
Condition stringJson - Contains a list of specific conditions including
active-between
,scheduled-weekly
, andfrequency-over
. The first element in the list is the label for the condition, followed by a list of values for the specific condition. For more details on these conditions see Advanced Condition in the PagerDuty API documentation.
- Action
Json string - A list of one or more actions for each rule. Each action within the list is itself a list.
- Condition
Json string - Contains a list of conditions. The first field in the list is
and
oror
, followed by a list of operators and values. - Advanced
Condition stringJson - Contains a list of specific conditions including
active-between
,scheduled-weekly
, andfrequency-over
. The first element in the list is the label for the condition, followed by a list of values for the specific condition. For more details on these conditions see Advanced Condition in the PagerDuty API documentation.
- action
Json String - A list of one or more actions for each rule. Each action within the list is itself a list.
- condition
Json String - Contains a list of conditions. The first field in the list is
and
oror
, followed by a list of operators and values. - advanced
Condition StringJson - Contains a list of specific conditions including
active-between
,scheduled-weekly
, andfrequency-over
. The first element in the list is the label for the condition, followed by a list of values for the specific condition. For more details on these conditions see Advanced Condition in the PagerDuty API documentation.
- action
Json string - A list of one or more actions for each rule. Each action within the list is itself a list.
- condition
Json string - Contains a list of conditions. The first field in the list is
and
oror
, followed by a list of operators and values. - advanced
Condition stringJson - Contains a list of specific conditions including
active-between
,scheduled-weekly
, andfrequency-over
. The first element in the list is the label for the condition, followed by a list of values for the specific condition. For more details on these conditions see Advanced Condition in the PagerDuty API documentation.
- action_
json str - A list of one or more actions for each rule. Each action within the list is itself a list.
- condition_
json str - Contains a list of conditions. The first field in the list is
and
oror
, followed by a list of operators and values. - advanced_
condition_ strjson - Contains a list of specific conditions including
active-between
,scheduled-weekly
, andfrequency-over
. The first element in the list is the label for the condition, followed by a list of values for the specific condition. For more details on these conditions see Advanced Condition in the PagerDuty API documentation.
- action
Json String - A list of one or more actions for each rule. Each action within the list is itself a list.
- condition
Json String - Contains a list of conditions. The first field in the list is
and
oror
, followed by a list of operators and values. - advanced
Condition StringJson - Contains a list of specific conditions including
active-between
,scheduled-weekly
, andfrequency-over
. The first element in the list is the label for the condition, followed by a list of values for the specific condition. For more details on these conditions see Advanced Condition in the PagerDuty API documentation.
Outputs
All input properties are implicitly available as output properties. Additionally, the EventRule resource produces the following output properties:
Look up Existing EventRule Resource
Get an existing EventRule 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?: EventRuleState, opts?: CustomResourceOptions): EventRule
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
action_json: Optional[str] = None,
advanced_condition_json: Optional[str] = None,
catch_all: Optional[bool] = None,
condition_json: Optional[str] = None) -> EventRule
func GetEventRule(ctx *Context, name string, id IDInput, state *EventRuleState, opts ...ResourceOption) (*EventRule, error)
public static EventRule Get(string name, Input<string> id, EventRuleState? state, CustomResourceOptions? opts = null)
public static EventRule get(String name, Output<String> id, EventRuleState 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.
- Action
Json string - A list of one or more actions for each rule. Each action within the list is itself a list.
- Advanced
Condition stringJson - Contains a list of specific conditions including
active-between
,scheduled-weekly
, andfrequency-over
. The first element in the list is the label for the condition, followed by a list of values for the specific condition. For more details on these conditions see Advanced Condition in the PagerDuty API documentation. - Catch
All bool - A boolean that indicates whether the rule is a catch-all for the account. This field is read-only through the PagerDuty API.
- Condition
Json string - Contains a list of conditions. The first field in the list is
and
oror
, followed by a list of operators and values.
- Action
Json string - A list of one or more actions for each rule. Each action within the list is itself a list.
- Advanced
Condition stringJson - Contains a list of specific conditions including
active-between
,scheduled-weekly
, andfrequency-over
. The first element in the list is the label for the condition, followed by a list of values for the specific condition. For more details on these conditions see Advanced Condition in the PagerDuty API documentation. - Catch
All bool - A boolean that indicates whether the rule is a catch-all for the account. This field is read-only through the PagerDuty API.
- Condition
Json string - Contains a list of conditions. The first field in the list is
and
oror
, followed by a list of operators and values.
- action
Json String - A list of one or more actions for each rule. Each action within the list is itself a list.
- advanced
Condition StringJson - Contains a list of specific conditions including
active-between
,scheduled-weekly
, andfrequency-over
. The first element in the list is the label for the condition, followed by a list of values for the specific condition. For more details on these conditions see Advanced Condition in the PagerDuty API documentation. - catch
All Boolean - A boolean that indicates whether the rule is a catch-all for the account. This field is read-only through the PagerDuty API.
- condition
Json String - Contains a list of conditions. The first field in the list is
and
oror
, followed by a list of operators and values.
- action
Json string - A list of one or more actions for each rule. Each action within the list is itself a list.
- advanced
Condition stringJson - Contains a list of specific conditions including
active-between
,scheduled-weekly
, andfrequency-over
. The first element in the list is the label for the condition, followed by a list of values for the specific condition. For more details on these conditions see Advanced Condition in the PagerDuty API documentation. - catch
All boolean - A boolean that indicates whether the rule is a catch-all for the account. This field is read-only through the PagerDuty API.
- condition
Json string - Contains a list of conditions. The first field in the list is
and
oror
, followed by a list of operators and values.
- action_
json str - A list of one or more actions for each rule. Each action within the list is itself a list.
- advanced_
condition_ strjson - Contains a list of specific conditions including
active-between
,scheduled-weekly
, andfrequency-over
. The first element in the list is the label for the condition, followed by a list of values for the specific condition. For more details on these conditions see Advanced Condition in the PagerDuty API documentation. - catch_
all bool - A boolean that indicates whether the rule is a catch-all for the account. This field is read-only through the PagerDuty API.
- condition_
json str - Contains a list of conditions. The first field in the list is
and
oror
, followed by a list of operators and values.
- action
Json String - A list of one or more actions for each rule. Each action within the list is itself a list.
- advanced
Condition StringJson - Contains a list of specific conditions including
active-between
,scheduled-weekly
, andfrequency-over
. The first element in the list is the label for the condition, followed by a list of values for the specific condition. For more details on these conditions see Advanced Condition in the PagerDuty API documentation. - catch
All Boolean - A boolean that indicates whether the rule is a catch-all for the account. This field is read-only through the PagerDuty API.
- condition
Json String - Contains a list of conditions. The first field in the list is
and
oror
, followed by a list of operators and values.
Import
Event rules can be imported using the id
, e.g.
$ pulumi import pagerduty:index/eventRule:EventRule main 19acac92-027a-4ea0-b06c-bbf516519601
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.