GetJobTopologyResult.cc 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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/teslastream/model/GetJobTopologyResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::TeslaStream;
  19. using namespace AlibabaCloud::TeslaStream::Model;
  20. GetJobTopologyResult::GetJobTopologyResult() :
  21. ServiceResult()
  22. {}
  23. GetJobTopologyResult::GetJobTopologyResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. GetJobTopologyResult::~GetJobTopologyResult()
  29. {}
  30. void GetJobTopologyResult::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"]["Job"];
  37. for (auto valueDataJob : allDataNode)
  38. {
  39. Job dataObject;
  40. if(!valueDataJob["Text"].isNull())
  41. dataObject.text = valueDataJob["Text"].asString();
  42. if(!valueDataJob["Type"].isNull())
  43. dataObject.type = valueDataJob["Type"].asString();
  44. if(!valueDataJob["PluginRelation"].isNull())
  45. dataObject.pluginRelation = valueDataJob["PluginRelation"].asString();
  46. auto allParents = value["Parents"]["Parent"];
  47. for (auto value : allParents)
  48. dataObject.parents.push_back(value.asString());
  49. auto allChildrens = value["Childrens"]["Children"];
  50. for (auto value : allChildrens)
  51. dataObject.childrens.push_back(value.asString());
  52. data_.push_back(dataObject);
  53. }
  54. if(!value["Code"].isNull())
  55. code_ = std::stoi(value["Code"].asString());
  56. if(!value["Message"].isNull())
  57. message_ = value["Message"].asString();
  58. }
  59. std::string GetJobTopologyResult::getMessage()const
  60. {
  61. return message_;
  62. }
  63. std::vector<GetJobTopologyResult::Job> GetJobTopologyResult::getData()const
  64. {
  65. return data_;
  66. }
  67. int GetJobTopologyResult::getCode()const
  68. {
  69. return code_;
  70. }