// <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>
    /// NetworkPolicyPort describes a port to allow traffic on
    /// </summary>
    public partial class V1NetworkPolicyPort
    {
        /// <summary>
        /// Initializes a new instance of the V1NetworkPolicyPort class.
        /// </summary>
        public V1NetworkPolicyPort()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the V1NetworkPolicyPort class.
        /// </summary>
        /// <param name="endPort">If set, indicates that the range of ports
        /// from port to endPort, inclusive, should be allowed by the policy.
        /// This field cannot be defined if the port field is not defined or if
        /// the port field is defined as a named (string) port. The endPort
        /// must be equal or greater than port. This feature is in Alpha state
        /// and should be enabled using the Feature Gate
        /// "NetworkPolicyEndPort".</param>
        /// <param name="port">The port on the given protocol. This can either
        /// be a numerical or named port on a pod. If this field is not
        /// provided, this matches all port names and numbers. If present, only
        /// traffic on the specified protocol AND port will be matched.</param>
        /// <param name="protocol">The protocol (TCP, UDP, or SCTP) which
        /// traffic must match. If not specified, this field defaults to
        /// TCP.</param>
        public V1NetworkPolicyPort(int? endPort = default(int?), IntstrIntOrString port = default(IntstrIntOrString), string protocol = default(string))
        {
            EndPort = endPort;
            Port = port;
            Protocol = protocol;
            CustomInit();
        }

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

        /// <summary>
        /// Gets or sets if set, indicates that the range of ports from port to
        /// endPort, inclusive, should be allowed by the policy. This field
        /// cannot be defined if the port field is not defined or if the port
        /// field is defined as a named (string) port. The endPort must be
        /// equal or greater than port. This feature is in Alpha state and
        /// should be enabled using the Feature Gate "NetworkPolicyEndPort".
        /// </summary>
        [JsonProperty(PropertyName = "endPort")]
        public int? EndPort { get; set; }

        /// <summary>
        /// Gets or sets the port on the given protocol. This can either be a
        /// numerical or named port on a pod. If this field is not provided,
        /// this matches all port names and numbers. If present, only traffic
        /// on the specified protocol AND port will be matched.
        /// </summary>
        [JsonProperty(PropertyName = "port")]
        public IntstrIntOrString Port { get; set; }

        /// <summary>
        /// Gets or sets the protocol (TCP, UDP, or SCTP) which traffic must
        /// match. If not specified, this field defaults to TCP.
        /// </summary>
        [JsonProperty(PropertyName = "protocol")]
        public string Protocol { get; set; }

    }
}
