diff options
author | Aurelien Poscia <aurelien.poscia@sonarsource.com> | 2023-08-08 16:33:06 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-08-09 20:03:37 +0000 |
commit | 3890d518d85f6cd63627d974f2cdbc931b1e068b (patch) | |
tree | 2453dc5dedf20c4661b1b8d8b1ca4f764e84f0a4 /sonar-ws/src/main/java/org/sonarqube/ws | |
parent | 8a7995fb4e79c7fd5b0a22401fcaabb2db6c5a06 (diff) | |
download | sonarqube-3890d518d85f6cd63627d974f2cdbc931b1e068b.tar.gz sonarqube-3890d518d85f6cd63627d974f2cdbc931b1e068b.zip |
SONAR-19789 add ITs for permission sync upon GitHub onboarding
Diffstat (limited to 'sonar-ws/src/main/java/org/sonarqube/ws')
3 files changed, 156 insertions, 0 deletions
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/AlmIntegrationsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/AlmIntegrationsService.java index 6d532bb8cb1..35075f7ae72 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/AlmIntegrationsService.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/AlmIntegrationsService.java @@ -102,6 +102,35 @@ public class AlmIntegrationsService extends BaseService { } /** + * This is a POST request. + * + * @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> + */ + public Projects.CreateWsResponse importGithubProject(ImportGithubProjectRequest request) { + return call( + new PostRequest(path("import_github_project")) + .setParam("almSetting", request.getAlmSetting()) + .setParam("organization", request.getOrganization()) + .setParam("repositoryKey", request.getRepositoryKey()) + .setMediaType(MediaTypes.JSON), + Projects.CreateWsResponse.parser()); + } + + /** + * This is a GET request. + * + * @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> + */ + public void listGithubOrganizations(ListGithubOrganizationsRequest request) { + call( + new GetRequest(path("list_github_organizations")) + .setParam("almSetting", request.getAlmSetting()) + .setParam("token", request.getToken()) + .setMediaType(MediaTypes.JSON), + Projects.CreateWsResponse.parser()); + } + + /** * This is part of the internal API. * This is a POST request. * diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/ImportGithubProjectRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/ImportGithubProjectRequest.java new file mode 100644 index 00000000000..d6cfa80912b --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/ImportGithubProjectRequest.java @@ -0,0 +1,72 @@ +/* + * SonarQube + * Copyright (C) 2009-2023 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonarqube.ws.client.almintegrations; + +/** + * This is part of the internal API. + * This is a POST request. + * + * @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> + */ +public class ImportGithubProjectRequest { + + private String almSetting; + private String repositoryKey; + + private String organization; + + /** + * This is a mandatory parameter. + */ + public ImportGithubProjectRequest setAlmSetting(String almSetting) { + this.almSetting = almSetting; + return this; + } + + public String getAlmSetting() { + return almSetting; + } + + + public String getRepositoryKey() { + return repositoryKey; + } + + /** + * This is a mandatory parameter. + */ + public ImportGithubProjectRequest setRepositoryKey(String repositoryKey) { + this.repositoryKey = repositoryKey; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * This is a mandatory parameter. + */ + public ImportGithubProjectRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/ListGithubOrganizationsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/ListGithubOrganizationsRequest.java new file mode 100644 index 00000000000..f0782d00267 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/ListGithubOrganizationsRequest.java @@ -0,0 +1,55 @@ +/* + * SonarQube + * Copyright (C) 2009-2023 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonarqube.ws.client.almintegrations; + +/** + * This is part of the internal API. + * This is a GET request. + * + * @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> + */ +public class ListGithubOrganizationsRequest { + + private String almSetting; + private String token; + + + + /** + * This is a mandatory parameter. + */ + public ListGithubOrganizationsRequest setAlmSetting(String almSetting) { + this.almSetting = almSetting; + return this; + } + + public String getAlmSetting() { + return almSetting; + } + + public String getToken() { + return token; + } + + public ListGithubOrganizationsRequest setToken(String token) { + this.token = token; + return this; + } +} |