diff options
author | Pierre Guillot <50145663+pierre-guillot-sonarsource@users.noreply.github.com> | 2019-10-16 14:06:15 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2019-11-06 10:04:25 +0100 |
commit | 87faff43bcc6dcd1f2ddc6b51ba8eaf7e65ed034 (patch) | |
tree | 6c2c0e87ef08569efba83d822562aef7ff9a2f9c /sonar-ws/src | |
parent | 26b26898865e90dcf772130d8224e1278d5dc8de (diff) | |
download | sonarqube-87faff43bcc6dcd1f2ddc6b51ba8eaf7e65ed034.tar.gz sonarqube-87faff43bcc6dcd1f2ddc6b51ba8eaf7e65ed034.zip |
SONAR-12576 Allow configuration of multiple Bitbucket instances
Diffstat (limited to 'sonar-ws/src')
4 files changed, 192 insertions, 0 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 85b2f8ac393..3392f021f7a 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 @@ -124,4 +124,35 @@ public class AlmSettingsService extends BaseService { .setMediaType(MediaTypes.JSON)).content(); } + /** + * + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_settings/create_bitbucket">Further information about this action online (including a response example)</a> + * @since 8.1 + */ + public void createBitbucket(CreateBitbucketRequest request) { + call( + new PostRequest(path("create_bitbucket")) + .setParam("key", request.getKey()) + .setParam("url", request.getUrl()) + .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_bitbucket">Further information about this action online (including a response example)</a> + * @since 8.1 + */ + public void updateBitbucket(UpdateBitbucketRequest request) { + call( + new PostRequest(path("update_bitbucket")) + .setParam("key", request.getKey()) + .setParam("newKey", request.getNewKey()) + .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/CreateBitbucketRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/CreateBitbucketRequest.java new file mode 100644 index 00000000000..dd698a7a02e --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/CreateBitbucketRequest.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/create_bitbucket">Further information about this action online (including a response example)</a> + * @since 8.1 + */ +@Generated("sonar-ws-generator") +public class CreateBitbucketRequest { + + private String key; + private String url; + private String personalAccessToken; + + /** + * This is a mandatory parameter. + */ + public CreateBitbucketRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * This is a mandatory parameter. + */ + public CreateBitbucketRequest setPersonalAccessToken(String personalAccessToken) { + this.personalAccessToken = personalAccessToken; + return this; + } + + public String getPersonalAccessToken() { + return personalAccessToken; + } + + /** + * This is a mandatory parameter. + */ + public CreateBitbucketRequest 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/UpdateBitbucketRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/UpdateBitbucketRequest.java new file mode 100644 index 00000000000..78df75e2428 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/UpdateBitbucketRequest.java @@ -0,0 +1,84 @@ +/* + * 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_bitbucket">Further information about this action online (including a response example)</a> + * @since 8.1 + */ +@Generated("sonar-ws-generator") +public class UpdateBitbucketRequest { + + private String key; + private String newKey; + private String personalAccessToken; + private String url; + + + public String getKey() { + return key; + } + + /** + * This is a mandatory parameter. + */ + public UpdateBitbucketRequest setKey(String key) { + this.key = key; + return this; + } + + public String getNewKey() { + return newKey; + } + + /** + */ + public UpdateBitbucketRequest setNewKey(String newKey) { + this.newKey = newKey; + return this; + } + + public String getPersonalAccessToken() { + return personalAccessToken; + } + + /** + * This is a mandatory parameter. + */ + public UpdateBitbucketRequest setPersonalAccessToken(String personalAccessToken) { + this.personalAccessToken = personalAccessToken; + return this; + } + + public String getUrl() { + return url; + } + + /** + * This is a mandatory parameter. + */ + public UpdateBitbucketRequest setUrl(String url) { + this.url = url; + 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 e7ba035cd23..aca6db28614 100644 --- a/sonar-ws/src/main/protobuf/ws-alm_settings.proto +++ b/sonar-ws/src/main/protobuf/ws-alm_settings.proto @@ -28,6 +28,7 @@ option optimize_for = SPEED; message ListDefinitionsWsResponse { repeated AlmSettingGithub github = 1; repeated AlmSettingAzure azure = 2; + repeated AlmSettingBitbucket bitbucket = 3; } message AlmSettingGithub { @@ -42,3 +43,8 @@ message AlmSettingAzure { optional string personalAccessToken = 2; } +message AlmSettingBitbucket { + optional string key = 1; + optional string url = 2; + optional string personalAccessToken = 3; +} |