com.pulumi.alicloud.arms.kotlin.DispatchRuleArgs.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-alicloud-kotlin Show documentation
Show all versions of pulumi-alicloud-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.alicloud.arms.kotlin
import com.pulumi.alicloud.arms.DispatchRuleArgs.builder
import com.pulumi.alicloud.arms.kotlin.inputs.DispatchRuleGroupRuleArgs
import com.pulumi.alicloud.arms.kotlin.inputs.DispatchRuleGroupRuleArgsBuilder
import com.pulumi.alicloud.arms.kotlin.inputs.DispatchRuleLabelMatchExpressionGridArgs
import com.pulumi.alicloud.arms.kotlin.inputs.DispatchRuleLabelMatchExpressionGridArgsBuilder
import com.pulumi.alicloud.arms.kotlin.inputs.DispatchRuleNotifyRuleArgs
import com.pulumi.alicloud.arms.kotlin.inputs.DispatchRuleNotifyRuleArgsBuilder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName
/**
* Provides a Application Real-Time Monitoring Service (ARMS) Alert Dispatch Rule resource.
* For information about Application Real-Time Monitoring Service (ARMS) Alert Dispatch Rule and how to use it, see [What is Alert Dispatch_Rule](https://next.api.alibabacloud.com/document/ARMS/2019-08-08/CreateDispatchRule).
* > **NOTE:** Available since v1.136.0.
* ## Example Usage
* Basic Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as alicloud from "@pulumi/alicloud";
* const _default = new alicloud.arms.AlertContact("default", {
* alertContactName: "example_value",
* email: "[email protected]",
* });
* const defaultAlertContactGroup = new alicloud.arms.AlertContactGroup("default", {
* alertContactGroupName: "example_value",
* contactIds: [_default.id],
* });
* const defaultDispatchRule = new alicloud.arms.DispatchRule("default", {
* dispatchRuleName: "example_value",
* dispatchType: "CREATE_ALERT",
* groupRules: [{
* groupWaitTime: 5,
* groupInterval: 15,
* repeatInterval: 100,
* groupingFields: ["alertname"],
* }],
* labelMatchExpressionGrids: [{
* labelMatchExpressionGroups: [{
* labelMatchExpressions: [{
* key: "_aliyun_arms_involvedObject_kind",
* value: "app",
* operator: "eq",
* }],
* }],
* }],
* notifyRules: [{
* notifyObjects: [
* {
* notifyObjectId: _default.id,
* notifyType: "ARMS_CONTACT",
* name: "example_value",
* },
* {
* notifyObjectId: defaultAlertContactGroup.id,
* notifyType: "ARMS_CONTACT_GROUP",
* name: "example_value",
* },
* ],
* notifyChannels: [
* "dingTalk",
* "wechat",
* ],
* }],
* });
* ```
* ```python
* import pulumi
* import pulumi_alicloud as alicloud
* default = alicloud.arms.AlertContact("default",
* alert_contact_name="example_value",
* email="[email protected]")
* default_alert_contact_group = alicloud.arms.AlertContactGroup("default",
* alert_contact_group_name="example_value",
* contact_ids=[default.id])
* default_dispatch_rule = alicloud.arms.DispatchRule("default",
* dispatch_rule_name="example_value",
* dispatch_type="CREATE_ALERT",
* group_rules=[{
* "group_wait_time": 5,
* "group_interval": 15,
* "repeat_interval": 100,
* "grouping_fields": ["alertname"],
* }],
* label_match_expression_grids=[{
* "label_match_expression_groups": [{
* "label_match_expressions": [{
* "key": "_aliyun_arms_involvedObject_kind",
* "value": "app",
* "operator": "eq",
* }],
* }],
* }],
* notify_rules=[{
* "notify_objects": [
* {
* "notify_object_id": default.id,
* "notify_type": "ARMS_CONTACT",
* "name": "example_value",
* },
* {
* "notify_object_id": default_alert_contact_group.id,
* "notify_type": "ARMS_CONTACT_GROUP",
* "name": "example_value",
* },
* ],
* "notify_channels": [
* "dingTalk",
* "wechat",
* ],
* }])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using AliCloud = Pulumi.AliCloud;
* return await Deployment.RunAsync(() =>
* {
* var @default = new AliCloud.Arms.AlertContact("default", new()
* {
* AlertContactName = "example_value",
* Email = "[email protected]",
* });
* var defaultAlertContactGroup = new AliCloud.Arms.AlertContactGroup("default", new()
* {
* AlertContactGroupName = "example_value",
* ContactIds = new[]
* {
* @default.Id,
* },
* });
* var defaultDispatchRule = new AliCloud.Arms.DispatchRule("default", new()
* {
* DispatchRuleName = "example_value",
* DispatchType = "CREATE_ALERT",
* GroupRules = new[]
* {
* new AliCloud.Arms.Inputs.DispatchRuleGroupRuleArgs
* {
* GroupWaitTime = 5,
* GroupInterval = 15,
* RepeatInterval = 100,
* GroupingFields = new[]
* {
* "alertname",
* },
* },
* },
* LabelMatchExpressionGrids = new[]
* {
* new AliCloud.Arms.Inputs.DispatchRuleLabelMatchExpressionGridArgs
* {
* LabelMatchExpressionGroups = new[]
* {
* new AliCloud.Arms.Inputs.DispatchRuleLabelMatchExpressionGridLabelMatchExpressionGroupArgs
* {
* LabelMatchExpressions = new[]
* {
* new AliCloud.Arms.Inputs.DispatchRuleLabelMatchExpressionGridLabelMatchExpressionGroupLabelMatchExpressionArgs
* {
* Key = "_aliyun_arms_involvedObject_kind",
* Value = "app",
* Operator = "eq",
* },
* },
* },
* },
* },
* },
* NotifyRules = new[]
* {
* new AliCloud.Arms.Inputs.DispatchRuleNotifyRuleArgs
* {
* NotifyObjects = new[]
* {
* new AliCloud.Arms.Inputs.DispatchRuleNotifyRuleNotifyObjectArgs
* {
* NotifyObjectId = @default.Id,
* NotifyType = "ARMS_CONTACT",
* Name = "example_value",
* },
* new AliCloud.Arms.Inputs.DispatchRuleNotifyRuleNotifyObjectArgs
* {
* NotifyObjectId = defaultAlertContactGroup.Id,
* NotifyType = "ARMS_CONTACT_GROUP",
* Name = "example_value",
* },
* },
* NotifyChannels = new[]
* {
* "dingTalk",
* "wechat",
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/arms"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := arms.NewAlertContact(ctx, "default", &arms.AlertContactArgs{
* AlertContactName: pulumi.String("example_value"),
* Email: pulumi.String("[email protected]"),
* })
* if err != nil {
* return err
* }
* defaultAlertContactGroup, err := arms.NewAlertContactGroup(ctx, "default", &arms.AlertContactGroupArgs{
* AlertContactGroupName: pulumi.String("example_value"),
* ContactIds: pulumi.StringArray{
* _default.ID(),
* },
* })
* if err != nil {
* return err
* }
* _, err = arms.NewDispatchRule(ctx, "default", &arms.DispatchRuleArgs{
* DispatchRuleName: pulumi.String("example_value"),
* DispatchType: pulumi.String("CREATE_ALERT"),
* GroupRules: arms.DispatchRuleGroupRuleArray{
* &arms.DispatchRuleGroupRuleArgs{
* GroupWaitTime: pulumi.Int(5),
* GroupInterval: pulumi.Int(15),
* RepeatInterval: pulumi.Int(100),
* GroupingFields: pulumi.StringArray{
* pulumi.String("alertname"),
* },
* },
* },
* LabelMatchExpressionGrids: arms.DispatchRuleLabelMatchExpressionGridArray{
* &arms.DispatchRuleLabelMatchExpressionGridArgs{
* LabelMatchExpressionGroups: arms.DispatchRuleLabelMatchExpressionGridLabelMatchExpressionGroupArray{
* &arms.DispatchRuleLabelMatchExpressionGridLabelMatchExpressionGroupArgs{
* LabelMatchExpressions: arms.DispatchRuleLabelMatchExpressionGridLabelMatchExpressionGroupLabelMatchExpressionArray{
* &arms.DispatchRuleLabelMatchExpressionGridLabelMatchExpressionGroupLabelMatchExpressionArgs{
* Key: pulumi.String("_aliyun_arms_involvedObject_kind"),
* Value: pulumi.String("app"),
* Operator: pulumi.String("eq"),
* },
* },
* },
* },
* },
* },
* NotifyRules: arms.DispatchRuleNotifyRuleArray{
* &arms.DispatchRuleNotifyRuleArgs{
* NotifyObjects: arms.DispatchRuleNotifyRuleNotifyObjectArray{
* &arms.DispatchRuleNotifyRuleNotifyObjectArgs{
* NotifyObjectId: _default.ID(),
* NotifyType: pulumi.String("ARMS_CONTACT"),
* Name: pulumi.String("example_value"),
* },
* &arms.DispatchRuleNotifyRuleNotifyObjectArgs{
* NotifyObjectId: defaultAlertContactGroup.ID(),
* NotifyType: pulumi.String("ARMS_CONTACT_GROUP"),
* Name: pulumi.String("example_value"),
* },
* },
* NotifyChannels: pulumi.StringArray{
* pulumi.String("dingTalk"),
* pulumi.String("wechat"),
* },
* },
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.alicloud.arms.AlertContact;
* import com.pulumi.alicloud.arms.AlertContactArgs;
* import com.pulumi.alicloud.arms.AlertContactGroup;
* import com.pulumi.alicloud.arms.AlertContactGroupArgs;
* import com.pulumi.alicloud.arms.DispatchRule;
* import com.pulumi.alicloud.arms.DispatchRuleArgs;
* import com.pulumi.alicloud.arms.inputs.DispatchRuleGroupRuleArgs;
* import com.pulumi.alicloud.arms.inputs.DispatchRuleLabelMatchExpressionGridArgs;
* import com.pulumi.alicloud.arms.inputs.DispatchRuleNotifyRuleArgs;
* 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 default_ = new AlertContact("default", AlertContactArgs.builder()
* .alertContactName("example_value")
* .email("[email protected]")
* .build());
* var defaultAlertContactGroup = new AlertContactGroup("defaultAlertContactGroup", AlertContactGroupArgs.builder()
* .alertContactGroupName("example_value")
* .contactIds(default_.id())
* .build());
* var defaultDispatchRule = new DispatchRule("defaultDispatchRule", DispatchRuleArgs.builder()
* .dispatchRuleName("example_value")
* .dispatchType("CREATE_ALERT")
* .groupRules(DispatchRuleGroupRuleArgs.builder()
* .groupWaitTime(5)
* .groupInterval(15)
* .repeatInterval(100)
* .groupingFields("alertname")
* .build())
* .labelMatchExpressionGrids(DispatchRuleLabelMatchExpressionGridArgs.builder()
* .labelMatchExpressionGroups(DispatchRuleLabelMatchExpressionGridLabelMatchExpressionGroupArgs.builder()
* .labelMatchExpressions(DispatchRuleLabelMatchExpressionGridLabelMatchExpressionGroupLabelMatchExpressionArgs.builder()
* .key("_aliyun_arms_involvedObject_kind")
* .value("app")
* .operator("eq")
* .build())
* .build())
* .build())
* .notifyRules(DispatchRuleNotifyRuleArgs.builder()
* .notifyObjects(
* DispatchRuleNotifyRuleNotifyObjectArgs.builder()
* .notifyObjectId(default_.id())
* .notifyType("ARMS_CONTACT")
* .name("example_value")
* .build(),
* DispatchRuleNotifyRuleNotifyObjectArgs.builder()
* .notifyObjectId(defaultAlertContactGroup.id())
* .notifyType("ARMS_CONTACT_GROUP")
* .name("example_value")
* .build())
* .notifyChannels(
* "dingTalk",
* "wechat")
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: alicloud:arms:AlertContact
* properties:
* alertContactName: example_value
* email: [email protected]
* defaultAlertContactGroup:
* type: alicloud:arms:AlertContactGroup
* name: default
* properties:
* alertContactGroupName: example_value
* contactIds:
* - ${default.id}
* defaultDispatchRule:
* type: alicloud:arms:DispatchRule
* name: default
* properties:
* dispatchRuleName: example_value
* dispatchType: CREATE_ALERT
* groupRules:
* - groupWaitTime: 5
* groupInterval: 15
* repeatInterval: 100
* groupingFields:
* - alertname
* labelMatchExpressionGrids:
* - labelMatchExpressionGroups:
* - labelMatchExpressions:
* - key: _aliyun_arms_involvedObject_kind
* value: app
* operator: eq
* notifyRules:
* - notifyObjects:
* - notifyObjectId: ${default.id}
* notifyType: ARMS_CONTACT
* name: example_value
* - notifyObjectId: ${defaultAlertContactGroup.id}
* notifyType: ARMS_CONTACT_GROUP
* name: example_value
* notifyChannels:
* - dingTalk
* - wechat
* ```
*
* ## Import
* Application Real-Time Monitoring Service (ARMS) Alert Contact can be imported using the id, e.g.
* ```sh
* $ pulumi import alicloud:arms/dispatchRule:DispatchRule example
* ```
* @property dispatchRuleName The name of the dispatch policy.
* @property dispatchType The alert handling method. Valid values: CREATE_ALERT: generates an alert. DISCARD_ALERT: discards the alert event and generates no alert.
* @property groupRules Sets the event group. See `group_rules` below. It will be ignored when `dispatch_type = "DISCARD_ALERT"`.
* @property isRecover Specifies whether to send the restored alert. Valid values: true: sends the alert. false: does not send the alert.
* @property labelMatchExpressionGrids Sets the dispatch rule. See `label_match_expression_grid` below.
* @property notifyRules Sets the notification rule. See `notify_rules` below. It will be ignored when `dispatch_type = "DISCARD_ALERT"`.
*/
public data class DispatchRuleArgs(
public val dispatchRuleName: Output? = null,
public val dispatchType: Output? = null,
public val groupRules: Output>? = null,
public val isRecover: Output? = null,
public val labelMatchExpressionGrids: Output>? =
null,
public val notifyRules: Output>? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.alicloud.arms.DispatchRuleArgs =
com.pulumi.alicloud.arms.DispatchRuleArgs.builder()
.dispatchRuleName(dispatchRuleName?.applyValue({ args0 -> args0 }))
.dispatchType(dispatchType?.applyValue({ args0 -> args0 }))
.groupRules(
groupRules?.applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
args0.toJava()
})
})
}),
)
.isRecover(isRecover?.applyValue({ args0 -> args0 }))
.labelMatchExpressionGrids(
labelMatchExpressionGrids?.applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> args0.toJava() })
})
}),
)
.notifyRules(
notifyRules?.applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
args0.toJava()
})
})
}),
).build()
}
/**
* Builder for [DispatchRuleArgs].
*/
@PulumiTagMarker
public class DispatchRuleArgsBuilder internal constructor() {
private var dispatchRuleName: Output? = null
private var dispatchType: Output? = null
private var groupRules: Output>? = null
private var isRecover: Output? = null
private var labelMatchExpressionGrids: Output>? =
null
private var notifyRules: Output>? = null
/**
* @param value The name of the dispatch policy.
*/
@JvmName("bhblvjfdrfhshgah")
public suspend fun dispatchRuleName(`value`: Output) {
this.dispatchRuleName = value
}
/**
* @param value The alert handling method. Valid values: CREATE_ALERT: generates an alert. DISCARD_ALERT: discards the alert event and generates no alert.
*/
@JvmName("qjfculfkaviqmxlc")
public suspend fun dispatchType(`value`: Output) {
this.dispatchType = value
}
/**
* @param value Sets the event group. See `group_rules` below. It will be ignored when `dispatch_type = "DISCARD_ALERT"`.
*/
@JvmName("kqftguluuqydylpa")
public suspend fun groupRules(`value`: Output>) {
this.groupRules = value
}
@JvmName("oluyfqxjfahatsuf")
public suspend fun groupRules(vararg values: Output) {
this.groupRules = Output.all(values.asList())
}
/**
* @param values Sets the event group. See `group_rules` below. It will be ignored when `dispatch_type = "DISCARD_ALERT"`.
*/
@JvmName("qavpnrojtycalpyd")
public suspend fun groupRules(values: List