// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package com.pulumi.kubernetes.networking.v1.outputs;

import com.pulumi.core.annotations.CustomType;
import com.pulumi.kubernetes.meta.v1.outputs.LabelSelector;
import com.pulumi.kubernetes.networking.v1.outputs.IPBlock;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Nullable;

@CustomType
public final class NetworkPolicyPeer {
    /**
     * @return ipBlock defines policy on a particular IPBlock. If this field is set then neither of the other fields can be.
     * 
     */
    private @Nullable IPBlock ipBlock;
    /**
     * @return namespaceSelector selects namespaces using cluster-scoped labels. This field follows standard label selector semantics; if present but empty, it selects all namespaces.
     * 
     * If podSelector is also set, then the NetworkPolicyPeer as a whole selects the pods matching podSelector in the namespaces selected by namespaceSelector. Otherwise it selects all pods in the namespaces selected by namespaceSelector.
     * 
     */
    private @Nullable LabelSelector namespaceSelector;
    /**
     * @return podSelector is a label selector which selects pods. This field follows standard label selector semantics; if present but empty, it selects all pods.
     * 
     * If namespaceSelector is also set, then the NetworkPolicyPeer as a whole selects the pods matching podSelector in the Namespaces selected by NamespaceSelector. Otherwise it selects the pods matching podSelector in the policy&#39;s own namespace.
     * 
     */
    private @Nullable LabelSelector podSelector;

    private NetworkPolicyPeer() {}
    /**
     * @return ipBlock defines policy on a particular IPBlock. If this field is set then neither of the other fields can be.
     * 
     */
    public Optional<IPBlock> ipBlock() {
        return Optional.ofNullable(this.ipBlock);
    }
    /**
     * @return namespaceSelector selects namespaces using cluster-scoped labels. This field follows standard label selector semantics; if present but empty, it selects all namespaces.
     * 
     * If podSelector is also set, then the NetworkPolicyPeer as a whole selects the pods matching podSelector in the namespaces selected by namespaceSelector. Otherwise it selects all pods in the namespaces selected by namespaceSelector.
     * 
     */
    public Optional<LabelSelector> namespaceSelector() {
        return Optional.ofNullable(this.namespaceSelector);
    }
    /**
     * @return podSelector is a label selector which selects pods. This field follows standard label selector semantics; if present but empty, it selects all pods.
     * 
     * If namespaceSelector is also set, then the NetworkPolicyPeer as a whole selects the pods matching podSelector in the Namespaces selected by NamespaceSelector. Otherwise it selects the pods matching podSelector in the policy&#39;s own namespace.
     * 
     */
    public Optional<LabelSelector> podSelector() {
        return Optional.ofNullable(this.podSelector);
    }

    public static Builder builder() {
        return new Builder();
    }

    public static Builder builder(NetworkPolicyPeer defaults) {
        return new Builder(defaults);
    }
    @CustomType.Builder
    public static final class Builder {
        private @Nullable IPBlock ipBlock;
        private @Nullable LabelSelector namespaceSelector;
        private @Nullable LabelSelector podSelector;
        public Builder() {}
        public Builder(NetworkPolicyPeer defaults) {
    	      Objects.requireNonNull(defaults);
    	      this.ipBlock = defaults.ipBlock;
    	      this.namespaceSelector = defaults.namespaceSelector;
    	      this.podSelector = defaults.podSelector;
        }

        @CustomType.Setter
        public Builder ipBlock(@Nullable IPBlock ipBlock) {
            this.ipBlock = ipBlock;
            return this;
        }
        @CustomType.Setter
        public Builder namespaceSelector(@Nullable LabelSelector namespaceSelector) {
            this.namespaceSelector = namespaceSelector;
            return this;
        }
        @CustomType.Setter
        public Builder podSelector(@Nullable LabelSelector podSelector) {
            this.podSelector = podSelector;
            return this;
        }
        public NetworkPolicyPeer build() {
            final var o = new NetworkPolicyPeer();
            o.ipBlock = ipBlock;
            o.namespaceSelector = namespaceSelector;
            o.podSelector = podSelector;
            return o;
        }
    }
}
