// <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>
    /// VolumeMount describes a mounting of a Volume within a container.
    /// </summary>
    public partial class V1VolumeMount
    {
        /// <summary>
        /// Initializes a new instance of the V1VolumeMount class.
        /// </summary>
        public V1VolumeMount()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the V1VolumeMount class.
        /// </summary>
        /// <param name="mountPath">Path within the container at which the
        /// volume should be mounted.  Must not contain ':'.</param>
        /// <param name="name">This must match the Name of a Volume.</param>
        /// <param name="mountPropagation">mountPropagation determines how
        /// mounts are propagated from the host to container and the other way
        /// around. When not set, MountPropagationNone is used. This field is
        /// beta in 1.10.</param>
        /// <param name="readOnlyProperty">Mounted read-only if true,
        /// read-write otherwise (false or unspecified). Defaults to
        /// false.</param>
        /// <param name="subPath">Path within the volume from which the
        /// container's volume should be mounted. Defaults to "" (volume's
        /// root).</param>
        /// <param name="subPathExpr">Expanded path within the volume from
        /// which the container's volume should be mounted. Behaves similarly
        /// to SubPath but environment variable references $(VAR_NAME) are
        /// expanded using the container's environment. Defaults to ""
        /// (volume's root). SubPathExpr and SubPath are mutually
        /// exclusive.</param>
        public V1VolumeMount(string mountPath, string name, string mountPropagation = default(string), bool? readOnlyProperty = default(bool?), string subPath = default(string), string subPathExpr = default(string))
        {
            MountPath = mountPath;
            MountPropagation = mountPropagation;
            Name = name;
            ReadOnlyProperty = readOnlyProperty;
            SubPath = subPath;
            SubPathExpr = subPathExpr;
            CustomInit();
        }

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

        /// <summary>
        /// Gets or sets path within the container at which the volume should
        /// be mounted.  Must not contain ':'.
        /// </summary>
        [JsonProperty(PropertyName = "mountPath")]
        public string MountPath { get; set; }

        /// <summary>
        /// Gets or sets mountPropagation determines how mounts are propagated
        /// from the host to container and the other way around. When not set,
        /// MountPropagationNone is used. This field is beta in 1.10.
        /// </summary>
        [JsonProperty(PropertyName = "mountPropagation")]
        public string MountPropagation { get; set; }

        /// <summary>
        /// Gets or sets this must match the Name of a Volume.
        /// </summary>
        [JsonProperty(PropertyName = "name")]
        public string Name { get; set; }

        /// <summary>
        /// Gets or sets mounted read-only if true, read-write otherwise (false
        /// or unspecified). Defaults to false.
        /// </summary>
        [JsonProperty(PropertyName = "readOnly")]
        public bool? ReadOnlyProperty { get; set; }

        /// <summary>
        /// Gets or sets path within the volume from which the container's
        /// volume should be mounted. Defaults to "" (volume's root).
        /// </summary>
        [JsonProperty(PropertyName = "subPath")]
        public string SubPath { get; set; }

        /// <summary>
        /// Gets or sets expanded path within the volume from which the
        /// container's volume should be mounted. Behaves similarly to SubPath
        /// but environment variable references $(VAR_NAME) are expanded using
        /// the container's environment. Defaults to "" (volume's root).
        /// SubPathExpr and SubPath are mutually exclusive.
        /// </summary>
        [JsonProperty(PropertyName = "subPathExpr")]
        public string SubPathExpr { get; set; }

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