DescribeNamespaceResourcesResult.cc 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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/DescribeNamespaceResourcesResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Sae;
  19. using namespace AlibabaCloud::Sae::Model;
  20. DescribeNamespaceResourcesResult::DescribeNamespaceResourcesResult() :
  21. ServiceResult()
  22. {}
  23. DescribeNamespaceResourcesResult::DescribeNamespaceResourcesResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeNamespaceResourcesResult::~DescribeNamespaceResourcesResult()
  29. {}
  30. void DescribeNamespaceResourcesResult::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["NamespaceId"].isNull())
  38. data_.namespaceId = dataNode["NamespaceId"].asString();
  39. if(!dataNode["NamespaceName"].isNull())
  40. data_.namespaceName = dataNode["NamespaceName"].asString();
  41. if(!dataNode["Description"].isNull())
  42. data_.description = dataNode["Description"].asString();
  43. if(!dataNode["UserId"].isNull())
  44. data_.userId = dataNode["UserId"].asString();
  45. if(!dataNode["BelongRegion"].isNull())
  46. data_.belongRegion = dataNode["BelongRegion"].asString();
  47. if(!dataNode["TenantId"].isNull())
  48. data_.tenantId = dataNode["TenantId"].asString();
  49. if(!dataNode["VpcId"].isNull())
  50. data_.vpcId = dataNode["VpcId"].asString();
  51. if(!dataNode["VSwitchId"].isNull())
  52. data_.vSwitchId = dataNode["VSwitchId"].asString();
  53. if(!dataNode["SecurityGroupId"].isNull())
  54. data_.securityGroupId = dataNode["SecurityGroupId"].asString();
  55. if(!dataNode["AppCount"].isNull())
  56. data_.appCount = std::stol(dataNode["AppCount"].asString());
  57. if(!dataNode["LastChangeOrderId"].isNull())
  58. data_.lastChangeOrderId = dataNode["LastChangeOrderId"].asString();
  59. if(!dataNode["LastChangeOrderStatus"].isNull())
  60. data_.lastChangeOrderStatus = dataNode["LastChangeOrderStatus"].asString();
  61. if(!dataNode["LastChangeOrderRunning"].isNull())
  62. data_.lastChangeOrderRunning = dataNode["LastChangeOrderRunning"].asString() == "true";
  63. if(!dataNode["VpcName"].isNull())
  64. data_.vpcName = dataNode["VpcName"].asString();
  65. if(!dataNode["VSwitchName"].isNull())
  66. data_.vSwitchName = dataNode["VSwitchName"].asString();
  67. if(!dataNode["NotificationExpired"].isNull())
  68. data_.notificationExpired = dataNode["NotificationExpired"].asString() == "true";
  69. if(!value["Code"].isNull())
  70. code_ = value["Code"].asString();
  71. if(!value["Message"].isNull())
  72. message_ = value["Message"].asString();
  73. if(!value["ErrorCode"].isNull())
  74. errorCode_ = value["ErrorCode"].asString();
  75. if(!value["TraceId"].isNull())
  76. traceId_ = value["TraceId"].asString();
  77. if(!value["Success"].isNull())
  78. success_ = value["Success"].asString() == "true";
  79. }
  80. std::string DescribeNamespaceResourcesResult::getMessage()const
  81. {
  82. return message_;
  83. }
  84. std::string DescribeNamespaceResourcesResult::getTraceId()const
  85. {
  86. return traceId_;
  87. }
  88. DescribeNamespaceResourcesResult::Data DescribeNamespaceResourcesResult::getData()const
  89. {
  90. return data_;
  91. }
  92. std::string DescribeNamespaceResourcesResult::getErrorCode()const
  93. {
  94. return errorCode_;
  95. }
  96. std::string DescribeNamespaceResourcesResult::getCode()const
  97. {
  98. return code_;
  99. }
  100. bool DescribeNamespaceResourcesResult::getSuccess()const
  101. {
  102. return success_;
  103. }