// <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>
    /// Endpoint represents a single logical "backend" implementing a service.
    /// </summary>
    public partial class V1beta1Endpoint
    {
        /// <summary>
        /// Initializes a new instance of the V1beta1Endpoint class.
        /// </summary>
        public V1beta1Endpoint()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the V1beta1Endpoint class.
        /// </summary>
        /// <param name="addresses">addresses of this endpoint. The contents of
        /// this field are interpreted according to the corresponding
        /// EndpointSlice addressType field. Consumers must handle different
        /// types of addresses in the context of their own capabilities. This
        /// must contain at least one address but no more than 100.</param>
        /// <param name="conditions">conditions contains information about the
        /// current status of the endpoint.</param>
        /// <param name="hints">hints contains information associated with how
        /// an endpoint should be consumed.</param>
        /// <param name="hostname">hostname of this endpoint. This field may be
        /// used by consumers of endpoints to distinguish endpoints from each
        /// other (e.g. in DNS names). Multiple endpoints which use the same
        /// hostname should be considered fungible (e.g. multiple A values in
        /// DNS). Must be lowercase and pass DNS Label (RFC 1123)
        /// validation.</param>
        /// <param name="nodeName">nodeName represents the name of the Node
        /// hosting this endpoint. This can be used to determine endpoints
        /// local to a Node. This field can be enabled with the
        /// EndpointSliceNodeName feature gate.</param>
        /// <param name="targetRef">targetRef is a reference to a Kubernetes
        /// object that represents this endpoint.</param>
        /// <param name="topology">topology contains arbitrary topology
        /// information associated with the endpoint. These key/value pairs
        /// must conform with the label format.
        /// https://kubernetes.io/docs/concepts/overview/working-with-objects/labels
        /// Topology may include a maximum of 16 key/value pairs. This
        /// includes, but is not limited to the following well known keys: *
        /// kubernetes.io/hostname: the value indicates the hostname of the
        /// node
        /// where the endpoint is located. This should match the corresponding
        /// node label.
        /// * topology.kubernetes.io/zone: the value indicates the zone where
        /// the
        /// endpoint is located. This should match the corresponding node
        /// label.
        /// * topology.kubernetes.io/region: the value indicates the region
        /// where the
        /// endpoint is located. This should match the corresponding node
        /// label.
        /// This field is deprecated and will be removed in future api
        /// versions.</param>
        public V1beta1Endpoint(IList<string> addresses, V1beta1EndpointConditions conditions = default(V1beta1EndpointConditions), V1beta1EndpointHints hints = default(V1beta1EndpointHints), string hostname = default(string), string nodeName = default(string), V1ObjectReference targetRef = default(V1ObjectReference), IDictionary<string, string> topology = default(IDictionary<string, string>))
        {
            Addresses = addresses;
            Conditions = conditions;
            Hints = hints;
            Hostname = hostname;
            NodeName = nodeName;
            TargetRef = targetRef;
            Topology = topology;
            CustomInit();
        }

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

        /// <summary>
        /// Gets or sets addresses of this endpoint. The contents of this field
        /// are interpreted according to the corresponding EndpointSlice
        /// addressType field. Consumers must handle different types of
        /// addresses in the context of their own capabilities. This must
        /// contain at least one address but no more than 100.
        /// </summary>
        [JsonProperty(PropertyName = "addresses")]
        public IList<string> Addresses { get; set; }

        /// <summary>
        /// Gets or sets conditions contains information about the current
        /// status of the endpoint.
        /// </summary>
        [JsonProperty(PropertyName = "conditions")]
        public V1beta1EndpointConditions Conditions { get; set; }

        /// <summary>
        /// Gets or sets hints contains information associated with how an
        /// endpoint should be consumed.
        /// </summary>
        [JsonProperty(PropertyName = "hints")]
        public V1beta1EndpointHints Hints { get; set; }

        /// <summary>
        /// Gets or sets hostname of this endpoint. This field may be used by
        /// consumers of endpoints to distinguish endpoints from each other
        /// (e.g. in DNS names). Multiple endpoints which use the same hostname
        /// should be considered fungible (e.g. multiple A values in DNS). Must
        /// be lowercase and pass DNS Label (RFC 1123) validation.
        /// </summary>
        [JsonProperty(PropertyName = "hostname")]
        public string Hostname { get; set; }

        /// <summary>
        /// Gets or sets nodeName represents the name of the Node hosting this
        /// endpoint. This can be used to determine endpoints local to a Node.
        /// This field can be enabled with the EndpointSliceNodeName feature
        /// gate.
        /// </summary>
        [JsonProperty(PropertyName = "nodeName")]
        public string NodeName { get; set; }

        /// <summary>
        /// Gets or sets targetRef is a reference to a Kubernetes object that
        /// represents this endpoint.
        /// </summary>
        [JsonProperty(PropertyName = "targetRef")]
        public V1ObjectReference TargetRef { get; set; }

        /// <summary>
        /// Gets or sets topology contains arbitrary topology information
        /// associated with the endpoint. These key/value pairs must conform
        /// with the label format.
        /// https://kubernetes.io/docs/concepts/overview/working-with-objects/labels
        /// Topology may include a maximum of 16 key/value pairs. This
        /// includes, but is not limited to the following well known keys: *
        /// kubernetes.io/hostname: the value indicates the hostname of the
        /// node
        /// where the endpoint is located. This should match the corresponding
        /// node label.
        /// * topology.kubernetes.io/zone: the value indicates the zone where
        /// the
        /// endpoint is located. This should match the corresponding node
        /// label.
        /// * topology.kubernetes.io/region: the value indicates the region
        /// where the
        /// endpoint is located. This should match the corresponding node
        /// label.
        /// This field is deprecated and will be removed in future api
        /// versions.
        /// </summary>
        [JsonProperty(PropertyName = "topology")]
        public IDictionary<string, string> Topology { get; set; }

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