ListCatalogsResult.cc 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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/datalake/model/ListCatalogsResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::DataLake;
  19. using namespace AlibabaCloud::DataLake::Model;
  20. ListCatalogsResult::ListCatalogsResult() :
  21. ServiceResult()
  22. {}
  23. ListCatalogsResult::ListCatalogsResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. ListCatalogsResult::~ListCatalogsResult()
  29. {}
  30. void ListCatalogsResult::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 allCatalogsNode = value["Catalogs"]["Catalog"];
  37. for (auto valueCatalogsCatalog : allCatalogsNode)
  38. {
  39. Catalog catalogsObject;
  40. if(!valueCatalogsCatalog["CatalogId"].isNull())
  41. catalogsObject.catalogId = valueCatalogsCatalog["CatalogId"].asString();
  42. if(!valueCatalogsCatalog["Description"].isNull())
  43. catalogsObject.description = valueCatalogsCatalog["Description"].asString();
  44. if(!valueCatalogsCatalog["LocationUri"].isNull())
  45. catalogsObject.locationUri = valueCatalogsCatalog["LocationUri"].asString();
  46. if(!valueCatalogsCatalog["Owner"].isNull())
  47. catalogsObject.owner = valueCatalogsCatalog["Owner"].asString();
  48. if(!valueCatalogsCatalog["CreatedBy"].isNull())
  49. catalogsObject.createdBy = valueCatalogsCatalog["CreatedBy"].asString();
  50. if(!valueCatalogsCatalog["CreateTime"].isNull())
  51. catalogsObject.createTime = std::stol(valueCatalogsCatalog["CreateTime"].asString());
  52. if(!valueCatalogsCatalog["UpdateTime"].isNull())
  53. catalogsObject.updateTime = std::stol(valueCatalogsCatalog["UpdateTime"].asString());
  54. if(!valueCatalogsCatalog["Status"].isNull())
  55. catalogsObject.status = valueCatalogsCatalog["Status"].asString();
  56. catalogs_.push_back(catalogsObject);
  57. }
  58. if(!value["Code"].isNull())
  59. code_ = value["Code"].asString();
  60. if(!value["Message"].isNull())
  61. message_ = value["Message"].asString();
  62. if(!value["NextPageToken"].isNull())
  63. nextPageToken_ = value["NextPageToken"].asString();
  64. if(!value["Success"].isNull())
  65. success_ = value["Success"].asString() == "true";
  66. }
  67. std::string ListCatalogsResult::getMessage()const
  68. {
  69. return message_;
  70. }
  71. std::string ListCatalogsResult::getNextPageToken()const
  72. {
  73. return nextPageToken_;
  74. }
  75. std::vector<ListCatalogsResult::Catalog> ListCatalogsResult::getCatalogs()const
  76. {
  77. return catalogs_;
  78. }
  79. std::string ListCatalogsResult::getCode()const
  80. {
  81. return code_;
  82. }
  83. bool ListCatalogsResult::getSuccess()const
  84. {
  85. return success_;
  86. }