// <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 Newtonsoft.Json;
    using System.Linq;

    /// <summary>
    /// Represents an ephemeral volume that is handled by a normal storage
    /// driver.
    /// </summary>
    public partial class V1EphemeralVolumeSource
    {
        /// <summary>
        /// Initializes a new instance of the V1EphemeralVolumeSource class.
        /// </summary>
        public V1EphemeralVolumeSource()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the V1EphemeralVolumeSource class.
        /// </summary>
        /// <param name="volumeClaimTemplate">Will be used to create a
        /// stand-alone PVC to provision the volume. The pod in which this
        /// EphemeralVolumeSource is embedded will be the owner of the PVC,
        /// i.e. the PVC will be deleted together with the pod.  The name of
        /// the PVC will be `&lt;pod name&gt;-&lt;volume name&gt;` where
        /// `&lt;volume name&gt;` is the name from the `PodSpec.Volumes` array
        /// entry. Pod validation will reject the pod if the concatenated name
        /// is not valid for a PVC (for example, too long).
        ///
        /// An existing PVC with that name that is not owned by the pod will
        /// *not* be used for the pod to avoid using an unrelated volume by
        /// mistake. Starting the pod is then blocked until the unrelated PVC
        /// is removed. If such a pre-created PVC is meant to be used by the
        /// pod, the PVC has to updated with an owner reference to the pod once
        /// the pod exists. Normally this should not be necessary, but it may
        /// be useful when manually reconstructing a broken cluster.
        ///
        /// This field is read-only and no changes will be made by Kubernetes
        /// to the PVC after it has been created.
        ///
        /// Required, must not be nil.</param>
        public V1EphemeralVolumeSource(V1PersistentVolumeClaimTemplate volumeClaimTemplate = default(V1PersistentVolumeClaimTemplate))
        {
            VolumeClaimTemplate = volumeClaimTemplate;
            CustomInit();
        }

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

        /// <summary>
        /// Gets or sets will be used to create a stand-alone PVC to provision
        /// the volume. The pod in which this EphemeralVolumeSource is embedded
        /// will be the owner of the PVC, i.e. the PVC will be deleted together
        /// with the pod.  The name of the PVC will be `&amp;lt;pod
        /// name&amp;gt;-&amp;lt;volume name&amp;gt;` where `&amp;lt;volume
        /// name&amp;gt;` is the name from the `PodSpec.Volumes` array entry.
        /// Pod validation will reject the pod if the concatenated name is not
        /// valid for a PVC (for example, too long).
        ///
        /// An existing PVC with that name that is not owned by the pod will
        /// *not* be used for the pod to avoid using an unrelated volume by
        /// mistake. Starting the pod is then blocked until the unrelated PVC
        /// is removed. If such a pre-created PVC is meant to be used by the
        /// pod, the PVC has to updated with an owner reference to the pod once
        /// the pod exists. Normally this should not be necessary, but it may
        /// be useful when manually reconstructing a broken cluster.
        ///
        /// This field is read-only and no changes will be made by Kubernetes
        /// to the PVC after it has been created.
        ///
        /// Required, must not be nil.
        /// </summary>
        [JsonProperty(PropertyName = "volumeClaimTemplate")]
        public V1PersistentVolumeClaimTemplate VolumeClaimTemplate { get; set; }

        /// <summary>
        /// Validate the object.
        /// </summary>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown if validation fails
        /// </exception>
        public virtual void Validate()
        {
            if (VolumeClaimTemplate != null)
            {
                VolumeClaimTemplate.Validate();
            }
        }
    }
}
