From: Aurelien Poscia Date: Tue, 8 Aug 2023 14:33:06 +0000 (+0200) Subject: SONAR-19789 add ITs for permission sync upon GitHub onboarding X-Git-Tag: 10.2.0.77647~245 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3890d518d85f6cd63627d974f2cdbc931b1e068b;p=sonarqube.git SONAR-19789 add ITs for permission sync upon GitHub onboarding --- 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 @@ -101,6 +101,35 @@ public class AlmIntegrationsService extends BaseService { Projects.CreateWsResponse.parser()); } + /** + * This is a POST request. + * + * @see Further information about this action online (including a response example) + */ + 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 Further information about this action online (including a response example) + */ + 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 Further information about this action online (including a response example) + */ +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 Further information about this action online (including a response example) + */ +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; + } +}