1. Packages
  2. Opsgenie Provider
  3. API Docs
  4. NotificationRule
Opsgenie v1.3.14 published on Wednesday, Feb 12, 2025 by Pulumi

opsgenie.NotificationRule

Explore with Pulumi AI

Manages a Notification Rule within Opsgenie.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as opsgenie from "@pulumi/opsgenie";

const test = new opsgenie.User("test", {
    username: "Example user",
    fullName: "Name Lastname",
    role: "User",
});
const testNotificationRule = new opsgenie.NotificationRule("test", {
    name: "Example notification rule",
    username: test.username,
    actionType: "schedule-end",
    notificationTimes: [
        "just-before",
        "15-minutes-ago",
    ],
    steps: [{
        contacts: [{
            method: "email",
            to: "example@user.com",
        }],
    }],
});
Copy
import pulumi
import pulumi_opsgenie as opsgenie

test = opsgenie.User("test",
    username="Example user",
    full_name="Name Lastname",
    role="User")
test_notification_rule = opsgenie.NotificationRule("test",
    name="Example notification rule",
    username=test.username,
    action_type="schedule-end",
    notification_times=[
        "just-before",
        "15-minutes-ago",
    ],
    steps=[{
        "contacts": [{
            "method": "email",
            "to": "example@user.com",
        }],
    }])
Copy
package main

import (
	"github.com/pulumi/pulumi-opsgenie/sdk/go/opsgenie"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		test, err := opsgenie.NewUser(ctx, "test", &opsgenie.UserArgs{
			Username: pulumi.String("Example user"),
			FullName: pulumi.String("Name Lastname"),
			Role:     pulumi.String("User"),
		})
		if err != nil {
			return err
		}
		_, err = opsgenie.NewNotificationRule(ctx, "test", &opsgenie.NotificationRuleArgs{
			Name:       pulumi.String("Example notification rule"),
			Username:   test.Username,
			ActionType: pulumi.String("schedule-end"),
			NotificationTimes: pulumi.StringArray{
				pulumi.String("just-before"),
				pulumi.String("15-minutes-ago"),
			},
			Steps: opsgenie.NotificationRuleStepArray{
				&opsgenie.NotificationRuleStepArgs{
					Contacts: opsgenie.NotificationRuleStepContactArray{
						&opsgenie.NotificationRuleStepContactArgs{
							Method: pulumi.String("email"),
							To:     pulumi.String("example@user.com"),
						},
					},
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Opsgenie = Pulumi.Opsgenie;

return await Deployment.RunAsync(() => 
{
    var test = new Opsgenie.User("test", new()
    {
        Username = "Example user",
        FullName = "Name Lastname",
        Role = "User",
    });

    var testNotificationRule = new Opsgenie.NotificationRule("test", new()
    {
        Name = "Example notification rule",
        Username = test.Username,
        ActionType = "schedule-end",
        NotificationTimes = new[]
        {
            "just-before",
            "15-minutes-ago",
        },
        Steps = new[]
        {
            new Opsgenie.Inputs.NotificationRuleStepArgs
            {
                Contacts = new[]
                {
                    new Opsgenie.Inputs.NotificationRuleStepContactArgs
                    {
                        Method = "email",
                        To = "example@user.com",
                    },
                },
            },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.opsgenie.User;
import com.pulumi.opsgenie.UserArgs;
import com.pulumi.opsgenie.NotificationRule;
import com.pulumi.opsgenie.NotificationRuleArgs;
import com.pulumi.opsgenie.inputs.NotificationRuleStepArgs;
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 test = new User("test", UserArgs.builder()
            .username("Example user")
            .fullName("Name Lastname")
            .role("User")
            .build());

        var testNotificationRule = new NotificationRule("testNotificationRule", NotificationRuleArgs.builder()
            .name("Example notification rule")
            .username(test.username())
            .actionType("schedule-end")
            .notificationTimes(            
                "just-before",
                "15-minutes-ago")
            .steps(NotificationRuleStepArgs.builder()
                .contacts(NotificationRuleStepContactArgs.builder()
                    .method("email")
                    .to("example@user.com")
                    .build())
                .build())
            .build());

    }
}
Copy
resources:
  test:
    type: opsgenie:User
    properties:
      username: Example user
      fullName: Name Lastname
      role: User
  testNotificationRule:
    type: opsgenie:NotificationRule
    name: test
    properties:
      name: Example notification rule
      username: ${test.username}
      actionType: schedule-end
      notificationTimes:
        - just-before
        - 15-minutes-ago
      steps:
        - contacts:
            - method: email
              to: example@user.com
Copy

Create NotificationRule Resource

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

Constructor syntax

new NotificationRule(name: string, args: NotificationRuleArgs, opts?: CustomResourceOptions);
@overload
def NotificationRule(resource_name: str,
                     args: NotificationRuleArgs,
                     opts: Optional[ResourceOptions] = None)

@overload
def NotificationRule(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     action_type: Optional[str] = None,
                     username: Optional[str] = None,
                     criterias: Optional[Sequence[NotificationRuleCriteriaArgs]] = None,
                     enabled: Optional[bool] = None,
                     name: Optional[str] = None,
                     notification_times: Optional[Sequence[str]] = None,
                     order: Optional[int] = None,
                     repeats: Optional[Sequence[NotificationRuleRepeatArgs]] = None,
                     schedules: Optional[Sequence[NotificationRuleScheduleArgs]] = None,
                     steps: Optional[Sequence[NotificationRuleStepArgs]] = None,
                     time_restrictions: Optional[Sequence[NotificationRuleTimeRestrictionArgs]] = None)
func NewNotificationRule(ctx *Context, name string, args NotificationRuleArgs, opts ...ResourceOption) (*NotificationRule, error)
public NotificationRule(string name, NotificationRuleArgs args, CustomResourceOptions? opts = null)
public NotificationRule(String name, NotificationRuleArgs args)
public NotificationRule(String name, NotificationRuleArgs args, CustomResourceOptions options)
type: opsgenie:NotificationRule
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. NotificationRuleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. NotificationRuleArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. NotificationRuleArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. NotificationRuleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. NotificationRuleArgs
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 notificationRuleResource = new Opsgenie.NotificationRule("notificationRuleResource", new()
{
    ActionType = "string",
    Username = "string",
    Criterias = new[]
    {
        new Opsgenie.Inputs.NotificationRuleCriteriaArgs
        {
            Type = "string",
            Conditions = new[]
            {
                new Opsgenie.Inputs.NotificationRuleCriteriaConditionArgs
                {
                    Field = "string",
                    Operation = "string",
                    ExpectedValue = "string",
                    Key = "string",
                    Not = false,
                    Order = 0,
                },
            },
        },
    },
    Enabled = false,
    Name = "string",
    NotificationTimes = new[]
    {
        "string",
    },
    Order = 0,
    Repeats = new[]
    {
        new Opsgenie.Inputs.NotificationRuleRepeatArgs
        {
            LoopAfter = 0,
            Enabled = false,
        },
    },
    Schedules = new[]
    {
        new Opsgenie.Inputs.NotificationRuleScheduleArgs
        {
            Name = "string",
            Type = "string",
        },
    },
    Steps = new[]
    {
        new Opsgenie.Inputs.NotificationRuleStepArgs
        {
            Contacts = new[]
            {
                new Opsgenie.Inputs.NotificationRuleStepContactArgs
                {
                    Method = "string",
                    To = "string",
                },
            },
            Enabled = false,
            SendAfter = 0,
        },
    },
    TimeRestrictions = new[]
    {
        new Opsgenie.Inputs.NotificationRuleTimeRestrictionArgs
        {
            Type = "string",
            Restriction = new[]
            {
                new Opsgenie.Inputs.NotificationRuleTimeRestrictionRestrictionArgs
                {
                    EndDay = "string",
                    EndHour = 0,
                    EndMin = 0,
                    StartDay = "string",
                    StartHour = 0,
                    StartMin = 0,
                },
            },
            Restrictions = new[]
            {
                new Opsgenie.Inputs.NotificationRuleTimeRestrictionRestrictionArgs
                {
                    EndDay = "string",
                    EndHour = 0,
                    EndMin = 0,
                    StartDay = "string",
                    StartHour = 0,
                    StartMin = 0,
                },
            },
        },
    },
});
Copy
example, err := opsgenie.NewNotificationRule(ctx, "notificationRuleResource", &opsgenie.NotificationRuleArgs{
	ActionType: pulumi.String("string"),
	Username:   pulumi.String("string"),
	Criterias: opsgenie.NotificationRuleCriteriaArray{
		&opsgenie.NotificationRuleCriteriaArgs{
			Type: pulumi.String("string"),
			Conditions: opsgenie.NotificationRuleCriteriaConditionArray{
				&opsgenie.NotificationRuleCriteriaConditionArgs{
					Field:         pulumi.String("string"),
					Operation:     pulumi.String("string"),
					ExpectedValue: pulumi.String("string"),
					Key:           pulumi.String("string"),
					Not:           pulumi.Bool(false),
					Order:         pulumi.Int(0),
				},
			},
		},
	},
	Enabled: pulumi.Bool(false),
	Name:    pulumi.String("string"),
	NotificationTimes: pulumi.StringArray{
		pulumi.String("string"),
	},
	Order: pulumi.Int(0),
	Repeats: opsgenie.NotificationRuleRepeatArray{
		&opsgenie.NotificationRuleRepeatArgs{
			LoopAfter: pulumi.Int(0),
			Enabled:   pulumi.Bool(false),
		},
	},
	Schedules: opsgenie.NotificationRuleScheduleArray{
		&opsgenie.NotificationRuleScheduleArgs{
			Name: pulumi.String("string"),
			Type: pulumi.String("string"),
		},
	},
	Steps: opsgenie.NotificationRuleStepArray{
		&opsgenie.NotificationRuleStepArgs{
			Contacts: opsgenie.NotificationRuleStepContactArray{
				&opsgenie.NotificationRuleStepContactArgs{
					Method: pulumi.String("string"),
					To:     pulumi.String("string"),
				},
			},
			Enabled:   pulumi.Bool(false),
			SendAfter: pulumi.Int(0),
		},
	},
	TimeRestrictions: opsgenie.NotificationRuleTimeRestrictionArray{
		&opsgenie.NotificationRuleTimeRestrictionArgs{
			Type: pulumi.String("string"),
			Restriction: opsgenie.NotificationRuleTimeRestrictionRestrictionArray{
				&opsgenie.NotificationRuleTimeRestrictionRestrictionArgs{
					EndDay:    pulumi.String("string"),
					EndHour:   pulumi.Int(0),
					EndMin:    pulumi.Int(0),
					StartDay:  pulumi.String("string"),
					StartHour: pulumi.Int(0),
					StartMin:  pulumi.Int(0),
				},
			},
			Restrictions: opsgenie.NotificationRuleTimeRestrictionRestrictionArray{
				&opsgenie.NotificationRuleTimeRestrictionRestrictionArgs{
					EndDay:    pulumi.String("string"),
					EndHour:   pulumi.Int(0),
					EndMin:    pulumi.Int(0),
					StartDay:  pulumi.String("string"),
					StartHour: pulumi.Int(0),
					StartMin:  pulumi.Int(0),
				},
			},
		},
	},
})
Copy
var notificationRuleResource = new NotificationRule("notificationRuleResource", NotificationRuleArgs.builder()
    .actionType("string")
    .username("string")
    .criterias(NotificationRuleCriteriaArgs.builder()
        .type("string")
        .conditions(NotificationRuleCriteriaConditionArgs.builder()
            .field("string")
            .operation("string")
            .expectedValue("string")
            .key("string")
            .not(false)
            .order(0)
            .build())
        .build())
    .enabled(false)
    .name("string")
    .notificationTimes("string")
    .order(0)
    .repeats(NotificationRuleRepeatArgs.builder()
        .loopAfter(0)
        .enabled(false)
        .build())
    .schedules(NotificationRuleScheduleArgs.builder()
        .name("string")
        .type("string")
        .build())
    .steps(NotificationRuleStepArgs.builder()
        .contacts(NotificationRuleStepContactArgs.builder()
            .method("string")
            .to("string")
            .build())
        .enabled(false)
        .sendAfter(0)
        .build())
    .timeRestrictions(NotificationRuleTimeRestrictionArgs.builder()
        .type("string")
        .restriction(NotificationRuleTimeRestrictionRestrictionArgs.builder()
            .endDay("string")
            .endHour(0)
            .endMin(0)
            .startDay("string")
            .startHour(0)
            .startMin(0)
            .build())
        .restrictions(NotificationRuleTimeRestrictionRestrictionArgs.builder()
            .endDay("string")
            .endHour(0)
            .endMin(0)
            .startDay("string")
            .startHour(0)
            .startMin(0)
            .build())
        .build())
    .build());
Copy
notification_rule_resource = opsgenie.NotificationRule("notificationRuleResource",
    action_type="string",
    username="string",
    criterias=[{
        "type": "string",
        "conditions": [{
            "field": "string",
            "operation": "string",
            "expected_value": "string",
            "key": "string",
            "not_": False,
            "order": 0,
        }],
    }],
    enabled=False,
    name="string",
    notification_times=["string"],
    order=0,
    repeats=[{
        "loop_after": 0,
        "enabled": False,
    }],
    schedules=[{
        "name": "string",
        "type": "string",
    }],
    steps=[{
        "contacts": [{
            "method": "string",
            "to": "string",
        }],
        "enabled": False,
        "send_after": 0,
    }],
    time_restrictions=[{
        "type": "string",
        "restriction": [{
            "end_day": "string",
            "end_hour": 0,
            "end_min": 0,
            "start_day": "string",
            "start_hour": 0,
            "start_min": 0,
        }],
        "restrictions": [{
            "end_day": "string",
            "end_hour": 0,
            "end_min": 0,
            "start_day": "string",
            "start_hour": 0,
            "start_min": 0,
        }],
    }])
Copy
const notificationRuleResource = new opsgenie.NotificationRule("notificationRuleResource", {
    actionType: "string",
    username: "string",
    criterias: [{
        type: "string",
        conditions: [{
            field: "string",
            operation: "string",
            expectedValue: "string",
            key: "string",
            not: false,
            order: 0,
        }],
    }],
    enabled: false,
    name: "string",
    notificationTimes: ["string"],
    order: 0,
    repeats: [{
        loopAfter: 0,
        enabled: false,
    }],
    schedules: [{
        name: "string",
        type: "string",
    }],
    steps: [{
        contacts: [{
            method: "string",
            to: "string",
        }],
        enabled: false,
        sendAfter: 0,
    }],
    timeRestrictions: [{
        type: "string",
        restriction: [{
            endDay: "string",
            endHour: 0,
            endMin: 0,
            startDay: "string",
            startHour: 0,
            startMin: 0,
        }],
        restrictions: [{
            endDay: "string",
            endHour: 0,
            endMin: 0,
            startDay: "string",
            startHour: 0,
            startMin: 0,
        }],
    }],
});
Copy
type: opsgenie:NotificationRule
properties:
    actionType: string
    criterias:
        - conditions:
            - expectedValue: string
              field: string
              key: string
              not: false
              operation: string
              order: 0
          type: string
    enabled: false
    name: string
    notificationTimes:
        - string
    order: 0
    repeats:
        - enabled: false
          loopAfter: 0
    schedules:
        - name: string
          type: string
    steps:
        - contacts:
            - method: string
              to: string
          enabled: false
          sendAfter: 0
    timeRestrictions:
        - restriction:
            - endDay: string
              endHour: 0
              endMin: 0
              startDay: string
              startHour: 0
              startMin: 0
          restrictions:
            - endDay: string
              endHour: 0
              endMin: 0
              startDay: string
              startHour: 0
              startMin: 0
          type: string
    username: string
Copy

NotificationRule 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 NotificationRule resource accepts the following input properties:

ActionType
This property is required.
Changes to this property will trigger replacement.
string
Type of the action that notification rule will have. Allowed values: create-alert, acknowledged-alert, closed-alert, assigned-alert, add-note, schedule-start, schedule-end, incoming-call-routing
Username This property is required. string
Username of user to which this notification rule belongs to.
Criterias List<NotificationRuleCriteria>
Enabled bool
If policy should be enabled. Default: true
Name Changes to this property will trigger replacement. string
Name of the notification policy
NotificationTimes List<string>
List of Time Periods that notification for schedule start/end will be sent. Allowed values: just-before, 15-minutes-ago, 1-hour-ago, 1-day-ago. If action_type is schedule-start or schedule-end then it is required.
Order int
Repeats List<NotificationRuleRepeat>
Schedules List<NotificationRuleSchedule>
Steps List<NotificationRuleStep>
Notification rule steps to take (eg. SMS or email message). This is a block, structure is documented below.
TimeRestrictions List<NotificationRuleTimeRestriction>
ActionType
This property is required.
Changes to this property will trigger replacement.
string
Type of the action that notification rule will have. Allowed values: create-alert, acknowledged-alert, closed-alert, assigned-alert, add-note, schedule-start, schedule-end, incoming-call-routing
Username This property is required. string
Username of user to which this notification rule belongs to.
Criterias []NotificationRuleCriteriaArgs
Enabled bool
If policy should be enabled. Default: true
Name Changes to this property will trigger replacement. string
Name of the notification policy
NotificationTimes []string
List of Time Periods that notification for schedule start/end will be sent. Allowed values: just-before, 15-minutes-ago, 1-hour-ago, 1-day-ago. If action_type is schedule-start or schedule-end then it is required.
Order int
Repeats []NotificationRuleRepeatArgs
Schedules []NotificationRuleScheduleArgs
Steps []NotificationRuleStepArgs
Notification rule steps to take (eg. SMS or email message). This is a block, structure is documented below.
TimeRestrictions []NotificationRuleTimeRestrictionArgs
actionType
This property is required.
Changes to this property will trigger replacement.
String
Type of the action that notification rule will have. Allowed values: create-alert, acknowledged-alert, closed-alert, assigned-alert, add-note, schedule-start, schedule-end, incoming-call-routing
username This property is required. String
Username of user to which this notification rule belongs to.
criterias List<NotificationRuleCriteria>
enabled Boolean
If policy should be enabled. Default: true
name Changes to this property will trigger replacement. String
Name of the notification policy
notificationTimes List<String>
List of Time Periods that notification for schedule start/end will be sent. Allowed values: just-before, 15-minutes-ago, 1-hour-ago, 1-day-ago. If action_type is schedule-start or schedule-end then it is required.
order Integer
repeats List<NotificationRuleRepeat>
schedules List<NotificationRuleSchedule>
steps List<NotificationRuleStep>
Notification rule steps to take (eg. SMS or email message). This is a block, structure is documented below.
timeRestrictions List<NotificationRuleTimeRestriction>
actionType
This property is required.
Changes to this property will trigger replacement.
string
Type of the action that notification rule will have. Allowed values: create-alert, acknowledged-alert, closed-alert, assigned-alert, add-note, schedule-start, schedule-end, incoming-call-routing
username This property is required. string
Username of user to which this notification rule belongs to.
criterias NotificationRuleCriteria[]
enabled boolean
If policy should be enabled. Default: true
name Changes to this property will trigger replacement. string
Name of the notification policy
notificationTimes string[]
List of Time Periods that notification for schedule start/end will be sent. Allowed values: just-before, 15-minutes-ago, 1-hour-ago, 1-day-ago. If action_type is schedule-start or schedule-end then it is required.
order number
repeats NotificationRuleRepeat[]
schedules NotificationRuleSchedule[]
steps NotificationRuleStep[]
Notification rule steps to take (eg. SMS or email message). This is a block, structure is documented below.
timeRestrictions NotificationRuleTimeRestriction[]
action_type
This property is required.
Changes to this property will trigger replacement.
str
Type of the action that notification rule will have. Allowed values: create-alert, acknowledged-alert, closed-alert, assigned-alert, add-note, schedule-start, schedule-end, incoming-call-routing
username This property is required. str
Username of user to which this notification rule belongs to.
criterias Sequence[NotificationRuleCriteriaArgs]
enabled bool
If policy should be enabled. Default: true
name Changes to this property will trigger replacement. str
Name of the notification policy
notification_times Sequence[str]
List of Time Periods that notification for schedule start/end will be sent. Allowed values: just-before, 15-minutes-ago, 1-hour-ago, 1-day-ago. If action_type is schedule-start or schedule-end then it is required.
order int
repeats Sequence[NotificationRuleRepeatArgs]
schedules Sequence[NotificationRuleScheduleArgs]
steps Sequence[NotificationRuleStepArgs]
Notification rule steps to take (eg. SMS or email message). This is a block, structure is documented below.
time_restrictions Sequence[NotificationRuleTimeRestrictionArgs]
actionType
This property is required.
Changes to this property will trigger replacement.
String
Type of the action that notification rule will have. Allowed values: create-alert, acknowledged-alert, closed-alert, assigned-alert, add-note, schedule-start, schedule-end, incoming-call-routing
username This property is required. String
Username of user to which this notification rule belongs to.
criterias List<Property Map>
enabled Boolean
If policy should be enabled. Default: true
name Changes to this property will trigger replacement. String
Name of the notification policy
notificationTimes List<String>
List of Time Periods that notification for schedule start/end will be sent. Allowed values: just-before, 15-minutes-ago, 1-hour-ago, 1-day-ago. If action_type is schedule-start or schedule-end then it is required.
order Number
repeats List<Property Map>
schedules List<Property Map>
steps List<Property Map>
Notification rule steps to take (eg. SMS or email message). This is a block, structure is documented below.
timeRestrictions List<Property Map>

Outputs

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

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

Look up Existing NotificationRule Resource

Get an existing NotificationRule 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?: NotificationRuleState, opts?: CustomResourceOptions): NotificationRule
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        action_type: Optional[str] = None,
        criterias: Optional[Sequence[NotificationRuleCriteriaArgs]] = None,
        enabled: Optional[bool] = None,
        name: Optional[str] = None,
        notification_times: Optional[Sequence[str]] = None,
        order: Optional[int] = None,
        repeats: Optional[Sequence[NotificationRuleRepeatArgs]] = None,
        schedules: Optional[Sequence[NotificationRuleScheduleArgs]] = None,
        steps: Optional[Sequence[NotificationRuleStepArgs]] = None,
        time_restrictions: Optional[Sequence[NotificationRuleTimeRestrictionArgs]] = None,
        username: Optional[str] = None) -> NotificationRule
func GetNotificationRule(ctx *Context, name string, id IDInput, state *NotificationRuleState, opts ...ResourceOption) (*NotificationRule, error)
public static NotificationRule Get(string name, Input<string> id, NotificationRuleState? state, CustomResourceOptions? opts = null)
public static NotificationRule get(String name, Output<String> id, NotificationRuleState state, CustomResourceOptions options)
resources:  _:    type: opsgenie:NotificationRule    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
ActionType Changes to this property will trigger replacement. string
Type of the action that notification rule will have. Allowed values: create-alert, acknowledged-alert, closed-alert, assigned-alert, add-note, schedule-start, schedule-end, incoming-call-routing
Criterias List<NotificationRuleCriteria>
Enabled bool
If policy should be enabled. Default: true
Name Changes to this property will trigger replacement. string
Name of the notification policy
NotificationTimes List<string>
List of Time Periods that notification for schedule start/end will be sent. Allowed values: just-before, 15-minutes-ago, 1-hour-ago, 1-day-ago. If action_type is schedule-start or schedule-end then it is required.
Order int
Repeats List<NotificationRuleRepeat>
Schedules List<NotificationRuleSchedule>
Steps List<NotificationRuleStep>
Notification rule steps to take (eg. SMS or email message). This is a block, structure is documented below.
TimeRestrictions List<NotificationRuleTimeRestriction>
Username string
Username of user to which this notification rule belongs to.
ActionType Changes to this property will trigger replacement. string
Type of the action that notification rule will have. Allowed values: create-alert, acknowledged-alert, closed-alert, assigned-alert, add-note, schedule-start, schedule-end, incoming-call-routing
Criterias []NotificationRuleCriteriaArgs
Enabled bool
If policy should be enabled. Default: true
Name Changes to this property will trigger replacement. string
Name of the notification policy
NotificationTimes []string
List of Time Periods that notification for schedule start/end will be sent. Allowed values: just-before, 15-minutes-ago, 1-hour-ago, 1-day-ago. If action_type is schedule-start or schedule-end then it is required.
Order int
Repeats []NotificationRuleRepeatArgs
Schedules []NotificationRuleScheduleArgs
Steps []NotificationRuleStepArgs
Notification rule steps to take (eg. SMS or email message). This is a block, structure is documented below.
TimeRestrictions []NotificationRuleTimeRestrictionArgs
Username string
Username of user to which this notification rule belongs to.
actionType Changes to this property will trigger replacement. String
Type of the action that notification rule will have. Allowed values: create-alert, acknowledged-alert, closed-alert, assigned-alert, add-note, schedule-start, schedule-end, incoming-call-routing
criterias List<NotificationRuleCriteria>
enabled Boolean
If policy should be enabled. Default: true
name Changes to this property will trigger replacement. String
Name of the notification policy
notificationTimes List<String>
List of Time Periods that notification for schedule start/end will be sent. Allowed values: just-before, 15-minutes-ago, 1-hour-ago, 1-day-ago. If action_type is schedule-start or schedule-end then it is required.
order Integer
repeats List<NotificationRuleRepeat>
schedules List<NotificationRuleSchedule>
steps List<NotificationRuleStep>
Notification rule steps to take (eg. SMS or email message). This is a block, structure is documented below.
timeRestrictions List<NotificationRuleTimeRestriction>
username String
Username of user to which this notification rule belongs to.
actionType Changes to this property will trigger replacement. string
Type of the action that notification rule will have. Allowed values: create-alert, acknowledged-alert, closed-alert, assigned-alert, add-note, schedule-start, schedule-end, incoming-call-routing
criterias NotificationRuleCriteria[]
enabled boolean
If policy should be enabled. Default: true
name Changes to this property will trigger replacement. string
Name of the notification policy
notificationTimes string[]
List of Time Periods that notification for schedule start/end will be sent. Allowed values: just-before, 15-minutes-ago, 1-hour-ago, 1-day-ago. If action_type is schedule-start or schedule-end then it is required.
order number
repeats NotificationRuleRepeat[]
schedules NotificationRuleSchedule[]
steps NotificationRuleStep[]
Notification rule steps to take (eg. SMS or email message). This is a block, structure is documented below.
timeRestrictions NotificationRuleTimeRestriction[]
username string
Username of user to which this notification rule belongs to.
action_type Changes to this property will trigger replacement. str
Type of the action that notification rule will have. Allowed values: create-alert, acknowledged-alert, closed-alert, assigned-alert, add-note, schedule-start, schedule-end, incoming-call-routing
criterias Sequence[NotificationRuleCriteriaArgs]
enabled bool
If policy should be enabled. Default: true
name Changes to this property will trigger replacement. str
Name of the notification policy
notification_times Sequence[str]
List of Time Periods that notification for schedule start/end will be sent. Allowed values: just-before, 15-minutes-ago, 1-hour-ago, 1-day-ago. If action_type is schedule-start or schedule-end then it is required.
order int
repeats Sequence[NotificationRuleRepeatArgs]
schedules Sequence[NotificationRuleScheduleArgs]
steps Sequence[NotificationRuleStepArgs]
Notification rule steps to take (eg. SMS or email message). This is a block, structure is documented below.
time_restrictions Sequence[NotificationRuleTimeRestrictionArgs]
username str
Username of user to which this notification rule belongs to.
actionType Changes to this property will trigger replacement. String
Type of the action that notification rule will have. Allowed values: create-alert, acknowledged-alert, closed-alert, assigned-alert, add-note, schedule-start, schedule-end, incoming-call-routing
criterias List<Property Map>
enabled Boolean
If policy should be enabled. Default: true
name Changes to this property will trigger replacement. String
Name of the notification policy
notificationTimes List<String>
List of Time Periods that notification for schedule start/end will be sent. Allowed values: just-before, 15-minutes-ago, 1-hour-ago, 1-day-ago. If action_type is schedule-start or schedule-end then it is required.
order Number
repeats List<Property Map>
schedules List<Property Map>
steps List<Property Map>
Notification rule steps to take (eg. SMS or email message). This is a block, structure is documented below.
timeRestrictions List<Property Map>
username String
Username of user to which this notification rule belongs to.

Supporting Types

NotificationRuleCriteria
, NotificationRuleCriteriaArgs

Type This property is required. string
Kind of matching filter. Possible values: match-all, match-any-condition, match-all-conditions
Conditions List<NotificationRuleCriteriaCondition>
Defines the fields and values when the condition applies
Type This property is required. string
Kind of matching filter. Possible values: match-all, match-any-condition, match-all-conditions
Conditions []NotificationRuleCriteriaCondition
Defines the fields and values when the condition applies
type This property is required. String
Kind of matching filter. Possible values: match-all, match-any-condition, match-all-conditions
conditions List<NotificationRuleCriteriaCondition>
Defines the fields and values when the condition applies
type This property is required. string
Kind of matching filter. Possible values: match-all, match-any-condition, match-all-conditions
conditions NotificationRuleCriteriaCondition[]
Defines the fields and values when the condition applies
type This property is required. str
Kind of matching filter. Possible values: match-all, match-any-condition, match-all-conditions
conditions Sequence[NotificationRuleCriteriaCondition]
Defines the fields and values when the condition applies
type This property is required. String
Kind of matching filter. Possible values: match-all, match-any-condition, match-all-conditions
conditions List<Property Map>
Defines the fields and values when the condition applies

NotificationRuleCriteriaCondition
, NotificationRuleCriteriaConditionArgs

Field This property is required. string
Possible values: message, alias, description, source, entity, tags, actions, details, extra-properties, recipients, teams, priority
Operation This property is required. string
Possible values: matches, contains, starts-with, ends-with, equals, contains-key, contains-value, greater-than, less-than, is-empty, equals-ignore-whitespace
ExpectedValue string
User defined value that will be compared with alert field according to the operation. Default: empty string
Key string
If 'field' is set as 'extra-properties', key could be used for key-value pair
Not bool
Indicates behaviour of the given operation. Default: false
Order int
Order of the condition in conditions list
Field This property is required. string
Possible values: message, alias, description, source, entity, tags, actions, details, extra-properties, recipients, teams, priority
Operation This property is required. string
Possible values: matches, contains, starts-with, ends-with, equals, contains-key, contains-value, greater-than, less-than, is-empty, equals-ignore-whitespace
ExpectedValue string
User defined value that will be compared with alert field according to the operation. Default: empty string
Key string
If 'field' is set as 'extra-properties', key could be used for key-value pair
Not bool
Indicates behaviour of the given operation. Default: false
Order int
Order of the condition in conditions list
field This property is required. String
Possible values: message, alias, description, source, entity, tags, actions, details, extra-properties, recipients, teams, priority
operation This property is required. String
Possible values: matches, contains, starts-with, ends-with, equals, contains-key, contains-value, greater-than, less-than, is-empty, equals-ignore-whitespace
expectedValue String
User defined value that will be compared with alert field according to the operation. Default: empty string
key String
If 'field' is set as 'extra-properties', key could be used for key-value pair
not Boolean
Indicates behaviour of the given operation. Default: false
order Integer
Order of the condition in conditions list
field This property is required. string
Possible values: message, alias, description, source, entity, tags, actions, details, extra-properties, recipients, teams, priority
operation This property is required. string
Possible values: matches, contains, starts-with, ends-with, equals, contains-key, contains-value, greater-than, less-than, is-empty, equals-ignore-whitespace
expectedValue string
User defined value that will be compared with alert field according to the operation. Default: empty string
key string
If 'field' is set as 'extra-properties', key could be used for key-value pair
not boolean
Indicates behaviour of the given operation. Default: false
order number
Order of the condition in conditions list
field This property is required. str
Possible values: message, alias, description, source, entity, tags, actions, details, extra-properties, recipients, teams, priority
operation This property is required. str
Possible values: matches, contains, starts-with, ends-with, equals, contains-key, contains-value, greater-than, less-than, is-empty, equals-ignore-whitespace
expected_value str
User defined value that will be compared with alert field according to the operation. Default: empty string
key str
If 'field' is set as 'extra-properties', key could be used for key-value pair
not_ bool
Indicates behaviour of the given operation. Default: false
order int
Order of the condition in conditions list
field This property is required. String
Possible values: message, alias, description, source, entity, tags, actions, details, extra-properties, recipients, teams, priority
operation This property is required. String
Possible values: matches, contains, starts-with, ends-with, equals, contains-key, contains-value, greater-than, less-than, is-empty, equals-ignore-whitespace
expectedValue String
User defined value that will be compared with alert field according to the operation. Default: empty string
key String
If 'field' is set as 'extra-properties', key could be used for key-value pair
not Boolean
Indicates behaviour of the given operation. Default: false
order Number
Order of the condition in conditions list

NotificationRuleRepeat
, NotificationRuleRepeatArgs

LoopAfter This property is required. int
Enabled bool
If policy should be enabled. Default: true
LoopAfter This property is required. int
Enabled bool
If policy should be enabled. Default: true
loopAfter This property is required. Integer
enabled Boolean
If policy should be enabled. Default: true
loopAfter This property is required. number
enabled boolean
If policy should be enabled. Default: true
loop_after This property is required. int
enabled bool
If policy should be enabled. Default: true
loopAfter This property is required. Number
enabled Boolean
If policy should be enabled. Default: true

NotificationRuleSchedule
, NotificationRuleScheduleArgs

Name This property is required. string
Name of the notification policy
Type This property is required. string
Kind of matching filter. Possible values: match-all, match-any-condition, match-all-conditions
Name This property is required. string
Name of the notification policy
Type This property is required. string
Kind of matching filter. Possible values: match-all, match-any-condition, match-all-conditions
name This property is required. String
Name of the notification policy
type This property is required. String
Kind of matching filter. Possible values: match-all, match-any-condition, match-all-conditions
name This property is required. string
Name of the notification policy
type This property is required. string
Kind of matching filter. Possible values: match-all, match-any-condition, match-all-conditions
name This property is required. str
Name of the notification policy
type This property is required. str
Kind of matching filter. Possible values: match-all, match-any-condition, match-all-conditions
name This property is required. String
Name of the notification policy
type This property is required. String
Kind of matching filter. Possible values: match-all, match-any-condition, match-all-conditions

NotificationRuleStep
, NotificationRuleStepArgs

Contacts This property is required. List<NotificationRuleStepContact>
Defines the contact that notification will be sent to. This is a block, structure is documented below.
Enabled bool
Defined if this step is enabled. Default: true
SendAfter int
Time period, in minutes, notification will be sent after.
Contacts This property is required. []NotificationRuleStepContact
Defines the contact that notification will be sent to. This is a block, structure is documented below.
Enabled bool
Defined if this step is enabled. Default: true
SendAfter int
Time period, in minutes, notification will be sent after.
contacts This property is required. List<NotificationRuleStepContact>
Defines the contact that notification will be sent to. This is a block, structure is documented below.
enabled Boolean
Defined if this step is enabled. Default: true
sendAfter Integer
Time period, in minutes, notification will be sent after.
contacts This property is required. NotificationRuleStepContact[]
Defines the contact that notification will be sent to. This is a block, structure is documented below.
enabled boolean
Defined if this step is enabled. Default: true
sendAfter number
Time period, in minutes, notification will be sent after.
contacts This property is required. Sequence[NotificationRuleStepContact]
Defines the contact that notification will be sent to. This is a block, structure is documented below.
enabled bool
Defined if this step is enabled. Default: true
send_after int
Time period, in minutes, notification will be sent after.
contacts This property is required. List<Property Map>
Defines the contact that notification will be sent to. This is a block, structure is documented below.
enabled Boolean
Defined if this step is enabled. Default: true
sendAfter Number
Time period, in minutes, notification will be sent after.

NotificationRuleStepContact
, NotificationRuleStepContactArgs

Method This property is required. string
Contact method. Possible values: email, sms, voice, mobile
To This property is required. string
Address of a given method (eg. email address for email, phone number for sms/voice or mobile application name for mobile)
Method This property is required. string
Contact method. Possible values: email, sms, voice, mobile
To This property is required. string
Address of a given method (eg. email address for email, phone number for sms/voice or mobile application name for mobile)
method This property is required. String
Contact method. Possible values: email, sms, voice, mobile
to This property is required. String
Address of a given method (eg. email address for email, phone number for sms/voice or mobile application name for mobile)
method This property is required. string
Contact method. Possible values: email, sms, voice, mobile
to This property is required. string
Address of a given method (eg. email address for email, phone number for sms/voice or mobile application name for mobile)
method This property is required. str
Contact method. Possible values: email, sms, voice, mobile
to This property is required. str
Address of a given method (eg. email address for email, phone number for sms/voice or mobile application name for mobile)
method This property is required. String
Contact method. Possible values: email, sms, voice, mobile
to This property is required. String
Address of a given method (eg. email address for email, phone number for sms/voice or mobile application name for mobile)

NotificationRuleTimeRestriction
, NotificationRuleTimeRestrictionArgs

Type This property is required. string
Kind of matching filter. Possible values: match-all, match-any-condition, match-all-conditions
Restriction List<NotificationRuleTimeRestrictionRestriction>
Restrictions List<NotificationRuleTimeRestrictionRestriction>
Type This property is required. string
Kind of matching filter. Possible values: match-all, match-any-condition, match-all-conditions
Restriction []NotificationRuleTimeRestrictionRestriction
Restrictions []NotificationRuleTimeRestrictionRestriction
type This property is required. String
Kind of matching filter. Possible values: match-all, match-any-condition, match-all-conditions
restriction List<NotificationRuleTimeRestrictionRestriction>
restrictions List<NotificationRuleTimeRestrictionRestriction>
type This property is required. string
Kind of matching filter. Possible values: match-all, match-any-condition, match-all-conditions
restriction NotificationRuleTimeRestrictionRestriction[]
restrictions NotificationRuleTimeRestrictionRestriction[]
type This property is required. str
Kind of matching filter. Possible values: match-all, match-any-condition, match-all-conditions
restriction Sequence[NotificationRuleTimeRestrictionRestriction]
restrictions Sequence[NotificationRuleTimeRestrictionRestriction]
type This property is required. String
Kind of matching filter. Possible values: match-all, match-any-condition, match-all-conditions
restriction List<Property Map>
restrictions List<Property Map>

NotificationRuleTimeRestrictionRestriction
, NotificationRuleTimeRestrictionRestrictionArgs

EndDay This property is required. string
EndHour This property is required. int
EndMin This property is required. int
StartDay This property is required. string
StartHour This property is required. int
StartMin This property is required. int
EndDay This property is required. string
EndHour This property is required. int
EndMin This property is required. int
StartDay This property is required. string
StartHour This property is required. int
StartMin This property is required. int
endDay This property is required. String
endHour This property is required. Integer
endMin This property is required. Integer
startDay This property is required. String
startHour This property is required. Integer
startMin This property is required. Integer
endDay This property is required. string
endHour This property is required. number
endMin This property is required. number
startDay This property is required. string
startHour This property is required. number
startMin This property is required. number
end_day This property is required. str
end_hour This property is required. int
end_min This property is required. int
start_day This property is required. str
start_hour This property is required. int
start_min This property is required. int
endDay This property is required. String
endHour This property is required. Number
endMin This property is required. Number
startDay This property is required. String
startHour This property is required. Number
startMin This property is required. Number

Import

Notification policies can be imported using the user_id/notification_rule_id, e.g.

$ pulumi import opsgenie:index/notificationRule:NotificationRule test user_id/notification_rule_id`
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Opsgenie pulumi/pulumi-opsgenie
License
Apache-2.0
Notes
This Pulumi package is based on the opsgenie Terraform Provider.