<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/compute/v1/compute.proto

namespace Google\Cloud\Compute\V1;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 *
 * Generated from protobuf message <code>google.cloud.compute.v1.SecurityPolicyRuleRateLimitOptions</code>
 */
class SecurityPolicyRuleRateLimitOptions extends \Google\Protobuf\Internal\Message
{
    /**
     * Can only be specified if the action for the rule is "rate_based_ban". If specified, determines the time (in seconds) the traffic will continue to be banned by the rate limit after the rate falls below the threshold.
     *
     * Generated from protobuf field <code>optional int32 ban_duration_sec = 42896726;</code>
     */
    private $ban_duration_sec = null;
    /**
     * Can only be specified if the action for the rule is "rate_based_ban". If specified, the key will be banned for the configured 'ban_duration_sec' when the number of requests that exceed the 'rate_limit_threshold' also exceed this 'ban_threshold'.
     *
     * Generated from protobuf field <code>optional .google.cloud.compute.v1.SecurityPolicyRuleRateLimitOptionsThreshold ban_threshold = 501208123;</code>
     */
    private $ban_threshold = null;
    /**
     * Action to take for requests that are under the configured rate limit threshold. Valid option is "allow" only.
     *
     * Generated from protobuf field <code>optional string conform_action = 517612367;</code>
     */
    private $conform_action = null;
    /**
     * Determines the key to enforce the rate_limit_threshold on. Possible values are: - ALL: A single rate limit threshold is applied to all the requests matching this rule. This is the default value if "enforceOnKey" is not configured. - IP: The source IP address of the request is the key. Each IP has this limit enforced separately. - HTTP_HEADER: The value of the HTTP header whose name is configured under "enforceOnKeyName". The key value is truncated to the first 128 bytes of the header value. If no such header is present in the request, the key type defaults to ALL. - XFF_IP: The first IP address (i.e. the originating client IP address) specified in the list of IPs under X-Forwarded-For HTTP header. If no such header is present or the value is not a valid IP, the key defaults to the source IP address of the request i.e. key type IP. - HTTP_COOKIE: The value of the HTTP cookie whose name is configured under "enforceOnKeyName". The key value is truncated to the first 128 bytes of the cookie value. If no such cookie is present in the request, the key type defaults to ALL. - HTTP_PATH: The URL path of the HTTP request. The key value is truncated to the first 128 bytes. - SNI: Server name indication in the TLS session of the HTTPS request. The key value is truncated to the first 128 bytes. The key type defaults to ALL on a HTTP session. - REGION_CODE: The country/region from which the request originates.
     * Check the EnforceOnKey enum for the list of possible values.
     *
     * Generated from protobuf field <code>optional string enforce_on_key = 416648956;</code>
     */
    private $enforce_on_key = null;
    /**
     * Rate limit key name applicable only for the following key types: HTTP_HEADER -- Name of the HTTP header whose value is taken as the key value. HTTP_COOKIE -- Name of the HTTP cookie whose value is taken as the key value.
     *
     * Generated from protobuf field <code>optional string enforce_on_key_name = 132555246;</code>
     */
    private $enforce_on_key_name = null;
    /**
     * Action to take for requests that are above the configured rate limit threshold, to either deny with a specified HTTP response code, or redirect to a different endpoint. Valid options are "deny(status)", where valid values for status are 403, 404, 429, and 502, and "redirect" where the redirect parameters come from exceedRedirectOptions below.
     *
     * Generated from protobuf field <code>optional string exceed_action = 167159073;</code>
     */
    private $exceed_action = null;
    /**
     * Parameters defining the redirect action that is used as the exceed action. Cannot be specified if the exceed action is not redirect.
     *
     * Generated from protobuf field <code>optional .google.cloud.compute.v1.SecurityPolicyRuleRedirectOptions exceed_redirect_options = 473646694;</code>
     */
    private $exceed_redirect_options = null;
    /**
     * Threshold at which to begin ratelimiting.
     *
     * Generated from protobuf field <code>optional .google.cloud.compute.v1.SecurityPolicyRuleRateLimitOptionsThreshold rate_limit_threshold = 315875208;</code>
     */
    private $rate_limit_threshold = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $ban_duration_sec
     *           Can only be specified if the action for the rule is "rate_based_ban". If specified, determines the time (in seconds) the traffic will continue to be banned by the rate limit after the rate falls below the threshold.
     *     @type \Google\Cloud\Compute\V1\SecurityPolicyRuleRateLimitOptionsThreshold $ban_threshold
     *           Can only be specified if the action for the rule is "rate_based_ban". If specified, the key will be banned for the configured 'ban_duration_sec' when the number of requests that exceed the 'rate_limit_threshold' also exceed this 'ban_threshold'.
     *     @type string $conform_action
     *           Action to take for requests that are under the configured rate limit threshold. Valid option is "allow" only.
     *     @type string $enforce_on_key
     *           Determines the key to enforce the rate_limit_threshold on. Possible values are: - ALL: A single rate limit threshold is applied to all the requests matching this rule. This is the default value if "enforceOnKey" is not configured. - IP: The source IP address of the request is the key. Each IP has this limit enforced separately. - HTTP_HEADER: The value of the HTTP header whose name is configured under "enforceOnKeyName". The key value is truncated to the first 128 bytes of the header value. If no such header is present in the request, the key type defaults to ALL. - XFF_IP: The first IP address (i.e. the originating client IP address) specified in the list of IPs under X-Forwarded-For HTTP header. If no such header is present or the value is not a valid IP, the key defaults to the source IP address of the request i.e. key type IP. - HTTP_COOKIE: The value of the HTTP cookie whose name is configured under "enforceOnKeyName". The key value is truncated to the first 128 bytes of the cookie value. If no such cookie is present in the request, the key type defaults to ALL. - HTTP_PATH: The URL path of the HTTP request. The key value is truncated to the first 128 bytes. - SNI: Server name indication in the TLS session of the HTTPS request. The key value is truncated to the first 128 bytes. The key type defaults to ALL on a HTTP session. - REGION_CODE: The country/region from which the request originates.
     *           Check the EnforceOnKey enum for the list of possible values.
     *     @type string $enforce_on_key_name
     *           Rate limit key name applicable only for the following key types: HTTP_HEADER -- Name of the HTTP header whose value is taken as the key value. HTTP_COOKIE -- Name of the HTTP cookie whose value is taken as the key value.
     *     @type string $exceed_action
     *           Action to take for requests that are above the configured rate limit threshold, to either deny with a specified HTTP response code, or redirect to a different endpoint. Valid options are "deny(status)", where valid values for status are 403, 404, 429, and 502, and "redirect" where the redirect parameters come from exceedRedirectOptions below.
     *     @type \Google\Cloud\Compute\V1\SecurityPolicyRuleRedirectOptions $exceed_redirect_options
     *           Parameters defining the redirect action that is used as the exceed action. Cannot be specified if the exceed action is not redirect.
     *     @type \Google\Cloud\Compute\V1\SecurityPolicyRuleRateLimitOptionsThreshold $rate_limit_threshold
     *           Threshold at which to begin ratelimiting.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Compute\V1\Compute::initOnce();
        parent::__construct($data);
    }

    /**
     * Can only be specified if the action for the rule is "rate_based_ban". If specified, determines the time (in seconds) the traffic will continue to be banned by the rate limit after the rate falls below the threshold.
     *
     * Generated from protobuf field <code>optional int32 ban_duration_sec = 42896726;</code>
     * @return int
     */
    public function getBanDurationSec()
    {
        return isset($this->ban_duration_sec) ? $this->ban_duration_sec : 0;
    }

    public function hasBanDurationSec()
    {
        return isset($this->ban_duration_sec);
    }

    public function clearBanDurationSec()
    {
        unset($this->ban_duration_sec);
    }

    /**
     * Can only be specified if the action for the rule is "rate_based_ban". If specified, determines the time (in seconds) the traffic will continue to be banned by the rate limit after the rate falls below the threshold.
     *
     * Generated from protobuf field <code>optional int32 ban_duration_sec = 42896726;</code>
     * @param int $var
     * @return $this
     */
    public function setBanDurationSec($var)
    {
        GPBUtil::checkInt32($var);
        $this->ban_duration_sec = $var;

        return $this;
    }

    /**
     * Can only be specified if the action for the rule is "rate_based_ban". If specified, the key will be banned for the configured 'ban_duration_sec' when the number of requests that exceed the 'rate_limit_threshold' also exceed this 'ban_threshold'.
     *
     * Generated from protobuf field <code>optional .google.cloud.compute.v1.SecurityPolicyRuleRateLimitOptionsThreshold ban_threshold = 501208123;</code>
     * @return \Google\Cloud\Compute\V1\SecurityPolicyRuleRateLimitOptionsThreshold|null
     */
    public function getBanThreshold()
    {
        return $this->ban_threshold;
    }

    public function hasBanThreshold()
    {
        return isset($this->ban_threshold);
    }

    public function clearBanThreshold()
    {
        unset($this->ban_threshold);
    }

    /**
     * Can only be specified if the action for the rule is "rate_based_ban". If specified, the key will be banned for the configured 'ban_duration_sec' when the number of requests that exceed the 'rate_limit_threshold' also exceed this 'ban_threshold'.
     *
     * Generated from protobuf field <code>optional .google.cloud.compute.v1.SecurityPolicyRuleRateLimitOptionsThreshold ban_threshold = 501208123;</code>
     * @param \Google\Cloud\Compute\V1\SecurityPolicyRuleRateLimitOptionsThreshold $var
     * @return $this
     */
    public function setBanThreshold($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Compute\V1\SecurityPolicyRuleRateLimitOptionsThreshold::class);
        $this->ban_threshold = $var;

        return $this;
    }

    /**
     * Action to take for requests that are under the configured rate limit threshold. Valid option is "allow" only.
     *
     * Generated from protobuf field <code>optional string conform_action = 517612367;</code>
     * @return string
     */
    public function getConformAction()
    {
        return isset($this->conform_action) ? $this->conform_action : '';
    }

    public function hasConformAction()
    {
        return isset($this->conform_action);
    }

    public function clearConformAction()
    {
        unset($this->conform_action);
    }

    /**
     * Action to take for requests that are under the configured rate limit threshold. Valid option is "allow" only.
     *
     * Generated from protobuf field <code>optional string conform_action = 517612367;</code>
     * @param string $var
     * @return $this
     */
    public function setConformAction($var)
    {
        GPBUtil::checkString($var, True);
        $this->conform_action = $var;

        return $this;
    }

    /**
     * Determines the key to enforce the rate_limit_threshold on. Possible values are: - ALL: A single rate limit threshold is applied to all the requests matching this rule. This is the default value if "enforceOnKey" is not configured. - IP: The source IP address of the request is the key. Each IP has this limit enforced separately. - HTTP_HEADER: The value of the HTTP header whose name is configured under "enforceOnKeyName". The key value is truncated to the first 128 bytes of the header value. If no such header is present in the request, the key type defaults to ALL. - XFF_IP: The first IP address (i.e. the originating client IP address) specified in the list of IPs under X-Forwarded-For HTTP header. If no such header is present or the value is not a valid IP, the key defaults to the source IP address of the request i.e. key type IP. - HTTP_COOKIE: The value of the HTTP cookie whose name is configured under "enforceOnKeyName". The key value is truncated to the first 128 bytes of the cookie value. If no such cookie is present in the request, the key type defaults to ALL. - HTTP_PATH: The URL path of the HTTP request. The key value is truncated to the first 128 bytes. - SNI: Server name indication in the TLS session of the HTTPS request. The key value is truncated to the first 128 bytes. The key type defaults to ALL on a HTTP session. - REGION_CODE: The country/region from which the request originates.
     * Check the EnforceOnKey enum for the list of possible values.
     *
     * Generated from protobuf field <code>optional string enforce_on_key = 416648956;</code>
     * @return string
     */
    public function getEnforceOnKey()
    {
        return isset($this->enforce_on_key) ? $this->enforce_on_key : '';
    }

    public function hasEnforceOnKey()
    {
        return isset($this->enforce_on_key);
    }

    public function clearEnforceOnKey()
    {
        unset($this->enforce_on_key);
    }

    /**
     * Determines the key to enforce the rate_limit_threshold on. Possible values are: - ALL: A single rate limit threshold is applied to all the requests matching this rule. This is the default value if "enforceOnKey" is not configured. - IP: The source IP address of the request is the key. Each IP has this limit enforced separately. - HTTP_HEADER: The value of the HTTP header whose name is configured under "enforceOnKeyName". The key value is truncated to the first 128 bytes of the header value. If no such header is present in the request, the key type defaults to ALL. - XFF_IP: The first IP address (i.e. the originating client IP address) specified in the list of IPs under X-Forwarded-For HTTP header. If no such header is present or the value is not a valid IP, the key defaults to the source IP address of the request i.e. key type IP. - HTTP_COOKIE: The value of the HTTP cookie whose name is configured under "enforceOnKeyName". The key value is truncated to the first 128 bytes of the cookie value. If no such cookie is present in the request, the key type defaults to ALL. - HTTP_PATH: The URL path of the HTTP request. The key value is truncated to the first 128 bytes. - SNI: Server name indication in the TLS session of the HTTPS request. The key value is truncated to the first 128 bytes. The key type defaults to ALL on a HTTP session. - REGION_CODE: The country/region from which the request originates.
     * Check the EnforceOnKey enum for the list of possible values.
     *
     * Generated from protobuf field <code>optional string enforce_on_key = 416648956;</code>
     * @param string $var
     * @return $this
     */
    public function setEnforceOnKey($var)
    {
        GPBUtil::checkString($var, True);
        $this->enforce_on_key = $var;

        return $this;
    }

    /**
     * Rate limit key name applicable only for the following key types: HTTP_HEADER -- Name of the HTTP header whose value is taken as the key value. HTTP_COOKIE -- Name of the HTTP cookie whose value is taken as the key value.
     *
     * Generated from protobuf field <code>optional string enforce_on_key_name = 132555246;</code>
     * @return string
     */
    public function getEnforceOnKeyName()
    {
        return isset($this->enforce_on_key_name) ? $this->enforce_on_key_name : '';
    }

    public function hasEnforceOnKeyName()
    {
        return isset($this->enforce_on_key_name);
    }

    public function clearEnforceOnKeyName()
    {
        unset($this->enforce_on_key_name);
    }

    /**
     * Rate limit key name applicable only for the following key types: HTTP_HEADER -- Name of the HTTP header whose value is taken as the key value. HTTP_COOKIE -- Name of the HTTP cookie whose value is taken as the key value.
     *
     * Generated from protobuf field <code>optional string enforce_on_key_name = 132555246;</code>
     * @param string $var
     * @return $this
     */
    public function setEnforceOnKeyName($var)
    {
        GPBUtil::checkString($var, True);
        $this->enforce_on_key_name = $var;

        return $this;
    }

    /**
     * Action to take for requests that are above the configured rate limit threshold, to either deny with a specified HTTP response code, or redirect to a different endpoint. Valid options are "deny(status)", where valid values for status are 403, 404, 429, and 502, and "redirect" where the redirect parameters come from exceedRedirectOptions below.
     *
     * Generated from protobuf field <code>optional string exceed_action = 167159073;</code>
     * @return string
     */
    public function getExceedAction()
    {
        return isset($this->exceed_action) ? $this->exceed_action : '';
    }

    public function hasExceedAction()
    {
        return isset($this->exceed_action);
    }

    public function clearExceedAction()
    {
        unset($this->exceed_action);
    }

    /**
     * Action to take for requests that are above the configured rate limit threshold, to either deny with a specified HTTP response code, or redirect to a different endpoint. Valid options are "deny(status)", where valid values for status are 403, 404, 429, and 502, and "redirect" where the redirect parameters come from exceedRedirectOptions below.
     *
     * Generated from protobuf field <code>optional string exceed_action = 167159073;</code>
     * @param string $var
     * @return $this
     */
    public function setExceedAction($var)
    {
        GPBUtil::checkString($var, True);
        $this->exceed_action = $var;

        return $this;
    }

    /**
     * Parameters defining the redirect action that is used as the exceed action. Cannot be specified if the exceed action is not redirect.
     *
     * Generated from protobuf field <code>optional .google.cloud.compute.v1.SecurityPolicyRuleRedirectOptions exceed_redirect_options = 473646694;</code>
     * @return \Google\Cloud\Compute\V1\SecurityPolicyRuleRedirectOptions|null
     */
    public function getExceedRedirectOptions()
    {
        return $this->exceed_redirect_options;
    }

    public function hasExceedRedirectOptions()
    {
        return isset($this->exceed_redirect_options);
    }

    public function clearExceedRedirectOptions()
    {
        unset($this->exceed_redirect_options);
    }

    /**
     * Parameters defining the redirect action that is used as the exceed action. Cannot be specified if the exceed action is not redirect.
     *
     * Generated from protobuf field <code>optional .google.cloud.compute.v1.SecurityPolicyRuleRedirectOptions exceed_redirect_options = 473646694;</code>
     * @param \Google\Cloud\Compute\V1\SecurityPolicyRuleRedirectOptions $var
     * @return $this
     */
    public function setExceedRedirectOptions($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Compute\V1\SecurityPolicyRuleRedirectOptions::class);
        $this->exceed_redirect_options = $var;

        return $this;
    }

    /**
     * Threshold at which to begin ratelimiting.
     *
     * Generated from protobuf field <code>optional .google.cloud.compute.v1.SecurityPolicyRuleRateLimitOptionsThreshold rate_limit_threshold = 315875208;</code>
     * @return \Google\Cloud\Compute\V1\SecurityPolicyRuleRateLimitOptionsThreshold|null
     */
    public function getRateLimitThreshold()
    {
        return $this->rate_limit_threshold;
    }

    public function hasRateLimitThreshold()
    {
        return isset($this->rate_limit_threshold);
    }

    public function clearRateLimitThreshold()
    {
        unset($this->rate_limit_threshold);
    }

    /**
     * Threshold at which to begin ratelimiting.
     *
     * Generated from protobuf field <code>optional .google.cloud.compute.v1.SecurityPolicyRuleRateLimitOptionsThreshold rate_limit_threshold = 315875208;</code>
     * @param \Google\Cloud\Compute\V1\SecurityPolicyRuleRateLimitOptionsThreshold $var
     * @return $this
     */
    public function setRateLimitThreshold($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Compute\V1\SecurityPolicyRuleRateLimitOptionsThreshold::class);
        $this->rate_limit_threshold = $var;

        return $this;
    }

}

