// <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>
    /// TokenRequest contains parameters of a service account token.
    /// </summary>
    public partial class Storagev1TokenRequest
    {
        /// <summary>
        /// Initializes a new instance of the Storagev1TokenRequest class.
        /// </summary>
        public Storagev1TokenRequest()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the Storagev1TokenRequest class.
        /// </summary>
        /// <param name="audience">Audience is the intended audience of the
        /// token in "TokenRequestSpec". It will default to the audiences of
        /// kube apiserver.</param>
        /// <param name="expirationSeconds">ExpirationSeconds is the duration
        /// of validity of the token in "TokenRequestSpec". It has the same
        /// default value of "ExpirationSeconds" in "TokenRequestSpec".</param>
        public Storagev1TokenRequest(string audience, long? expirationSeconds = default(long?))
        {
            Audience = audience;
            ExpirationSeconds = expirationSeconds;
            CustomInit();
        }

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

        /// <summary>
        /// Gets or sets audience is the intended audience of the token in
        /// "TokenRequestSpec". It will default to the audiences of kube
        /// apiserver.
        /// </summary>
        [JsonProperty(PropertyName = "audience")]
        public string Audience { get; set; }

        /// <summary>
        /// Gets or sets expirationSeconds is the duration of validity of the
        /// token in "TokenRequestSpec". It has the same default value of
        /// "ExpirationSeconds" in "TokenRequestSpec".
        /// </summary>
        [JsonProperty(PropertyName = "expirationSeconds")]
        public long? ExpirationSeconds { get; set; }

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