diff options
author | Pierre Guillot <pierre.guillot@sonarsource.com> | 2020-01-31 15:11:22 +0100 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2020-02-20 20:46:16 +0100 |
commit | cbf4540966ab6d3eb48c2a54262f90bc667096ba (patch) | |
tree | d660e317e7953b2008bbc41f3f4b7d316abe1544 /sonar-ws | |
parent | 7915d064a2d0740face4845dc0d8ea3732f236fb (diff) | |
download | sonarqube-cbf4540966ab6d3eb48c2a54262f90bc667096ba.tar.gz sonarqube-cbf4540966ab6d3eb48c2a54262f90bc667096ba.zip |
SONAR-13001 create endpoint alm_integrations/check_pat + ITs
Diffstat (limited to 'sonar-ws')
5 files changed, 169 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 e79a30533af..68fee7f1f62 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.almintegration.AlmIntegrationService; import org.sonarqube.ws.client.almsettings.AlmSettingsService; import org.sonarqube.ws.client.analysisreports.AnalysisReportsService; import org.sonarqube.ws.client.applications.ApplicationsService; @@ -140,6 +141,7 @@ class DefaultWsClient implements WsClient { private final WebservicesService webservicesService; private final BatchService batchService; private final SecurityReportsService securityReportsService; + private final AlmIntegrationService almIntegrationService; DefaultWsClient(WsConnector wsConnector) { this.wsConnector = wsConnector; @@ -198,6 +200,7 @@ class DefaultWsClient implements WsClient { this.webservicesService = new WebservicesService(wsConnector); this.batchService = new BatchService(wsConnector); this.securityReportsService = new SecurityReportsService(wsConnector); + this.almIntegrationService = new AlmIntegrationService(wsConnector); } @Override @@ -212,6 +215,11 @@ class DefaultWsClient implements WsClient { } @Override + public AlmIntegrationService almIntegrations() { + return almIntegrationService; + } + + @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 f00373232bf..56873593d03 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.almintegration.AlmIntegrationService; import org.sonarqube.ws.client.almsettings.AlmSettingsService; import org.sonarqube.ws.client.analysisreports.AnalysisReportsService; import org.sonarqube.ws.client.applications.ApplicationsService; @@ -100,6 +101,8 @@ public interface WsClient { AlmSettingsService almSettings(); + AlmIntegrationService almIntegrations(); + AnalysisReportsService analysisReports(); ApplicationsService applications(); diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegration/AlmIntegrationService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegration/AlmIntegrationService.java new file mode 100644 index 00000000000..3eb984c20ad --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegration/AlmIntegrationService.java @@ -0,0 +1,63 @@ +/* + * SonarQube + * Copyright (C) 2009-2020 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.almintegration; + +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_integration">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class AlmIntegrationService extends BaseService { + + public AlmIntegrationService(WsConnector wsConnector) { + super(wsConnector, "api/alm_integrations"); + } + + /** + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_integration/set_pat">Further information about this action online (including a response example)</a> + * @since 8.1 + */ + public void setPat(SetPatRequest request) { + call( + new PostRequest(path("set_pat")) + .setParam("almSetting", request.getAlmSetting()) + .setParam("pat", request.getPat()) + .setMediaType(MediaTypes.JSON)).content(); + } + + /** + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_integration/check_pat">Further information about this action online (including a response example)</a> + * @since 8.1 + */ + public void checkPat(CheckPatRequest request) { + call( + new PostRequest(path("check_pat")) + .setParam("almSetting", request.getAlmSetting()) + .setMediaType(MediaTypes.JSON)).content(); + } + +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegration/CheckPatRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegration/CheckPatRequest.java new file mode 100644 index 00000000000..38a007c9301 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegration/CheckPatRequest.java @@ -0,0 +1,43 @@ +/* + * SonarQube + * Copyright (C) 2009-2020 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.almintegration; + +import javax.annotation.Generated; + +/** + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_integration/check_pat">Further information about this action online (including a response example)</a> + * @since 8.1 + */ +@Generated("sonar-ws-generator") +public class CheckPatRequest { + + private String almSetting; + + public String getAlmSetting() { + return almSetting; + } + + public CheckPatRequest setAlmSetting(String almSetting) { + this.almSetting = almSetting; + return this; + } + +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegration/SetPatRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegration/SetPatRequest.java new file mode 100644 index 00000000000..24c622d45f3 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegration/SetPatRequest.java @@ -0,0 +1,52 @@ +/* + * SonarQube + * Copyright (C) 2009-2020 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.almintegration; + +import javax.annotation.Generated; + +/** + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_integration/set_pat">Further information about this action online (including a response example)</a> + * @since 8.1 + */ +@Generated("sonar-ws-generator") +public class SetPatRequest { + + private String almSetting; + private String pat; + + public String getAlmSetting() { + return almSetting; + } + + public SetPatRequest setAlmSetting(String almSetting) { + this.almSetting = almSetting; + return this; + } + + public String getPat() { + return pat; + } + + public SetPatRequest setPat(String pat) { + this.pat = pat; + return this; + } +} |