]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-19789 add ITs for permission sync upon GitHub onboarding
authorAurelien Poscia <aurelien.poscia@sonarsource.com>
Tue, 8 Aug 2023 14:33:06 +0000 (16:33 +0200)
committersonartech <sonartech@sonarsource.com>
Wed, 9 Aug 2023 20:03:37 +0000 (20:03 +0000)
sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/AlmIntegrationsService.java
sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/ImportGithubProjectRequest.java [new file with mode: 0644]
sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/ListGithubOrganizationsRequest.java [new file with mode: 0644]

index 6d532bb8cb1eb56b7a78c7145a3533f7f9b645da..35075f7ae720168af2aafaf2ed1cee271f655462 100644 (file)
@@ -101,6 +101,35 @@ public class AlmIntegrationsService extends BaseService {
       Projects.CreateWsResponse.parser());
   }
 
+  /**
+   * 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 (file)
index 0000000..d6cfa80
--- /dev/null
@@ -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 (file)
index 0000000..f0782d0
--- /dev/null
@@ -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;
+  }
+}