CheckResourceResult.cc 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /*
  2. * Copyright 2009-2017 Alibaba Cloud All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #include <alibabacloud/tdsr/model/CheckResourceResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Tdsr;
  19. using namespace AlibabaCloud::Tdsr::Model;
  20. CheckResourceResult::CheckResourceResult() :
  21. ServiceResult()
  22. {}
  23. CheckResourceResult::CheckResourceResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. CheckResourceResult::~CheckResourceResult()
  29. {}
  30. void CheckResourceResult::parse(const std::string &payload)
  31. {
  32. Json::Reader reader;
  33. Json::Value value;
  34. reader.parse(payload, value);
  35. setRequestId(value["RequestId"].asString());
  36. if(!value["Interrupt"].isNull())
  37. interrupt_ = value["Interrupt"].asString() == "true";
  38. if(!value["Invoker"].isNull())
  39. invoker_ = value["Invoker"].asString();
  40. if(!value["Pk"].isNull())
  41. pk_ = value["Pk"].asString();
  42. if(!value["Bid"].isNull())
  43. bid_ = value["Bid"].asString();
  44. if(!value["Hid"].isNull())
  45. hid_ = std::stol(value["Hid"].asString());
  46. if(!value["Country"].isNull())
  47. country_ = value["Country"].asString();
  48. if(!value["TaskIdentifier"].isNull())
  49. taskIdentifier_ = value["TaskIdentifier"].asString();
  50. if(!value["TaskExtraData"].isNull())
  51. taskExtraData_ = value["TaskExtraData"].asString();
  52. if(!value["GmtWakeup"].isNull())
  53. gmtWakeup_ = value["GmtWakeup"].asString();
  54. if(!value["Success"].isNull())
  55. success_ = value["Success"].asString() == "true";
  56. if(!value["Message"].isNull())
  57. message_ = value["Message"].asString();
  58. if(!value["Level"].isNull())
  59. level_ = std::stol(value["Level"].asString());
  60. if(!value["Url"].isNull())
  61. url_ = value["Url"].asString();
  62. if(!value["Prompt"].isNull())
  63. prompt_ = value["Prompt"].asString();
  64. }
  65. std::string CheckResourceResult::getGmtWakeup()const
  66. {
  67. return gmtWakeup_;
  68. }
  69. long CheckResourceResult::getHid()const
  70. {
  71. return hid_;
  72. }
  73. std::string CheckResourceResult::getTaskIdentifier()const
  74. {
  75. return taskIdentifier_;
  76. }
  77. std::string CheckResourceResult::getMessage()const
  78. {
  79. return message_;
  80. }
  81. bool CheckResourceResult::getInterrupt()const
  82. {
  83. return interrupt_;
  84. }
  85. bool CheckResourceResult::getSuccess()const
  86. {
  87. return success_;
  88. }
  89. std::string CheckResourceResult::getUrl()const
  90. {
  91. return url_;
  92. }
  93. std::string CheckResourceResult::getInvoker()const
  94. {
  95. return invoker_;
  96. }
  97. std::string CheckResourceResult::getTaskExtraData()const
  98. {
  99. return taskExtraData_;
  100. }
  101. std::string CheckResourceResult::getCountry()const
  102. {
  103. return country_;
  104. }
  105. long CheckResourceResult::getLevel()const
  106. {
  107. return level_;
  108. }
  109. std::string CheckResourceResult::getPrompt()const
  110. {
  111. return prompt_;
  112. }
  113. std::string CheckResourceResult::getPk()const
  114. {
  115. return pk_;
  116. }
  117. std::string CheckResourceResult::getBid()const
  118. {
  119. return bid_;
  120. }