1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. eventbridge
  5. getRules
Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi

alicloud.eventbridge.getRules

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 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);
    
    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)
    
    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
    	})
    }
    
    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),
        };
    });
    
    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()));
        }
    }
    
    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}
    

    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>
    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]
    func GetRules(ctx *Context, args *GetRulesArgs, opts ...InvokeOption) (*GetRulesResult, error)
    func GetRulesOutput(ctx *Context, args *GetRulesOutputArgs, opts ...InvokeOption) GetRulesResultOutput

    > 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)
    }
    public static CompletableFuture<GetRulesResult> getRules(GetRulesArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:eventbridge/getRules:getRules
      arguments:
        # arguments dictionary

    The following arguments are supported:

    EventBusName string
    The name of event bus.
    Ids List<string>
    A list of Rule IDs.
    NameRegex 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 string
    The rule name prefix.
    Status string
    Rule status, either Enable or Disable.
    EventBusName string
    The name of event bus.
    Ids []string
    A list of Rule IDs.
    NameRegex 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 string
    The rule name prefix.
    Status string
    Rule status, either Enable or Disable.
    eventBusName String
    The name of event bus.
    ids List<String>
    A list of Rule IDs.
    nameRegex 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 String
    The rule name prefix.
    status String
    Rule status, either Enable or Disable.
    eventBusName string
    The name of event bus.
    ids string[]
    A list of Rule IDs.
    nameRegex 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 string
    The rule name prefix.
    status string
    Rule status, either Enable or Disable.
    event_bus_name str
    The name of event bus.
    ids Sequence[str]
    A list of Rule IDs.
    name_regex 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 str
    The rule name prefix.
    status str
    Rule status, either Enable or Disable.
    eventBusName String
    The name of event bus.
    ids List<String>
    A list of Rule IDs.
    nameRegex 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 String
    The rule name prefix.
    status String
    Rule status, either Enable or Disable.

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

    GetRulesRuleTarget

    Endpoint string
    The endpoint.
    TargetId string
    The id of target.
    Type string
    The type of target.
    Endpoint string
    The endpoint.
    TargetId string
    The id of target.
    Type string
    The type of target.
    endpoint String
    The endpoint.
    targetId String
    The id of target.
    type String
    The type of target.
    endpoint string
    The endpoint.
    targetId string
    The id of target.
    type string
    The type of target.
    endpoint str
    The endpoint.
    target_id str
    The id of target.
    type str
    The type of target.
    endpoint String
    The endpoint.
    targetId String
    The id of target.
    type 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.
    alicloud logo
    Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi