GetJobsProgressResult.cc 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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/ccc/model/GetJobsProgressResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::CCC;
  19. using namespace AlibabaCloud::CCC::Model;
  20. GetJobsProgressResult::GetJobsProgressResult() :
  21. ServiceResult()
  22. {}
  23. GetJobsProgressResult::GetJobsProgressResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. GetJobsProgressResult::~GetJobsProgressResult()
  29. {}
  30. void GetJobsProgressResult::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 jobsProgressNode = value["JobsProgress"];
  37. if(!jobsProgressNode["Status"].isNull())
  38. jobsProgress_.status = jobsProgressNode["Status"].asString();
  39. if(!jobsProgressNode["StartTime"].isNull())
  40. jobsProgress_.startTime = std::stol(jobsProgressNode["StartTime"].asString());
  41. if(!jobsProgressNode["Duration"].isNull())
  42. jobsProgress_.duration = std::stoi(jobsProgressNode["Duration"].asString());
  43. if(!jobsProgressNode["TotalJobs"].isNull())
  44. jobsProgress_.totalJobs = std::stoi(jobsProgressNode["TotalJobs"].asString());
  45. if(!jobsProgressNode["TotalNotAnswered"].isNull())
  46. jobsProgress_.totalNotAnswered = std::stoi(jobsProgressNode["TotalNotAnswered"].asString());
  47. if(!jobsProgressNode["TotalCompleted"].isNull())
  48. jobsProgress_.totalCompleted = std::stoi(jobsProgressNode["TotalCompleted"].asString());
  49. if(!jobsProgressNode["Scheduling"].isNull())
  50. jobsProgress_.scheduling = std::stoi(jobsProgressNode["Scheduling"].asString());
  51. if(!jobsProgressNode["Executing"].isNull())
  52. jobsProgress_.executing = std::stoi(jobsProgressNode["Executing"].asString());
  53. if(!jobsProgressNode["Paused"].isNull())
  54. jobsProgress_.paused = std::stoi(jobsProgressNode["Paused"].asString());
  55. if(!jobsProgressNode["Failed"].isNull())
  56. jobsProgress_.failed = std::stoi(jobsProgressNode["Failed"].asString());
  57. if(!jobsProgressNode["Cancelled"].isNull())
  58. jobsProgress_.cancelled = std::stoi(jobsProgressNode["Cancelled"].asString());
  59. if(!jobsProgressNode["RepeatCall"].isNull())
  60. jobsProgress_.repeatCall = std::stoi(jobsProgressNode["RepeatCall"].asString());
  61. if(!value["Success"].isNull())
  62. success_ = value["Success"].asString() == "true";
  63. if(!value["Code"].isNull())
  64. code_ = value["Code"].asString();
  65. if(!value["Message"].isNull())
  66. message_ = value["Message"].asString();
  67. if(!value["HttpStatusCode"].isNull())
  68. httpStatusCode_ = std::stoi(value["HttpStatusCode"].asString());
  69. }
  70. std::string GetJobsProgressResult::getMessage()const
  71. {
  72. return message_;
  73. }
  74. int GetJobsProgressResult::getHttpStatusCode()const
  75. {
  76. return httpStatusCode_;
  77. }
  78. std::string GetJobsProgressResult::getCode()const
  79. {
  80. return code_;
  81. }
  82. GetJobsProgressResult::JobsProgress GetJobsProgressResult::getJobsProgress()const
  83. {
  84. return jobsProgress_;
  85. }
  86. bool GetJobsProgressResult::getSuccess()const
  87. {
  88. return success_;
  89. }