// <auto-generated>
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// </auto-generated>

namespace k8s.Models
{
    using Microsoft.Rest;
    using Newtonsoft.Json;
    using System.Linq;

    /// <summary>
    /// ExternalMetricSource indicates how to scale on a metric not associated
    /// with any Kubernetes object (for example length of queue in cloud
    /// messaging service, or QPS from loadbalancer running outside of
    /// cluster). Exactly one "target" type should be set.
    /// </summary>
    public partial class V2beta1ExternalMetricSource
    {
        /// <summary>
        /// Initializes a new instance of the V2beta1ExternalMetricSource
        /// class.
        /// </summary>
        public V2beta1ExternalMetricSource()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the V2beta1ExternalMetricSource
        /// class.
        /// </summary>
        /// <param name="metricName">metricName is the name of the metric in
        /// question.</param>
        /// <param name="metricSelector">metricSelector is used to identify a
        /// specific time series within a given metric.</param>
        /// <param name="targetAverageValue">targetAverageValue is the target
        /// per-pod value of global metric (as a quantity). Mutually exclusive
        /// with TargetValue.</param>
        /// <param name="targetValue">targetValue is the target value of the
        /// metric (as a quantity). Mutually exclusive with
        /// TargetAverageValue.</param>
        public V2beta1ExternalMetricSource(string metricName, V1LabelSelector metricSelector = default(V1LabelSelector), ResourceQuantity targetAverageValue = default(ResourceQuantity), ResourceQuantity targetValue = default(ResourceQuantity))
        {
            MetricName = metricName;
            MetricSelector = metricSelector;
            TargetAverageValue = targetAverageValue;
            TargetValue = targetValue;
            CustomInit();
        }

        /// <summary>
        /// An initialization method that performs custom operations like setting defaults
        /// </summary>
        partial void CustomInit();

        /// <summary>
        /// Gets or sets metricName is the name of the metric in question.
        /// </summary>
        [JsonProperty(PropertyName = "metricName")]
        public string MetricName { get; set; }

        /// <summary>
        /// Gets or sets metricSelector is used to identify a specific time
        /// series within a given metric.
        /// </summary>
        [JsonProperty(PropertyName = "metricSelector")]
        public V1LabelSelector MetricSelector { get; set; }

        /// <summary>
        /// Gets or sets targetAverageValue is the target per-pod value of
        /// global metric (as a quantity). Mutually exclusive with TargetValue.
        /// </summary>
        [JsonProperty(PropertyName = "targetAverageValue")]
        public ResourceQuantity TargetAverageValue { get; set; }

        /// <summary>
        /// Gets or sets targetValue is the target value of the metric (as a
        /// quantity). Mutually exclusive with TargetAverageValue.
        /// </summary>
        [JsonProperty(PropertyName = "targetValue")]
        public ResourceQuantity TargetValue { get; set; }

        /// <summary>
        /// Validate the object.
        /// </summary>
        /// <exception cref="ValidationException">
        /// Thrown if validation fails
        /// </exception>
        public virtual void Validate()
        {
            if (MetricName == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "MetricName");
            }
        }
    }
}
