// <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 V1Endpoint
    {
        /// <summary>
        /// Initializes a new instance of the V1Endpoint class.
        /// </summary>
        public V1Endpoint()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the V1Endpoint 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="deprecatedTopology">deprecatedTopology contains
        /// topology information part of the v1beta1 API. This field is
        /// deprecated, and will be removed when the v1beta1 API is removed (no
        /// sooner than kubernetes v1.24).  While this field can hold values,
        /// it is not writable through the v1 API, and any attempts to write to
        /// it will be silently ignored. Topology information can be found in
        /// the zone and nodeName fields instead.</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="zone">zone is the name of the Zone this endpoint
        /// exists in.</param>
        public V1Endpoint(IList<string> addresses, V1EndpointConditions conditions = default(V1EndpointConditions), IDictionary<string, string> deprecatedTopology = default(IDictionary<string, string>), V1EndpointHints hints = default(V1EndpointHints), string hostname = default(string), string nodeName = default(string), V1ObjectReference targetRef = default(V1ObjectReference), string zone = default(string))
        {
            Addresses = addresses;
            Conditions = conditions;
            DeprecatedTopology = deprecatedTopology;
            Hints = hints;
            Hostname = hostname;
            NodeName = nodeName;
            TargetRef = targetRef;
            Zone = zone;
            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 V1EndpointConditions Conditions { get; set; }

        /// <summary>
        /// Gets or sets deprecatedTopology contains topology information part
        /// of the v1beta1 API. This field is deprecated, and will be removed
        /// when the v1beta1 API is removed (no sooner than kubernetes v1.24).
        /// While this field can hold values, it is not writable through the v1
        /// API, and any attempts to write to it will be silently ignored.
        /// Topology information can be found in the zone and nodeName fields
        /// instead.
        /// </summary>
        [JsonProperty(PropertyName = "deprecatedTopology")]
        public IDictionary<string, string> DeprecatedTopology { get; set; }

        /// <summary>
        /// Gets or sets hints contains information associated with how an
        /// endpoint should be consumed.
        /// </summary>
        [JsonProperty(PropertyName = "hints")]
        public V1EndpointHints 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 zone is the name of the Zone this endpoint exists in.
        /// </summary>
        [JsonProperty(PropertyName = "zone")]
        public string Zone { 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");
            }
        }
    }
}
