EventRuleArgs

data class EventRuleArgs(val contactParameters: Output<List<EventRuleContactParameterArgs>>? = null, val description: Output<String>? = null, val eventPattern: Output<EventRuleEventPatternArgs>? = null, val fcParameters: Output<List<EventRuleFcParameterArgs>>? = null, val groupId: Output<String>? = null, val mnsParameters: Output<List<EventRuleMnsParameterArgs>>? = null, val openApiParameters: Output<List<EventRuleOpenApiParameterArgs>>? = null, val ruleName: Output<String>? = null, val silenceTime: Output<Int>? = null, val slsParameters: Output<List<EventRuleSlsParameterArgs>>? = null, val status: Output<String>? = null, val webhookParameters: Output<List<EventRuleWebhookParameterArgs>>? = null) : ConvertibleToJava<EventRuleArgs>

Provides a Cloud Monitor Service Event Rule resource. For information about Cloud Monitor Service Event Rule and how to use it, see What is Event Rule.

NOTE: Available since v1.182.0.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "tf-example";
const _default = new alicloud.cms.MonitorGroup("default", {monitorGroupName: name});
const example = new alicloud.cms.EventRule("example", {
ruleName: name,
groupId: _default.id,
silenceTime: 100,
description: name,
status: "ENABLED",
eventPattern: {
product: "ecs",
sqlFilter: "example_value",
nameLists: ["example_value"],
levelLists: ["CRITICAL"],
eventTypeLists: ["StatusNotification"],
},
});
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "tf-example"
default = alicloud.cms.MonitorGroup("default", monitor_group_name=name)
example = alicloud.cms.EventRule("example",
rule_name=name,
group_id=default.id,
silence_time=100,
description=name,
status="ENABLED",
event_pattern={
"product": "ecs",
"sql_filter": "example_value",
"name_lists": ["example_value"],
"level_lists": ["CRITICAL"],
"event_type_lists": ["StatusNotification"],
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "tf-example";
var @default = new AliCloud.Cms.MonitorGroup("default", new()
{
MonitorGroupName = name,
});
var example = new AliCloud.Cms.EventRule("example", new()
{
RuleName = name,
GroupId = @default.Id,
SilenceTime = 100,
Description = name,
Status = "ENABLED",
EventPattern = new AliCloud.Cms.Inputs.EventRuleEventPatternArgs
{
Product = "ecs",
SqlFilter = "example_value",
NameLists = new[]
{
"example_value",
},
LevelLists = new[]
{
"CRITICAL",
},
EventTypeLists = new[]
{
"StatusNotification",
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cms"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
name := "tf-example"
if param := cfg.Get("name"); param != "" {
name = param
}
_default, err := cms.NewMonitorGroup(ctx, "default", &cms.MonitorGroupArgs{
MonitorGroupName: pulumi.String(name),
})
if err != nil {
return err
}
_, err = cms.NewEventRule(ctx, "example", &cms.EventRuleArgs{
RuleName: pulumi.String(name),
GroupId: _default.ID(),
SilenceTime: pulumi.Int(100),
Description: pulumi.String(name),
Status: pulumi.String("ENABLED"),
EventPattern: &cms.EventRuleEventPatternArgs{
Product: pulumi.String("ecs"),
SqlFilter: pulumi.String("example_value"),
NameLists: pulumi.StringArray{
pulumi.String("example_value"),
},
LevelLists: pulumi.StringArray{
pulumi.String("CRITICAL"),
},
EventTypeLists: pulumi.StringArray{
pulumi.String("StatusNotification"),
},
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.cms.MonitorGroup;
import com.pulumi.alicloud.cms.MonitorGroupArgs;
import com.pulumi.alicloud.cms.EventRule;
import com.pulumi.alicloud.cms.EventRuleArgs;
import com.pulumi.alicloud.cms.inputs.EventRuleEventPatternArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var config = ctx.config();
final var name = config.get("name").orElse("tf-example");
var default_ = new MonitorGroup("default", MonitorGroupArgs.builder()
.monitorGroupName(name)
.build());
var example = new EventRule("example", EventRuleArgs.builder()
.ruleName(name)
.groupId(default_.id())
.silenceTime(100)
.description(name)
.status("ENABLED")
.eventPattern(EventRuleEventPatternArgs.builder()
.product("ecs")
.sqlFilter("example_value")
.nameLists("example_value")
.levelLists("CRITICAL")
.eventTypeLists("StatusNotification")
.build())
.build());
}
}
configuration:
name:
type: string
default: tf-example
resources:
default:
type: alicloud:cms:MonitorGroup
properties:
monitorGroupName: ${name}
example:
type: alicloud:cms:EventRule
properties:
ruleName: ${name}
groupId: ${default.id}
silenceTime: 100
description: ${name}
status: ENABLED
eventPattern:
product: ecs
sqlFilter: example_value
nameLists:
- example_value
levelLists:
- CRITICAL
eventTypeLists:
- StatusNotification

Import

Cloud Monitor Service Event Rule can be imported using the id, e.g.

$ pulumi import alicloud:cms/eventRule:EventRule example <rule_name>

Constructors

Link copied to clipboard
constructor(contactParameters: Output<List<EventRuleContactParameterArgs>>? = null, description: Output<String>? = null, eventPattern: Output<EventRuleEventPatternArgs>? = null, fcParameters: Output<List<EventRuleFcParameterArgs>>? = null, groupId: Output<String>? = null, mnsParameters: Output<List<EventRuleMnsParameterArgs>>? = null, openApiParameters: Output<List<EventRuleOpenApiParameterArgs>>? = null, ruleName: Output<String>? = null, silenceTime: Output<Int>? = null, slsParameters: Output<List<EventRuleSlsParameterArgs>>? = null, status: Output<String>? = null, webhookParameters: Output<List<EventRuleWebhookParameterArgs>>? = null)

Properties

Link copied to clipboard

The information about the alert contact groups that receive alert notifications. See contact_parameters below.

Link copied to clipboard
val description: Output<String>? = null

The description of the event-triggered alert rule.

Link copied to clipboard

Event mode, used to describe the trigger conditions for this event. See event_pattern below.

Link copied to clipboard

The information about the recipients in Function Compute. See fc_parameters below.

Link copied to clipboard
val groupId: Output<String>? = null

The ID of the application group to which the event-triggered alert rule belongs.

Link copied to clipboard

The information about the recipients in Message Service (MNS). See mns_parameters below.

Link copied to clipboard

The parameters of API callback notification. See open_api_parameters below.

Link copied to clipboard
val ruleName: Output<String>? = null

The name of the event-triggered alert rule.

Link copied to clipboard
val silenceTime: Output<Int>? = null

The silence time.

Link copied to clipboard

The information about the recipients in Simple Log Service. See sls_parameters below.

Link copied to clipboard
val status: Output<String>? = null

The status of the resource. Valid values: ENABLED, DISABLED.

Link copied to clipboard

The information about the callback URLs that are used to receive alert notifications. See webhook_parameters below.

Functions

Link copied to clipboard
open override fun toJava(): EventRuleArgs