// *** 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.gcp.networkservices.outputs;

import com.pulumi.core.annotations.CustomType;
import com.pulumi.gcp.networkservices.outputs.TcpRouteRuleAction;
import com.pulumi.gcp.networkservices.outputs.TcpRouteRuleMatch;
import java.util.List;
import java.util.Objects;
import javax.annotation.Nullable;

@CustomType
public final class TcpRouteRule {
    /**
     * @return A detailed rule defining how to route traffic.
     * Structure is documented below.
     * 
     */
    private TcpRouteRuleAction action;
    /**
     * @return RouteMatch defines the predicate used to match requests to a given action. Multiple match types are &#34;OR&#34;ed for evaluation.
     * If no routeMatch field is specified, this rule will unconditionally match traffic.
     * Structure is documented below.
     * 
     */
    private @Nullable List<TcpRouteRuleMatch> matches;

    private TcpRouteRule() {}
    /**
     * @return A detailed rule defining how to route traffic.
     * Structure is documented below.
     * 
     */
    public TcpRouteRuleAction action() {
        return this.action;
    }
    /**
     * @return RouteMatch defines the predicate used to match requests to a given action. Multiple match types are &#34;OR&#34;ed for evaluation.
     * If no routeMatch field is specified, this rule will unconditionally match traffic.
     * Structure is documented below.
     * 
     */
    public List<TcpRouteRuleMatch> matches() {
        return this.matches == null ? List.of() : this.matches;
    }

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

    public static Builder builder(TcpRouteRule defaults) {
        return new Builder(defaults);
    }
    @CustomType.Builder
    public static final class Builder {
        private TcpRouteRuleAction action;
        private @Nullable List<TcpRouteRuleMatch> matches;
        public Builder() {}
        public Builder(TcpRouteRule defaults) {
    	      Objects.requireNonNull(defaults);
    	      this.action = defaults.action;
    	      this.matches = defaults.matches;
        }

        @CustomType.Setter
        public Builder action(TcpRouteRuleAction action) {
            this.action = Objects.requireNonNull(action);
            return this;
        }
        @CustomType.Setter
        public Builder matches(@Nullable List<TcpRouteRuleMatch> matches) {
            this.matches = matches;
            return this;
        }
        public Builder matches(TcpRouteRuleMatch... matches) {
            return matches(List.of(matches));
        }
        public TcpRouteRule build() {
            final var o = new TcpRouteRule();
            o.action = action;
            o.matches = matches;
            return o;
        }
    }
}
