// <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>
    /// PersistentVolumeClaimTemplate is used to produce PersistentVolumeClaim
    /// objects as part of an EphemeralVolumeSource.
    /// </summary>
    public partial class V1PersistentVolumeClaimTemplate
    {
        /// <summary>
        /// Initializes a new instance of the V1PersistentVolumeClaimTemplate
        /// class.
        /// </summary>
        public V1PersistentVolumeClaimTemplate()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the V1PersistentVolumeClaimTemplate
        /// class.
        /// </summary>
        /// <param name="spec">The specification for the PersistentVolumeClaim.
        /// The entire content is copied unchanged into the PVC that gets
        /// created from this template. The same fields as in a
        /// PersistentVolumeClaim are also valid here.</param>
        /// <param name="metadata">May contain labels and annotations that will
        /// be copied into the PVC when creating it. No other fields are
        /// allowed and will be rejected during validation.</param>
        public V1PersistentVolumeClaimTemplate(V1PersistentVolumeClaimSpec spec, V1ObjectMeta metadata = default(V1ObjectMeta))
        {
            Metadata = metadata;
            Spec = spec;
            CustomInit();
        }

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

        /// <summary>
        /// Gets or sets may contain labels and annotations that will be copied
        /// into the PVC when creating it. No other fields are allowed and will
        /// be rejected during validation.
        /// </summary>
        [JsonProperty(PropertyName = "metadata")]
        public V1ObjectMeta Metadata { get; set; }

        /// <summary>
        /// Gets or sets the specification for the PersistentVolumeClaim. The
        /// entire content is copied unchanged into the PVC that gets created
        /// from this template. The same fields as in a PersistentVolumeClaim
        /// are also valid here.
        /// </summary>
        [JsonProperty(PropertyName = "spec")]
        public V1PersistentVolumeClaimSpec Spec { get; set; }

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