<reponame>rhysmdnz/pulumi-alicloud-rhys-hacks<filename>sdk/dotnet/Arms/PrometheusAlertRule.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.Arms
{
    /// <summary>
    /// Provides a Application Real-Time Monitoring Service (ARMS) Prometheus Alert Rule resource.
    /// 
    /// For information about Application Real-Time Monitoring Service (ARMS) Prometheus Alert Rule and how to use it, see [What is Prometheus Alert Rule](https://www.alibabacloud.com/help/en/doc-detail/212056.htm).
    /// 
    /// &gt; **NOTE:** Available in v1.136.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.Arms.PrometheusAlertRule("example", new()
    ///     {
    ///         ClusterId = "example_value",
    ///         Duration = "example_value",
    ///         Expression = "example_value",
    ///         Message = "example_value",
    ///         PrometheusAlertRuleName = "example_value",
    ///     });
    /// 
    /// });
    /// ```
    /// 
    /// ## Import
    /// 
    /// Application Real-Time Monitoring Service (ARMS) Prometheus Alert Rule can be imported using the id, e.g.
    /// 
    /// ```sh
    ///  $ pulumi import alicloud:arms/prometheusAlertRule:PrometheusAlertRule example &lt;cluster_id&gt;:&lt;prometheus_alert_rule_id&gt;
    /// ```
    /// </summary>
    [AliCloudResourceType("alicloud:arms/prometheusAlertRule:PrometheusAlertRule")]
    public partial class PrometheusAlertRule : global::Pulumi.CustomResource
    {
        /// <summary>
        /// The annotations of the alert rule.. See the following `Block annotations`.
        /// </summary>
        [Output("annotations")]
        public Output<ImmutableArray<Outputs.PrometheusAlertRuleAnnotation>> Annotations { get; private set; } = null!;

        /// <summary>
        /// The ID of the cluster.
        /// </summary>
        [Output("clusterId")]
        public Output<string> ClusterId { get; private set; } = null!;

        /// <summary>
        /// The ID of the notification policy. This parameter is required when the `notify_type` parameter is set to `DISPATCH_RULE`.
        /// </summary>
        [Output("dispatchRuleId")]
        public Output<string?> DispatchRuleId { get; private set; } = null!;

        /// <summary>
        /// The duration of the alert.
        /// </summary>
        [Output("duration")]
        public Output<string> Duration { get; private set; } = null!;

        /// <summary>
        /// The alert rule expression that follows the PromQL syntax.
        /// </summary>
        [Output("expression")]
        public Output<string> Expression { get; private set; } = null!;

        /// <summary>
        /// The labels of the resource. See the following `Block labels`.
        /// </summary>
        [Output("labels")]
        public Output<ImmutableArray<Outputs.PrometheusAlertRuleLabel>> Labels { get; private set; } = null!;

        /// <summary>
        /// The message of the alert notification.
        /// </summary>
        [Output("message")]
        public Output<string> Message { get; private set; } = null!;

        /// <summary>
        /// The method of sending the alert notification. Valid values: `ALERT_MANAGER`, `DISPATCH_RULE`.
        /// </summary>
        [Output("notifyType")]
        public Output<string?> NotifyType { get; private set; } = null!;

        /// <summary>
        /// The first ID of the resource.
        /// </summary>
        [Output("prometheusAlertRuleId")]
        public Output<int> PrometheusAlertRuleId { get; private set; } = null!;

        /// <summary>
        /// The name of the resource.
        /// </summary>
        [Output("prometheusAlertRuleName")]
        public Output<string> PrometheusAlertRuleName { get; private set; } = null!;

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

        /// <summary>
        /// The type of the alert rule.
        /// </summary>
        [Output("type")]
        public Output<string> Type { get; private set; } = null!;


        /// <summary>
        /// Create a PrometheusAlertRule 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 PrometheusAlertRule(string name, PrometheusAlertRuleArgs args, CustomResourceOptions? options = null)
            : base("alicloud:arms/prometheusAlertRule:PrometheusAlertRule", name, args ?? new PrometheusAlertRuleArgs(), MakeResourceOptions(options, ""))
        {
        }

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

    public sealed class PrometheusAlertRuleArgs : global::Pulumi.ResourceArgs
    {
        [Input("annotations")]
        private InputList<Inputs.PrometheusAlertRuleAnnotationArgs>? _annotations;

        /// <summary>
        /// The annotations of the alert rule.. See the following `Block annotations`.
        /// </summary>
        public InputList<Inputs.PrometheusAlertRuleAnnotationArgs> Annotations
        {
            get => _annotations ?? (_annotations = new InputList<Inputs.PrometheusAlertRuleAnnotationArgs>());
            set => _annotations = value;
        }

        /// <summary>
        /// The ID of the cluster.
        /// </summary>
        [Input("clusterId", required: true)]
        public Input<string> ClusterId { get; set; } = null!;

        /// <summary>
        /// The ID of the notification policy. This parameter is required when the `notify_type` parameter is set to `DISPATCH_RULE`.
        /// </summary>
        [Input("dispatchRuleId")]
        public Input<string>? DispatchRuleId { get; set; }

        /// <summary>
        /// The duration of the alert.
        /// </summary>
        [Input("duration", required: true)]
        public Input<string> Duration { get; set; } = null!;

        /// <summary>
        /// The alert rule expression that follows the PromQL syntax.
        /// </summary>
        [Input("expression", required: true)]
        public Input<string> Expression { get; set; } = null!;

        [Input("labels")]
        private InputList<Inputs.PrometheusAlertRuleLabelArgs>? _labels;

        /// <summary>
        /// The labels of the resource. See the following `Block labels`.
        /// </summary>
        public InputList<Inputs.PrometheusAlertRuleLabelArgs> Labels
        {
            get => _labels ?? (_labels = new InputList<Inputs.PrometheusAlertRuleLabelArgs>());
            set => _labels = value;
        }

        /// <summary>
        /// The message of the alert notification.
        /// </summary>
        [Input("message", required: true)]
        public Input<string> Message { get; set; } = null!;

        /// <summary>
        /// The method of sending the alert notification. Valid values: `ALERT_MANAGER`, `DISPATCH_RULE`.
        /// </summary>
        [Input("notifyType")]
        public Input<string>? NotifyType { get; set; }

        /// <summary>
        /// The name of the resource.
        /// </summary>
        [Input("prometheusAlertRuleName", required: true)]
        public Input<string> PrometheusAlertRuleName { get; set; } = null!;

        /// <summary>
        /// The type of the alert rule.
        /// </summary>
        [Input("type")]
        public Input<string>? Type { get; set; }

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

    public sealed class PrometheusAlertRuleState : global::Pulumi.ResourceArgs
    {
        [Input("annotations")]
        private InputList<Inputs.PrometheusAlertRuleAnnotationGetArgs>? _annotations;

        /// <summary>
        /// The annotations of the alert rule.. See the following `Block annotations`.
        /// </summary>
        public InputList<Inputs.PrometheusAlertRuleAnnotationGetArgs> Annotations
        {
            get => _annotations ?? (_annotations = new InputList<Inputs.PrometheusAlertRuleAnnotationGetArgs>());
            set => _annotations = value;
        }

        /// <summary>
        /// The ID of the cluster.
        /// </summary>
        [Input("clusterId")]
        public Input<string>? ClusterId { get; set; }

        /// <summary>
        /// The ID of the notification policy. This parameter is required when the `notify_type` parameter is set to `DISPATCH_RULE`.
        /// </summary>
        [Input("dispatchRuleId")]
        public Input<string>? DispatchRuleId { get; set; }

        /// <summary>
        /// The duration of the alert.
        /// </summary>
        [Input("duration")]
        public Input<string>? Duration { get; set; }

        /// <summary>
        /// The alert rule expression that follows the PromQL syntax.
        /// </summary>
        [Input("expression")]
        public Input<string>? Expression { get; set; }

        [Input("labels")]
        private InputList<Inputs.PrometheusAlertRuleLabelGetArgs>? _labels;

        /// <summary>
        /// The labels of the resource. See the following `Block labels`.
        /// </summary>
        public InputList<Inputs.PrometheusAlertRuleLabelGetArgs> Labels
        {
            get => _labels ?? (_labels = new InputList<Inputs.PrometheusAlertRuleLabelGetArgs>());
            set => _labels = value;
        }

        /// <summary>
        /// The message of the alert notification.
        /// </summary>
        [Input("message")]
        public Input<string>? Message { get; set; }

        /// <summary>
        /// The method of sending the alert notification. Valid values: `ALERT_MANAGER`, `DISPATCH_RULE`.
        /// </summary>
        [Input("notifyType")]
        public Input<string>? NotifyType { get; set; }

        /// <summary>
        /// The first ID of the resource.
        /// </summary>
        [Input("prometheusAlertRuleId")]
        public Input<int>? PrometheusAlertRuleId { get; set; }

        /// <summary>
        /// The name of the resource.
        /// </summary>
        [Input("prometheusAlertRuleName")]
        public Input<string>? PrometheusAlertRuleName { get; set; }

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

        /// <summary>
        /// The type of the alert rule.
        /// </summary>
        [Input("type")]
        public Input<string>? Type { get; set; }

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