// <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.Collections;
    using System.Collections.Generic;
    using System.Linq;

    /// <summary>
    /// NonResourcePolicyRule is a predicate that matches non-resource requests
    /// according to their verb and the target non-resource URL. A
    /// NonResourcePolicyRule matches a request if and only if both (a) at
    /// least one member of verbs matches the request and (b) at least one
    /// member of nonResourceURLs matches the request.
    /// </summary>
    public partial class V1beta1NonResourcePolicyRule
    {
        /// <summary>
        /// Initializes a new instance of the V1beta1NonResourcePolicyRule
        /// class.
        /// </summary>
        public V1beta1NonResourcePolicyRule()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the V1beta1NonResourcePolicyRule
        /// class.
        /// </summary>
        /// <param name="nonResourceURLs">`nonResourceURLs` is a set of url
        /// prefixes that a user should have access to and may not be empty.
        /// For example:
        /// - "/healthz" is legal
        /// - "/hea*" is illegal
        /// - "/hea" is legal but matches nothing
        /// - "/hea/*" also matches nothing
        /// - "/healthz/*" matches all per-component health checks.
        /// "*" matches all non-resource urls. if it is present, it must be the
        /// only entry. Required.</param>
        /// <param name="verbs">`verbs` is a list of matching verbs and may not
        /// be empty. "*" matches all verbs. If it is present, it must be the
        /// only entry. Required.</param>
        public V1beta1NonResourcePolicyRule(IList<string> nonResourceURLs, IList<string> verbs)
        {
            NonResourceURLs = nonResourceURLs;
            Verbs = verbs;
            CustomInit();
        }

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

        /// <summary>
        /// Gets or sets `nonResourceURLs` is a set of url prefixes that a user
        /// should have access to and may not be empty. For example:
        /// - "/healthz" is legal
        /// - "/hea*" is illegal
        /// - "/hea" is legal but matches nothing
        /// - "/hea/*" also matches nothing
        /// - "/healthz/*" matches all per-component health checks.
        /// "*" matches all non-resource urls. if it is present, it must be the
        /// only entry. Required.
        /// </summary>
        [JsonProperty(PropertyName = "nonResourceURLs")]
        public IList<string> NonResourceURLs { get; set; }

        /// <summary>
        /// Gets or sets `verbs` is a list of matching verbs and may not be
        /// empty. "*" matches all verbs. If it is present, it must be the only
        /// entry. Required.
        /// </summary>
        [JsonProperty(PropertyName = "verbs")]
        public IList<string> Verbs { get; set; }

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