ListLogConfigsResult.cc 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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/sae/model/ListLogConfigsResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Sae;
  19. using namespace AlibabaCloud::Sae::Model;
  20. ListLogConfigsResult::ListLogConfigsResult() :
  21. ServiceResult()
  22. {}
  23. ListLogConfigsResult::ListLogConfigsResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. ListLogConfigsResult::~ListLogConfigsResult()
  29. {}
  30. void ListLogConfigsResult::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. auto dataNode = value["Data"];
  37. if(!dataNode["CurrentPage"].isNull())
  38. data_.currentPage = std::stoi(dataNode["CurrentPage"].asString());
  39. if(!dataNode["PageSize"].isNull())
  40. data_.pageSize = std::stoi(dataNode["PageSize"].asString());
  41. if(!dataNode["TotalSize"].isNull())
  42. data_.totalSize = std::stoi(dataNode["TotalSize"].asString());
  43. auto allLogConfigsNode = dataNode["LogConfigs"]["LogConfig"];
  44. for (auto dataNodeLogConfigsLogConfig : allLogConfigsNode)
  45. {
  46. Data::LogConfig logConfigObject;
  47. if(!dataNodeLogConfigsLogConfig["ConfigName"].isNull())
  48. logConfigObject.configName = dataNodeLogConfigsLogConfig["ConfigName"].asString();
  49. if(!dataNodeLogConfigsLogConfig["LogDir"].isNull())
  50. logConfigObject.logDir = dataNodeLogConfigsLogConfig["LogDir"].asString();
  51. if(!dataNodeLogConfigsLogConfig["SlsProject"].isNull())
  52. logConfigObject.slsProject = dataNodeLogConfigsLogConfig["SlsProject"].asString();
  53. if(!dataNodeLogConfigsLogConfig["SlsLogStore"].isNull())
  54. logConfigObject.slsLogStore = dataNodeLogConfigsLogConfig["SlsLogStore"].asString();
  55. if(!dataNodeLogConfigsLogConfig["StoreType"].isNull())
  56. logConfigObject.storeType = dataNodeLogConfigsLogConfig["StoreType"].asString();
  57. if(!dataNodeLogConfigsLogConfig["LogType"].isNull())
  58. logConfigObject.logType = dataNodeLogConfigsLogConfig["LogType"].asString();
  59. if(!dataNodeLogConfigsLogConfig["RegionId"].isNull())
  60. logConfigObject.regionId = dataNodeLogConfigsLogConfig["RegionId"].asString();
  61. if(!dataNodeLogConfigsLogConfig["CreateTime"].isNull())
  62. logConfigObject.createTime = dataNodeLogConfigsLogConfig["CreateTime"].asString();
  63. data_.logConfigs.push_back(logConfigObject);
  64. }
  65. if(!value["Code"].isNull())
  66. code_ = value["Code"].asString();
  67. if(!value["Message"].isNull())
  68. message_ = value["Message"].asString();
  69. if(!value["Success"].isNull())
  70. success_ = value["Success"].asString() == "true";
  71. if(!value["ErrorCode"].isNull())
  72. errorCode_ = value["ErrorCode"].asString();
  73. if(!value["TraceId"].isNull())
  74. traceId_ = value["TraceId"].asString();
  75. }
  76. std::string ListLogConfigsResult::getMessage()const
  77. {
  78. return message_;
  79. }
  80. std::string ListLogConfigsResult::getTraceId()const
  81. {
  82. return traceId_;
  83. }
  84. ListLogConfigsResult::Data ListLogConfigsResult::getData()const
  85. {
  86. return data_;
  87. }
  88. std::string ListLogConfigsResult::getErrorCode()const
  89. {
  90. return errorCode_;
  91. }
  92. std::string ListLogConfigsResult::getCode()const
  93. {
  94. return code_;
  95. }
  96. bool ListLogConfigsResult::getSuccess()const
  97. {
  98. return success_;
  99. }