// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;

namespace Pulumi.AliCloud.EventBridge
{
    /// <summary>
    /// Provides a Event Bridge Event Source resource.
    /// 
    /// For information about Event Bridge Event Source and how to use it, see [What is Event Source](https://www.alibabacloud.com/help/doc-detail/188425.htm).
    /// 
    /// &gt; **NOTE:** Available in v1.130.0+.
    /// 
    /// ## Example Usage
    /// 
    /// Basic Usage
    /// 
    /// ```csharp
    /// using System.Collections.Generic;
    /// using Pulumi;
    /// using AliCloud = Pulumi.AliCloud;
    /// 
    /// return await Deployment.RunAsync(() =&gt; 
    /// {
    ///     var example = new AliCloud.EventBridge.EventSource("example", new()
    ///     {
    ///         Description = "tf-test",
    ///         EventBusName = "bus_name",
    ///         EventSourceName = "tftest",
    ///         ExternalSourceConfig = 
    ///         {
    ///             { "QueueName", "mns_queuqe_name" },
    ///         },
    ///         ExternalSourceType = "MNS",
    ///         LinkedExternalSource = true,
    ///     });
    /// 
    /// });
    /// ```
    /// 
    /// ## Import
    /// 
    /// Event Bridge Event Source can be imported using the id, e.g.
    /// 
    /// ```sh
    ///  $ pulumi import alicloud:eventbridge/eventSource:EventSource example &lt;event_source_name&gt;
    /// ```
    /// </summary>
    [AliCloudResourceType("alicloud:eventbridge/eventSource:EventSource")]
    public partial class EventSource : global::Pulumi.CustomResource
    {
        /// <summary>
        /// The detail describe of event source.
        /// </summary>
        [Output("description")]
        public Output<string?> Description { get; private set; } = null!;

        /// <summary>
        /// The name of event bus.
        /// </summary>
        [Output("eventBusName")]
        public Output<string> EventBusName { get; private set; } = null!;

        /// <summary>
        /// The code name of event source.
        /// </summary>
        [Output("eventSourceName")]
        public Output<string> EventSourceName { get; private set; } = null!;

        /// <summary>
        /// The config of external source.
        /// When `external_source_type` is `RabbitMQ`, The following attributes are supported:
        /// `RegionId` - The region ID of RabbitMQ.
        /// `InstanceId` - The instance ID of RabbitMQ.
        /// `VirtualHostName` - The virtual host name of RabbitMQ.
        /// `QueueName` - The queue name of RabbitMQ.
        /// When `external_source_type` is `RabbitMQ`, The following attributes are supported:
        /// `RegionId` - The region ID of RabbitMQ.
        /// `InstanceId` - The instance ID of RabbitMQ.
        /// `Topic` - The topic of RabbitMQ.
        /// `Offset` -  The offset of RabbitMQ, valid values: `CONSUME_FROM_FIRST_OFFSET`, `CONSUME_FROM_LAST_OFFSET` and `CONSUME_FROM_TIMESTAMP`.
        /// `GroupID` - The group ID of consumer.
        /// When `external_source_type` is `MNS`, The following attributes are supported:
        /// `QueueName` - The queue name of MNS.
        /// </summary>
        [Output("externalSourceConfig")]
        public Output<ImmutableDictionary<string, object>?> ExternalSourceConfig { get; private set; } = null!;

        /// <summary>
        /// The type of external data source. Valid value : `RabbitMQ`, `RocketMQ` and `MNS`. **NOTE:** Only When `linked_external_source` is `true`, This field is valid.
        /// </summary>
        [Output("externalSourceType")]
        public Output<string?> ExternalSourceType { get; private set; } = null!;

        /// <summary>
        /// Whether to connect to an external data source. Default value: `false`
        /// </summary>
        [Output("linkedExternalSource")]
        public Output<bool> LinkedExternalSource { get; private set; } = null!;


        /// <summary>
        /// Create a EventSource resource with the given unique name, arguments, and options.
        /// </summary>
        ///
        /// <param name="name">The unique name of the resource</param>
        /// <param name="args">The arguments used to populate this resource's properties</param>
        /// <param name="options">A bag of options that control this resource's behavior</param>
        public EventSource(string name, EventSourceArgs args, CustomResourceOptions? options = null)
            : base("alicloud:eventbridge/eventSource:EventSource", name, args ?? new EventSourceArgs(), MakeResourceOptions(options, ""))
        {
        }

        private EventSource(string name, Input<string> id, EventSourceState? state = null, CustomResourceOptions? options = null)
            : base("alicloud:eventbridge/eventSource:EventSource", name, state, MakeResourceOptions(options, id))
        {
        }

        private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id)
        {
            var defaultOptions = new CustomResourceOptions
            {
                Version = Utilities.Version,
                PluginDownloadURL = "github://api.github.com/rhysmdnz/pulumi-alicloud",
            };
            var merged = CustomResourceOptions.Merge(defaultOptions, options);
            // Override the ID if one was specified for consistency with other language SDKs.
            merged.Id = id ?? merged.Id;
            return merged;
        }
        /// <summary>
        /// Get an existing EventSource resource's state with the given name, ID, and optional extra
        /// properties used to qualify the lookup.
        /// </summary>
        ///
        /// <param name="name">The unique name of the resulting resource.</param>
        /// <param name="id">The unique provider ID of the resource to lookup.</param>
        /// <param name="state">Any extra arguments used during the lookup.</param>
        /// <param name="options">A bag of options that control this resource's behavior</param>
        public static EventSource Get(string name, Input<string> id, EventSourceState? state = null, CustomResourceOptions? options = null)
        {
            return new EventSource(name, id, state, options);
        }
    }

    public sealed class EventSourceArgs : global::Pulumi.ResourceArgs
    {
        /// <summary>
        /// The detail describe of event source.
        /// </summary>
        [Input("description")]
        public Input<string>? Description { get; set; }

        /// <summary>
        /// The name of event bus.
        /// </summary>
        [Input("eventBusName", required: true)]
        public Input<string> EventBusName { get; set; } = null!;

        /// <summary>
        /// The code name of event source.
        /// </summary>
        [Input("eventSourceName", required: true)]
        public Input<string> EventSourceName { get; set; } = null!;

        [Input("externalSourceConfig")]
        private InputMap<object>? _externalSourceConfig;

        /// <summary>
        /// The config of external source.
        /// When `external_source_type` is `RabbitMQ`, The following attributes are supported:
        /// `RegionId` - The region ID of RabbitMQ.
        /// `InstanceId` - The instance ID of RabbitMQ.
        /// `VirtualHostName` - The virtual host name of RabbitMQ.
        /// `QueueName` - The queue name of RabbitMQ.
        /// When `external_source_type` is `RabbitMQ`, The following attributes are supported:
        /// `RegionId` - The region ID of RabbitMQ.
        /// `InstanceId` - The instance ID of RabbitMQ.
        /// `Topic` - The topic of RabbitMQ.
        /// `Offset` -  The offset of RabbitMQ, valid values: `CONSUME_FROM_FIRST_OFFSET`, `CONSUME_FROM_LAST_OFFSET` and `CONSUME_FROM_TIMESTAMP`.
        /// `GroupID` - The group ID of consumer.
        /// When `external_source_type` is `MNS`, The following attributes are supported:
        /// `QueueName` - The queue name of MNS.
        /// </summary>
        public InputMap<object> ExternalSourceConfig
        {
            get => _externalSourceConfig ?? (_externalSourceConfig = new InputMap<object>());
            set => _externalSourceConfig = value;
        }

        /// <summary>
        /// The type of external data source. Valid value : `RabbitMQ`, `RocketMQ` and `MNS`. **NOTE:** Only When `linked_external_source` is `true`, This field is valid.
        /// </summary>
        [Input("externalSourceType")]
        public Input<string>? ExternalSourceType { get; set; }

        /// <summary>
        /// Whether to connect to an external data source. Default value: `false`
        /// </summary>
        [Input("linkedExternalSource")]
        public Input<bool>? LinkedExternalSource { get; set; }

        public EventSourceArgs()
        {
        }
        public static new EventSourceArgs Empty => new EventSourceArgs();
    }

    public sealed class EventSourceState : global::Pulumi.ResourceArgs
    {
        /// <summary>
        /// The detail describe of event source.
        /// </summary>
        [Input("description")]
        public Input<string>? Description { get; set; }

        /// <summary>
        /// The name of event bus.
        /// </summary>
        [Input("eventBusName")]
        public Input<string>? EventBusName { get; set; }

        /// <summary>
        /// The code name of event source.
        /// </summary>
        [Input("eventSourceName")]
        public Input<string>? EventSourceName { get; set; }

        [Input("externalSourceConfig")]
        private InputMap<object>? _externalSourceConfig;

        /// <summary>
        /// The config of external source.
        /// When `external_source_type` is `RabbitMQ`, The following attributes are supported:
        /// `RegionId` - The region ID of RabbitMQ.
        /// `InstanceId` - The instance ID of RabbitMQ.
        /// `VirtualHostName` - The virtual host name of RabbitMQ.
        /// `QueueName` - The queue name of RabbitMQ.
        /// When `external_source_type` is `RabbitMQ`, The following attributes are supported:
        /// `RegionId` - The region ID of RabbitMQ.
        /// `InstanceId` - The instance ID of RabbitMQ.
        /// `Topic` - The topic of RabbitMQ.
        /// `Offset` -  The offset of RabbitMQ, valid values: `CONSUME_FROM_FIRST_OFFSET`, `CONSUME_FROM_LAST_OFFSET` and `CONSUME_FROM_TIMESTAMP`.
        /// `GroupID` - The group ID of consumer.
        /// When `external_source_type` is `MNS`, The following attributes are supported:
        /// `QueueName` - The queue name of MNS.
        /// </summary>
        public InputMap<object> ExternalSourceConfig
        {
            get => _externalSourceConfig ?? (_externalSourceConfig = new InputMap<object>());
            set => _externalSourceConfig = value;
        }

        /// <summary>
        /// The type of external data source. Valid value : `RabbitMQ`, `RocketMQ` and `MNS`. **NOTE:** Only When `linked_external_source` is `true`, This field is valid.
        /// </summary>
        [Input("externalSourceType")]
        public Input<string>? ExternalSourceType { get; set; }

        /// <summary>
        /// Whether to connect to an external data source. Default value: `false`
        /// </summary>
        [Input("linkedExternalSource")]
        public Input<bool>? LinkedExternalSource { get; set; }

        public EventSourceState()
        {
        }
        public static new EventSourceState Empty => new EventSourceState();
    }
}
