Welcome to Pulumi Registry, your window into the cloud. Read the announcement.

Opsgenie

v1.1.0 published on Thursday, Nov 11, 2021 by Pulumi

TeamRoutingRule

Manages a Team Routing Rule within Opsgenie.

Example Usage

using Pulumi;
using Opsgenie = Pulumi.Opsgenie;

class MyStack : Stack
{
    public MyStack()
    {
        var testSchedule = new Opsgenie.Schedule("testSchedule", new Opsgenie.ScheduleArgs
        {
            Description = "schedule test",
            Enabled = false,
            Timezone = "Europe/Rome",
        });
        var testTeam = new Opsgenie.Team("testTeam", new Opsgenie.TeamArgs
        {
            Description = "This team deals with all the things",
        });
        var testTeamRoutingRule = new Opsgenie.TeamRoutingRule("testTeamRoutingRule", new Opsgenie.TeamRoutingRuleArgs
        {
            Criterias = 
            {
                new Opsgenie.Inputs.TeamRoutingRuleCriteriaArgs
                {
                    Conditions = 
                    {
                        new Opsgenie.Inputs.TeamRoutingRuleCriteriaConditionArgs
                        {
                            ExpectedValue = "expected1",
                            Field = "message",
                            Not = false,
                            Operation = "contains",
                        },
                    },
                    Type = "match-any-condition",
                },
            },
            Notifies = 
            {
                new Opsgenie.Inputs.TeamRoutingRuleNotifyArgs
                {
                    Name = testSchedule.Name,
                    Type = "schedule",
                },
            },
            Order = 0,
            TeamId = testTeam.Id,
            TimeRestrictions = 
            {
                new Opsgenie.Inputs.TeamRoutingRuleTimeRestrictionArgs
                {
                    Restrictions = 
                    {
                        new Opsgenie.Inputs.TeamRoutingRuleTimeRestrictionRestrictionArgs
                        {
                            EndDay = "tuesday",
                            EndHour = 18,
                            EndMin = 30,
                            StartDay = "monday",
                            StartHour = 8,
                            StartMin = 0,
                        },
                    },
                    Type = "weekday-and-time-of-day",
                },
            },
            Timezone = "America/Los_Angeles",
        });
    }

}
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 {
		testSchedule, err := opsgenie.NewSchedule(ctx, "testSchedule", &opsgenie.ScheduleArgs{
			Description: pulumi.String("schedule test"),
			Enabled:     pulumi.Bool(false),
			Timezone:    pulumi.String("Europe/Rome"),
		})
		if err != nil {
			return err
		}
		testTeam, err := opsgenie.NewTeam(ctx, "testTeam", &opsgenie.TeamArgs{
			Description: pulumi.String("This team deals with all the things"),
		})
		if err != nil {
			return err
		}
		_, err = opsgenie.NewTeamRoutingRule(ctx, "testTeamRoutingRule", &opsgenie.TeamRoutingRuleArgs{
			Criterias: TeamRoutingRuleCriteriaArray{
				&TeamRoutingRuleCriteriaArgs{
					Conditions: TeamRoutingRuleCriteriaConditionArray{
						&TeamRoutingRuleCriteriaConditionArgs{
							ExpectedValue: pulumi.String("expected1"),
							Field:         pulumi.String("message"),
							Not:           pulumi.Bool(false),
							Operation:     pulumi.String("contains"),
						},
					},
					Type: pulumi.String("match-any-condition"),
				},
			},
			Notifies: TeamRoutingRuleNotifyArray{
				&TeamRoutingRuleNotifyArgs{
					Name: testSchedule.Name,
					Type: pulumi.String("schedule"),
				},
			},
			Order:  pulumi.Int(0),
			TeamId: testTeam.ID(),
			TimeRestrictions: TeamRoutingRuleTimeRestrictionArray{
				&TeamRoutingRuleTimeRestrictionArgs{
					Restrictions: TeamRoutingRuleTimeRestrictionRestrictionArray{
						&TeamRoutingRuleTimeRestrictionRestrictionArgs{
							EndDay:    pulumi.String("tuesday"),
							EndHour:   pulumi.Int(18),
							EndMin:    pulumi.Int(30),
							StartDay:  pulumi.String("monday"),
							StartHour: pulumi.Int(8),
							StartMin:  pulumi.Int(0),
						},
					},
					Type: pulumi.String("weekday-and-time-of-day"),
				},
			},
			Timezone: pulumi.String("America/Los_Angeles"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_opsgenie as opsgenie

test_schedule = opsgenie.Schedule("testSchedule",
    description="schedule test",
    enabled=False,
    timezone="Europe/Rome")
test_team = opsgenie.Team("testTeam", description="This team deals with all the things")
test_team_routing_rule = opsgenie.TeamRoutingRule("testTeamRoutingRule",
    criterias=[opsgenie.TeamRoutingRuleCriteriaArgs(
        conditions=[opsgenie.TeamRoutingRuleCriteriaConditionArgs(
            expected_value="expected1",
            field="message",
            not_=False,
            operation="contains",
        )],
        type="match-any-condition",
    )],
    notifies=[opsgenie.TeamRoutingRuleNotifyArgs(
        name=test_schedule.name,
        type="schedule",
    )],
    order=0,
    team_id=test_team.id,
    time_restrictions=[opsgenie.TeamRoutingRuleTimeRestrictionArgs(
        restrictions=[opsgenie.TeamRoutingRuleTimeRestrictionRestrictionArgs(
            end_day="tuesday",
            end_hour=18,
            end_min=30,
            start_day="monday",
            start_hour=8,
            start_min=0,
        )],
        type="weekday-and-time-of-day",
    )],
    timezone="America/Los_Angeles")
import * as pulumi from "@pulumi/pulumi";
import * as opsgenie from "@pulumi/opsgenie";

const testSchedule = new opsgenie.Schedule("test", {
    description: "schedule test",
    enabled: false,
    timezone: "Europe/Rome",
});
const testTeam = new opsgenie.Team("test", {
    description: "This team deals with all the things",
});
const testTeamRoutingRule = new opsgenie.TeamRoutingRule("test", {
    criterias: [{
        conditions: [{
            expectedValue: "expected1",
            field: "message",
            not: false,
            operation: "contains",
        }],
        type: "match-any-condition",
    }],
    notifies: [{
        name: testSchedule.name,
        type: "schedule",
    }],
    order: 0,
    teamId: testTeam.id,
    timeRestrictions: [{
        restrictions: [{
            endDay: "tuesday",
            endHour: 18,
            endMin: 30,
            startDay: "monday",
            startHour: 8,
            startMin: 0,
        }],
        type: "weekday-and-time-of-day",
    }],
    timezone: "America/Los_Angeles",
});

Create a TeamRoutingRule Resource

new TeamRoutingRule(name: string, args: TeamRoutingRuleArgs, opts?: CustomResourceOptions);
@overload
def TeamRoutingRule(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    criterias: Optional[Sequence[TeamRoutingRuleCriteriaArgs]] = None,
                    name: Optional[str] = None,
                    notifies: Optional[Sequence[TeamRoutingRuleNotifyArgs]] = None,
                    order: Optional[int] = None,
                    team_id: Optional[str] = None,
                    time_restrictions: Optional[Sequence[TeamRoutingRuleTimeRestrictionArgs]] = None,
                    timezone: Optional[str] = None)
@overload
def TeamRoutingRule(resource_name: str,
                    args: TeamRoutingRuleArgs,
                    opts: Optional[ResourceOptions] = None)
func NewTeamRoutingRule(ctx *Context, name string, args TeamRoutingRuleArgs, opts ...ResourceOption) (*TeamRoutingRule, error)
public TeamRoutingRule(string name, TeamRoutingRuleArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args TeamRoutingRuleArgs
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 TeamRoutingRuleArgs
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 TeamRoutingRuleArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args TeamRoutingRuleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

TeamRoutingRule Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The TeamRoutingRule resource accepts the following input properties:

Notifies List<TeamRoutingRuleNotifyArgs>
Target entity of schedule, escalation, or the reserved word none which will be notified in routing rule. The possible values are: schedule, escalation, none
TeamId string
Id of the team owning the routing rule
Criterias List<TeamRoutingRuleCriteriaArgs>
You can refer Criteria for detailed information about criteria and its fields
Name string
Name of the team routing rule
Order int
The order of the team routing rule within the rules. order value is actually the index of the team routing rule whose minimum value is 0 and whose maximum value is n-1 (number of team routing rules is n)
TimeRestrictions List<TeamRoutingRuleTimeRestrictionArgs>
Timezone string
Timezone of team routing rule. If timezone field is not given, account timezone is used as default.You can refer to Supported Locale IDs for available timezones
Notifies []TeamRoutingRuleNotifyArgs
Target entity of schedule, escalation, or the reserved word none which will be notified in routing rule. The possible values are: schedule, escalation, none
TeamId string
Id of the team owning the routing rule
Criterias []TeamRoutingRuleCriteriaArgs
You can refer Criteria for detailed information about criteria and its fields
Name string
Name of the team routing rule
Order int
The order of the team routing rule within the rules. order value is actually the index of the team routing rule whose minimum value is 0 and whose maximum value is n-1 (number of team routing rules is n)
TimeRestrictions []TeamRoutingRuleTimeRestrictionArgs
Timezone string
Timezone of team routing rule. If timezone field is not given, account timezone is used as default.You can refer to Supported Locale IDs for available timezones
notifies TeamRoutingRuleNotifyArgs[]
Target entity of schedule, escalation, or the reserved word none which will be notified in routing rule. The possible values are: schedule, escalation, none
teamId string
Id of the team owning the routing rule
criterias TeamRoutingRuleCriteriaArgs[]
You can refer Criteria for detailed information about criteria and its fields
name string
Name of the team routing rule
order number
The order of the team routing rule within the rules. order value is actually the index of the team routing rule whose minimum value is 0 and whose maximum value is n-1 (number of team routing rules is n)
timeRestrictions TeamRoutingRuleTimeRestrictionArgs[]
timezone string
Timezone of team routing rule. If timezone field is not given, account timezone is used as default.You can refer to Supported Locale IDs for available timezones
notifies Sequence[TeamRoutingRuleNotifyArgs]
Target entity of schedule, escalation, or the reserved word none which will be notified in routing rule. The possible values are: schedule, escalation, none
team_id str
Id of the team owning the routing rule
criterias Sequence[TeamRoutingRuleCriteriaArgs]
You can refer Criteria for detailed information about criteria and its fields
name str
Name of the team routing rule
order int
The order of the team routing rule within the rules. order value is actually the index of the team routing rule whose minimum value is 0 and whose maximum value is n-1 (number of team routing rules is n)
time_restrictions Sequence[TeamRoutingRuleTimeRestrictionArgs]
timezone str
Timezone of team routing rule. If timezone field is not given, account timezone is used as default.You can refer to Supported Locale IDs for available timezones

Outputs

All input properties are implicitly available as output properties. Additionally, the TeamRoutingRule 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 str
The provider-assigned unique ID for this managed resource.

Look up an Existing TeamRoutingRule Resource

Get an existing TeamRoutingRule 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?: TeamRoutingRuleState, opts?: CustomResourceOptions): TeamRoutingRule
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        criterias: Optional[Sequence[TeamRoutingRuleCriteriaArgs]] = None,
        name: Optional[str] = None,
        notifies: Optional[Sequence[TeamRoutingRuleNotifyArgs]] = None,
        order: Optional[int] = None,
        team_id: Optional[str] = None,
        time_restrictions: Optional[Sequence[TeamRoutingRuleTimeRestrictionArgs]] = None,
        timezone: Optional[str] = None) -> TeamRoutingRule
func GetTeamRoutingRule(ctx *Context, name string, id IDInput, state *TeamRoutingRuleState, opts ...ResourceOption) (*TeamRoutingRule, error)
public static TeamRoutingRule Get(string name, Input<string> id, TeamRoutingRuleState? state, CustomResourceOptions? opts = null)
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.

The following state arguments are supported:

Criterias List<TeamRoutingRuleCriteriaArgs>
You can refer Criteria for detailed information about criteria and its fields
Name string
Name of the team routing rule
Notifies List<TeamRoutingRuleNotifyArgs>
Target entity of schedule, escalation, or the reserved word none which will be notified in routing rule. The possible values are: schedule, escalation, none
Order int
The order of the team routing rule within the rules. order value is actually the index of the team routing rule whose minimum value is 0 and whose maximum value is n-1 (number of team routing rules is n)
TeamId string
Id of the team owning the routing rule
TimeRestrictions List<TeamRoutingRuleTimeRestrictionArgs>
Timezone string
Timezone of team routing rule. If timezone field is not given, account timezone is used as default.You can refer to Supported Locale IDs for available timezones
Criterias []TeamRoutingRuleCriteriaArgs
You can refer Criteria for detailed information about criteria and its fields
Name string
Name of the team routing rule
Notifies []TeamRoutingRuleNotifyArgs
Target entity of schedule, escalation, or the reserved word none which will be notified in routing rule. The possible values are: schedule, escalation, none
Order int
The order of the team routing rule within the rules. order value is actually the index of the team routing rule whose minimum value is 0 and whose maximum value is n-1 (number of team routing rules is n)
TeamId string
Id of the team owning the routing rule
TimeRestrictions []TeamRoutingRuleTimeRestrictionArgs
Timezone string
Timezone of team routing rule. If timezone field is not given, account timezone is used as default.You can refer to Supported Locale IDs for available timezones
criterias TeamRoutingRuleCriteriaArgs[]
You can refer Criteria for detailed information about criteria and its fields
name string
Name of the team routing rule
notifies TeamRoutingRuleNotifyArgs[]
Target entity of schedule, escalation, or the reserved word none which will be notified in routing rule. The possible values are: schedule, escalation, none
order number
The order of the team routing rule within the rules. order value is actually the index of the team routing rule whose minimum value is 0 and whose maximum value is n-1 (number of team routing rules is n)
teamId string
Id of the team owning the routing rule
timeRestrictions TeamRoutingRuleTimeRestrictionArgs[]
timezone string
Timezone of team routing rule. If timezone field is not given, account timezone is used as default.You can refer to Supported Locale IDs for available timezones
criterias Sequence[TeamRoutingRuleCriteriaArgs]
You can refer Criteria for detailed information about criteria and its fields
name str
Name of the team routing rule
notifies Sequence[TeamRoutingRuleNotifyArgs]
Target entity of schedule, escalation, or the reserved word none which will be notified in routing rule. The possible values are: schedule, escalation, none
order int
The order of the team routing rule within the rules. order value is actually the index of the team routing rule whose minimum value is 0 and whose maximum value is n-1 (number of team routing rules is n)
team_id str
Id of the team owning the routing rule
time_restrictions Sequence[TeamRoutingRuleTimeRestrictionArgs]
timezone str
Timezone of team routing rule. If timezone field is not given, account timezone is used as default.You can refer to Supported Locale IDs for available timezones

Supporting Types

TeamRoutingRuleCriteria

Type string
Type of the operation will be applied on conditions. Should be one of match-all, match-any-condition or match-all-conditions.
Conditions List<TeamRoutingRuleCriteriaCondition>
List of conditions will be checked before applying team routing rule. This field declaration should be omitted if the criteria type is set to match-all.
Type string
Type of the operation will be applied on conditions. Should be one of match-all, match-any-condition or match-all-conditions.
Conditions []TeamRoutingRuleCriteriaCondition
List of conditions will be checked before applying team routing rule. This field declaration should be omitted if the criteria type is set to match-all.
type string
Type of the operation will be applied on conditions. Should be one of match-all, match-any-condition or match-all-conditions.
conditions TeamRoutingRuleCriteriaCondition[]
List of conditions will be checked before applying team routing rule. This field declaration should be omitted if the criteria type is set to match-all.
type str
Type of the operation will be applied on conditions. Should be one of match-all, match-any-condition or match-all-conditions.
conditions Sequence[TeamRoutingRuleCriteriaCondition]
List of conditions will be checked before applying team routing rule. This field declaration should be omitted if the criteria type is set to match-all.

TeamRoutingRuleCriteriaCondition

Field string
Specifies which alert field will be used in condition. Possible values are message, alias, description, source, entity, tags, actions, extra-properties, recipients, teams or priority.
Operation string
It is the operation that will be executed for the given field and key. Possible operations are matches, contains, starts-with, ends-with, equals, contains-key, contains-value, greater-than, less-than, is-empty and equals-ignore-whitespace.
ExpectedValue 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 value is false.
Order int
Order of the condition in conditions list.
Field string
Specifies which alert field will be used in condition. Possible values are message, alias, description, source, entity, tags, actions, extra-properties, recipients, teams or priority.
Operation string
It is the operation that will be executed for the given field and key. Possible operations are matches, contains, starts-with, ends-with, equals, contains-key, contains-value, greater-than, less-than, is-empty and equals-ignore-whitespace.
ExpectedValue 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 value is false.
Order int
Order of the condition in conditions list.
field string
Specifies which alert field will be used in condition. Possible values are message, alias, description, source, entity, tags, actions, extra-properties, recipients, teams or priority.
operation string
It is the operation that will be executed for the given field and key. Possible operations are matches, contains, starts-with, ends-with, equals, contains-key, contains-value, greater-than, less-than, is-empty and equals-ignore-whitespace.
expectedValue 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 value is false.
order number
Order of the condition in conditions list.
field str
Specifies which alert field will be used in condition. Possible values are message, alias, description, source, entity, tags, actions, extra-properties, recipients, teams or priority.
operation str
It is the operation that will be executed for the given field and key. Possible operations are matches, contains, starts-with, ends-with, equals, contains-key, contains-value, greater-than, less-than, is-empty and equals-ignore-whitespace.
expected_value str
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 value is false.
order int
Order of the condition in conditions list.

TeamRoutingRuleNotify

Type string
Id string
The ID of the Opsgenie Team Routing Rule.
Name string
Name of the team routing rule
Type string
Id string
The ID of the Opsgenie Team Routing Rule.
Name string
Name of the team routing rule
type string
id string
The ID of the Opsgenie Team Routing Rule.
name string
Name of the team routing rule
type str
id str
The ID of the Opsgenie Team Routing Rule.
name str
Name of the team routing rule

TeamRoutingRuleTimeRestriction

TeamRoutingRuleTimeRestrictionRestriction

EndDay string
EndHour int
EndMin int
StartDay string
StartHour int
StartMin int
EndDay string
EndHour int
EndMin int
StartDay string
StartHour int
StartMin int
endDay string
endHour number
endMin number
startDay string
startHour number
startMin number

Import

Team Routing Rules can be imported using the team_id/routing_rule_id, e.g.

 $ pulumi import opsgenie:index/teamRoutingRule:TeamRoutingRule ruletest team_id/routing_rule_id`

Package Details

Repository
https://github.com/pulumi/pulumi-opsgenie
License
Apache-2.0
Notes
This Pulumi package is based on the opsgenie Terraform Provider.