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.

AlmIntegrationsService.java 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  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.almintegrations;
  21. import javax.annotation.Generated;
  22. import org.sonarqube.ws.AlmIntegrations;
  23. import org.sonarqube.ws.MediaTypes;
  24. import org.sonarqube.ws.Projects;
  25. import org.sonarqube.ws.client.BaseService;
  26. import org.sonarqube.ws.client.GetRequest;
  27. import org.sonarqube.ws.client.PostRequest;
  28. import org.sonarqube.ws.client.WsConnector;
  29. /**
  30. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_integrations">Further information about this web service online</a>
  31. */
  32. @Generated("sonar-ws-generator")
  33. public class AlmIntegrationsService extends BaseService {
  34. public AlmIntegrationsService(WsConnector wsConnector) {
  35. super(wsConnector, "api/alm_integrations");
  36. }
  37. /**
  38. * This is part of the internal API.
  39. * This is a GET request.
  40. *
  41. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_integrations/check_pat">Further information about this action online (including a response example)</a>
  42. * @since 8.2
  43. */
  44. public void checkPat(CheckPatRequest request) {
  45. call(
  46. new GetRequest(path("check_pat"))
  47. .setParam("almSetting", request.getAlmSetting())
  48. .setMediaType(MediaTypes.JSON)
  49. ).content();
  50. }
  51. /**
  52. * This is part of the internal API.
  53. * This is a POST request.
  54. *
  55. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_integrations/import_bitbucketserver_project">Further information about this action online (including a response example)</a>
  56. * @since 8.2
  57. */
  58. public Projects.CreateWsResponse importBitbucketserverProject(ImportBitbucketserverProjectRequest request) {
  59. return call(
  60. new PostRequest(path("import_bitbucketserver_project"))
  61. .setParam("almSetting", request.getAlmSetting())
  62. .setParam("projectKey", request.getProjectKey())
  63. .setParam("repositorySlug", request.getRepositorySlug())
  64. .setMediaType(MediaTypes.JSON),
  65. Projects.CreateWsResponse.parser());
  66. }
  67. /**
  68. * This is part of the internal API.
  69. * This is a POST request.
  70. *
  71. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_integrations/import_bitbucketcloud_project">Further information about this action online (including a response example)</a>
  72. * @since 8.2
  73. */
  74. public Projects.CreateWsResponse importBitbucketcloudProject(ImportBitbucketcloudRepoRequest request) {
  75. return call(
  76. new PostRequest(path("import_bitbucketcloud_repo"))
  77. .setParam("almSetting", request.getAlmSetting())
  78. .setParam("repositorySlug", request.getRepositorySlug())
  79. .setMediaType(MediaTypes.JSON),
  80. Projects.CreateWsResponse.parser());
  81. }
  82. /**
  83. * This is a POST request.
  84. *
  85. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_integrations/import_gitlab_project">Further information about this action online (including a response example)</a>
  86. * @since 8.5
  87. */
  88. public Projects.CreateWsResponse importGitLabProject(ImportGitLabProjectRequest request) {
  89. return call(
  90. new PostRequest(path("import_gitlab_project"))
  91. .setParam("almSetting", request.getAlmSetting())
  92. .setParam("gitlabProjectId", request.getGitlabProjectId())
  93. .setMediaType(MediaTypes.JSON),
  94. Projects.CreateWsResponse.parser());
  95. }
  96. /**
  97. * This is a POST request.
  98. *
  99. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_integrations/import_github_project">Further information about this action online (including a response example)</a>
  100. */
  101. public Projects.CreateWsResponse importGithubProject(ImportGithubProjectRequest request) {
  102. return call(
  103. new PostRequest(path("import_github_project"))
  104. .setParam("almSetting", request.getAlmSetting())
  105. .setParam("organization", request.getOrganization())
  106. .setParam("repositoryKey", request.getRepositoryKey())
  107. .setMediaType(MediaTypes.JSON),
  108. Projects.CreateWsResponse.parser());
  109. }
  110. /**
  111. * This is a GET request.
  112. *
  113. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_integrations/list_github_organizations">Further information about this action online (including a response example)</a>
  114. */
  115. public void listGithubOrganizations(ListGithubOrganizationsRequest request) {
  116. call(
  117. new GetRequest(path("list_github_organizations"))
  118. .setParam("almSetting", request.getAlmSetting())
  119. .setParam("token", request.getToken())
  120. .setMediaType(MediaTypes.JSON),
  121. Projects.CreateWsResponse.parser());
  122. }
  123. /**
  124. * This is part of the internal API.
  125. * This is a POST request.
  126. *
  127. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_integrations/import_azure_project">Further information about this action online (including a response example)</a>
  128. * @since 8.6
  129. */
  130. public Projects.CreateWsResponse importAzureProject(ImportAzureProjectRequest request) {
  131. return call(
  132. new PostRequest(path("import_azure_project"))
  133. .setParam("almSetting", request.getAlmSetting())
  134. .setParam("projectName", request.getProjectName())
  135. .setParam("repositoryName", request.getRepositoryName())
  136. .setMediaType(MediaTypes.JSON),
  137. Projects.CreateWsResponse.parser()
  138. );
  139. }
  140. /**
  141. * This is part of the internal API.
  142. * This is a GET request.
  143. *
  144. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_integrations/search_gitlab_repos">Further information about this action online (including a response example)</a>
  145. * @since 8.5
  146. */
  147. public AlmIntegrations.SearchGitlabReposWsResponse searchGitlabRepos(SearchGitlabReposRequest request) {
  148. return call(
  149. new GetRequest(path("search_gitlab_repos"))
  150. .setParam("almSetting", request.getAlmSetting())
  151. .setParam("projectName", request.getProjectName())
  152. .setMediaType(MediaTypes.JSON),
  153. AlmIntegrations.SearchGitlabReposWsResponse.parser());
  154. }
  155. /**
  156. * This is part of the internal API.
  157. * This is a GET request.
  158. *
  159. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_integrations/list_azure_projects">Further information about this action online (including a response example)</a>
  160. * @since 8.2
  161. */
  162. public AlmIntegrations.ListAzureProjectsWsResponse listAzureProjects(ListAzureProjectsRequest request) {
  163. return call(
  164. new GetRequest(path("list_azure_projects"))
  165. .setParam("almSetting", request.getAlmSetting())
  166. .setMediaType(MediaTypes.JSON),
  167. AlmIntegrations.ListAzureProjectsWsResponse.parser());
  168. }
  169. /**
  170. * This is part of the internal API.
  171. * This is a GET request.
  172. *
  173. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_integrations/list_bitbucketserver_projects">Further information about this action online (including a response example)</a>
  174. * @since 8.2
  175. */
  176. public AlmIntegrations.ListBitbucketserverProjectsWsResponse listBitbucketserverProjects(ListBitbucketserverProjectsRequest request) {
  177. return call(
  178. new GetRequest(path("list_bitbucketserver_projects"))
  179. .setParam("almSetting", request.getAlmSetting())
  180. .setMediaType(MediaTypes.JSON),
  181. AlmIntegrations.ListBitbucketserverProjectsWsResponse.parser());
  182. }
  183. /**
  184. * This is part of the internal API.
  185. * This is a GET request.
  186. *
  187. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_integrations/search_bitbucketserver_repos">Further information about this action online (including a response example)</a>
  188. * @since 8.2
  189. */
  190. public AlmIntegrations.SearchBitbucketserverReposWsResponse searchBitbucketserverRepos(SearchBitbucketserverReposRequest request) {
  191. return call(
  192. new GetRequest(path("search_bitbucketserver_repos"))
  193. .setParam("almSetting", request.getAlmSetting())
  194. .setParam("projectName", request.getProjectName())
  195. .setParam("repositoryName", request.getRepositoryName())
  196. .setMediaType(MediaTypes.JSON),
  197. AlmIntegrations.SearchBitbucketserverReposWsResponse.parser());
  198. }
  199. /**
  200. * This is part of the internal API.
  201. * This is a GET request.
  202. *
  203. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_integrations/search_bitbucketcloud_repos">Further information about this action online (including a response example)</a>
  204. * @since 8.2
  205. */
  206. public AlmIntegrations.SearchBitbucketcloudReposWsResponse searchBitbucketcloudRepos(SearchBitbucketcloudReposRequest request) {
  207. return call(
  208. new GetRequest(path("search_bitbucketcloud_repos"))
  209. .setParam("almSetting", request.getAlmSetting())
  210. .setMediaType(MediaTypes.JSON),
  211. AlmIntegrations.SearchBitbucketcloudReposWsResponse.parser());
  212. }
  213. /**
  214. * This is part of the internal API.
  215. * This is a POST request.
  216. *
  217. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_integrations/webhook_github">Further information about this action online (including a response example)</a>
  218. * @since 9.7
  219. */
  220. public void sendGitubCodeScanningAlertWebhookPayload(SendGithubCodeScanningAlertWebhookPayloadRequest request) {
  221. call(
  222. new PostRequest(path("webhook_github"))
  223. .setHeader("X-GitHub-Event", request.getGithubEventHeader())
  224. .setHeader("X-Hub-Signature", request.getGithubSignatureHeader())
  225. .setHeader("X-Hub-Signature-256", request.getGithubSignature256Header())
  226. .setHeader("x-github-hook-installation-target-id", request.getGithubAppId())
  227. .setBody(request.getPayload())
  228. .setMediaType(MediaTypes.JSON)
  229. ).content();
  230. }
  231. /**
  232. * This is part of the internal API.
  233. * This is a POST request.
  234. *
  235. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_integrations/set_pat">Further information about this action online (including a response example)</a>
  236. * @since 8.2
  237. */
  238. public void setPat(SetPatRequest request) {
  239. call(
  240. new PostRequest(path("set_pat"))
  241. .setParam("almSetting", request.getAlmSetting())
  242. .setParam("pat", request.getPat())
  243. .setParam("username", request.getUsername())
  244. .setMediaType(MediaTypes.JSON)
  245. ).content();
  246. }
  247. }