All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.kubernetes.networking.v1.inputs.NetworkPolicyIngressRuleArgs Maven / Gradle / Ivy

There is a newer version: 4.19.0
Show newest version
// *** 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.inputs;

import com.pulumi.core.Output;
import com.pulumi.core.annotations.Import;
import com.pulumi.kubernetes.networking.v1.inputs.NetworkPolicyPeerArgs;
import com.pulumi.kubernetes.networking.v1.inputs.NetworkPolicyPortArgs;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Nullable;


/**
 * NetworkPolicyIngressRule describes a particular set of traffic that is allowed to the pods matched by a NetworkPolicySpec's podSelector. The traffic must match both ports and from.
 * 
 */
public final class NetworkPolicyIngressRuleArgs extends com.pulumi.resources.ResourceArgs {

    public static final NetworkPolicyIngressRuleArgs Empty = new NetworkPolicyIngressRuleArgs();

    /**
     * from is a list of sources which should be able to access the pods selected for this rule. Items in this list are combined using a logical OR operation. If this field is empty or missing, this rule matches all sources (traffic not restricted by source). If this field is present and contains at least one item, this rule allows traffic only if the traffic matches at least one item in the from list.
     * 
     */
    @Import(name="from")
    private @Nullable Output> from;

    /**
     * @return from is a list of sources which should be able to access the pods selected for this rule. Items in this list are combined using a logical OR operation. If this field is empty or missing, this rule matches all sources (traffic not restricted by source). If this field is present and contains at least one item, this rule allows traffic only if the traffic matches at least one item in the from list.
     * 
     */
    public Optional>> from() {
        return Optional.ofNullable(this.from);
    }

    /**
     * ports is a list of ports which should be made accessible on the pods selected for this rule. Each item in this list is combined using a logical OR. If this field is empty or missing, this rule matches all ports (traffic not restricted by port). If this field is present and contains at least one item, then this rule allows traffic only if the traffic matches at least one port in the list.
     * 
     */
    @Import(name="ports")
    private @Nullable Output> ports;

    /**
     * @return ports is a list of ports which should be made accessible on the pods selected for this rule. Each item in this list is combined using a logical OR. If this field is empty or missing, this rule matches all ports (traffic not restricted by port). If this field is present and contains at least one item, then this rule allows traffic only if the traffic matches at least one port in the list.
     * 
     */
    public Optional>> ports() {
        return Optional.ofNullable(this.ports);
    }

    private NetworkPolicyIngressRuleArgs() {}

    private NetworkPolicyIngressRuleArgs(NetworkPolicyIngressRuleArgs $) {
        this.from = $.from;
        this.ports = $.ports;
    }

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

    public static final class Builder {
        private NetworkPolicyIngressRuleArgs $;

        public Builder() {
            $ = new NetworkPolicyIngressRuleArgs();
        }

        public Builder(NetworkPolicyIngressRuleArgs defaults) {
            $ = new NetworkPolicyIngressRuleArgs(Objects.requireNonNull(defaults));
        }

        /**
         * @param from from is a list of sources which should be able to access the pods selected for this rule. Items in this list are combined using a logical OR operation. If this field is empty or missing, this rule matches all sources (traffic not restricted by source). If this field is present and contains at least one item, this rule allows traffic only if the traffic matches at least one item in the from list.
         * 
         * @return builder
         * 
         */
        public Builder from(@Nullable Output> from) {
            $.from = from;
            return this;
        }

        /**
         * @param from from is a list of sources which should be able to access the pods selected for this rule. Items in this list are combined using a logical OR operation. If this field is empty or missing, this rule matches all sources (traffic not restricted by source). If this field is present and contains at least one item, this rule allows traffic only if the traffic matches at least one item in the from list.
         * 
         * @return builder
         * 
         */
        public Builder from(List from) {
            return from(Output.of(from));
        }

        /**
         * @param from from is a list of sources which should be able to access the pods selected for this rule. Items in this list are combined using a logical OR operation. If this field is empty or missing, this rule matches all sources (traffic not restricted by source). If this field is present and contains at least one item, this rule allows traffic only if the traffic matches at least one item in the from list.
         * 
         * @return builder
         * 
         */
        public Builder from(NetworkPolicyPeerArgs... from) {
            return from(List.of(from));
        }

        /**
         * @param ports ports is a list of ports which should be made accessible on the pods selected for this rule. Each item in this list is combined using a logical OR. If this field is empty or missing, this rule matches all ports (traffic not restricted by port). If this field is present and contains at least one item, then this rule allows traffic only if the traffic matches at least one port in the list.
         * 
         * @return builder
         * 
         */
        public Builder ports(@Nullable Output> ports) {
            $.ports = ports;
            return this;
        }

        /**
         * @param ports ports is a list of ports which should be made accessible on the pods selected for this rule. Each item in this list is combined using a logical OR. If this field is empty or missing, this rule matches all ports (traffic not restricted by port). If this field is present and contains at least one item, then this rule allows traffic only if the traffic matches at least one port in the list.
         * 
         * @return builder
         * 
         */
        public Builder ports(List ports) {
            return ports(Output.of(ports));
        }

        /**
         * @param ports ports is a list of ports which should be made accessible on the pods selected for this rule. Each item in this list is combined using a logical OR. If this field is empty or missing, this rule matches all ports (traffic not restricted by port). If this field is present and contains at least one item, then this rule allows traffic only if the traffic matches at least one port in the list.
         * 
         * @return builder
         * 
         */
        public Builder ports(NetworkPolicyPortArgs... ports) {
            return ports(List.of(ports));
        }

        public NetworkPolicyIngressRuleArgs build() {
            return $;
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy