/**
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * SPDX-License-Identifier: Apache-2.0.
 */

#pragma once
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/waf-regional/WAFRegionalRequest.h>
#include <aws/waf-regional/WAFRegional_EXPORTS.h>
#include <aws/waf-regional/model/RateKey.h>
#include <aws/waf-regional/model/Tag.h>

#include <utility>

namespace Aws {
namespace WAFRegional {
namespace Model {

/**
 */
class CreateRateBasedRuleRequest : public WAFRegionalRequest {
 public:
  AWS_WAFREGIONAL_API CreateRateBasedRuleRequest() = default;

  // Service request name is the Operation name which will send this request out,
  // each operation should has unique request name, so that we can get operation's name from this request.
  // Note: this is not true for response, multiple operations may have the same response name,
  // so we can not get operation's name from response.
  inline virtual const char* GetServiceRequestName() const override { return "CreateRateBasedRule"; }

  AWS_WAFREGIONAL_API Aws::String SerializePayload() const override;

  AWS_WAFREGIONAL_API Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;

  ///@{
  /**
   * <p>A friendly name or description of the <a>RateBasedRule</a>. You can't change
   * the name of a <code>RateBasedRule</code> after you create it.</p>
   */
  inline const Aws::String& GetName() const { return m_name; }
  inline bool NameHasBeenSet() const { return m_nameHasBeenSet; }
  template <typename NameT = Aws::String>
  void SetName(NameT&& value) {
    m_nameHasBeenSet = true;
    m_name = std::forward<NameT>(value);
  }
  template <typename NameT = Aws::String>
  CreateRateBasedRuleRequest& WithName(NameT&& value) {
    SetName(std::forward<NameT>(value));
    return *this;
  }
  ///@}

  ///@{
  /**
   * <p>A friendly name or description for the metrics for this
   * <code>RateBasedRule</code>. The name can contain only alphanumeric characters
   * (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't
   * contain whitespace or metric names reserved for AWS WAF, including "All" and
   * "Default_Action." You can't change the name of the metric after you create the
   * <code>RateBasedRule</code>.</p>
   */
  inline const Aws::String& GetMetricName() const { return m_metricName; }
  inline bool MetricNameHasBeenSet() const { return m_metricNameHasBeenSet; }
  template <typename MetricNameT = Aws::String>
  void SetMetricName(MetricNameT&& value) {
    m_metricNameHasBeenSet = true;
    m_metricName = std::forward<MetricNameT>(value);
  }
  template <typename MetricNameT = Aws::String>
  CreateRateBasedRuleRequest& WithMetricName(MetricNameT&& value) {
    SetMetricName(std::forward<MetricNameT>(value));
    return *this;
  }
  ///@}

  ///@{
  /**
   * <p>The field that AWS WAF uses to determine if requests are likely arriving from
   * a single source and thus subject to rate monitoring. The only valid value for
   * <code>RateKey</code> is <code>IP</code>. <code>IP</code> indicates that requests
   * that arrive from the same IP address are subject to the <code>RateLimit</code>
   * that is specified in the <code>RateBasedRule</code>.</p>
   */
  inline RateKey GetRateKey() const { return m_rateKey; }
  inline bool RateKeyHasBeenSet() const { return m_rateKeyHasBeenSet; }
  inline void SetRateKey(RateKey value) {
    m_rateKeyHasBeenSet = true;
    m_rateKey = value;
  }
  inline CreateRateBasedRuleRequest& WithRateKey(RateKey value) {
    SetRateKey(value);
    return *this;
  }
  ///@}

  ///@{
  /**
   * <p>The maximum number of requests, which have an identical value in the field
   * that is specified by <code>RateKey</code>, allowed in a five-minute period. If
   * the number of requests exceeds the <code>RateLimit</code> and the other
   * predicates specified in the rule are also met, AWS WAF triggers the action that
   * is specified for this rule.</p>
   */
  inline long long GetRateLimit() const { return m_rateLimit; }
  inline bool RateLimitHasBeenSet() const { return m_rateLimitHasBeenSet; }
  inline void SetRateLimit(long long value) {
    m_rateLimitHasBeenSet = true;
    m_rateLimit = value;
  }
  inline CreateRateBasedRuleRequest& WithRateLimit(long long value) {
    SetRateLimit(value);
    return *this;
  }
  ///@}

  ///@{
  /**
   * <p>The <code>ChangeToken</code> that you used to submit the
   * <code>CreateRateBasedRule</code> request. You can also use this value to query
   * the status of the request. For more information, see
   * <a>GetChangeTokenStatus</a>.</p>
   */
  inline const Aws::String& GetChangeToken() const { return m_changeToken; }
  inline bool ChangeTokenHasBeenSet() const { return m_changeTokenHasBeenSet; }
  template <typename ChangeTokenT = Aws::String>
  void SetChangeToken(ChangeTokenT&& value) {
    m_changeTokenHasBeenSet = true;
    m_changeToken = std::forward<ChangeTokenT>(value);
  }
  template <typename ChangeTokenT = Aws::String>
  CreateRateBasedRuleRequest& WithChangeToken(ChangeTokenT&& value) {
    SetChangeToken(std::forward<ChangeTokenT>(value));
    return *this;
  }
  ///@}

  ///@{
  /**
   * <p/>
   */
  inline const Aws::Vector<Tag>& GetTags() const { return m_tags; }
  inline bool TagsHasBeenSet() const { return m_tagsHasBeenSet; }
  template <typename TagsT = Aws::Vector<Tag>>
  void SetTags(TagsT&& value) {
    m_tagsHasBeenSet = true;
    m_tags = std::forward<TagsT>(value);
  }
  template <typename TagsT = Aws::Vector<Tag>>
  CreateRateBasedRuleRequest& WithTags(TagsT&& value) {
    SetTags(std::forward<TagsT>(value));
    return *this;
  }
  template <typename TagsT = Tag>
  CreateRateBasedRuleRequest& AddTags(TagsT&& value) {
    m_tagsHasBeenSet = true;
    m_tags.emplace_back(std::forward<TagsT>(value));
    return *this;
  }
  ///@}
 private:
  Aws::String m_name;

  Aws::String m_metricName;

  RateKey m_rateKey{RateKey::NOT_SET};

  long long m_rateLimit{0};

  Aws::String m_changeToken;

  Aws::Vector<Tag> m_tags;
  bool m_nameHasBeenSet = false;
  bool m_metricNameHasBeenSet = false;
  bool m_rateKeyHasBeenSet = false;
  bool m_rateLimitHasBeenSet = false;
  bool m_changeTokenHasBeenSet = false;
  bool m_tagsHasBeenSet = false;
};

}  // namespace Model
}  // namespace WAFRegional
}  // namespace Aws
