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

        /// <summary>
        /// Initializes a new instance of the V1IngressBackend class.
        /// </summary>
        /// <param name="resource">Resource is an ObjectRef to another
        /// Kubernetes resource in the namespace of the Ingress object. If
        /// resource is specified, a service.Name and service.Port must not be
        /// specified. This is a mutually exclusive setting with
        /// "Service".</param>
        /// <param name="service">Service references a Service as a Backend.
        /// This is a mutually exclusive setting with "Resource".</param>
        public V1IngressBackend(V1TypedLocalObjectReference resource = default(V1TypedLocalObjectReference), V1IngressServiceBackend service = default(V1IngressServiceBackend))
        {
            Resource = resource;
            Service = service;
            CustomInit();
        }

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

        /// <summary>
        /// Gets or sets resource is an ObjectRef to another Kubernetes
        /// resource in the namespace of the Ingress object. If resource is
        /// specified, a service.Name and service.Port must not be specified.
        /// This is a mutually exclusive setting with "Service".
        /// </summary>
        [JsonProperty(PropertyName = "resource")]
        public V1TypedLocalObjectReference Resource { get; set; }

        /// <summary>
        /// Gets or sets service references a Service as a Backend. This is a
        /// mutually exclusive setting with "Resource".
        /// </summary>
        [JsonProperty(PropertyName = "service")]
        public V1IngressServiceBackend Service { get; set; }

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