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

import com.pulumi.core.annotations.CustomType;
import com.pulumi.gcp.networksecurity.outputs.AuthorizationPolicyRuleDestination;
import com.pulumi.gcp.networksecurity.outputs.AuthorizationPolicyRuleSource;
import java.util.List;
import java.util.Objects;
import javax.annotation.Nullable;

@CustomType
public final class AuthorizationPolicyRule {
    /**
     * @return List of attributes for the traffic destination. All of the destinations must match. A destination is a match if a request matches all the specified hosts, ports, methods and headers.
     * If not set, the action specified in the &#39;action&#39; field will be applied without any rule checks for the destination.
     * Structure is documented below.
     * 
     */
    private @Nullable List<AuthorizationPolicyRuleDestination> destinations;
    /**
     * @return List of attributes for the traffic source. All of the sources must match. A source is a match if both principals and ipBlocks match.
     * If not set, the action specified in the &#39;action&#39; field will be applied without any rule checks for the source.
     * Structure is documented below.
     * 
     */
    private @Nullable List<AuthorizationPolicyRuleSource> sources;

    private AuthorizationPolicyRule() {}
    /**
     * @return List of attributes for the traffic destination. All of the destinations must match. A destination is a match if a request matches all the specified hosts, ports, methods and headers.
     * If not set, the action specified in the &#39;action&#39; field will be applied without any rule checks for the destination.
     * Structure is documented below.
     * 
     */
    public List<AuthorizationPolicyRuleDestination> destinations() {
        return this.destinations == null ? List.of() : this.destinations;
    }
    /**
     * @return List of attributes for the traffic source. All of the sources must match. A source is a match if both principals and ipBlocks match.
     * If not set, the action specified in the &#39;action&#39; field will be applied without any rule checks for the source.
     * Structure is documented below.
     * 
     */
    public List<AuthorizationPolicyRuleSource> sources() {
        return this.sources == null ? List.of() : this.sources;
    }

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

    public static Builder builder(AuthorizationPolicyRule defaults) {
        return new Builder(defaults);
    }
    @CustomType.Builder
    public static final class Builder {
        private @Nullable List<AuthorizationPolicyRuleDestination> destinations;
        private @Nullable List<AuthorizationPolicyRuleSource> sources;
        public Builder() {}
        public Builder(AuthorizationPolicyRule defaults) {
    	      Objects.requireNonNull(defaults);
    	      this.destinations = defaults.destinations;
    	      this.sources = defaults.sources;
        }

        @CustomType.Setter
        public Builder destinations(@Nullable List<AuthorizationPolicyRuleDestination> destinations) {
            this.destinations = destinations;
            return this;
        }
        public Builder destinations(AuthorizationPolicyRuleDestination... destinations) {
            return destinations(List.of(destinations));
        }
        @CustomType.Setter
        public Builder sources(@Nullable List<AuthorizationPolicyRuleSource> sources) {
            this.sources = sources;
            return this;
        }
        public Builder sources(AuthorizationPolicyRuleSource... sources) {
            return sources(List.of(sources));
        }
        public AuthorizationPolicyRule build() {
            final var o = new AuthorizationPolicyRule();
            o.destinations = destinations;
            o.sources = sources;
            return o;
        }
    }
}
