ListPublishedServicesResult.cc 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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/ListPublishedServicesResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Sae;
  19. using namespace AlibabaCloud::Sae::Model;
  20. ListPublishedServicesResult::ListPublishedServicesResult() :
  21. ServiceResult()
  22. {}
  23. ListPublishedServicesResult::ListPublishedServicesResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. ListPublishedServicesResult::~ListPublishedServicesResult()
  29. {}
  30. void ListPublishedServicesResult::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 allDataNode = value["Data"]["DataItem"];
  37. for (auto valueDataDataItem : allDataNode)
  38. {
  39. DataItem dataObject;
  40. if(!valueDataDataItem["AppId"].isNull())
  41. dataObject.appId = valueDataDataItem["AppId"].asString();
  42. if(!valueDataDataItem["Group2Ip"].isNull())
  43. dataObject.group2Ip = valueDataDataItem["Group2Ip"].asString();
  44. if(!valueDataDataItem["Name"].isNull())
  45. dataObject.name = valueDataDataItem["Name"].asString();
  46. if(!valueDataDataItem["Type"].isNull())
  47. dataObject.type = valueDataDataItem["Type"].asString();
  48. if(!valueDataDataItem["Version"].isNull())
  49. dataObject.version = valueDataDataItem["Version"].asString();
  50. auto allGroups = value["Groups"]["Group"];
  51. for (auto value : allGroups)
  52. dataObject.groups.push_back(value.asString());
  53. auto allIps = value["Ips"]["Ip"];
  54. for (auto value : allIps)
  55. dataObject.ips.push_back(value.asString());
  56. data_.push_back(dataObject);
  57. }
  58. if(!value["Code"].isNull())
  59. code_ = value["Code"].asString();
  60. if(!value["Message"].isNull())
  61. message_ = value["Message"].asString();
  62. if(!value["Success"].isNull())
  63. success_ = value["Success"].asString() == "true";
  64. if(!value["ErrorCode"].isNull())
  65. errorCode_ = value["ErrorCode"].asString();
  66. if(!value["TraceId"].isNull())
  67. traceId_ = value["TraceId"].asString();
  68. }
  69. std::string ListPublishedServicesResult::getMessage()const
  70. {
  71. return message_;
  72. }
  73. std::string ListPublishedServicesResult::getTraceId()const
  74. {
  75. return traceId_;
  76. }
  77. std::vector<ListPublishedServicesResult::DataItem> ListPublishedServicesResult::getData()const
  78. {
  79. return data_;
  80. }
  81. std::string ListPublishedServicesResult::getErrorCode()const
  82. {
  83. return errorCode_;
  84. }
  85. std::string ListPublishedServicesResult::getCode()const
  86. {
  87. return code_;
  88. }
  89. bool ListPublishedServicesResult::getSuccess()const
  90. {
  91. return success_;
  92. }