CommitJobRequest.cc 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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/foas/model/CommitJobRequest.h>
  17. using AlibabaCloud::Foas::Model::CommitJobRequest;
  18. CommitJobRequest::CommitJobRequest() :
  19. RoaServiceRequest("foas", "2018-11-11")
  20. {
  21. setResourcePath("/api/v2/projects/[projectName]/jobs/[jobName]/commit");
  22. setMethod(HttpRequest::Method::Put);
  23. }
  24. CommitJobRequest::~CommitJobRequest()
  25. {}
  26. std::string CommitJobRequest::getProjectName()const
  27. {
  28. return projectName_;
  29. }
  30. void CommitJobRequest::setProjectName(const std::string& projectName)
  31. {
  32. projectName_ = projectName;
  33. setParameter("ProjectName", projectName);
  34. }
  35. bool CommitJobRequest::getRecommendOnly()const
  36. {
  37. return recommendOnly_;
  38. }
  39. void CommitJobRequest::setRecommendOnly(bool recommendOnly)
  40. {
  41. recommendOnly_ = recommendOnly;
  42. setBodyParameter("RecommendOnly", recommendOnly ? "true" : "false");
  43. }
  44. std::string CommitJobRequest::getRegionId()const
  45. {
  46. return regionId_;
  47. }
  48. void CommitJobRequest::setRegionId(const std::string& regionId)
  49. {
  50. regionId_ = regionId;
  51. setHeader("RegionId", regionId);
  52. }
  53. std::string CommitJobRequest::getSuspendPeriods()const
  54. {
  55. return suspendPeriods_;
  56. }
  57. void CommitJobRequest::setSuspendPeriods(const std::string& suspendPeriods)
  58. {
  59. suspendPeriods_ = suspendPeriods;
  60. setBodyParameter("SuspendPeriods", suspendPeriods);
  61. }
  62. float CommitJobRequest::getMaxCU()const
  63. {
  64. return maxCU_;
  65. }
  66. void CommitJobRequest::setMaxCU(float maxCU)
  67. {
  68. maxCU_ = maxCU;
  69. setBodyParameter("MaxCU", std::to_string(maxCU));
  70. }
  71. std::string CommitJobRequest::getConfigure()const
  72. {
  73. return configure_;
  74. }
  75. void CommitJobRequest::setConfigure(const std::string& configure)
  76. {
  77. configure_ = configure;
  78. setBodyParameter("Configure", configure);
  79. }
  80. bool CommitJobRequest::getIsOnOff()const
  81. {
  82. return isOnOff_;
  83. }
  84. void CommitJobRequest::setIsOnOff(bool isOnOff)
  85. {
  86. isOnOff_ = isOnOff;
  87. setBodyParameter("IsOnOff", isOnOff ? "true" : "false");
  88. }
  89. std::string CommitJobRequest::getJobName()const
  90. {
  91. return jobName_;
  92. }
  93. void CommitJobRequest::setJobName(const std::string& jobName)
  94. {
  95. jobName_ = jobName;
  96. setParameter("JobName", jobName);
  97. }
  98. std::vector<CommitJobRequest::suspendPeriodParam> CommitJobRequest::getSuspendPeriodParam()const
  99. {
  100. return suspendPeriodParam_;
  101. }
  102. void CommitJobRequest::setSuspendPeriodParam(const std::vector<suspendPeriodParam>& suspendPeriodParam)
  103. {
  104. suspendPeriodParam_ = suspendPeriodParam;
  105. for(int dep1 = 0; dep1!= suspendPeriodParam.size(); dep1++) {
  106. auto suspendPeriodParamObj = suspendPeriodParam.at(dep1);
  107. std::string suspendPeriodParamObjStr = "suspendPeriodParam." + std::to_string(dep1 + 1);
  108. setParameter(suspendPeriodParamObjStr + ".EndTime", suspendPeriodParamObj.endTime);
  109. setParameter(suspendPeriodParamObjStr + ".StartTime", suspendPeriodParamObj.startTime);
  110. setParameter(suspendPeriodParamObjStr + ".Plan", suspendPeriodParamObj.plan);
  111. setParameter(suspendPeriodParamObjStr + ".Policy", suspendPeriodParamObj.policy);
  112. }
  113. }