DescribeConfigMapResult.cc 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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/DescribeConfigMapResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Sae;
  19. using namespace AlibabaCloud::Sae::Model;
  20. DescribeConfigMapResult::DescribeConfigMapResult() :
  21. ServiceResult()
  22. {}
  23. DescribeConfigMapResult::DescribeConfigMapResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeConfigMapResult::~DescribeConfigMapResult()
  29. {}
  30. void DescribeConfigMapResult::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["ConfigMapId"].isNull())
  38. data_.configMapId = std::stol(dataNode["ConfigMapId"].asString());
  39. if(!dataNode["Name"].isNull())
  40. data_.name = dataNode["Name"].asString();
  41. if(!dataNode["NamespaceId"].isNull())
  42. data_.namespaceId = dataNode["NamespaceId"].asString();
  43. if(!dataNode["Description"].isNull())
  44. data_.description = dataNode["Description"].asString();
  45. if(!dataNode["Data"].isNull())
  46. data_.data = dataNode["Data"].asString();
  47. if(!dataNode["CreateTime"].isNull())
  48. data_.createTime = std::stol(dataNode["CreateTime"].asString());
  49. if(!dataNode["UpdateTime"].isNull())
  50. data_.updateTime = std::stol(dataNode["UpdateTime"].asString());
  51. auto allRelateAppsNode = dataNode["RelateApps"]["RelateApp"];
  52. for (auto dataNodeRelateAppsRelateApp : allRelateAppsNode)
  53. {
  54. Data::RelateApp relateAppObject;
  55. if(!dataNodeRelateAppsRelateApp["AppId"].isNull())
  56. relateAppObject.appId = dataNodeRelateAppsRelateApp["AppId"].asString();
  57. if(!dataNodeRelateAppsRelateApp["AppName"].isNull())
  58. relateAppObject.appName = dataNodeRelateAppsRelateApp["AppName"].asString();
  59. data_.relateApps.push_back(relateAppObject);
  60. }
  61. if(!value["Code"].isNull())
  62. code_ = value["Code"].asString();
  63. if(!value["Message"].isNull())
  64. message_ = value["Message"].asString();
  65. if(!value["ErrorCode"].isNull())
  66. errorCode_ = value["ErrorCode"].asString();
  67. if(!value["TraceId"].isNull())
  68. traceId_ = value["TraceId"].asString();
  69. if(!value["Success"].isNull())
  70. success_ = value["Success"].asString() == "true";
  71. }
  72. std::string DescribeConfigMapResult::getMessage()const
  73. {
  74. return message_;
  75. }
  76. std::string DescribeConfigMapResult::getTraceId()const
  77. {
  78. return traceId_;
  79. }
  80. DescribeConfigMapResult::Data DescribeConfigMapResult::getData()const
  81. {
  82. return data_;
  83. }
  84. std::string DescribeConfigMapResult::getErrorCode()const
  85. {
  86. return errorCode_;
  87. }
  88. std::string DescribeConfigMapResult::getCode()const
  89. {
  90. return code_;
  91. }
  92. bool DescribeConfigMapResult::getSuccess()const
  93. {
  94. return success_;
  95. }