aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2019-10-08 17:51:53 +0200
committersonartech <sonartech@sonarsource.com>2019-11-06 10:04:19 +0100
commit58d04f69bb33f17cfe6db3d9885fe4c9adabd2d1 (patch)
treebc48a5c0b0e2884ffa6ec2b61c99326844f030ba /sonar-ws
parentf8c9b9c8b3e7040907e0ded89511f86b827449ad (diff)
downloadsonarqube-58d04f69bb33f17cfe6db3d9885fe4c9adabd2d1.tar.gz
sonarqube-58d04f69bb33f17cfe6db3d9885fe4c9adabd2d1.zip
SONAR-12512 Allow configuration of multiple GitHub instances
Diffstat (limited to 'sonar-ws')
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java8
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java3
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/AlmSettingsService.java97
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/CreateGithubRequest.java85
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/DeleteRequest.java45
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/UpdateGithubRequest.java96
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/package-info.java25
-rw-r--r--sonar-ws/src/main/protobuf/ws-alm_settings.proto38
8 files changed, 397 insertions, 0 deletions
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java
index b532a4145e7..22b9c5112bc 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java
@@ -20,6 +20,7 @@
package org.sonarqube.ws.client;
import javax.annotation.Generated;
+import org.sonarqube.ws.client.almsettings.AlmSettingsService;
import org.sonarqube.ws.client.analysisreports.AnalysisReportsService;
import org.sonarqube.ws.client.applications.ApplicationsService;
import org.sonarqube.ws.client.authentication.AuthenticationService;
@@ -85,6 +86,7 @@ class DefaultWsClient implements WsClient {
private final WsConnector wsConnector;
+ private final AlmSettingsService almSettingsService;
private final AnalysisReportsService analysisReportsService;
private final ApplicationsService applicationsService;
private final AuthenticationService authenticationService;
@@ -142,6 +144,7 @@ class DefaultWsClient implements WsClient {
DefaultWsClient(WsConnector wsConnector) {
this.wsConnector = wsConnector;
+ this.almSettingsService = new AlmSettingsService(wsConnector);
this.analysisReportsService = new AnalysisReportsService(wsConnector);
this.applicationsService = new ApplicationsService(wsConnector);
this.authenticationService = new AuthenticationService(wsConnector);
@@ -204,6 +207,11 @@ class DefaultWsClient implements WsClient {
}
@Override
+ public AlmSettingsService almSettings() {
+ return almSettingsService;
+ }
+
+ @Override
public AnalysisReportsService analysisReports() {
return analysisReportsService;
}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java
index 45bda4afc9d..7023bf716fd 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java
@@ -20,6 +20,7 @@
package org.sonarqube.ws.client;
import javax.annotation.Generated;
+import org.sonarqube.ws.client.almsettings.AlmSettingsService;
import org.sonarqube.ws.client.analysisreports.AnalysisReportsService;
import org.sonarqube.ws.client.applications.ApplicationsService;
import org.sonarqube.ws.client.authentication.AuthenticationService;
@@ -97,6 +98,8 @@ public interface WsClient {
WsConnector wsConnector();
+ AlmSettingsService almSettings();
+
AnalysisReportsService analysisReports();
ApplicationsService applications();
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/AlmSettingsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/AlmSettingsService.java
new file mode 100644
index 00000000000..04b802c6741
--- /dev/null
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/AlmSettingsService.java
@@ -0,0 +1,97 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 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.almsettings;
+
+import javax.annotation.Generated;
+import org.sonarqube.ws.AlmSettings;
+import org.sonarqube.ws.MediaTypes;
+import org.sonarqube.ws.client.BaseService;
+import org.sonarqube.ws.client.GetRequest;
+import org.sonarqube.ws.client.PostRequest;
+import org.sonarqube.ws.client.WsConnector;
+
+/**
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_settings">Further information about this web service online</a>
+ */
+@Generated("sonar-ws-generator")
+public class AlmSettingsService extends BaseService {
+
+ public AlmSettingsService(WsConnector wsConnector) {
+ super(wsConnector, "api/alm_settings");
+ }
+
+ /**
+ *
+ * This is a POST request.
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_settings/create_github">Further information about this action online (including a response example)</a>
+ * @since 8.1
+ */
+ public void createGithub(CreateGithubRequest request) {
+ call(
+ new PostRequest(path("create_github"))
+ .setParam("appId", request.getAppId())
+ .setParam("key", request.getKey())
+ .setParam("privateKey", request.getPrivateKey())
+ .setParam("url", request.getUrl())
+ .setMediaType(MediaTypes.JSON)).content();
+ }
+
+ /**
+ *
+ * This is a POST request.
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_settings/delete">Further information about this action online (including a response example)</a>
+ * @since 8.1
+ */
+ public void delete(DeleteRequest request) {
+ call(
+ new PostRequest(path("delete"))
+ .setParam("key", request.getKey())
+ .setMediaType(MediaTypes.JSON)).content();
+ }
+
+ /**
+ *
+ * This is a GET request.
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_settings/list_definitions">Further information about this action online (including a response example)</a>
+ * @since 8.1
+ */
+ public AlmSettings.ListDefinitionsWsResponse listDefinitions() {
+ return call(
+ new GetRequest(path("list_definitions")),
+ AlmSettings.ListDefinitionsWsResponse.parser());
+ }
+
+ /**
+ *
+ * This is a POST request.
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_settings/update_github">Further information about this action online (including a response example)</a>
+ * @since 8.1
+ */
+ public void updateGithub(UpdateGithubRequest request) {
+ call(
+ new PostRequest(path("update_github"))
+ .setParam("appId", request.getAppId())
+ .setParam("key", request.getKey())
+ .setParam("newKey", request.getNewKey())
+ .setParam("privateKey", request.getPrivateKey())
+ .setParam("url", request.getUrl())
+ .setMediaType(MediaTypes.JSON)).content();
+ }
+}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/CreateGithubRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/CreateGithubRequest.java
new file mode 100644
index 00000000000..ad8edf7ac52
--- /dev/null
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/CreateGithubRequest.java
@@ -0,0 +1,85 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 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.almsettings;
+
+import javax.annotation.Generated;
+
+/**
+ * This is part of the internal API.
+ * This is a POST request.
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_settings/create_github">Further information about this action online (including a response example)</a>
+ * @since 8.1
+ */
+@Generated("sonar-ws-generator")
+public class CreateGithubRequest {
+
+ private String appId;
+ private String key;
+ private String privateKey;
+ private String url;
+
+ /**
+ * This is a mandatory parameter.
+ */
+ public CreateGithubRequest setAppId(String appId) {
+ this.appId = appId;
+ return this;
+ }
+
+ public String getAppId() {
+ return appId;
+ }
+
+ /**
+ * This is a mandatory parameter.
+ */
+ public CreateGithubRequest setKey(String key) {
+ this.key = key;
+ return this;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ /**
+ * This is a mandatory parameter.
+ */
+ public CreateGithubRequest setPrivateKey(String privateKey) {
+ this.privateKey = privateKey;
+ return this;
+ }
+
+ public String getPrivateKey() {
+ return privateKey;
+ }
+
+ /**
+ * This is a mandatory parameter.
+ */
+ public CreateGithubRequest setUrl(String url) {
+ this.url = url;
+ return this;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/DeleteRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/DeleteRequest.java
new file mode 100644
index 00000000000..a65ffd11c08
--- /dev/null
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/DeleteRequest.java
@@ -0,0 +1,45 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 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.almsettings;
+
+import javax.annotation.Generated;
+
+/**
+ * This is a POST request.
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_settings/delete">Further information about this action online (including a response example)</a>
+ * @since 8.1
+ */
+@Generated("sonar-ws-generator")
+public class DeleteRequest {
+
+ private String key;
+
+ public String getKey() {
+ return key;
+ }
+
+ /**
+ * This is a mandatory parameter.
+ */
+ public DeleteRequest setKey(String key) {
+ this.key = key;
+ return this;
+ }
+}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/UpdateGithubRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/UpdateGithubRequest.java
new file mode 100644
index 00000000000..ef06fa664f0
--- /dev/null
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/UpdateGithubRequest.java
@@ -0,0 +1,96 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 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.almsettings;
+
+import javax.annotation.Generated;
+
+/**
+ * This is a POST request.
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_settings/update_github">Further information about this action online (including a response example)</a>
+ * @since 8.1
+ */
+@Generated("sonar-ws-generator")
+public class UpdateGithubRequest {
+
+ private String appId;
+ private String key;
+ private String newKey;
+ private String privateKey;
+ private String url;
+
+ public String getAppId() {
+ return appId;
+ }
+
+ /**
+ * This is a mandatory parameter.
+ */
+ public UpdateGithubRequest setAppId(String appId) {
+ this.appId = appId;
+ return this;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ /**
+ * This is a mandatory parameter.
+ */
+ public UpdateGithubRequest setKey(String key) {
+ this.key = key;
+ return this;
+ }
+
+ public String getNewKey() {
+ return newKey;
+ }
+
+ /**
+ */
+ public UpdateGithubRequest setNewKey(String newKey) {
+ this.newKey = newKey;
+ return this;
+ }
+
+ public String getPrivateKey() {
+ return privateKey;
+ }
+
+ /**
+ * This is a mandatory parameter.
+ */
+ public UpdateGithubRequest setPrivateKey(String privateKey) {
+ this.privateKey = privateKey;
+ return this;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ /**
+ * This is a mandatory parameter.
+ */
+ public UpdateGithubRequest setUrl(String url) {
+ this.url = url;
+ return this;
+ }
+}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/package-info.java
new file mode 100644
index 00000000000..b3a8311984c
--- /dev/null
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/package-info.java
@@ -0,0 +1,25 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 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.
+ */
+@ParametersAreNonnullByDefault
+@Generated("sonar-ws-generator")
+package org.sonarqube.ws.client.almsettings;
+
+import javax.annotation.Generated;
+import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-ws/src/main/protobuf/ws-alm_settings.proto b/sonar-ws/src/main/protobuf/ws-alm_settings.proto
new file mode 100644
index 00000000000..ba67e11017e
--- /dev/null
+++ b/sonar-ws/src/main/protobuf/ws-alm_settings.proto
@@ -0,0 +1,38 @@
+// SonarQube, open source software quality management tool.
+// Copyright (C) 2008-2016 SonarSource
+// mailto:contact AT sonarsource DOT com
+//
+// SonarQube 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.
+//
+// SonarQube 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.
+
+syntax = "proto2";
+
+package sonarqube.ws.almsetting;
+
+option java_package = "org.sonarqube.ws";
+option java_outer_classname = "AlmSettings";
+option optimize_for = SPEED;
+
+// WS api/alm_settings/list_definitions
+message ListDefinitionsWsResponse {
+ repeated AlmSettingGithub github = 1;
+}
+
+message AlmSettingGithub {
+ optional string key = 1;
+ optional string url = 2;
+ optional string appId = 3;
+ optional string privateKey = 4;
+}
+