Opsgenie

Pulumi Official
Package maintained by Pulumi
v1.1.5 published on Friday, Feb 18, 2022 by Pulumi

ServiceIncidentRule

Manages a Service Incident Rule within Opsgenie.

Example Usage

using Pulumi;
using Opsgenie = Pulumi.Opsgenie;

class MyStack : Stack
{
    public MyStack()
    {
        var testTeam = new Opsgenie.Team("testTeam", new Opsgenie.TeamArgs
        {
            Description = "This team deals with all the things",
        });
        var testService = new Opsgenie.Service("testService", new Opsgenie.ServiceArgs
        {
            TeamId = testTeam.Id,
        });
        var testServiceIncidentRule = new Opsgenie.ServiceIncidentRule("testServiceIncidentRule", new Opsgenie.ServiceIncidentRuleArgs
        {
            ServiceId = testService.Id,
            IncidentRules = 
            {
                new Opsgenie.Inputs.ServiceIncidentRuleIncidentRuleArgs
                {
                    ConditionMatchType = "match-any-condition",
                    Conditions = 
                    {
                        new Opsgenie.Inputs.ServiceIncidentRuleIncidentRuleConditionArgs
                        {
                            Field = "message",
                            Not = false,
                            Operation = "contains",
                            ExpectedValue = "expected1",
                        },
                        new Opsgenie.Inputs.ServiceIncidentRuleIncidentRuleConditionArgs
                        {
                            Field = "message",
                            Not = false,
                            Operation = "contains",
                            ExpectedValue = "expected2",
                        },
                    },
                    IncidentProperties = 
                    {
                        new Opsgenie.Inputs.ServiceIncidentRuleIncidentRuleIncidentPropertyArgs
                        {
                            Message = "This is a test message",
                            Priority = "P3",
                            StakeholderProperties = 
                            {
                                new Opsgenie.Inputs.ServiceIncidentRuleIncidentRuleIncidentPropertyStakeholderPropertyArgs
                                {
                                    Message = "Message for stakeholders",
                                    Enable = true,
                                },
                            },
                        },
                    },
                },
            },
        });
    }

}
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 {
		testTeam, err := opsgenie.NewTeam(ctx, "testTeam", &opsgenie.TeamArgs{
			Description: pulumi.String("This team deals with all the things"),
		})
		if err != nil {
			return err
		}
		testService, err := opsgenie.NewService(ctx, "testService", &opsgenie.ServiceArgs{
			TeamId: testTeam.ID(),
		})
		if err != nil {
			return err
		}
		_, err = opsgenie.NewServiceIncidentRule(ctx, "testServiceIncidentRule", &opsgenie.ServiceIncidentRuleArgs{
			ServiceId: testService.ID(),
			IncidentRules: ServiceIncidentRuleIncidentRuleArray{
				&ServiceIncidentRuleIncidentRuleArgs{
					ConditionMatchType: pulumi.String("match-any-condition"),
					Conditions: ServiceIncidentRuleIncidentRuleConditionArray{
						&ServiceIncidentRuleIncidentRuleConditionArgs{
							Field:         pulumi.String("message"),
							Not:           pulumi.Bool(false),
							Operation:     pulumi.String("contains"),
							ExpectedValue: pulumi.String("expected1"),
						},
						&ServiceIncidentRuleIncidentRuleConditionArgs{
							Field:         pulumi.String("message"),
							Not:           pulumi.Bool(false),
							Operation:     pulumi.String("contains"),
							ExpectedValue: pulumi.String("expected2"),
						},
					},
					IncidentProperties: ServiceIncidentRuleIncidentRuleIncidentPropertyArray{
						&ServiceIncidentRuleIncidentRuleIncidentPropertyArgs{
							Message:  pulumi.String("This is a test message"),
							Priority: pulumi.String("P3"),
							StakeholderProperties: ServiceIncidentRuleIncidentRuleIncidentPropertyStakeholderPropertyArray{
								&ServiceIncidentRuleIncidentRuleIncidentPropertyStakeholderPropertyArgs{
									Message: pulumi.String("Message for stakeholders"),
									Enable:  pulumi.Bool(true),
								},
							},
						},
					},
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}

Coming soon!

import pulumi
import pulumi_opsgenie as opsgenie

test_team = opsgenie.Team("testTeam", description="This team deals with all the things")
test_service = opsgenie.Service("testService", team_id=test_team.id)
test_service_incident_rule = opsgenie.ServiceIncidentRule("testServiceIncidentRule",
    service_id=test_service.id,
    incident_rules=[opsgenie.ServiceIncidentRuleIncidentRuleArgs(
        condition_match_type="match-any-condition",
        conditions=[
            opsgenie.ServiceIncidentRuleIncidentRuleConditionArgs(
                field="message",
                not_=False,
                operation="contains",
                expected_value="expected1",
            ),
            opsgenie.ServiceIncidentRuleIncidentRuleConditionArgs(
                field="message",
                not_=False,
                operation="contains",
                expected_value="expected2",
            ),
        ],
        incident_properties=[opsgenie.ServiceIncidentRuleIncidentRuleIncidentPropertyArgs(
            message="This is a test message",
            priority="P3",
            stakeholder_properties=[opsgenie.ServiceIncidentRuleIncidentRuleIncidentPropertyStakeholderPropertyArgs(
                message="Message for stakeholders",
                enable=True,
            )],
        )],
    )])
import * as pulumi from "@pulumi/pulumi";
import * as opsgenie from "@pulumi/opsgenie";

const testTeam = new opsgenie.Team("testTeam", {description: "This team deals with all the things"});
const testService = new opsgenie.Service("testService", {teamId: testTeam.id});
const testServiceIncidentRule = new opsgenie.ServiceIncidentRule("testServiceIncidentRule", {
    serviceId: testService.id,
    incidentRules: [{
        conditionMatchType: "match-any-condition",
        conditions: [
            {
                field: "message",
                not: false,
                operation: "contains",
                expectedValue: "expected1",
            },
            {
                field: "message",
                not: false,
                operation: "contains",
                expectedValue: "expected2",
            },
        ],
        incidentProperties: [{
            message: "This is a test message",
            priority: "P3",
            stakeholderProperties: [{
                message: "Message for stakeholders",
                enable: "true",
            }],
        }],
    }],
});

Coming soon!

Create a ServiceIncidentRule Resource

new ServiceIncidentRule(name: string, args: ServiceIncidentRuleArgs, opts?: CustomResourceOptions);
@overload
def ServiceIncidentRule(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        incident_rules: Optional[Sequence[ServiceIncidentRuleIncidentRuleArgs]] = None,
                        service_id: Optional[str] = None)
@overload
def ServiceIncidentRule(resource_name: str,
                        args: ServiceIncidentRuleArgs,
                        opts: Optional[ResourceOptions] = None)
func NewServiceIncidentRule(ctx *Context, name string, args ServiceIncidentRuleArgs, opts ...ResourceOption) (*ServiceIncidentRule, error)
public ServiceIncidentRule(string name, ServiceIncidentRuleArgs args, CustomResourceOptions? opts = null)
public ServiceIncidentRule(String name, ServiceIncidentRuleArgs args)
public ServiceIncidentRule(String name, ServiceIncidentRuleArgs args, CustomResourceOptions options)
type: opsgenie:ServiceIncidentRule
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args ServiceIncidentRuleArgs
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 ServiceIncidentRuleArgs
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 ServiceIncidentRuleArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ServiceIncidentRuleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args ServiceIncidentRuleArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

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

IncidentRules List<ServiceIncidentRuleIncidentRuleArgs>

This is the rule configuration for this incident rule. This is a block, structure is documented below.

ServiceId string

ID of the service associated

IncidentRules []ServiceIncidentRuleIncidentRuleArgs

This is the rule configuration for this incident rule. This is a block, structure is documented below.

ServiceId string

ID of the service associated

incidentRules ListIncidentRuleIncidentRuleArgs>

This is the rule configuration for this incident rule. This is a block, structure is documented below.

serviceId String

ID of the service associated

incidentRules ServiceIncidentRuleIncidentRuleArgs[]

This is the rule configuration for this incident rule. This is a block, structure is documented below.

serviceId string

ID of the service associated

incident_rules Sequence[ServiceIncidentRuleIncidentRuleArgs]

This is the rule configuration for this incident rule. This is a block, structure is documented below.

service_id str

ID of the service associated

incidentRules List

This is the rule configuration for this incident rule. This is a block, structure is documented below.

serviceId String

ID of the service associated

Outputs

All input properties are implicitly available as output properties. Additionally, the ServiceIncidentRule 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 an Existing ServiceIncidentRule Resource

Get an existing ServiceIncidentRule 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?: ServiceIncidentRuleState, opts?: CustomResourceOptions): ServiceIncidentRule
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        incident_rules: Optional[Sequence[ServiceIncidentRuleIncidentRuleArgs]] = None,
        service_id: Optional[str] = None) -> ServiceIncidentRule
func GetServiceIncidentRule(ctx *Context, name string, id IDInput, state *ServiceIncidentRuleState, opts ...ResourceOption) (*ServiceIncidentRule, error)
public static ServiceIncidentRule Get(string name, Input<string> id, ServiceIncidentRuleState? state, CustomResourceOptions? opts = null)
public static ServiceIncidentRule get(String name, Output<String> id, ServiceIncidentRuleState 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.
The following state arguments are supported:
IncidentRules List<ServiceIncidentRuleIncidentRuleArgs>

This is the rule configuration for this incident rule. This is a block, structure is documented below.

ServiceId string

ID of the service associated

IncidentRules []ServiceIncidentRuleIncidentRuleArgs

This is the rule configuration for this incident rule. This is a block, structure is documented below.

ServiceId string

ID of the service associated

incidentRules ListIncidentRuleIncidentRuleArgs>

This is the rule configuration for this incident rule. This is a block, structure is documented below.

serviceId String

ID of the service associated

incidentRules ServiceIncidentRuleIncidentRuleArgs[]

This is the rule configuration for this incident rule. This is a block, structure is documented below.

serviceId string

ID of the service associated

incident_rules Sequence[ServiceIncidentRuleIncidentRuleArgs]

This is the rule configuration for this incident rule. This is a block, structure is documented below.

service_id str

ID of the service associated

incidentRules List

This is the rule configuration for this incident rule. This is a block, structure is documented below.

serviceId String

ID of the service associated

Supporting Types

ServiceIncidentRuleIncidentRule

IncidentProperties List<ServiceIncidentRuleIncidentRuleIncidentProperty>

Properties for incident rule. This is a block, structure is documented below.

ConditionMatchType string

A Condition type, supported types are: match-all, match-any-condition, match-all-conditions. Default: match-all

Conditions List<ServiceIncidentRuleIncidentRuleCondition>

Conditions applied to incident. This is a block, structure is documented below.

IncidentProperties []ServiceIncidentRuleIncidentRuleIncidentProperty

Properties for incident rule. This is a block, structure is documented below.

ConditionMatchType string

A Condition type, supported types are: match-all, match-any-condition, match-all-conditions. Default: match-all

Conditions []ServiceIncidentRuleIncidentRuleCondition

Conditions applied to incident. This is a block, structure is documented below.

incidentProperties ListIncidentRuleIncidentRuleIncidentProperty>

Properties for incident rule. This is a block, structure is documented below.

conditionMatchType String

A Condition type, supported types are: match-all, match-any-condition, match-all-conditions. Default: match-all

conditions ListIncidentRuleIncidentRuleCondition>

Conditions applied to incident. This is a block, structure is documented below.

incidentProperties ServiceIncidentRuleIncidentRuleIncidentProperty[]

Properties for incident rule. This is a block, structure is documented below.

conditionMatchType string

A Condition type, supported types are: match-all, match-any-condition, match-all-conditions. Default: match-all

conditions ServiceIncidentRuleIncidentRuleCondition[]

Conditions applied to incident. This is a block, structure is documented below.

incident_properties Sequence[ServiceIncidentRuleIncidentRuleIncidentProperty]

Properties for incident rule. This is a block, structure is documented below.

condition_match_type str

A Condition type, supported types are: match-all, match-any-condition, match-all-conditions. Default: match-all

conditions Sequence[ServiceIncidentRuleIncidentRuleCondition]

Conditions applied to incident. This is a block, structure is documented below.

incidentProperties List

Properties for incident rule. This is a block, structure is documented below.

conditionMatchType String

A Condition type, supported types are: match-all, match-any-condition, match-all-conditions. Default: match-all

conditions List

Conditions applied to incident. This is a block, structure is documented below.

ServiceIncidentRuleIncidentRuleCondition

Field string

Specifies which alert field will be used in condition. Possible values are message, alias, description, source, entity, tags, actions, details, extra-properties, recipients, teams, 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, equals-ignore-whitespace.

ExpectedValue string

User defined value that will be compared with alert field according to the operation. Default: empty string

Key string
Not bool

Indicates behaviour of the given operation. Default: false

Field string

Specifies which alert field will be used in condition. Possible values are message, alias, description, source, entity, tags, actions, details, extra-properties, recipients, teams, 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, equals-ignore-whitespace.

ExpectedValue string

User defined value that will be compared with alert field according to the operation. Default: empty string

Key string
Not bool

Indicates behaviour of the given operation. Default: false

field String

Specifies which alert field will be used in condition. Possible values are message, alias, description, source, entity, tags, actions, details, extra-properties, recipients, teams, 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, equals-ignore-whitespace.

expectedValue String

User defined value that will be compared with alert field according to the operation. Default: empty string

key String
not Boolean

Indicates behaviour of the given operation. Default: false

field string

Specifies which alert field will be used in condition. Possible values are message, alias, description, source, entity, tags, actions, details, extra-properties, recipients, teams, 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, equals-ignore-whitespace.

expectedValue string

User defined value that will be compared with alert field according to the operation. Default: empty string

key string
not boolean

Indicates behaviour of the given operation. Default: false

field str

Specifies which alert field will be used in condition. Possible values are message, alias, description, source, entity, tags, actions, details, extra-properties, recipients, teams, 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, 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
not_ bool

Indicates behaviour of the given operation. Default: false

field String

Specifies which alert field will be used in condition. Possible values are message, alias, description, source, entity, tags, actions, details, extra-properties, recipients, teams, 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, equals-ignore-whitespace.

expectedValue String

User defined value that will be compared with alert field according to the operation. Default: empty string

key String
not Boolean

Indicates behaviour of the given operation. Default: false

ServiceIncidentRuleIncidentRuleIncidentProperty

Message string

Message that is to be passed to audience that is generally used to provide a content information about the alert.

Priority string

Priority level of the alert. Possible values are P1, P2, P3, P4 and P5

StakeholderProperties List<ServiceIncidentRuleIncidentRuleIncidentPropertyStakeholderProperty>

DEtails about stakeholders for this rule. This is a block, structure is documented below.

Description string

Description that is generally used to provide a detailed information about the alert.

Details Dictionary<string, string>

Map of key-value pairs to use as custom properties of the alert.

Tags List<string>

Tags of the alert.

Message string

Message that is to be passed to audience that is generally used to provide a content information about the alert.

Priority string

Priority level of the alert. Possible values are P1, P2, P3, P4 and P5

StakeholderProperties []ServiceIncidentRuleIncidentRuleIncidentPropertyStakeholderProperty

DEtails about stakeholders for this rule. This is a block, structure is documented below.

Description string

Description that is generally used to provide a detailed information about the alert.

Details map[string]string

Map of key-value pairs to use as custom properties of the alert.

Tags []string

Tags of the alert.

message String

Message that is to be passed to audience that is generally used to provide a content information about the alert.

priority String

Priority level of the alert. Possible values are P1, P2, P3, P4 and P5

stakeholderProperties ListIncidentRuleIncidentRuleIncidentPropertyStakeholderProperty>

DEtails about stakeholders for this rule. This is a block, structure is documented below.

description String

Description that is generally used to provide a detailed information about the alert.

details Map

Map of key-value pairs to use as custom properties of the alert.

tags List

Tags of the alert.

message string

Message that is to be passed to audience that is generally used to provide a content information about the alert.

priority string

Priority level of the alert. Possible values are P1, P2, P3, P4 and P5

stakeholderProperties ServiceIncidentRuleIncidentRuleIncidentPropertyStakeholderProperty[]

DEtails about stakeholders for this rule. This is a block, structure is documented below.

description string

Description that is generally used to provide a detailed information about the alert.

details {[key: string]: string}

Map of key-value pairs to use as custom properties of the alert.

tags string[]

Tags of the alert.

message str

Message that is to be passed to audience that is generally used to provide a content information about the alert.

priority str

Priority level of the alert. Possible values are P1, P2, P3, P4 and P5

stakeholder_properties Sequence[ServiceIncidentRuleIncidentRuleIncidentPropertyStakeholderProperty]

DEtails about stakeholders for this rule. This is a block, structure is documented below.

description str

Description that is generally used to provide a detailed information about the alert.

details Mapping[str, str]

Map of key-value pairs to use as custom properties of the alert.

tags Sequence[str]

Tags of the alert.

message String

Message that is to be passed to audience that is generally used to provide a content information about the alert.

priority String

Priority level of the alert. Possible values are P1, P2, P3, P4 and P5

stakeholderProperties List

DEtails about stakeholders for this rule. This is a block, structure is documented below.

description String

Description that is generally used to provide a detailed information about the alert.

details Map

Map of key-value pairs to use as custom properties of the alert.

tags List

Tags of the alert.

ServiceIncidentRuleIncidentRuleIncidentPropertyStakeholderProperty

Message string

Message that is to be passed to audience that is generally used to provide a content information about the alert.

Description string

Description that is generally used to provide a detailed information about the alert.

Enable bool

Option to enable stakeholder notifications.Default value is true.

Message string

Message that is to be passed to audience that is generally used to provide a content information about the alert.

Description string

Description that is generally used to provide a detailed information about the alert.

Enable bool

Option to enable stakeholder notifications.Default value is true.

message String

Message that is to be passed to audience that is generally used to provide a content information about the alert.

description String

Description that is generally used to provide a detailed information about the alert.

enable Boolean

Option to enable stakeholder notifications.Default value is true.

message string

Message that is to be passed to audience that is generally used to provide a content information about the alert.

description string

Description that is generally used to provide a detailed information about the alert.

enable boolean

Option to enable stakeholder notifications.Default value is true.

message str

Message that is to be passed to audience that is generally used to provide a content information about the alert.

description str

Description that is generally used to provide a detailed information about the alert.

enable bool

Option to enable stakeholder notifications.Default value is true.

message String

Message that is to be passed to audience that is generally used to provide a content information about the alert.

description String

Description that is generally used to provide a detailed information about the alert.

enable Boolean

Option to enable stakeholder notifications.Default value is true.

Import

Service Incident Rule can be imported using the service_id/service_incident_rule_id, e.g.

 $ pulumi import opsgenie:index/serviceIncidentRule:ServiceIncidentRule this service_id/service_incident_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.