text: /*
   * Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. All Rights Reserved.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *    http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  #include <tencentcloud/antiddos/v20200309/model/CCReqLimitPolicy.h>
  
  using TencentCloud::CoreInternalOutcome;
  using namespace TencentCloud::Antiddos::V20200309::Model;
  using namespace std;
  
  CCReqLimitPolicy::CCReqLimitPolicy() :
      m_policyIdHasBeenSet(false),
      m_instanceIdHasBeenSet(false),
      m_ipHasBeenSet(false),
      m_protocolHasBeenSet(false),
      m_domainHasBeenSet(false),
      m_policyRecordHasBeenSet(false),
      m_createTimeHasBeenSet(false),
      m_modifyTimeHasBeenSet(false)
  {
  }
  
  CoreInternalOutcome CCReqLimitPolicy::Deserialize(const rapidjson::Value &value)
  {
      string requestId = "";
  
  
      if (value.HasMember("PolicyId") && !value["PolicyId"].IsNull())
      {
          if (!value["PolicyId"].IsString())
          {
              return CoreInternalOutcome(Core::Error("response `CCReqLimitPolicy.PolicyId` IsString=false incorrectly").SetRequestId(requestId));
          }
          m_policyId = string(value["PolicyId"].GetString());
          m_policyIdHasBeenSet = true;
      }
  
      if (value.HasMember("InstanceId") && !value["InstanceId"].IsNull())
      {
          if (!value["InstanceId"].IsString())
          {
              return CoreInternalOutcome(Core::Error("response `CCReqLimitPolicy.InstanceId` IsString=false incorrectly").SetRequestId(requestId));
          }
          m_instanceId = string(value["InstanceId"].GetString());
          m_instanceIdHasBeenSet = true;
      }
  
      if (value.HasMember("Ip") && !value["Ip"].IsNull())
      {
          if (!value["Ip"].IsString())
          {
              return CoreInternalOutcome(Core::Error("response `CCReqLimitPolicy.Ip` IsString=false incorrectly").SetRequestId(requestId));
          }
          m_ip = string(value["Ip"].GetString());
          m_ipHasBeenSet = true;
      }
  
      if (value.HasMember("Protocol") && !value["Protocol"].IsNull())
      {
          if (!value["Protocol"].IsString())
          {
              return CoreInternalOutcome(Core::Error("response `CCReqLimitPolicy.Protocol` IsString=false incorrectly").SetRequestId(requestId));
          }
          m_protocol = string(value["Protocol"].GetString());
          m_protocolHasBeenSet = true;
      }
  
      if (value.HasMember("Domain") && !value["Domain"].IsNull())
      {
          if (!value["Domain"].IsString())
          {
              return CoreInternalOutcome(Core::Error("response `CCReqLimitPolicy.Domain` IsString=false incorrectly").SetRequestId(requestId));
          }
          m_domain = string(value["Domain"].GetString());
          m_domainHasBeenSet = true;
      }
  
      if (value.HasMember("PolicyRecord") && !value["PolicyRecord"].IsNull())
      {
          if (!value["PolicyRecord"].IsObject())
          {
              return CoreInternalOutcome(Core::Error("response `CCReqLimitPolicy.PolicyRecord` is not object type").SetRequestId(requestId));
          }
  
          CoreInternalOutcome outcome = m_policyRecord.Deserialize(value["PolicyRecord"]);
          if (!outcome.IsSuccess())
          {
              outcome.GetError().SetRequestId(requestId);
              return outcome;
          }
  
          m_policyRecordHasBeenSet = true;
      }
  
      if (value.HasMember("CreateTime") && !value["CreateTime"].IsNull())
      {
          if (!value["CreateTime"].IsString())
          {
              return CoreInternalOutcome(Core::Error("response `CCReqLimitPolicy.CreateTime` IsString=false incorrectly").SetRequestId(requestId));
          }
          m_createTime = string(value["CreateTime"].GetString());
          m_createTimeHasBeenSet = true;
      }
  
      if (value.HasMember("ModifyTime") && !value["ModifyTime"].IsNull())
      {
          if (!value["ModifyTime"].IsString())
          {
              return CoreInternalOutcome(Core::Error("response `CCReqLimitPolicy.ModifyTime` IsString=false incorrectly").SetRequestId(requestId));
          }
          m_modifyTime = string(value["ModifyTime"].GetString());
          m_modifyTimeHasBeenSet = true;
      }
  
  
      return CoreInternalOutcome(true);
  }
  
  void CCReqLimitPolicy::ToJsonObject(rapidjson::Value &value, rapidjson::Document::AllocatorType& allocator) const
  {
  
      if (m_policyIdHasBeenSet)
      {
          rapidjson::Value iKey(rapidjson::kStringType);
          string key = "PolicyId";
          iKey.SetString(key.c_str(), allocator);
          value.AddMember(iKey, rapidjson::Value(m_policyId.c_str(), allocator).Move(), allocator);
      }
  
      if (m_instanceIdHasBeenSet)
      {
          rapidjson::Value iKey(rapidjson::kStringType);
          string key = "InstanceId";
          iKey.SetString(key.c_str(), allocator);
          value.AddMember(iKey, rapidjson::Value(m_instanceId.c_str(), allocator).Move(), allocator);
      }
  
      if (m_ipHasBeenSet)
      {
          rapidjson::Value iKey(rapidjson::kStringType);
          string key = "Ip";
          iKey.SetString(key.c_str(), allocator);
          value.AddMember(iKey, rapidjson::Value(m_ip.c_str(), allocator).Move(), allocator);
      }
  
      if (m_protocolHasBeenSet)
      {
          rapidjson::Value iKey(rapidjson::kStringType);
          string key = "Protocol";
          iKey.SetString(key.c_str(), allocator);
          value.AddMember(iKey, rapidjson::Value(m_protocol.c_str(), allocator).Move(), allocator);
      }
  
      if (m_domainHasBeenSet)
      {
          rapidjson::Value iKey(rapidjson::kStringType);
          string key = "Domain";
          iKey.SetString(key.c_str(), allocator);
          value.AddMember(iKey, rapidjson::Value(m_domain.c_str(), allocator).Move(), allocator);
      }
  
      if (m_policyRecordHasBeenSet)
      {
          rapidjson::Value iKey(rapidjson::kStringType);
          string key = "PolicyRecord";
          iKey.SetString(key.c_str(), allocator);
          value.AddMember(iKey, rapidjson::Value(rapidjson::kObjectType).Move(), allocator);
          m_policyRecord.ToJsonObject(value[key.c_str()], allocator);
      }
  
      if (m_createTimeHasBeenSet)
      {
          rapidjson::Value iKey(rapidjson::kStringType);
          string key = "CreateTime";
          iKey.SetString(key.c_str(), allocator);
          value.AddMember(iKey, rapidjson::Value(m_createTime.c_str(), allocator).Move(), allocator);
      }
  
      if (m_modifyTimeHasBeenSet)
      {
          rapidjson::Value iKey(rapidjson::kStringType);
          string key = "ModifyTime";
          iKey.SetString(key.c_str(), allocator);
          value.AddMember(iKey, rapidjson::Value(m_modifyTime.c_str(), allocator).Move(), allocator);
      }
  
  }
  
  
  string CCReqLimitPolicy::GetPolicyId() const
  {
      return m_policyId;
  }
  
  void CCReqLimitPolicy::SetPolicyId(const string& _policyId)
  {
      m_policyId = _policyId;
      m_policyIdHasBeenSet = true;
  }
  
  bool CCReqLimitPolicy::PolicyIdHasBeenSet() const
  {
      return m_policyIdHasBeenSet;
  }
  
  string CCReqLimitPolicy::GetInstanceId() const
  {
      return m_instanceId;
  }
  
  void CCReqLimitPolicy::SetInstanceId(const string& _instanceId)
  {
      m_instanceId = _instanceId;
      m_instanceIdHasBeenSet = true;
  }
  
  bool CCReqLimitPolicy::InstanceIdHasBeenSet() const
  {
      return m_instanceIdHasBeenSet;
  }
  
  string CCReqLimitPolicy::GetIp() const
  {
      return m_ip;
  }
  
  void CCReqLimitPolicy::SetIp(const string& _ip)
  {
      m_ip = _ip;
      m_ipHasBeenSet = true;
  }
  
  bool CCReqLimitPolicy::IpHasBeenSet() const
  {
      return m_ipHasBeenSet;
  }
  
  string CCReqLimitPolicy::GetProtocol() const
  {
      return m_protocol;
  }
  
  void CCReqLimitPolicy::SetProtocol(const string& _protocol)
  {
      m_protocol = _protocol;
      m_protocolHasBeenSet = true;
  }
  
  bool CCReqLimitPolicy::ProtocolHasBeenSet() const
  {
      return m_protocolHasBeenSet;
  }
  
  string CCReqLimitPolicy::GetDomain() const
  {
      return m_domain;
  }
  
  void CCReqLimitPolicy::SetDomain(const string& _domain)
  {
      m_domain = _domain;
      m_domainHasBeenSet = true;
  }
  
  bool CCReqLimitPolicy::DomainHasBeenSet() const
  {
      return m_domainHasBeenSet;
  }
  
  CCReqLimitPolicyRecord CCReqLimitPolicy::GetPolicyRecord() const
  {
      return m_policyRecord;
  }
  
  void CCReqLimitPolicy::SetPolicyRecord(const CCReqLimitPolicyRecord& _policyRecord)
  {
      m_policyRecord = _policyRecord;
      m_policyRecordHasBeenSet = true;
  }
  
  bool CCReqLimitPolicy::PolicyRecordHasBeenSet() const
  {
      return m_policyRecordHasBeenSet;
  }
  
  string CCReqLimitPolicy::GetCreateTime() const
  {
      return m_createTime;
  }
  
  void CCReqLimitPolicy::SetCreateTime(const string& _createTime)
  {
      m_createTime = _createTime;
      m_createTimeHasBeenSet = true;
  }
  
  bool CCReqLimitPolicy::CreateTimeHasBeenSet() const
  {
      return m_createTimeHasBeenSet;
  }
  
  string CCReqLimitPolicy::GetModifyTime() const
  {
      return m_modifyTime;
  }
  
  void CCReqLimitPolicy::SetModifyTime(const string& _modifyTime)
  {
      m_modifyTime = _modifyTime;
      m_modifyTimeHasBeenSet = true;
  }
  
  bool CCReqLimitPolicy::ModifyTimeHasBeenSet() const
  {
      return m_modifyTimeHasBeenSet;
  }
  
  