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

import com.pulumi.aws.wafv2.outputs.RuleGroupRuleStatementRateBasedStatementForwardedIpConfig;
import com.pulumi.aws.wafv2.outputs.RuleGroupRuleStatementRateBasedStatementScopeDownStatement;
import com.pulumi.core.annotations.CustomType;
import java.lang.Integer;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Nullable;

@CustomType
public final class RuleGroupRuleStatementRateBasedStatement {
    /**
     * @return Setting that indicates how to aggregate the request counts. Valid values include: `FORWARDED_IP` or `IP`. Default: `IP`.
     * 
     */
    private @Nullable String aggregateKeyType;
    /**
     * @return The configuration for inspecting IP addresses in an HTTP header that you specify, instead of using the IP address that&#39;s reported by the web request origin. If `aggregate_key_type` is set to `FORWARDED_IP`, this block is required. See Forwarded IP Config below for details.
     * 
     */
    private @Nullable RuleGroupRuleStatementRateBasedStatementForwardedIpConfig forwardedIpConfig;
    /**
     * @return The limit on requests per 5-minute period for a single originating IP address.
     * 
     */
    private Integer limit;
    /**
     * @return An optional nested statement that narrows the scope of the rate-based statement to matching web requests. This can be any nestable statement, and you can nest statements at any level below this scope-down statement. See Statement above for details.
     * 
     */
    private @Nullable RuleGroupRuleStatementRateBasedStatementScopeDownStatement scopeDownStatement;

    private RuleGroupRuleStatementRateBasedStatement() {}
    /**
     * @return Setting that indicates how to aggregate the request counts. Valid values include: `FORWARDED_IP` or `IP`. Default: `IP`.
     * 
     */
    public Optional<String> aggregateKeyType() {
        return Optional.ofNullable(this.aggregateKeyType);
    }
    /**
     * @return The configuration for inspecting IP addresses in an HTTP header that you specify, instead of using the IP address that&#39;s reported by the web request origin. If `aggregate_key_type` is set to `FORWARDED_IP`, this block is required. See Forwarded IP Config below for details.
     * 
     */
    public Optional<RuleGroupRuleStatementRateBasedStatementForwardedIpConfig> forwardedIpConfig() {
        return Optional.ofNullable(this.forwardedIpConfig);
    }
    /**
     * @return The limit on requests per 5-minute period for a single originating IP address.
     * 
     */
    public Integer limit() {
        return this.limit;
    }
    /**
     * @return An optional nested statement that narrows the scope of the rate-based statement to matching web requests. This can be any nestable statement, and you can nest statements at any level below this scope-down statement. See Statement above for details.
     * 
     */
    public Optional<RuleGroupRuleStatementRateBasedStatementScopeDownStatement> scopeDownStatement() {
        return Optional.ofNullable(this.scopeDownStatement);
    }

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

    public static Builder builder(RuleGroupRuleStatementRateBasedStatement defaults) {
        return new Builder(defaults);
    }
    @CustomType.Builder
    public static final class Builder {
        private @Nullable String aggregateKeyType;
        private @Nullable RuleGroupRuleStatementRateBasedStatementForwardedIpConfig forwardedIpConfig;
        private Integer limit;
        private @Nullable RuleGroupRuleStatementRateBasedStatementScopeDownStatement scopeDownStatement;
        public Builder() {}
        public Builder(RuleGroupRuleStatementRateBasedStatement defaults) {
    	      Objects.requireNonNull(defaults);
    	      this.aggregateKeyType = defaults.aggregateKeyType;
    	      this.forwardedIpConfig = defaults.forwardedIpConfig;
    	      this.limit = defaults.limit;
    	      this.scopeDownStatement = defaults.scopeDownStatement;
        }

        @CustomType.Setter
        public Builder aggregateKeyType(@Nullable String aggregateKeyType) {
            this.aggregateKeyType = aggregateKeyType;
            return this;
        }
        @CustomType.Setter
        public Builder forwardedIpConfig(@Nullable RuleGroupRuleStatementRateBasedStatementForwardedIpConfig forwardedIpConfig) {
            this.forwardedIpConfig = forwardedIpConfig;
            return this;
        }
        @CustomType.Setter
        public Builder limit(Integer limit) {
            this.limit = Objects.requireNonNull(limit);
            return this;
        }
        @CustomType.Setter
        public Builder scopeDownStatement(@Nullable RuleGroupRuleStatementRateBasedStatementScopeDownStatement scopeDownStatement) {
            this.scopeDownStatement = scopeDownStatement;
            return this;
        }
        public RuleGroupRuleStatementRateBasedStatement build() {
            final var o = new RuleGroupRuleStatementRateBasedStatement();
            o.aggregateKeyType = aggregateKeyType;
            o.forwardedIpConfig = forwardedIpConfig;
            o.limit = limit;
            o.scopeDownStatement = scopeDownStatement;
            return o;
        }
    }
}
