// <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>
    /// ConfigMapNodeConfigSource contains the information to reference a
    /// ConfigMap as a config source for the Node.
    /// </summary>
    public partial class V1ConfigMapNodeConfigSource
    {
        /// <summary>
        /// Initializes a new instance of the V1ConfigMapNodeConfigSource
        /// class.
        /// </summary>
        public V1ConfigMapNodeConfigSource()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the V1ConfigMapNodeConfigSource
        /// class.
        /// </summary>
        /// <param name="kubeletConfigKey">KubeletConfigKey declares which key
        /// of the referenced ConfigMap corresponds to the KubeletConfiguration
        /// structure This field is required in all cases.</param>
        /// <param name="name">Name is the metadata.name of the referenced
        /// ConfigMap. This field is required in all cases.</param>
        /// <param name="namespaceProperty">Namespace is the metadata.namespace
        /// of the referenced ConfigMap. This field is required in all
        /// cases.</param>
        /// <param name="resourceVersion">ResourceVersion is the
        /// metadata.ResourceVersion of the referenced ConfigMap. This field is
        /// forbidden in Node.Spec, and required in Node.Status.</param>
        /// <param name="uid">UID is the metadata.UID of the referenced
        /// ConfigMap. This field is forbidden in Node.Spec, and required in
        /// Node.Status.</param>
        public V1ConfigMapNodeConfigSource(string kubeletConfigKey, string name, string namespaceProperty, string resourceVersion = default(string), string uid = default(string))
        {
            KubeletConfigKey = kubeletConfigKey;
            Name = name;
            NamespaceProperty = namespaceProperty;
            ResourceVersion = resourceVersion;
            Uid = uid;
            CustomInit();
        }

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

        /// <summary>
        /// Gets or sets kubeletConfigKey declares which key of the referenced
        /// ConfigMap corresponds to the KubeletConfiguration structure This
        /// field is required in all cases.
        /// </summary>
        [JsonProperty(PropertyName = "kubeletConfigKey")]
        public string KubeletConfigKey { get; set; }

        /// <summary>
        /// Gets or sets name is the metadata.name of the referenced ConfigMap.
        /// This field is required in all cases.
        /// </summary>
        [JsonProperty(PropertyName = "name")]
        public string Name { get; set; }

        /// <summary>
        /// Gets or sets namespace is the metadata.namespace of the referenced
        /// ConfigMap. This field is required in all cases.
        /// </summary>
        [JsonProperty(PropertyName = "namespace")]
        public string NamespaceProperty { get; set; }

        /// <summary>
        /// Gets or sets resourceVersion is the metadata.ResourceVersion of the
        /// referenced ConfigMap. This field is forbidden in Node.Spec, and
        /// required in Node.Status.
        /// </summary>
        [JsonProperty(PropertyName = "resourceVersion")]
        public string ResourceVersion { get; set; }

        /// <summary>
        /// Gets or sets UID is the metadata.UID of the referenced ConfigMap.
        /// This field is forbidden in Node.Spec, and required in Node.Status.
        /// </summary>
        [JsonProperty(PropertyName = "uid")]
        public string Uid { get; set; }

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