// <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>
    /// ResourceFieldSelector represents container resources (cpu, memory) and
    /// their output format
    /// </summary>
    public partial class V1ResourceFieldSelector
    {
        /// <summary>
        /// Initializes a new instance of the V1ResourceFieldSelector class.
        /// </summary>
        public V1ResourceFieldSelector()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the V1ResourceFieldSelector class.
        /// </summary>
        /// <param name="resource">Required: resource to select</param>
        /// <param name="containerName">Container name: required for volumes,
        /// optional for env vars</param>
        /// <param name="divisor">Specifies the output format of the exposed
        /// resources, defaults to "1"</param>
        public V1ResourceFieldSelector(string resource, string containerName = default(string), ResourceQuantity divisor = default(ResourceQuantity))
        {
            ContainerName = containerName;
            Divisor = divisor;
            Resource = resource;
            CustomInit();
        }

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

        /// <summary>
        /// Gets or sets container name: required for volumes, optional for env
        /// vars
        /// </summary>
        [JsonProperty(PropertyName = "containerName")]
        public string ContainerName { get; set; }

        /// <summary>
        /// Gets or sets specifies the output format of the exposed resources,
        /// defaults to "1"
        /// </summary>
        [JsonProperty(PropertyName = "divisor")]
        public ResourceQuantity Divisor { get; set; }

        /// <summary>
        /// Gets or sets required: resource to select
        /// </summary>
        [JsonProperty(PropertyName = "resource")]
        public string Resource { get; set; }

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