1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. eventbridge
  5. getRules
Alibaba Cloud v3.75.0 published on Friday, Mar 7, 2025 by Pulumi

alicloud.eventbridge.getRules

Explore with Pulumi AI

Alibaba Cloud v3.75.0 published on Friday, Mar 7, 2025 by Pulumi

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

NOTE: Available in v1.129.0+.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const example = alicloud.eventbridge.getRules({
    eventBusName: "example_value",
    ids: ["example_value"],
    nameRegex: "the_resource_name",
});
export const firstEventBridgeRuleId = example.then(example => example.rules?.[0]?.id);
Copy
import pulumi
import pulumi_alicloud as alicloud

example = alicloud.eventbridge.get_rules(event_bus_name="example_value",
    ids=["example_value"],
    name_regex="the_resource_name")
pulumi.export("firstEventBridgeRuleId", example.rules[0].id)
Copy
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := eventbridge.GetRules(ctx, &eventbridge.GetRulesArgs{
			EventBusName: "example_value",
			Ids: []string{
				"example_value",
			},
			NameRegex: pulumi.StringRef("the_resource_name"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("firstEventBridgeRuleId", example.Rules[0].Id)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var example = AliCloud.EventBridge.GetRules.Invoke(new()
    {
        EventBusName = "example_value",
        Ids = new[]
        {
            "example_value",
        },
        NameRegex = "the_resource_name",
    });

    return new Dictionary<string, object?>
    {
        ["firstEventBridgeRuleId"] = example.Apply(getRulesResult => getRulesResult.Rules[0]?.Id),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.eventbridge.EventbridgeFunctions;
import com.pulumi.alicloud.eventbridge.inputs.GetRulesArgs;
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 example = EventbridgeFunctions.getRules(GetRulesArgs.builder()
            .eventBusName("example_value")
            .ids("example_value")
            .nameRegex("the_resource_name")
            .build());

        ctx.export("firstEventBridgeRuleId", example.applyValue(getRulesResult -> getRulesResult.rules()[0].id()));
    }
}
Copy
variables:
  example:
    fn::invoke:
      function: alicloud:eventbridge:getRules
      arguments:
        eventBusName: example_value
        ids:
          - example_value
        nameRegex: the_resource_name
outputs:
  firstEventBridgeRuleId: ${example.rules[0].id}
Copy

Using getRules

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 getRules(args: GetRulesArgs, opts?: InvokeOptions): Promise<GetRulesResult>
function getRulesOutput(args: GetRulesOutputArgs, opts?: InvokeOptions): Output<GetRulesResult>
Copy
def get_rules(event_bus_name: Optional[str] = None,
              ids: Optional[Sequence[str]] = None,
              name_regex: Optional[str] = None,
              output_file: Optional[str] = None,
              rule_name_prefix: Optional[str] = None,
              status: Optional[str] = None,
              opts: Optional[InvokeOptions] = None) -> GetRulesResult
def get_rules_output(event_bus_name: Optional[pulumi.Input[str]] = None,
              ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
              name_regex: Optional[pulumi.Input[str]] = None,
              output_file: Optional[pulumi.Input[str]] = None,
              rule_name_prefix: Optional[pulumi.Input[str]] = None,
              status: Optional[pulumi.Input[str]] = None,
              opts: Optional[InvokeOptions] = None) -> Output[GetRulesResult]
Copy
func GetRules(ctx *Context, args *GetRulesArgs, opts ...InvokeOption) (*GetRulesResult, error)
func GetRulesOutput(ctx *Context, args *GetRulesOutputArgs, opts ...InvokeOption) GetRulesResultOutput
Copy

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

public static class GetRules 
{
    public static Task<GetRulesResult> InvokeAsync(GetRulesArgs args, InvokeOptions? opts = null)
    public static Output<GetRulesResult> Invoke(GetRulesInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetRulesResult> getRules(GetRulesArgs args, InvokeOptions options)
public static Output<GetRulesResult> getRules(GetRulesArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: alicloud:eventbridge/getRules:getRules
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

EventBusName
This property is required.
Changes to this property will trigger replacement.
string
The name of event bus.
Ids Changes to this property will trigger replacement. List<string>
A list of Rule IDs.
NameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Rule name.
OutputFile string
File name where to save data source results (after running pulumi preview).
RuleNamePrefix Changes to this property will trigger replacement. string
The rule name prefix.
Status Changes to this property will trigger replacement. string
Rule status, either Enable or Disable. Valid values: DISABLE, ENABLE.
EventBusName
This property is required.
Changes to this property will trigger replacement.
string
The name of event bus.
Ids Changes to this property will trigger replacement. []string
A list of Rule IDs.
NameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Rule name.
OutputFile string
File name where to save data source results (after running pulumi preview).
RuleNamePrefix Changes to this property will trigger replacement. string
The rule name prefix.
Status Changes to this property will trigger replacement. string
Rule status, either Enable or Disable. Valid values: DISABLE, ENABLE.
eventBusName
This property is required.
Changes to this property will trigger replacement.
String
The name of event bus.
ids Changes to this property will trigger replacement. List<String>
A list of Rule IDs.
nameRegex Changes to this property will trigger replacement. String
A regex string to filter results by Rule name.
outputFile String
File name where to save data source results (after running pulumi preview).
ruleNamePrefix Changes to this property will trigger replacement. String
The rule name prefix.
status Changes to this property will trigger replacement. String
Rule status, either Enable or Disable. Valid values: DISABLE, ENABLE.
eventBusName
This property is required.
Changes to this property will trigger replacement.
string
The name of event bus.
ids Changes to this property will trigger replacement. string[]
A list of Rule IDs.
nameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Rule name.
outputFile string
File name where to save data source results (after running pulumi preview).
ruleNamePrefix Changes to this property will trigger replacement. string
The rule name prefix.
status Changes to this property will trigger replacement. string
Rule status, either Enable or Disable. Valid values: DISABLE, ENABLE.
event_bus_name
This property is required.
Changes to this property will trigger replacement.
str
The name of event bus.
ids Changes to this property will trigger replacement. Sequence[str]
A list of Rule IDs.
name_regex Changes to this property will trigger replacement. str
A regex string to filter results by Rule name.
output_file str
File name where to save data source results (after running pulumi preview).
rule_name_prefix Changes to this property will trigger replacement. str
The rule name prefix.
status Changes to this property will trigger replacement. str
Rule status, either Enable or Disable. Valid values: DISABLE, ENABLE.
eventBusName
This property is required.
Changes to this property will trigger replacement.
String
The name of event bus.
ids Changes to this property will trigger replacement. List<String>
A list of Rule IDs.
nameRegex Changes to this property will trigger replacement. String
A regex string to filter results by Rule name.
outputFile String
File name where to save data source results (after running pulumi preview).
ruleNamePrefix Changes to this property will trigger replacement. String
The rule name prefix.
status Changes to this property will trigger replacement. String
Rule status, either Enable or Disable. Valid values: DISABLE, ENABLE.

getRules Result

The following output properties are available:

EventBusName string
Id string
The provider-assigned unique ID for this managed resource.
Ids List<string>
Names List<string>
Rules List<Pulumi.AliCloud.EventBridge.Outputs.GetRulesRule>
NameRegex string
OutputFile string
RuleNamePrefix string
Status string
EventBusName string
Id string
The provider-assigned unique ID for this managed resource.
Ids []string
Names []string
Rules []GetRulesRule
NameRegex string
OutputFile string
RuleNamePrefix string
Status string
eventBusName String
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
names List<String>
rules List<GetRulesRule>
nameRegex String
outputFile String
ruleNamePrefix String
status String
eventBusName string
id string
The provider-assigned unique ID for this managed resource.
ids string[]
names string[]
rules GetRulesRule[]
nameRegex string
outputFile string
ruleNamePrefix string
status string
event_bus_name str
id str
The provider-assigned unique ID for this managed resource.
ids Sequence[str]
names Sequence[str]
rules Sequence[GetRulesRule]
name_regex str
output_file str
rule_name_prefix str
status str
eventBusName String
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
names List<String>
rules List<Property Map>
nameRegex String
outputFile String
ruleNamePrefix String
status String

Supporting Types

GetRulesRule

Description This property is required. string
The description of rule.
EventBusName This property is required. string
The name of event bus.
FilterPattern This property is required. string
The pattern to match interested events.
Id This property is required. string
The ID of the Rule.
RuleName This property is required. string
The name of rule.
Status This property is required. string
Rule status, either Enable or Disable.
Targets This property is required. List<Pulumi.AliCloud.EventBridge.Inputs.GetRulesRuleTarget>
The target for rule.
Description This property is required. string
The description of rule.
EventBusName This property is required. string
The name of event bus.
FilterPattern This property is required. string
The pattern to match interested events.
Id This property is required. string
The ID of the Rule.
RuleName This property is required. string
The name of rule.
Status This property is required. string
Rule status, either Enable or Disable.
Targets This property is required. []GetRulesRuleTarget
The target for rule.
description This property is required. String
The description of rule.
eventBusName This property is required. String
The name of event bus.
filterPattern This property is required. String
The pattern to match interested events.
id This property is required. String
The ID of the Rule.
ruleName This property is required. String
The name of rule.
status This property is required. String
Rule status, either Enable or Disable.
targets This property is required. List<GetRulesRuleTarget>
The target for rule.
description This property is required. string
The description of rule.
eventBusName This property is required. string
The name of event bus.
filterPattern This property is required. string
The pattern to match interested events.
id This property is required. string
The ID of the Rule.
ruleName This property is required. string
The name of rule.
status This property is required. string
Rule status, either Enable or Disable.
targets This property is required. GetRulesRuleTarget[]
The target for rule.
description This property is required. str
The description of rule.
event_bus_name This property is required. str
The name of event bus.
filter_pattern This property is required. str
The pattern to match interested events.
id This property is required. str
The ID of the Rule.
rule_name This property is required. str
The name of rule.
status This property is required. str
Rule status, either Enable or Disable.
targets This property is required. Sequence[GetRulesRuleTarget]
The target for rule.
description This property is required. String
The description of rule.
eventBusName This property is required. String
The name of event bus.
filterPattern This property is required. String
The pattern to match interested events.
id This property is required. String
The ID of the Rule.
ruleName This property is required. String
The name of rule.
status This property is required. String
Rule status, either Enable or Disable.
targets This property is required. List<Property Map>
The target for rule.

GetRulesRuleTarget

Endpoint This property is required. string
The endpoint.
TargetId This property is required. string
The id of target.
Type This property is required. string
The type of target.
Endpoint This property is required. string
The endpoint.
TargetId This property is required. string
The id of target.
Type This property is required. string
The type of target.
endpoint This property is required. String
The endpoint.
targetId This property is required. String
The id of target.
type This property is required. String
The type of target.
endpoint This property is required. string
The endpoint.
targetId This property is required. string
The id of target.
type This property is required. string
The type of target.
endpoint This property is required. str
The endpoint.
target_id This property is required. str
The id of target.
type This property is required. str
The type of target.
endpoint This property is required. String
The endpoint.
targetId This property is required. String
The id of target.
type This property is required. String
The type of target.

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.75.0 published on Friday, Mar 7, 2025 by Pulumi