alicloud logo
Alibaba Cloud v3.30.0, Feb 1 23

alicloud.cms.getEventRules

This data source provides the Cms Event Rules of the current Alibaba Cloud user.

NOTE: Available in v1.182.0+.

Example Usage

Basic Usage

using System.Collections.Generic;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var ids = AliCloud.Cms.GetEventRules.Invoke(new()
    {
        Ids = new[]
        {
            "example_id",
        },
    });

    var nameRegex = AliCloud.Cms.GetEventRules.Invoke(new()
    {
        NameRegex = "^my-EventRule",
    });

    return new Dictionary<string, object?>
    {
        ["cmsEventRuleId1"] = ids.Apply(getEventRulesResult => getEventRulesResult.Rules[0]?.Id),
        ["cmsEventRuleId2"] = nameRegex.Apply(getEventRulesResult => getEventRulesResult.Rules[0]?.Id),
    };
});
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		ids, err := cms.GetEventRules(ctx, &cms.GetEventRulesArgs{
			Ids: []string{
				"example_id",
			},
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("cmsEventRuleId1", ids.Rules[0].Id)
		nameRegex, err := cms.GetEventRules(ctx, &cms.GetEventRulesArgs{
			NameRegex: pulumi.StringRef("^my-EventRule"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("cmsEventRuleId2", nameRegex.Rules[0].Id)
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.cms.CmsFunctions;
import com.pulumi.alicloud.cms.inputs.GetEventRulesArgs;
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 ids = CmsFunctions.getEventRules(GetEventRulesArgs.builder()
            .ids("example_id")
            .build());

        ctx.export("cmsEventRuleId1", ids.applyValue(getEventRulesResult -> getEventRulesResult.rules()[0].id()));
        final var nameRegex = CmsFunctions.getEventRules(GetEventRulesArgs.builder()
            .nameRegex("^my-EventRule")
            .build());

        ctx.export("cmsEventRuleId2", nameRegex.applyValue(getEventRulesResult -> getEventRulesResult.rules()[0].id()));
    }
}
import pulumi
import pulumi_alicloud as alicloud

ids = alicloud.cms.get_event_rules(ids=["example_id"])
pulumi.export("cmsEventRuleId1", ids.rules[0].id)
name_regex = alicloud.cms.get_event_rules(name_regex="^my-EventRule")
pulumi.export("cmsEventRuleId2", name_regex.rules[0].id)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const ids = alicloud.cms.getEventRules({
    ids: ["example_id"],
});
export const cmsEventRuleId1 = ids.then(ids => ids.rules?.[0]?.id);
const nameRegex = alicloud.cms.getEventRules({
    nameRegex: "^my-EventRule",
});
export const cmsEventRuleId2 = nameRegex.then(nameRegex => nameRegex.rules?.[0]?.id);
variables:
  ids:
    fn::invoke:
      Function: alicloud:cms:getEventRules
      Arguments:
        ids:
          - example_id
  nameRegex:
    fn::invoke:
      Function: alicloud:cms:getEventRules
      Arguments:
        nameRegex: ^my-EventRule
outputs:
  cmsEventRuleId1: ${ids.rules[0].id}
  cmsEventRuleId2: ${nameRegex.rules[0].id}

Using getEventRules

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getEventRules(args: GetEventRulesArgs, opts?: InvokeOptions): Promise<GetEventRulesResult>
function getEventRulesOutput(args: GetEventRulesOutputArgs, opts?: InvokeOptions): Output<GetEventRulesResult>
def get_event_rules(ids: Optional[Sequence[str]] = None,
                    name_prefix: Optional[str] = None,
                    name_regex: Optional[str] = None,
                    output_file: Optional[str] = None,
                    page_number: Optional[int] = None,
                    page_size: Optional[int] = None,
                    status: Optional[str] = None,
                    opts: Optional[InvokeOptions] = None) -> GetEventRulesResult
def get_event_rules_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                    name_prefix: Optional[pulumi.Input[str]] = None,
                    name_regex: Optional[pulumi.Input[str]] = None,
                    output_file: Optional[pulumi.Input[str]] = None,
                    page_number: Optional[pulumi.Input[int]] = None,
                    page_size: Optional[pulumi.Input[int]] = None,
                    status: Optional[pulumi.Input[str]] = None,
                    opts: Optional[InvokeOptions] = None) -> Output[GetEventRulesResult]
func GetEventRules(ctx *Context, args *GetEventRulesArgs, opts ...InvokeOption) (*GetEventRulesResult, error)
func GetEventRulesOutput(ctx *Context, args *GetEventRulesOutputArgs, opts ...InvokeOption) GetEventRulesResultOutput

> Note: This function is named GetEventRules in the Go SDK.

public static class GetEventRules 
{
    public static Task<GetEventRulesResult> InvokeAsync(GetEventRulesArgs args, InvokeOptions? opts = null)
    public static Output<GetEventRulesResult> Invoke(GetEventRulesInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetEventRulesResult> getEventRules(GetEventRulesArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: alicloud:cms/getEventRules:getEventRules
  arguments:
    # arguments dictionary

The following arguments are supported:

Ids List<string>

A list of Event Rule IDs. Its element value is same as Event Rule Name.

NamePrefix string

The name prefix.

NameRegex string

A regex string to filter results by Event Rule name.

OutputFile string
PageNumber int
PageSize int
Status string

The status of the resource.

Ids []string

A list of Event Rule IDs. Its element value is same as Event Rule Name.

NamePrefix string

The name prefix.

NameRegex string

A regex string to filter results by Event Rule name.

OutputFile string
PageNumber int
PageSize int
Status string

The status of the resource.

ids List<String>

A list of Event Rule IDs. Its element value is same as Event Rule Name.

namePrefix String

The name prefix.

nameRegex String

A regex string to filter results by Event Rule name.

outputFile String
pageNumber Integer
pageSize Integer
status String

The status of the resource.

ids string[]

A list of Event Rule IDs. Its element value is same as Event Rule Name.

namePrefix string

The name prefix.

nameRegex string

A regex string to filter results by Event Rule name.

outputFile string
pageNumber number
pageSize number
status string

The status of the resource.

ids Sequence[str]

A list of Event Rule IDs. Its element value is same as Event Rule Name.

name_prefix str

The name prefix.

name_regex str

A regex string to filter results by Event Rule name.

output_file str
page_number int
page_size int
status str

The status of the resource.

ids List<String>

A list of Event Rule IDs. Its element value is same as Event Rule Name.

namePrefix String

The name prefix.

nameRegex String

A regex string to filter results by Event Rule name.

outputFile String
pageNumber Number
pageSize Number
status String

The status of the resource.

getEventRules Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Ids List<string>
Names List<string>
Rules List<Pulumi.AliCloud.Cms.Outputs.GetEventRulesRule>
NamePrefix string
NameRegex string
OutputFile string
PageNumber int
PageSize int
Status string
Id string

The provider-assigned unique ID for this managed resource.

Ids []string
Names []string
Rules []GetEventRulesRule
NamePrefix string
NameRegex string
OutputFile string
PageNumber int
PageSize int
Status string
id String

The provider-assigned unique ID for this managed resource.

ids List<String>
names List<String>
rules List<GetEventRulesRule>
namePrefix String
nameRegex String
outputFile String
pageNumber Integer
pageSize Integer
status String
id string

The provider-assigned unique ID for this managed resource.

ids string[]
names string[]
rules GetEventRulesRule[]
namePrefix string
nameRegex string
outputFile string
pageNumber number
pageSize number
status string
id str

The provider-assigned unique ID for this managed resource.

ids Sequence[str]
names Sequence[str]
rules Sequence[GetEventRulesRule]
name_prefix str
name_regex str
output_file str
page_number int
page_size int
status str
id String

The provider-assigned unique ID for this managed resource.

ids List<String>
names List<String>
rules List<Property Map>
namePrefix String
nameRegex String
outputFile String
pageNumber Number
pageSize Number
status String

Supporting Types

GetEventRulesRule

Description string

The description of the rule.

EventPatterns List<Pulumi.AliCloud.Cms.Inputs.GetEventRulesRuleEventPattern>

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

EventRuleName string

The name of the event rule.

EventType string

The type of event.

GroupId string

The ID of the application Group.

Id string

The ID of the Event Rule. Its value is same as Event Rule Name.

SilenceTime int

The mute period during which new alerts are not sent even if the trigger conditions are met.

Status string

The status of the resource.

Description string

The description of the rule.

EventPatterns []GetEventRulesRuleEventPattern

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

EventRuleName string

The name of the event rule.

EventType string

The type of event.

GroupId string

The ID of the application Group.

Id string

The ID of the Event Rule. Its value is same as Event Rule Name.

SilenceTime int

The mute period during which new alerts are not sent even if the trigger conditions are met.

Status string

The status of the resource.

description String

The description of the rule.

eventPatterns List<GetEventRulesRuleEventPattern>

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

eventRuleName String

The name of the event rule.

eventType String

The type of event.

groupId String

The ID of the application Group.

id String

The ID of the Event Rule. Its value is same as Event Rule Name.

silenceTime Integer

The mute period during which new alerts are not sent even if the trigger conditions are met.

status String

The status of the resource.

description string

The description of the rule.

eventPatterns GetEventRulesRuleEventPattern[]

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

eventRuleName string

The name of the event rule.

eventType string

The type of event.

groupId string

The ID of the application Group.

id string

The ID of the Event Rule. Its value is same as Event Rule Name.

silenceTime number

The mute period during which new alerts are not sent even if the trigger conditions are met.

status string

The status of the resource.

description str

The description of the rule.

event_patterns Sequence[GetEventRulesRuleEventPattern]

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

event_rule_name str

The name of the event rule.

event_type str

The type of event.

group_id str

The ID of the application Group.

id str

The ID of the Event Rule. Its value is same as Event Rule Name.

silence_time int

The mute period during which new alerts are not sent even if the trigger conditions are met.

status str

The status of the resource.

description String

The description of the rule.

eventPatterns List<Property Map>

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

eventRuleName String

The name of the event rule.

eventType String

The type of event.

groupId String

The ID of the application Group.

id String

The ID of the Event Rule. Its value is same as Event Rule Name.

silenceTime Number

The mute period during which new alerts are not sent even if the trigger conditions are met.

status String

The status of the resource.

GetEventRulesRuleEventPattern

EventTypeLists List<string>

The list of event types.

KeywordFilters List<Pulumi.AliCloud.Cms.Inputs.GetEventRulesRuleEventPatternKeywordFilter>

The filter keyword.

LevelLists List<string>

The list of event levels.

NameLists List<string>

The list of event names.

Product string

The type of the cloud service.

SqlFilter string

The SQL condition that is used to filter events.

EventTypeLists []string

The list of event types.

KeywordFilters []GetEventRulesRuleEventPatternKeywordFilter

The filter keyword.

LevelLists []string

The list of event levels.

NameLists []string

The list of event names.

Product string

The type of the cloud service.

SqlFilter string

The SQL condition that is used to filter events.

eventTypeLists List<String>

The list of event types.

keywordFilters List<GetEventRulesRuleEventPatternKeywordFilter>

The filter keyword.

levelLists List<String>

The list of event levels.

nameLists List<String>

The list of event names.

product String

The type of the cloud service.

sqlFilter String

The SQL condition that is used to filter events.

eventTypeLists string[]

The list of event types.

keywordFilters GetEventRulesRuleEventPatternKeywordFilter[]

The filter keyword.

levelLists string[]

The list of event levels.

nameLists string[]

The list of event names.

product string

The type of the cloud service.

sqlFilter string

The SQL condition that is used to filter events.

event_type_lists Sequence[str]

The list of event types.

keyword_filters Sequence[GetEventRulesRuleEventPatternKeywordFilter]

The filter keyword.

level_lists Sequence[str]

The list of event levels.

name_lists Sequence[str]

The list of event names.

product str

The type of the cloud service.

sql_filter str

The SQL condition that is used to filter events.

eventTypeLists List<String>

The list of event types.

keywordFilters List<Property Map>

The filter keyword.

levelLists List<String>

The list of event levels.

nameLists List<String>

The list of event names.

product String

The type of the cloud service.

sqlFilter String

The SQL condition that is used to filter events.

GetEventRulesRuleEventPatternKeywordFilter

KeyWords List<string>

The keywords that are used to match events.

Relation string

The relationship between multiple keywords in a condition.

KeyWords []string

The keywords that are used to match events.

Relation string

The relationship between multiple keywords in a condition.

keyWords List<String>

The keywords that are used to match events.

relation String

The relationship between multiple keywords in a condition.

keyWords string[]

The keywords that are used to match events.

relation string

The relationship between multiple keywords in a condition.

key_words Sequence[str]

The keywords that are used to match events.

relation str

The relationship between multiple keywords in a condition.

keyWords List<String>

The keywords that are used to match events.

relation String

The relationship between multiple keywords in a condition.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.