// <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>
    /// IngressBackend describes all endpoints for a given service and port.
    /// </summary>
    public partial class V1beta1IngressBackend
    {
        /// <summary>
        /// Initializes a new instance of the V1beta1IngressBackend class.
        /// </summary>
        public V1beta1IngressBackend()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the V1beta1IngressBackend class.
        /// </summary>
        /// <param name="serviceName">Specifies the name of the referenced
        /// service.</param>
        /// <param name="servicePort">Specifies the port of the referenced
        /// service.</param>
        public V1beta1IngressBackend(string serviceName, IntstrIntOrString servicePort)
        {
            ServiceName = serviceName;
            ServicePort = servicePort;
            CustomInit();
        }

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

        /// <summary>
        /// Gets or sets specifies the name of the referenced service.
        /// </summary>
        [JsonProperty(PropertyName = "serviceName")]
        public string ServiceName { get; set; }

        /// <summary>
        /// Gets or sets specifies the port of the referenced service.
        /// </summary>
        [JsonProperty(PropertyName = "servicePort")]
        public IntstrIntOrString ServicePort { get; set; }

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