You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CeService.java 9.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2023 SonarSource SA
  4. * mailto:info AT sonarsource DOT com
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 3 of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with this program; if not, write to the Free Software Foundation,
  18. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. */
  20. package org.sonarqube.ws.client.ce;
  21. import java.util.stream.Collectors;
  22. import javax.annotation.Generated;
  23. import org.sonarqube.ws.Ce.ActivityResponse;
  24. import org.sonarqube.ws.Ce.ActivityStatusWsResponse;
  25. import org.sonarqube.ws.Ce.AnalysisStatusWsResponse;
  26. import org.sonarqube.ws.Ce.ComponentResponse;
  27. import org.sonarqube.ws.Ce.InfoWsResponse;
  28. import org.sonarqube.ws.Ce.SubmitResponse;
  29. import org.sonarqube.ws.Ce.TaskResponse;
  30. import org.sonarqube.ws.Ce.TaskTypesWsResponse;
  31. import org.sonarqube.ws.Ce.WorkerCountResponse;
  32. import org.sonarqube.ws.MediaTypes;
  33. import org.sonarqube.ws.client.BaseService;
  34. import org.sonarqube.ws.client.GetRequest;
  35. import org.sonarqube.ws.client.PostRequest;
  36. import org.sonarqube.ws.client.WsConnector;
  37. /**
  38. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce">Further information about this web service online</a>
  39. */
  40. @Generated("sonar-ws-generator")
  41. public class CeService extends BaseService {
  42. public CeService(WsConnector wsConnector) {
  43. super(wsConnector, "api/ce");
  44. }
  45. /**
  46. *
  47. * This is part of the internal API.
  48. * This is a GET request.
  49. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/activity">Further information about this action online (including a response example)</a>
  50. * @since 5.2
  51. */
  52. public ActivityResponse activity(ActivityRequest request) {
  53. return call(
  54. new GetRequest(path("activity"))
  55. .setParam("component", request.getComponent())
  56. .setParam("maxExecutedAt", request.getMaxExecutedAt())
  57. .setParam("minSubmittedAt", request.getMinSubmittedAt())
  58. .setParam("onlyCurrents", request.getOnlyCurrents())
  59. .setParam("p", request.getP())
  60. .setParam("ps", request.getPs())
  61. .setParam("q", request.getQ())
  62. .setParam("status", request.getStatus() == null ? null : request.getStatus().stream().collect(Collectors.joining(",")))
  63. .setParam("type", request.getType()),
  64. ActivityResponse.parser());
  65. }
  66. /**
  67. *
  68. * This is part of the internal API.
  69. * This is a GET request.
  70. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/activity_status">Further information about this action online (including a response example)</a>
  71. * @since 5.5
  72. */
  73. public ActivityStatusWsResponse activityStatus(ActivityStatusRequest request) {
  74. return call(
  75. new GetRequest(path("activity_status"))
  76. .setParam("component", request.getComponent()),
  77. ActivityStatusWsResponse.parser());
  78. }
  79. /**
  80. *
  81. * This is part of the internal API.
  82. * This is a GET request.
  83. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/analysis_status">Further information about this action online (including a response example)</a>
  84. * @since 7.4
  85. */
  86. public AnalysisStatusWsResponse analysisStatus(AnalysisStatusRequest request) {
  87. return call(
  88. new GetRequest(path("analysis_status"))
  89. .setParam("branch", request.getBranch())
  90. .setParam("component", request.getComponent())
  91. .setParam("pullRequest", request.getPullRequest()),
  92. AnalysisStatusWsResponse.parser());
  93. }
  94. /**
  95. *
  96. * This is part of the internal API.
  97. * This is a POST request.
  98. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/cancel">Further information about this action online (including a response example)</a>
  99. * @since 5.2
  100. */
  101. public void cancel(CancelRequest request) {
  102. call(
  103. new PostRequest(path("cancel"))
  104. .setParam("id", request.getId())
  105. .setMediaType(MediaTypes.JSON)).content();
  106. }
  107. /**
  108. *
  109. * This is part of the internal API.
  110. * This is a POST request.
  111. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/cancel_all">Further information about this action online (including a response example)</a>
  112. * @since 5.2
  113. */
  114. public void cancelAll() {
  115. call(
  116. new PostRequest(path("cancel_all"))
  117. .setMediaType(MediaTypes.JSON)).content();
  118. }
  119. /**
  120. *
  121. * This is part of the internal API.
  122. * This is a GET request.
  123. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/component">Further information about this action online (including a response example)</a>
  124. * @since 5.2
  125. */
  126. public ComponentResponse component(ComponentRequest request) {
  127. return call(
  128. new GetRequest(path("component"))
  129. .setParam("component", request.getComponent())
  130. .setParam("componentId", request.getComponentId()),
  131. ComponentResponse.parser());
  132. }
  133. /**
  134. *
  135. * This is part of the internal API.
  136. * This is a POST request.
  137. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/dismiss_analysis_warning">Further information about this action online (including a response example)</a>
  138. * @since 8.5
  139. */
  140. public void dismissAnalysisWarning(DismissAnalysisWarningRequest request) {
  141. call(
  142. new PostRequest(path("dismiss_analysis_warning"))
  143. .setParam("component", request.getComponent())
  144. .setParam("warning", request.getWarning())
  145. .setMediaType(MediaTypes.JSON)
  146. ).content();
  147. }
  148. /**
  149. *
  150. * This is part of the internal API.
  151. * This is a GET request.
  152. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/info">Further information about this action online (including a response example)</a>
  153. * @since 7.2
  154. */
  155. public InfoWsResponse info() {
  156. return call(
  157. new GetRequest(path("info")),
  158. InfoWsResponse.parser());
  159. }
  160. /**
  161. *
  162. * This is part of the internal API.
  163. * This is a POST request.
  164. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/pause">Further information about this action online (including a response example)</a>
  165. * @since 7.2
  166. */
  167. public void pause() {
  168. call(
  169. new PostRequest(path("pause"))
  170. .setMediaType(MediaTypes.JSON)).content();
  171. }
  172. /**
  173. *
  174. * This is part of the internal API.
  175. * This is a POST request.
  176. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/resume">Further information about this action online (including a response example)</a>
  177. * @since 7.2
  178. */
  179. public void resume() {
  180. call(
  181. new PostRequest(path("resume"))
  182. .setMediaType(MediaTypes.JSON)).content();
  183. }
  184. /**
  185. *
  186. * This is part of the internal API.
  187. * This is a POST request.
  188. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/submit">Further information about this action online (including a response example)</a>
  189. * @since 5.2
  190. */
  191. public SubmitResponse submit(SubmitRequest request) {
  192. return call(
  193. new PostRequest(path("submit"))
  194. .setParam("characteristic", request.getCharacteristic())
  195. .setParam("projectBranch", request.getProjectBranch())
  196. .setParam("projectKey", request.getProjectKey())
  197. .setParam("projectName", request.getProjectName())
  198. .setParam("report", request.getReport()),
  199. SubmitResponse.parser());
  200. }
  201. /**
  202. *
  203. * This is part of the internal API.
  204. * This is a GET request.
  205. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/task">Further information about this action online (including a response example)</a>
  206. * @since 5.2
  207. */
  208. public TaskResponse task(TaskRequest request) {
  209. return call(
  210. new GetRequest(path("task"))
  211. .setParam("additionalFields", request.getAdditionalFields() == null ? null : request.getAdditionalFields().stream().collect(Collectors.joining(",")))
  212. .setParam("id", request.getId()),
  213. TaskResponse.parser());
  214. }
  215. /**
  216. *
  217. * This is part of the internal API.
  218. * This is a GET request.
  219. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/task_types">Further information about this action online (including a response example)</a>
  220. * @since 5.5
  221. */
  222. public TaskTypesWsResponse taskTypes() {
  223. return call(
  224. new GetRequest(path("task_types")),
  225. TaskTypesWsResponse.parser());
  226. }
  227. /**
  228. *
  229. * This is part of the internal API.
  230. * This is a GET request.
  231. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/worker_count">Further information about this action online (including a response example)</a>
  232. * @since 6.5
  233. */
  234. public WorkerCountResponse workerCount() {
  235. return call(
  236. new GetRequest(path("worker_count")),
  237. WorkerCountResponse.parser());
  238. }
  239. }