1. Packages
  2. Tencentcloud Provider
  3. API Docs
  4. EbEventRule
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack

tencentcloud.EbEventRule

Explore with Pulumi AI

tencentcloud logo
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack

    Provides a resource to create a eb event_rule

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as tencentcloud from "@pulumi/tencentcloud";
    
    const foo = new tencentcloud.EbEventBus("foo", {
        eventBusName: "tf-event_bus",
        description: "event bus desc",
        enableStore: false,
        saveDays: 1,
        tags: {
            createdBy: "terraform",
        },
    });
    const eventRule = new tencentcloud.EbEventRule("eventRule", {
        eventBusId: foo.ebEventBusId,
        ruleName: "tf-event_rule",
        description: "event rule desc",
        enable: true,
        eventPattern: JSON.stringify({
            source: "apigw.cloud.tencent",
            type: ["connector:apigw"],
        }),
        tags: {
            createdBy: "terraform",
        },
    });
    
    import pulumi
    import json
    import pulumi_tencentcloud as tencentcloud
    
    foo = tencentcloud.EbEventBus("foo",
        event_bus_name="tf-event_bus",
        description="event bus desc",
        enable_store=False,
        save_days=1,
        tags={
            "createdBy": "terraform",
        })
    event_rule = tencentcloud.EbEventRule("eventRule",
        event_bus_id=foo.eb_event_bus_id,
        rule_name="tf-event_rule",
        description="event rule desc",
        enable=True,
        event_pattern=json.dumps({
            "source": "apigw.cloud.tencent",
            "type": ["connector:apigw"],
        }),
        tags={
            "createdBy": "terraform",
        })
    
    package main
    
    import (
    	"encoding/json"
    
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		foo, err := tencentcloud.NewEbEventBus(ctx, "foo", &tencentcloud.EbEventBusArgs{
    			EventBusName: pulumi.String("tf-event_bus"),
    			Description:  pulumi.String("event bus desc"),
    			EnableStore:  pulumi.Bool(false),
    			SaveDays:     pulumi.Float64(1),
    			Tags: pulumi.StringMap{
    				"createdBy": pulumi.String("terraform"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		tmpJSON0, err := json.Marshal(map[string]interface{}{
    			"source": "apigw.cloud.tencent",
    			"type": []string{
    				"connector:apigw",
    			},
    		})
    		if err != nil {
    			return err
    		}
    		json0 := string(tmpJSON0)
    		_, err = tencentcloud.NewEbEventRule(ctx, "eventRule", &tencentcloud.EbEventRuleArgs{
    			EventBusId:   foo.EbEventBusId,
    			RuleName:     pulumi.String("tf-event_rule"),
    			Description:  pulumi.String("event rule desc"),
    			Enable:       pulumi.Bool(true),
    			EventPattern: pulumi.String(json0),
    			Tags: pulumi.StringMap{
    				"createdBy": pulumi.String("terraform"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using System.Text.Json;
    using Pulumi;
    using Tencentcloud = Pulumi.Tencentcloud;
    
    return await Deployment.RunAsync(() => 
    {
        var foo = new Tencentcloud.EbEventBus("foo", new()
        {
            EventBusName = "tf-event_bus",
            Description = "event bus desc",
            EnableStore = false,
            SaveDays = 1,
            Tags = 
            {
                { "createdBy", "terraform" },
            },
        });
    
        var eventRule = new Tencentcloud.EbEventRule("eventRule", new()
        {
            EventBusId = foo.EbEventBusId,
            RuleName = "tf-event_rule",
            Description = "event rule desc",
            Enable = true,
            EventPattern = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["source"] = "apigw.cloud.tencent",
                ["type"] = new[]
                {
                    "connector:apigw",
                },
            }),
            Tags = 
            {
                { "createdBy", "terraform" },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tencentcloud.EbEventBus;
    import com.pulumi.tencentcloud.EbEventBusArgs;
    import com.pulumi.tencentcloud.EbEventRule;
    import com.pulumi.tencentcloud.EbEventRuleArgs;
    import static com.pulumi.codegen.internal.Serialization.*;
    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 foo = new EbEventBus("foo", EbEventBusArgs.builder()
                .eventBusName("tf-event_bus")
                .description("event bus desc")
                .enableStore(false)
                .saveDays(1)
                .tags(Map.of("createdBy", "terraform"))
                .build());
    
            var eventRule = new EbEventRule("eventRule", EbEventRuleArgs.builder()
                .eventBusId(foo.ebEventBusId())
                .ruleName("tf-event_rule")
                .description("event rule desc")
                .enable(true)
                .eventPattern(serializeJson(
                    jsonObject(
                        jsonProperty("source", "apigw.cloud.tencent"),
                        jsonProperty("type", jsonArray("connector:apigw"))
                    )))
                .tags(Map.of("createdBy", "terraform"))
                .build());
    
        }
    }
    
    resources:
      foo:
        type: tencentcloud:EbEventBus
        properties:
          eventBusName: tf-event_bus
          description: event bus desc
          enableStore: false
          saveDays: 1
          tags:
            createdBy: terraform
      eventRule:
        type: tencentcloud:EbEventRule
        properties:
          eventBusId: ${foo.ebEventBusId}
          ruleName: tf-event_rule
          description: event rule desc
          enable: true
          eventPattern:
            fn::toJSON:
              source: apigw.cloud.tencent
              type:
                - connector:apigw
          tags:
            createdBy: terraform
    

    Create EbEventRule Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new EbEventRule(name: string, args: EbEventRuleArgs, opts?: CustomResourceOptions);
    @overload
    def EbEventRule(resource_name: str,
                    args: EbEventRuleArgs,
                    opts: Optional[ResourceOptions] = None)
    
    @overload
    def EbEventRule(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    event_bus_id: Optional[str] = None,
                    event_pattern: Optional[str] = None,
                    rule_name: Optional[str] = None,
                    description: Optional[str] = None,
                    eb_event_rule_id: Optional[str] = None,
                    enable: Optional[bool] = None,
                    tags: Optional[Mapping[str, str]] = None)
    func NewEbEventRule(ctx *Context, name string, args EbEventRuleArgs, opts ...ResourceOption) (*EbEventRule, error)
    public EbEventRule(string name, EbEventRuleArgs args, CustomResourceOptions? opts = null)
    public EbEventRule(String name, EbEventRuleArgs args)
    public EbEventRule(String name, EbEventRuleArgs args, CustomResourceOptions options)
    
    type: tencentcloud:EbEventRule
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args EbEventRuleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args EbEventRuleArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args EbEventRuleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args EbEventRuleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args EbEventRuleArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    EbEventRule Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The EbEventRule resource accepts the following input properties:

    EventBusId string
    event bus Id.
    EventPattern string
    Reference: Event Mode.
    RuleName string
    Event rule name, which can only contain letters, numbers, underscores, hyphens, starts with a letter and ends with a number or letter, 2~60 characters.
    Description string
    Event set description, unlimited character type, description within 200 characters.
    EbEventRuleId string
    ID of the resource.
    Enable bool
    Enable switch.
    Tags Dictionary<string, string>
    Tag description list.
    EventBusId string
    event bus Id.
    EventPattern string
    Reference: Event Mode.
    RuleName string
    Event rule name, which can only contain letters, numbers, underscores, hyphens, starts with a letter and ends with a number or letter, 2~60 characters.
    Description string
    Event set description, unlimited character type, description within 200 characters.
    EbEventRuleId string
    ID of the resource.
    Enable bool
    Enable switch.
    Tags map[string]string
    Tag description list.
    eventBusId String
    event bus Id.
    eventPattern String
    Reference: Event Mode.
    ruleName String
    Event rule name, which can only contain letters, numbers, underscores, hyphens, starts with a letter and ends with a number or letter, 2~60 characters.
    description String
    Event set description, unlimited character type, description within 200 characters.
    ebEventRuleId String
    ID of the resource.
    enable Boolean
    Enable switch.
    tags Map<String,String>
    Tag description list.
    eventBusId string
    event bus Id.
    eventPattern string
    Reference: Event Mode.
    ruleName string
    Event rule name, which can only contain letters, numbers, underscores, hyphens, starts with a letter and ends with a number or letter, 2~60 characters.
    description string
    Event set description, unlimited character type, description within 200 characters.
    ebEventRuleId string
    ID of the resource.
    enable boolean
    Enable switch.
    tags {[key: string]: string}
    Tag description list.
    event_bus_id str
    event bus Id.
    event_pattern str
    Reference: Event Mode.
    rule_name str
    Event rule name, which can only contain letters, numbers, underscores, hyphens, starts with a letter and ends with a number or letter, 2~60 characters.
    description str
    Event set description, unlimited character type, description within 200 characters.
    eb_event_rule_id str
    ID of the resource.
    enable bool
    Enable switch.
    tags Mapping[str, str]
    Tag description list.
    eventBusId String
    event bus Id.
    eventPattern String
    Reference: Event Mode.
    ruleName String
    Event rule name, which can only contain letters, numbers, underscores, hyphens, starts with a letter and ends with a number or letter, 2~60 characters.
    description String
    Event set description, unlimited character type, description within 200 characters.
    ebEventRuleId String
    ID of the resource.
    enable Boolean
    Enable switch.
    tags Map<String>
    Tag description list.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the EbEventRule resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    RuleId string
    event rule id.
    Id string
    The provider-assigned unique ID for this managed resource.
    RuleId string
    event rule id.
    id String
    The provider-assigned unique ID for this managed resource.
    ruleId String
    event rule id.
    id string
    The provider-assigned unique ID for this managed resource.
    ruleId string
    event rule id.
    id str
    The provider-assigned unique ID for this managed resource.
    rule_id str
    event rule id.
    id String
    The provider-assigned unique ID for this managed resource.
    ruleId String
    event rule id.

    Look up Existing EbEventRule Resource

    Get an existing EbEventRule resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: EbEventRuleState, opts?: CustomResourceOptions): EbEventRule
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            description: Optional[str] = None,
            eb_event_rule_id: Optional[str] = None,
            enable: Optional[bool] = None,
            event_bus_id: Optional[str] = None,
            event_pattern: Optional[str] = None,
            rule_id: Optional[str] = None,
            rule_name: Optional[str] = None,
            tags: Optional[Mapping[str, str]] = None) -> EbEventRule
    func GetEbEventRule(ctx *Context, name string, id IDInput, state *EbEventRuleState, opts ...ResourceOption) (*EbEventRule, error)
    public static EbEventRule Get(string name, Input<string> id, EbEventRuleState? state, CustomResourceOptions? opts = null)
    public static EbEventRule get(String name, Output<String> id, EbEventRuleState state, CustomResourceOptions options)
    resources:  _:    type: tencentcloud:EbEventRule    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Description string
    Event set description, unlimited character type, description within 200 characters.
    EbEventRuleId string
    ID of the resource.
    Enable bool
    Enable switch.
    EventBusId string
    event bus Id.
    EventPattern string
    Reference: Event Mode.
    RuleId string
    event rule id.
    RuleName string
    Event rule name, which can only contain letters, numbers, underscores, hyphens, starts with a letter and ends with a number or letter, 2~60 characters.
    Tags Dictionary<string, string>
    Tag description list.
    Description string
    Event set description, unlimited character type, description within 200 characters.
    EbEventRuleId string
    ID of the resource.
    Enable bool
    Enable switch.
    EventBusId string
    event bus Id.
    EventPattern string
    Reference: Event Mode.
    RuleId string
    event rule id.
    RuleName string
    Event rule name, which can only contain letters, numbers, underscores, hyphens, starts with a letter and ends with a number or letter, 2~60 characters.
    Tags map[string]string
    Tag description list.
    description String
    Event set description, unlimited character type, description within 200 characters.
    ebEventRuleId String
    ID of the resource.
    enable Boolean
    Enable switch.
    eventBusId String
    event bus Id.
    eventPattern String
    Reference: Event Mode.
    ruleId String
    event rule id.
    ruleName String
    Event rule name, which can only contain letters, numbers, underscores, hyphens, starts with a letter and ends with a number or letter, 2~60 characters.
    tags Map<String,String>
    Tag description list.
    description string
    Event set description, unlimited character type, description within 200 characters.
    ebEventRuleId string
    ID of the resource.
    enable boolean
    Enable switch.
    eventBusId string
    event bus Id.
    eventPattern string
    Reference: Event Mode.
    ruleId string
    event rule id.
    ruleName string
    Event rule name, which can only contain letters, numbers, underscores, hyphens, starts with a letter and ends with a number or letter, 2~60 characters.
    tags {[key: string]: string}
    Tag description list.
    description str
    Event set description, unlimited character type, description within 200 characters.
    eb_event_rule_id str
    ID of the resource.
    enable bool
    Enable switch.
    event_bus_id str
    event bus Id.
    event_pattern str
    Reference: Event Mode.
    rule_id str
    event rule id.
    rule_name str
    Event rule name, which can only contain letters, numbers, underscores, hyphens, starts with a letter and ends with a number or letter, 2~60 characters.
    tags Mapping[str, str]
    Tag description list.
    description String
    Event set description, unlimited character type, description within 200 characters.
    ebEventRuleId String
    ID of the resource.
    enable Boolean
    Enable switch.
    eventBusId String
    event bus Id.
    eventPattern String
    Reference: Event Mode.
    ruleId String
    event rule id.
    ruleName String
    Event rule name, which can only contain letters, numbers, underscores, hyphens, starts with a letter and ends with a number or letter, 2~60 characters.
    tags Map<String>
    Tag description list.

    Import

    eb event_rule can be imported using the id, e.g.

    $ pulumi import tencentcloud:index/ebEventRule:EbEventRule event_rule event_rule_id
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    tencentcloud tencentcloudstack/terraform-provider-tencentcloud
    License
    Notes
    This Pulumi package is based on the tencentcloud Terraform Provider.
    tencentcloud logo
    tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack