diff options
author | Pierre Guillot <50145663+pierre-guillot-sonarsource@users.noreply.github.com> | 2019-10-16 14:03:34 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2019-11-06 10:04:25 +0100 |
commit | 26b26898865e90dcf772130d8224e1278d5dc8de (patch) | |
tree | d9bcb97ffb6d55a786c553f0d4e5052a5d301cf4 /sonar-ws/src | |
parent | 58d04f69bb33f17cfe6db3d9885fe4c9adabd2d1 (diff) | |
download | sonarqube-26b26898865e90dcf772130d8224e1278d5dc8de.tar.gz sonarqube-26b26898865e90dcf772130d8224e1278d5dc8de.zip |
SONAR-12515 Allow configuration of multiple Azure instances
Diffstat (limited to 'sonar-ws/src')
5 files changed, 178 insertions, 13 deletions
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 index 04b802c6741..85b2f8ac393 100644 --- 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 @@ -39,6 +39,18 @@ public class AlmSettingsService extends BaseService { /** * + * 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/create_github">Further information about this action online (including a response example)</a> * @since 8.1 @@ -56,6 +68,23 @@ public class AlmSettingsService extends BaseService { /** * * 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(); + } + + /** + * + * 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 */ @@ -68,30 +97,31 @@ public class AlmSettingsService extends BaseService { /** * - * 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> + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_settings/create_azure">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()); + public void createAzure(CreateAzureRequest request) { + call( + new PostRequest(path("create_azure")) + .setParam("key", request.getKey()) + .setParam("personalAccessToken", request.getPersonalAccessToken()) + .setMediaType(MediaTypes.JSON)).content(); } /** * * 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> + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_settings/update_azure">Further information about this action online (including a response example)</a> * @since 8.1 */ - public void updateGithub(UpdateGithubRequest request) { + public void updateAzure(UpdateAzureRequest request) { call( - new PostRequest(path("update_github")) - .setParam("appId", request.getAppId()) + new PostRequest(path("update_azure")) .setParam("key", request.getKey()) .setParam("newKey", request.getNewKey()) - .setParam("privateKey", request.getPrivateKey()) - .setParam("url", request.getUrl()) + .setParam("personalAccessToken", request.getPersonalAccessToken()) .setMediaType(MediaTypes.JSON)).content(); } + } diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/CreateAzureRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/CreateAzureRequest.java new file mode 100644 index 00000000000..b3f586975b8 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/CreateAzureRequest.java @@ -0,0 +1,59 @@ +/* + * 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/create_azure">Further information about this action online (including a response example)</a> + * @since 8.1 + */ +@Generated("sonar-ws-generator") +public class CreateAzureRequest { + + private String key; + private String personalAccessToken; + + /** + * This is a mandatory parameter. + */ + public CreateAzureRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * This is a mandatory parameter. + */ + public CreateAzureRequest setPersonalAccessToken(String personalAccessToken) { + this.personalAccessToken = personalAccessToken; + return this; + } + + public String getPersonalAccessToken() { + return personalAccessToken; + } + +} 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 index ad8edf7ac52..0db264fa4c4 100644 --- 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 @@ -22,7 +22,6 @@ 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 diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/UpdateAzureRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/UpdateAzureRequest.java new file mode 100644 index 00000000000..f6428ee7289 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/UpdateAzureRequest.java @@ -0,0 +1,71 @@ +/* + * 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_azure">Further information about this action online (including a response example)</a> + * @since 8.1 + */ +@Generated("sonar-ws-generator") +public class UpdateAzureRequest { + + private String key; + private String newKey; + private String personalAccessToken; + + public String getKey() { + return key; + } + + /** + * This is a mandatory parameter. + */ + public UpdateAzureRequest setKey(String key) { + this.key = key; + return this; + } + + public String getNewKey() { + return newKey; + } + + /** + */ + public UpdateAzureRequest setNewKey(String newKey) { + this.newKey = newKey; + return this; + } + + public String getPersonalAccessToken() { + return personalAccessToken; + } + + /** + * This is a mandatory parameter. + */ + public UpdateAzureRequest setPersonalAccessToken(String personalAccessToken) { + this.personalAccessToken = personalAccessToken; + return this; + } + +} diff --git a/sonar-ws/src/main/protobuf/ws-alm_settings.proto b/sonar-ws/src/main/protobuf/ws-alm_settings.proto index ba67e11017e..e7ba035cd23 100644 --- a/sonar-ws/src/main/protobuf/ws-alm_settings.proto +++ b/sonar-ws/src/main/protobuf/ws-alm_settings.proto @@ -27,6 +27,7 @@ option optimize_for = SPEED; // WS api/alm_settings/list_definitions message ListDefinitionsWsResponse { repeated AlmSettingGithub github = 1; + repeated AlmSettingAzure azure = 2; } message AlmSettingGithub { @@ -36,3 +37,8 @@ message AlmSettingGithub { optional string privateKey = 4; } +message AlmSettingAzure { + optional string key = 1; + optional string personalAccessToken = 2; +} + |