1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. cms
  5. getEventRules
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.cms.getEventRules

Explore with Pulumi AI

Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

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

NOTE: Available in v1.182.0+.

Example Usage

Basic Usage

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);
Copy
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)
Copy
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
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
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),
    };
});
Copy
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()));
    }
}
Copy
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}
Copy

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>
Copy
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]
Copy
func GetEventRules(ctx *Context, args *GetEventRulesArgs, opts ...InvokeOption) (*GetEventRulesResult, error)
func GetEventRulesOutput(ctx *Context, args *GetEventRulesOutputArgs, opts ...InvokeOption) GetEventRulesResultOutput
Copy

> 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)
}
Copy
public static CompletableFuture<GetEventRulesResult> getEventRules(GetEventRulesArgs args, InvokeOptions options)
public static Output<GetEventRulesResult> getEventRules(GetEventRulesArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: alicloud:cms/getEventRules:getEventRules
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Ids Changes to this property will trigger replacement. List<string>
A list of Event Rule IDs. Its element value is same as Event Rule Name.
NamePrefix Changes to this property will trigger replacement. string
The name prefix.
NameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Event Rule name.
OutputFile string
File name where to save data source results (after running pulumi preview).
PageNumber int
PageSize int
Status Changes to this property will trigger replacement. string
The status of the resource. Valid values: DISABLED, ENABLED.
Ids Changes to this property will trigger replacement. []string
A list of Event Rule IDs. Its element value is same as Event Rule Name.
NamePrefix Changes to this property will trigger replacement. string
The name prefix.
NameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Event Rule name.
OutputFile string
File name where to save data source results (after running pulumi preview).
PageNumber int
PageSize int
Status Changes to this property will trigger replacement. string
The status of the resource. Valid values: DISABLED, ENABLED.
ids Changes to this property will trigger replacement. List<String>
A list of Event Rule IDs. Its element value is same as Event Rule Name.
namePrefix Changes to this property will trigger replacement. String
The name prefix.
nameRegex Changes to this property will trigger replacement. String
A regex string to filter results by Event Rule name.
outputFile String
File name where to save data source results (after running pulumi preview).
pageNumber Integer
pageSize Integer
status Changes to this property will trigger replacement. String
The status of the resource. Valid values: DISABLED, ENABLED.
ids Changes to this property will trigger replacement. string[]
A list of Event Rule IDs. Its element value is same as Event Rule Name.
namePrefix Changes to this property will trigger replacement. string
The name prefix.
nameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Event Rule name.
outputFile string
File name where to save data source results (after running pulumi preview).
pageNumber number
pageSize number
status Changes to this property will trigger replacement. string
The status of the resource. Valid values: DISABLED, ENABLED.
ids Changes to this property will trigger replacement. Sequence[str]
A list of Event Rule IDs. Its element value is same as Event Rule Name.
name_prefix Changes to this property will trigger replacement. str
The name prefix.
name_regex Changes to this property will trigger replacement. str
A regex string to filter results by Event Rule name.
output_file str
File name where to save data source results (after running pulumi preview).
page_number int
page_size int
status Changes to this property will trigger replacement. str
The status of the resource. Valid values: DISABLED, ENABLED.
ids Changes to this property will trigger replacement. List<String>
A list of Event Rule IDs. Its element value is same as Event Rule Name.
namePrefix Changes to this property will trigger replacement. String
The name prefix.
nameRegex Changes to this property will trigger replacement. String
A regex string to filter results by Event Rule name.
outputFile String
File name where to save data source results (after running pulumi preview).
pageNumber Number
pageSize Number
status Changes to this property will trigger replacement. String
The status of the resource. Valid values: DISABLED, ENABLED.

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 This property is required. string
The description of the rule.
EventPatterns This property is required. List<Pulumi.AliCloud.Cms.Inputs.GetEventRulesRuleEventPattern>
Event mode, used to describe the trigger conditions for this event.
EventRuleName This property is required. string
The name of the event rule.
EventType This property is required. string
The type of event.
GroupId This property is required. string
The ID of the application Group.
Id This property is required. string
The ID of the Event Rule. Its value is same as Event Rule Name.
SilenceTime This property is required. int
The mute period during which new alerts are not sent even if the trigger conditions are met.
Status This property is required. string
The status of the resource.
Description This property is required. string
The description of the rule.
EventPatterns This property is required. []GetEventRulesRuleEventPattern
Event mode, used to describe the trigger conditions for this event.
EventRuleName This property is required. string
The name of the event rule.
EventType This property is required. string
The type of event.
GroupId This property is required. string
The ID of the application Group.
Id This property is required. string
The ID of the Event Rule. Its value is same as Event Rule Name.
SilenceTime This property is required. int
The mute period during which new alerts are not sent even if the trigger conditions are met.
Status This property is required. string
The status of the resource.
description This property is required. String
The description of the rule.
eventPatterns This property is required. List<GetEventRulesRuleEventPattern>
Event mode, used to describe the trigger conditions for this event.
eventRuleName This property is required. String
The name of the event rule.
eventType This property is required. String
The type of event.
groupId This property is required. String
The ID of the application Group.
id This property is required. String
The ID of the Event Rule. Its value is same as Event Rule Name.
silenceTime This property is required. Integer
The mute period during which new alerts are not sent even if the trigger conditions are met.
status This property is required. String
The status of the resource.
description This property is required. string
The description of the rule.
eventPatterns This property is required. GetEventRulesRuleEventPattern[]
Event mode, used to describe the trigger conditions for this event.
eventRuleName This property is required. string
The name of the event rule.
eventType This property is required. string
The type of event.
groupId This property is required. string
The ID of the application Group.
id This property is required. string
The ID of the Event Rule. Its value is same as Event Rule Name.
silenceTime This property is required. number
The mute period during which new alerts are not sent even if the trigger conditions are met.
status This property is required. string
The status of the resource.
description This property is required. str
The description of the rule.
event_patterns This property is required. Sequence[GetEventRulesRuleEventPattern]
Event mode, used to describe the trigger conditions for this event.
event_rule_name This property is required. str
The name of the event rule.
event_type This property is required. str
The type of event.
group_id This property is required. str
The ID of the application Group.
id This property is required. str
The ID of the Event Rule. Its value is same as Event Rule Name.
silence_time This property is required. int
The mute period during which new alerts are not sent even if the trigger conditions are met.
status This property is required. str
The status of the resource.
description This property is required. String
The description of the rule.
eventPatterns This property is required. List<Property Map>
Event mode, used to describe the trigger conditions for this event.
eventRuleName This property is required. String
The name of the event rule.
eventType This property is required. String
The type of event.
groupId This property is required. String
The ID of the application Group.
id This property is required. String
The ID of the Event Rule. Its value is same as Event Rule Name.
silenceTime This property is required. Number
The mute period during which new alerts are not sent even if the trigger conditions are met.
status This property is required. String
The status of the resource.

GetEventRulesRuleEventPattern

EventTypeLists This property is required. List<string>
The list of event types.
KeywordFilters This property is required. List<Pulumi.AliCloud.Cms.Inputs.GetEventRulesRuleEventPatternKeywordFilter>
The filter keyword.
LevelLists This property is required. List<string>
The list of event levels.
NameLists This property is required. List<string>
The list of event names.
Product This property is required. string
The type of the cloud service.
SqlFilter This property is required. string
The SQL condition that is used to filter events.
EventTypeLists This property is required. []string
The list of event types.
KeywordFilters This property is required. []GetEventRulesRuleEventPatternKeywordFilter
The filter keyword.
LevelLists This property is required. []string
The list of event levels.
NameLists This property is required. []string
The list of event names.
Product This property is required. string
The type of the cloud service.
SqlFilter This property is required. string
The SQL condition that is used to filter events.
eventTypeLists This property is required. List<String>
The list of event types.
keywordFilters This property is required. List<GetEventRulesRuleEventPatternKeywordFilter>
The filter keyword.
levelLists This property is required. List<String>
The list of event levels.
nameLists This property is required. List<String>
The list of event names.
product This property is required. String
The type of the cloud service.
sqlFilter This property is required. String
The SQL condition that is used to filter events.
eventTypeLists This property is required. string[]
The list of event types.
keywordFilters This property is required. GetEventRulesRuleEventPatternKeywordFilter[]
The filter keyword.
levelLists This property is required. string[]
The list of event levels.
nameLists This property is required. string[]
The list of event names.
product This property is required. string
The type of the cloud service.
sqlFilter This property is required. string
The SQL condition that is used to filter events.
event_type_lists This property is required. Sequence[str]
The list of event types.
keyword_filters This property is required. Sequence[GetEventRulesRuleEventPatternKeywordFilter]
The filter keyword.
level_lists This property is required. Sequence[str]
The list of event levels.
name_lists This property is required. Sequence[str]
The list of event names.
product This property is required. str
The type of the cloud service.
sql_filter This property is required. str
The SQL condition that is used to filter events.
eventTypeLists This property is required. List<String>
The list of event types.
keywordFilters This property is required. List<Property Map>
The filter keyword.
levelLists This property is required. List<String>
The list of event levels.
nameLists This property is required. List<String>
The list of event names.
product This property is required. String
The type of the cloud service.
sqlFilter This property is required. String
The SQL condition that is used to filter events.

GetEventRulesRuleEventPatternKeywordFilter

KeyWords This property is required. List<string>
The keywords that are used to match events.
Relation This property is required. string
The relationship between multiple keywords in a condition.
KeyWords This property is required. []string
The keywords that are used to match events.
Relation This property is required. string
The relationship between multiple keywords in a condition.
keyWords This property is required. List<String>
The keywords that are used to match events.
relation This property is required. String
The relationship between multiple keywords in a condition.
keyWords This property is required. string[]
The keywords that are used to match events.
relation This property is required. string
The relationship between multiple keywords in a condition.
key_words This property is required. Sequence[str]
The keywords that are used to match events.
relation This property is required. str
The relationship between multiple keywords in a condition.
keyWords This property is required. List<String>
The keywords that are used to match events.
relation This property is required. 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.
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi