<filename>sdk/dotnet/Cms/EventRule.cs// *** 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.Cms
{
    /// <summary>
    /// Provides a Cloud Monitor Service Event Rule resource.
    /// 
    /// For information about Cloud Monitor Service Event Rule and how to use it, see [What is Event Rule](https://www.alibabacloud.com/help/en/cloudmonitor/latest/puteventrule).
    /// 
    /// &gt; **NOTE:** Available in v1.182.0+.
    /// 
    /// ## Example Usage
    /// 
    /// Basic Usage
    /// 
    /// ```csharp
    /// using System.Collections.Generic;
    /// using Pulumi;
    /// using AliCloud = Pulumi.AliCloud;
    /// 
    /// return await Deployment.RunAsync(() =&gt; 
    /// {
    ///     var @default = new AliCloud.Cms.MonitorGroup("default", new()
    ///     {
    ///         MonitorGroupName = "example_value",
    ///     });
    /// 
    ///     var example = new AliCloud.Cms.EventRule("example", new()
    ///     {
    ///         RuleName = "example_value",
    ///         GroupId = @default.Id,
    ///         Description = "example_value",
    ///         Status = "ENABLED",
    ///         EventPattern = new AliCloud.Cms.Inputs.EventRuleEventPatternArgs
    ///         {
    ///             Product = "ecs",
    ///             EventTypeLists = new[]
    ///             {
    ///                 "StatusNotification",
    ///             },
    ///             LevelLists = new[]
    ///             {
    ///                 "CRITICAL",
    ///             },
    ///             NameLists = new[]
    ///             {
    ///                 "example_value",
    ///             },
    ///             SqlFilter = "example_value",
    ///         },
    ///         SilenceTime = 100,
    ///     });
    /// 
    /// });
    /// ```
    /// 
    /// ## Import
    /// 
    /// Cloud Monitor Service Event Rule can be imported using the id, e.g.
    /// 
    /// ```sh
    ///  $ pulumi import alicloud:cms/eventRule:EventRule example &lt;rule_name&gt;
    /// ```
    /// </summary>
    [AliCloudResourceType("alicloud:cms/eventRule:EventRule")]
    public partial class EventRule : global::Pulumi.CustomResource
    {
        /// <summary>
        /// The description of the event-triggered alert rule.
        /// </summary>
        [Output("description")]
        public Output<string?> Description { get; private set; } = null!;

        /// <summary>
        /// Event mode, used to describe the trigger conditions for this event. See the following `Block event_pattern`.
        /// </summary>
        [Output("eventPattern")]
        public Output<Outputs.EventRuleEventPattern> EventPattern { get; private set; } = null!;

        /// <summary>
        /// The ID of the application group to which the event-triggered alert rule belongs.
        /// </summary>
        [Output("groupId")]
        public Output<string?> GroupId { get; private set; } = null!;

        /// <summary>
        /// The name of the event-triggered alert rule.
        /// </summary>
        [Output("ruleName")]
        public Output<string> RuleName { get; private set; } = null!;

        /// <summary>
        /// The silence time.
        /// </summary>
        [Output("silenceTime")]
        public Output<int?> SilenceTime { get; private set; } = null!;

        /// <summary>
        /// The status of the resource. Valid values: `ENABLED`, `DISABLED`.
        /// </summary>
        [Output("status")]
        public Output<string> Status { get; private set; } = null!;


        /// <summary>
        /// Create a EventRule 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 EventRule(string name, EventRuleArgs args, CustomResourceOptions? options = null)
            : base("alicloud:cms/eventRule:EventRule", name, args ?? new EventRuleArgs(), MakeResourceOptions(options, ""))
        {
        }

        private EventRule(string name, Input<string> id, EventRuleState? state = null, CustomResourceOptions? options = null)
            : base("alicloud:cms/eventRule:EventRule", 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 EventRule 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 EventRule Get(string name, Input<string> id, EventRuleState? state = null, CustomResourceOptions? options = null)
        {
            return new EventRule(name, id, state, options);
        }
    }

    public sealed class EventRuleArgs : global::Pulumi.ResourceArgs
    {
        /// <summary>
        /// The description of the event-triggered alert rule.
        /// </summary>
        [Input("description")]
        public Input<string>? Description { get; set; }

        /// <summary>
        /// Event mode, used to describe the trigger conditions for this event. See the following `Block event_pattern`.
        /// </summary>
        [Input("eventPattern", required: true)]
        public Input<Inputs.EventRuleEventPatternArgs> EventPattern { get; set; } = null!;

        /// <summary>
        /// The ID of the application group to which the event-triggered alert rule belongs.
        /// </summary>
        [Input("groupId")]
        public Input<string>? GroupId { get; set; }

        /// <summary>
        /// The name of the event-triggered alert rule.
        /// </summary>
        [Input("ruleName", required: true)]
        public Input<string> RuleName { get; set; } = null!;

        /// <summary>
        /// The silence time.
        /// </summary>
        [Input("silenceTime")]
        public Input<int>? SilenceTime { get; set; }

        /// <summary>
        /// The status of the resource. Valid values: `ENABLED`, `DISABLED`.
        /// </summary>
        [Input("status")]
        public Input<string>? Status { get; set; }

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

    public sealed class EventRuleState : global::Pulumi.ResourceArgs
    {
        /// <summary>
        /// The description of the event-triggered alert rule.
        /// </summary>
        [Input("description")]
        public Input<string>? Description { get; set; }

        /// <summary>
        /// Event mode, used to describe the trigger conditions for this event. See the following `Block event_pattern`.
        /// </summary>
        [Input("eventPattern")]
        public Input<Inputs.EventRuleEventPatternGetArgs>? EventPattern { get; set; }

        /// <summary>
        /// The ID of the application group to which the event-triggered alert rule belongs.
        /// </summary>
        [Input("groupId")]
        public Input<string>? GroupId { get; set; }

        /// <summary>
        /// The name of the event-triggered alert rule.
        /// </summary>
        [Input("ruleName")]
        public Input<string>? RuleName { get; set; }

        /// <summary>
        /// The silence time.
        /// </summary>
        [Input("silenceTime")]
        public Input<int>? SilenceTime { get; set; }

        /// <summary>
        /// The status of the resource. Valid values: `ENABLED`, `DISABLED`.
        /// </summary>
        [Input("status")]
        public Input<string>? Status { get; set; }

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