# This file was generated by the Julia Swagger Code Generator
# Do not modify this file directly. Modify the swagger specification instead.


@doc raw"""NetworkPolicySpec provides the specification of a NetworkPolicy

    IoK8sApiNetworkingV1NetworkPolicySpec(;
        egress=nothing,
        ingress=nothing,
        podSelector=nothing,
        policyTypes=nothing,
    )

    - egress::Vector{IoK8sApiNetworkingV1NetworkPolicyEgressRule} : List of egress rules to be applied to the selected pods. Outgoing traffic is allowed if there are no NetworkPolicies selecting the pod (and cluster policy otherwise allows the traffic), OR if the traffic matches at least one egress rule across all of the NetworkPolicy objects whose podSelector matches the pod. If this field is empty then this NetworkPolicy limits all outgoing traffic (and serves solely to ensure that the pods it selects are isolated by default). This field is beta-level in 1.8
    - ingress::Vector{IoK8sApiNetworkingV1NetworkPolicyIngressRule} : List of ingress rules to be applied to the selected pods. Traffic is allowed to a pod if there are no NetworkPolicies selecting the pod (and cluster policy otherwise allows the traffic), OR if the traffic source is the pod&#39;s local node, OR if the traffic matches at least one ingress rule across all of the NetworkPolicy objects whose podSelector matches the pod. If this field is empty then this NetworkPolicy does not allow any traffic (and serves solely to ensure that the pods it selects are isolated by default)
    - podSelector::IoK8sApimachineryPkgApisMetaV1LabelSelector : Selects the pods to which this NetworkPolicy object applies. The array of ingress rules is applied to any pods selected by this field. Multiple network policies can select the same set of pods. In this case, the ingress rules for each are combined additively. This field is NOT optional and follows standard label selector semantics. An empty podSelector matches all pods in this namespace.
    - policyTypes::Vector{String} : List of rule types that the NetworkPolicy relates to. Valid options are \&quot;Ingress\&quot;, \&quot;Egress\&quot;, or \&quot;Ingress,Egress\&quot;. If this field is not specified, it will default based on the existence of Ingress or Egress rules; policies that contain an Egress section are assumed to affect Egress, and all policies (whether or not they contain an Ingress section) are assumed to affect Ingress. If you want to write an egress-only policy, you must explicitly specify policyTypes [ \&quot;Egress\&quot; ]. Likewise, if you want to write a policy that specifies that no egress is allowed, you must specify a policyTypes value that include \&quot;Egress\&quot; (since such a policy would not include an Egress section and would otherwise default to just [ \&quot;Ingress\&quot; ]). This field is beta-level in 1.8
"""
mutable struct IoK8sApiNetworkingV1NetworkPolicySpec <: SwaggerModel
    egress::Any # spec type: Union{ Nothing, Vector{IoK8sApiNetworkingV1NetworkPolicyEgressRule} } # spec name: egress
    ingress::Any # spec type: Union{ Nothing, Vector{IoK8sApiNetworkingV1NetworkPolicyIngressRule} } # spec name: ingress
    podSelector::Any # spec type: Union{ Nothing, IoK8sApimachineryPkgApisMetaV1LabelSelector } # spec name: podSelector
    policyTypes::Any # spec type: Union{ Nothing, Vector{String} } # spec name: policyTypes

    function IoK8sApiNetworkingV1NetworkPolicySpec(;egress=nothing, ingress=nothing, podSelector=nothing, policyTypes=nothing)
        o = new()
        validate_property(IoK8sApiNetworkingV1NetworkPolicySpec, Symbol("egress"), egress)
        setfield!(o, Symbol("egress"), egress)
        validate_property(IoK8sApiNetworkingV1NetworkPolicySpec, Symbol("ingress"), ingress)
        setfield!(o, Symbol("ingress"), ingress)
        validate_property(IoK8sApiNetworkingV1NetworkPolicySpec, Symbol("podSelector"), podSelector)
        setfield!(o, Symbol("podSelector"), podSelector)
        validate_property(IoK8sApiNetworkingV1NetworkPolicySpec, Symbol("policyTypes"), policyTypes)
        setfield!(o, Symbol("policyTypes"), policyTypes)
        o
    end
end # type IoK8sApiNetworkingV1NetworkPolicySpec

const _property_map_IoK8sApiNetworkingV1NetworkPolicySpec = Dict{Symbol,Symbol}(Symbol("egress")=>Symbol("egress"), Symbol("ingress")=>Symbol("ingress"), Symbol("podSelector")=>Symbol("podSelector"), Symbol("policyTypes")=>Symbol("policyTypes"))
const _property_types_IoK8sApiNetworkingV1NetworkPolicySpec = Dict{Symbol,String}(Symbol("egress")=>"Vector{IoK8sApiNetworkingV1NetworkPolicyEgressRule}", Symbol("ingress")=>"Vector{IoK8sApiNetworkingV1NetworkPolicyIngressRule}", Symbol("podSelector")=>"IoK8sApimachineryPkgApisMetaV1LabelSelector", Symbol("policyTypes")=>"Vector{String}")
Base.propertynames(::Type{ IoK8sApiNetworkingV1NetworkPolicySpec }) = collect(keys(_property_map_IoK8sApiNetworkingV1NetworkPolicySpec))
Swagger.property_type(::Type{ IoK8sApiNetworkingV1NetworkPolicySpec }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_IoK8sApiNetworkingV1NetworkPolicySpec[name]))}
Swagger.field_name(::Type{ IoK8sApiNetworkingV1NetworkPolicySpec }, property_name::Symbol) =  _property_map_IoK8sApiNetworkingV1NetworkPolicySpec[property_name]

function check_required(o::IoK8sApiNetworkingV1NetworkPolicySpec)
    (getproperty(o, Symbol("podSelector")) === nothing) && (return false)
    true
end

function validate_property(::Type{ IoK8sApiNetworkingV1NetworkPolicySpec }, name::Symbol, val)
end
