CreateAppGroupResult.cc 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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/opensearch/model/CreateAppGroupResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::OpenSearch;
  19. using namespace AlibabaCloud::OpenSearch::Model;
  20. CreateAppGroupResult::CreateAppGroupResult() :
  21. ServiceResult()
  22. {}
  23. CreateAppGroupResult::CreateAppGroupResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. CreateAppGroupResult::~CreateAppGroupResult()
  29. {}
  30. void CreateAppGroupResult::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 resultNode = value["result"];
  37. if(!resultNode["id"].isNull())
  38. result_.id = resultNode["id"].asString();
  39. if(!resultNode["name"].isNull())
  40. result_.name = resultNode["name"].asString();
  41. if(!resultNode["currentVersion"].isNull())
  42. result_.currentVersion = resultNode["currentVersion"].asString();
  43. if(!resultNode["switchedTime"].isNull())
  44. result_.switchedTime = std::stoi(resultNode["switchedTime"].asString());
  45. if(!resultNode["chargingWay"].isNull())
  46. result_.chargingWay = std::stoi(resultNode["chargingWay"].asString());
  47. if(!resultNode["type"].isNull())
  48. result_.type = resultNode["type"].asString();
  49. if(!resultNode["projectId"].isNull())
  50. result_.projectId = resultNode["projectId"].asString();
  51. if(!resultNode["chargeType"].isNull())
  52. result_.chargeType = resultNode["chargeType"].asString();
  53. if(!resultNode["expireOn"].isNull())
  54. result_.expireOn = resultNode["expireOn"].asString();
  55. if(!resultNode["instanceId"].isNull())
  56. result_.instanceId = resultNode["instanceId"].asString();
  57. if(!resultNode["commodityCode"].isNull())
  58. result_.commodityCode = resultNode["commodityCode"].asString();
  59. if(!resultNode["processingOrderId"].isNull())
  60. result_.processingOrderId = resultNode["processingOrderId"].asString();
  61. if(!resultNode["firstRankAlgoDeploymentId"].isNull())
  62. result_.firstRankAlgoDeploymentId = std::stoi(resultNode["firstRankAlgoDeploymentId"].asString());
  63. if(!resultNode["secondRankAlgoDeploymentId"].isNull())
  64. result_.secondRankAlgoDeploymentId = std::stoi(resultNode["secondRankAlgoDeploymentId"].asString());
  65. if(!resultNode["pendingSecondRankAlgoDeploymentId"].isNull())
  66. result_.pendingSecondRankAlgoDeploymentId = std::stoi(resultNode["pendingSecondRankAlgoDeploymentId"].asString());
  67. if(!resultNode["description"].isNull())
  68. result_.description = resultNode["description"].asString();
  69. if(!resultNode["produced"].isNull())
  70. result_.produced = std::stoi(resultNode["produced"].asString());
  71. if(!resultNode["lockedByExpiration"].isNull())
  72. result_.lockedByExpiration = std::stoi(resultNode["lockedByExpiration"].asString());
  73. if(!resultNode["hasPendingQuotaReviewTask"].isNull())
  74. result_.hasPendingQuotaReviewTask = std::stoi(resultNode["hasPendingQuotaReviewTask"].asString());
  75. if(!resultNode["created"].isNull())
  76. result_.created = std::stoi(resultNode["created"].asString());
  77. if(!resultNode["updated"].isNull())
  78. result_.updated = std::stoi(resultNode["updated"].asString());
  79. if(!resultNode["status"].isNull())
  80. result_.status = resultNode["status"].asString();
  81. if(!resultNode["lockMode"].isNull())
  82. result_.lockMode = resultNode["lockMode"].asString();
  83. if(!resultNode["domain"].isNull())
  84. result_.domain = resultNode["domain"].asString();
  85. auto quotaNode = resultNode["quota"];
  86. if(!quotaNode["docSize"].isNull())
  87. result_.quota.docSize = std::stoi(quotaNode["docSize"].asString());
  88. if(!quotaNode["computeResource"].isNull())
  89. result_.quota.computeResource = std::stoi(quotaNode["computeResource"].asString());
  90. if(!quotaNode["spec"].isNull())
  91. result_.quota.spec = quotaNode["spec"].asString();
  92. if(!value["requestId"].isNull())
  93. requestId_ = value["requestId"].asString();
  94. }
  95. std::string CreateAppGroupResult::getRequestId()const
  96. {
  97. return requestId_;
  98. }
  99. CreateAppGroupResult::Result CreateAppGroupResult::getResult()const
  100. {
  101. return result_;
  102. }