]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-12515 Allow binding of projects on Azure ALM
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 23 Oct 2019 09:30:18 +0000 (11:30 +0200)
committersonartech <sonartech@sonarsource.com>
Wed, 6 Nov 2019 09:04:27 +0000 (10:04 +0100)
15 files changed:
server/sonar-db-dao/src/testFixtures/java/org/sonar/db/almsettings/AlmSettingsDbTester.java
server/sonar-db-dao/src/testFixtures/java/org/sonar/db/almsettings/AlmSettingsTesting.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/almsettings/AlmSettingsSupport.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/almsettings/SetAzureBindingAction.java
server/sonar-webserver-webapi/src/main/resources/org/sonar/server/almsettings/list-example.json
server/sonar-webserver-webapi/src/main/resources/org/sonar/server/almsettings/list_definitions-example.json
server/sonar-webserver-webapi/src/test/java/org/sonar/server/almsettings/CountBindingActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/almsettings/GetBindingActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/almsettings/ListActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/almsettings/ListDefinitionsActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/almsettings/SetAzureBindingActionTest.java [new file with mode: 0644]
sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/AlmSettingsService.java
sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/GetBindingRequest.java [new file with mode: 0644]
sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/GetGithubBindingRequest.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/SetAzureBindingRequest.java [new file with mode: 0644]

index f0cb2ee71fe00f4d5276747fd6353ead68fc48a4..4a1c04ae0675f1b6b57de9e93401c309b1b0ddd9 100644 (file)
@@ -27,6 +27,7 @@ import org.sonar.db.component.ComponentDto;
 
 import static java.util.Arrays.stream;
 import static org.sonar.db.almsettings.AlmSettingsTesting.newAzureAlmSettingDto;
+import static org.sonar.db.almsettings.AlmSettingsTesting.newAzureProjectAlmSettingDto;
 import static org.sonar.db.almsettings.AlmSettingsTesting.newBitbucketAlmSettingDto;
 import static org.sonar.db.almsettings.AlmSettingsTesting.newGithubAlmSettingDto;
 import static org.sonar.db.almsettings.AlmSettingsTesting.newGithubProjectAlmSettingDto;
@@ -56,9 +57,15 @@ public class AlmSettingsDbTester {
 
   @SafeVarargs
   public final ProjectAlmSettingDto insertGitHubProjectAlmSetting(AlmSettingDto githubAlmSetting, ComponentDto project, Consumer<ProjectAlmSettingDto>... populators) {
-    ProjectAlmSettingDto dto = newGithubProjectAlmSettingDto(githubAlmSetting, project);
-    stream(populators).forEach(p -> p.accept(dto));
+    return insertProjectAlmSetting(newGithubProjectAlmSettingDto(githubAlmSetting, project), populators);
+  }
+
+  public ProjectAlmSettingDto insertAzureProjectAlmSetting(AlmSettingDto azureAlmSetting, ComponentDto project) {
+    return insertProjectAlmSetting(newAzureProjectAlmSettingDto(azureAlmSetting, project));
+  }
 
+  private ProjectAlmSettingDto insertProjectAlmSetting(ProjectAlmSettingDto dto, Consumer<ProjectAlmSettingDto>... populators) {
+    stream(populators).forEach(p -> p.accept(dto));
     db.getDbClient().projectAlmSettingDao().insertOrUpdate(db.getSession(), dto);
     db.commit();
     return dto;
@@ -66,7 +73,6 @@ public class AlmSettingsDbTester {
 
   private AlmSettingDto insert(AlmSettingDto dto, Consumer<AlmSettingDto>[] populators) {
     stream(populators).forEach(p -> p.accept(dto));
-
     db.getDbClient().almSettingDao().insert(db.getSession(), dto);
     db.commit();
     return dto;
index 99952b0aa9636d61ebf44ee4341ee8fe5f5d3402..74d32a7c4228a2cd33f9b03b89792f029f25f82e 100644 (file)
@@ -59,4 +59,10 @@ public class AlmSettingsTesting {
       .setAlmRepo(randomAlphanumeric(256))
       .setAlmSlug(randomAlphanumeric(256));
   }
+
+  public static ProjectAlmSettingDto newAzureProjectAlmSettingDto(AlmSettingDto githubAlmSetting, ComponentDto project) {
+    return new ProjectAlmSettingDto()
+      .setAlmSettingUuid(githubAlmSetting.getUuid())
+      .setProjectUuid(project.uuid());
+  }
 }
index bbead0d9abf84a1b1aeba75802aa8dbe6102b75b..f4e0812acdd5887780eaf9e810154b57c120b0d5 100644 (file)
@@ -33,7 +33,7 @@ import org.sonarqube.ws.AlmSettings;
 import static java.lang.String.format;
 import static org.sonar.api.web.UserRole.ADMIN;
 
-class AlmSettingsSupport {
+public class AlmSettingsSupport {
 
   private final DbClient dbClient;
   private final UserSession userSession;
index 31b7e0e1db2c372467fbe7d0d39cb6bda275518f..02cb4a17bdbff7dcfe9a73d72ff96e0265f2092c 100644 (file)
@@ -73,7 +73,9 @@ public class SetAzureBindingAction implements AlmSettingsWsAction {
       AlmSettingDto almSettingDto = almSettingsSupport.getAlmSetting(dbSession, almSetting);
       dbClient.projectAlmSettingDao().insertOrUpdate(dbSession, new ProjectAlmSettingDto()
         .setProjectUuid(project.uuid())
-        .setAlmSettingUuid(almSettingDto.getUuid()));
+        .setAlmSettingUuid(almSettingDto.getUuid())
+        .setAlmRepo(null)
+        .setAlmSlug(null));
       dbSession.commit();
     }
   }
index 624dbadd03f465ac75b0292bbdafff2242280a2a..444283d396023c480d200e82de1f6da59cdfbfaa 100644 (file)
@@ -4,6 +4,11 @@
       "key": "GitHub Server - Dev Team",
       "alm": "github",
       "url": "https://github.enterprise.com"
+    },
+    {
+      "key": "Azure Server - Dev Team",
+      "alm": "azure",
+      "url": "https://azure.com"
     }
   ]
 }
index aedb00599c123f7a0c935ce4a93c7dc35ea39deb..f565a04acb67bde4882002f123a2bac94277903f 100644 (file)
       "key": "Azure Devops Server - Dev Team",
       "personalAccessToken": "12345"
     }
+  ],
+  "bitbucket": [
+    {
+      "key": "Bitbucket Server - Dev Team",
+      "url": "https://bitbucket.enterprise.com",
+      "personalAccessToken": "abcdef"
+    }
   ]
 }
index 8ea3c03fc4570562efcb13e1a386748d154ca4cd..6ff8b658bdb57cd3fbb8f26621840419405efddf 100644 (file)
@@ -52,23 +52,39 @@ public class CountBindingActionTest {
     new AlmSettingsSupport(db.getDbClient(), userSession, new ComponentFinder(db.getDbClient(), null))));
 
   @Test
-  public void count_binding() {
+  public void count_github_binding() {
     UserDto user = db.users().insertUser();
     userSession.logIn(user).setSystemAdministrator();
-    AlmSettingDto githubAlmSetting = db.almSettings().insertGitHubAlmSetting();
+    AlmSettingDto almSetting = db.almSettings().insertGitHubAlmSetting();
     ComponentDto project1 = db.components().insertPrivateProject();
     ComponentDto project2 = db.components().insertPrivateProject();
-    db.almSettings().insertGitHubProjectAlmSetting(githubAlmSetting, project1);
-    db.almSettings().insertGitHubProjectAlmSetting(githubAlmSetting, project2);
+    db.almSettings().insertGitHubProjectAlmSetting(almSetting, project1);
+    db.almSettings().insertGitHubProjectAlmSetting(almSetting, project2);
 
     CountBindingWsResponse response = ws.newRequest()
-      .setParam("almSetting", githubAlmSetting.getKey())
+      .setParam("almSetting", almSetting.getKey())
       .executeProtobuf(CountBindingWsResponse.class);
 
-    assertThat(response.getKey()).isEqualTo(githubAlmSetting.getKey());
+    assertThat(response.getKey()).isEqualTo(almSetting.getKey());
     assertThat(response.getProjects()).isEqualTo(2);
   }
 
+  @Test
+  public void count_azure_binding() {
+    UserDto user = db.users().insertUser();
+    userSession.logIn(user).setSystemAdministrator();
+    AlmSettingDto almSetting = db.almSettings().insertAzureAlmSetting();
+    ComponentDto project1 = db.components().insertPrivateProject();
+    db.almSettings().insertAzureProjectAlmSetting(almSetting, project1);
+
+    CountBindingWsResponse response = ws.newRequest()
+      .setParam("almSetting", almSetting.getKey())
+      .executeProtobuf(CountBindingWsResponse.class);
+
+    assertThat(response.getKey()).isEqualTo(almSetting.getKey());
+    assertThat(response.getProjects()).isEqualTo(1);
+  }
+
   @Test
   public void fail_when_alm_setting_does_not_exist() {
     UserDto user = db.users().insertUser();
index 8b59c81aa8b6a015c7d7e4a383c2df41ed67e30f..54fe6fc39e734cb6a5731b0caa8f9a8a4a1aefeb 100644 (file)
@@ -55,7 +55,7 @@ public class GetBindingActionTest {
   private WsActionTester ws = new WsActionTester(new GetBindingAction(db.getDbClient(), userSession, new ComponentFinder(db.getDbClient(), null)));
 
   @Test
-  public void get_project_binding() {
+  public void get_github_project_binding() {
     UserDto user = db.users().insertUser();
     ComponentDto project = db.components().insertPrivateProject();
     userSession.logIn(user).addProjectPermission(ADMIN, project);
@@ -72,6 +72,24 @@ public class GetBindingActionTest {
     assertThat(response.getUrl()).isEqualTo(githubAlmSetting.getUrl());
   }
 
+  @Test
+  public void get_azure_project_binding() {
+    UserDto user = db.users().insertUser();
+    ComponentDto project = db.components().insertPrivateProject();
+    userSession.logIn(user).addProjectPermission(ADMIN, project);
+    AlmSettingDto githubAlmSetting = db.almSettings().insertAzureAlmSetting();
+    db.almSettings().insertAzureProjectAlmSetting(githubAlmSetting, project);
+
+    GetBindingWsResponse response = ws.newRequest()
+      .setParam("project", project.getKey())
+      .executeProtobuf(GetBindingWsResponse.class);
+
+    assertThat(response.getAlm()).isEqualTo(AlmSettings.Alm.azure);
+    assertThat(response.getKey()).isEqualTo(githubAlmSetting.getKey());
+    assertThat(response.hasRepository()).isFalse();
+    assertThat(response.hasUrl()).isFalse();
+  }
+
   @Test
   public void fail_when_project_does_not_exist() {
     UserDto user = db.users().insertUser();
index 72baba18c4aa55fa1875d37ddc956e1f6f853804..ca54685f6dcb6bc3a29b4fcc30c213539b70b860 100644 (file)
@@ -61,16 +61,19 @@ public class ListActionTest {
     userSession.logIn(user).addProjectPermission(ADMIN, project);
     AlmSettingDto githubAlmSetting1 = db.almSettings().insertGitHubAlmSetting();
     AlmSettingDto githubAlmSetting2 = db.almSettings().insertGitHubAlmSetting();
+    AlmSettingDto azureAlmSetting = db.almSettings().insertAzureAlmSetting();
 
     ListWsResponse response = ws.newRequest()
       .setParam("project", project.getKey())
       .executeProtobuf(AlmSettings.ListWsResponse.class);
 
     assertThat(response.getAlmSettingsList())
-      .extracting(AlmSetting::getAlm, AlmSetting::getKey, AlmSetting::getUrl)
+      .extracting(AlmSetting::getAlm, AlmSetting::getKey, AlmSetting::hasUrl, AlmSetting::getUrl)
       .containsExactlyInAnyOrder(
-        tuple(AlmSettings.Alm.github, githubAlmSetting1.getKey(), githubAlmSetting1.getUrl()),
-        tuple(AlmSettings.Alm.github, githubAlmSetting2.getKey(), githubAlmSetting2.getUrl()));
+        tuple(AlmSettings.Alm.github, githubAlmSetting1.getKey(), true, githubAlmSetting1.getUrl()),
+        tuple(AlmSettings.Alm.github, githubAlmSetting2.getKey(), true, githubAlmSetting2.getUrl()),
+        tuple(AlmSettings.Alm.azure, azureAlmSetting.getKey(), false, "")
+      );
   }
 
   @Test
@@ -115,6 +118,12 @@ public class ListActionTest {
         .setAppId("12345")
         .setPrivateKey("54684654"));
     db.almSettings().insertGitHubProjectAlmSetting(githubAlmSetting, project, projectAlmSetting -> projectAlmSetting.setAlmRepo("team/project"));
+    AlmSettingDto azureAlmSetting = db.almSettings().insertAzureAlmSetting(
+      almSettingDto -> almSettingDto
+        .setKey("Azure Server - Dev Team")
+        .setUrl("https://azure.com")
+        .setPersonalAccessToken("abcdefg"));
+    db.almSettings().insertAzureProjectAlmSetting(azureAlmSetting, project);
 
     String response = ws.newRequest()
       .setParam("project", project.getKey())
@@ -129,6 +138,7 @@ public class ListActionTest {
 
     assertThat(def.since()).isEqualTo("8.1");
     assertThat(def.isPost()).isFalse();
+    assertThat(def.responseExampleAsString()).isNotEmpty();
     assertThat(def.params())
       .extracting(WebService.Param::key, WebService.Param::isRequired)
       .containsExactlyInAnyOrder(tuple("project", true));
index d97d31af8ed8d15328cde965bbc5bc91c8898d5a..a32b074a3f32c21b47047b1ff33799cbdeed4817 100644 (file)
@@ -96,11 +96,16 @@ public class ListDefinitionsActionTest {
         .setUrl("https://github.enterprise.com")
         .setAppId("12345")
         .setPrivateKey("54684654"));
-
     db.almSettings().insertAzureAlmSetting(
       a -> a.setKey("Azure Devops Server - Dev Team")
       .setPersonalAccessToken("12345")
     );
+    db.almSettings().insertBitbucketAlmSetting(
+      a -> a.setKey("Bitbucket Server - Dev Team")
+        .setUrl("https://bitbucket.enterprise.com")
+        .setPersonalAccessToken("abcdef")
+    );
+
     String response = ws.newRequest().execute().getInput();
 
     assertJson(response).isSimilarTo(getClass().getResource("list_definitions-example.json"));
@@ -113,5 +118,6 @@ public class ListDefinitionsActionTest {
     assertThat(def.since()).isEqualTo("8.1");
     assertThat(def.params()).isEmpty();
     assertThat(def.isPost()).isFalse();
+    assertThat(def.responseExampleAsString()).isNotEmpty();
   }
 }
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/almsettings/SetAzureBindingActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/almsettings/SetAzureBindingActionTest.java
new file mode 100644 (file)
index 0000000..b20f83f
--- /dev/null
@@ -0,0 +1,147 @@
+/*
+ * 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.sonar.server.almsettings;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.sonar.api.server.ws.WebService;
+import org.sonar.db.DbTester;
+import org.sonar.db.alm.setting.AlmSettingDto;
+import org.sonar.db.alm.setting.ProjectAlmSettingDto;
+import org.sonar.db.component.ComponentDto;
+import org.sonar.db.user.UserDto;
+import org.sonar.server.component.ComponentFinder;
+import org.sonar.server.exceptions.ForbiddenException;
+import org.sonar.server.exceptions.NotFoundException;
+import org.sonar.server.tester.UserSessionRule;
+import org.sonar.server.ws.WsActionTester;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.groups.Tuple.tuple;
+import static org.sonar.api.web.UserRole.ADMIN;
+import static org.sonar.api.web.UserRole.USER;
+
+public class SetAzureBindingActionTest {
+
+  @Rule
+  public ExpectedException expectedException = ExpectedException.none();
+  @Rule
+  public UserSessionRule userSession = UserSessionRule.standalone();
+  @Rule
+  public DbTester db = DbTester.create();
+
+  private WsActionTester ws = new WsActionTester(new SetAzureBindingAction(db.getDbClient(),
+    new AlmSettingsSupport(db.getDbClient(), userSession, new ComponentFinder(db.getDbClient(), null))));
+
+  @Test
+  public void set_azure_project_binding() {
+    UserDto user = db.users().insertUser();
+    AlmSettingDto almSetting = db.almSettings().insertAzureAlmSetting();
+    ComponentDto project = db.components().insertPrivateProject();
+    userSession.logIn(user).addProjectPermission(ADMIN, project);
+
+    ws.newRequest()
+      .setParam("almSetting", almSetting.getKey())
+      .setParam("project", project.getKey())
+      .execute();
+
+    assertThat(db.getDbClient().projectAlmSettingDao().selectByProject(db.getSession(), project).get())
+      .extracting(ProjectAlmSettingDto::getAlmSettingUuid, ProjectAlmSettingDto::getProjectUuid, ProjectAlmSettingDto::getAlmRepo, ProjectAlmSettingDto::getAlmSlug)
+      .containsOnly(almSetting.getUuid(), project.uuid(), null, null);
+  }
+
+  @Test
+  public void override_existing_azure_project_binding() {
+    UserDto user = db.users().insertUser();
+    AlmSettingDto almSetting = db.almSettings().insertAzureAlmSetting();
+    ComponentDto project = db.components().insertPrivateProject();
+    db.almSettings().insertAzureProjectAlmSetting(almSetting, project);
+    AlmSettingDto anotherAlmSetting = db.almSettings().insertAzureAlmSetting();
+    userSession.logIn(user).addProjectPermission(ADMIN, project);
+
+    ws.newRequest()
+      .setParam("almSetting", anotherAlmSetting.getKey())
+      .setParam("project", project.getKey())
+      .execute();
+
+    assertThat(db.getDbClient().projectAlmSettingDao().selectByProject(db.getSession(), project).get())
+      .extracting(ProjectAlmSettingDto::getAlmSettingUuid, ProjectAlmSettingDto::getProjectUuid, ProjectAlmSettingDto::getAlmRepo, ProjectAlmSettingDto::getAlmSlug)
+      .containsOnly(anotherAlmSetting.getUuid(), project.uuid(), null, null);
+  }
+
+  @Test
+  public void fail_when_alm_setting_does_not_exist() {
+    UserDto user = db.users().insertUser();
+    ComponentDto project = db.components().insertPrivateProject();
+    userSession.logIn(user).addProjectPermission(ADMIN, project);
+
+    expectedException.expect(NotFoundException.class);
+    expectedException.expectMessage("ALM setting with key 'unknown' cannot be found");
+
+    ws.newRequest()
+      .setParam("almSetting", "unknown")
+      .setParam("project", project.getKey())
+      .execute();
+  }
+
+  @Test
+  public void fail_when_project_does_not_exist() {
+    UserDto user = db.users().insertUser();
+    AlmSettingDto almSetting = db.almSettings().insertAzureAlmSetting();
+    ComponentDto project = db.components().insertPrivateProject();
+    userSession.logIn(user).addProjectPermission(ADMIN, project);
+
+    expectedException.expect(NotFoundException.class);
+
+    ws.newRequest()
+      .setParam("almSetting", almSetting.getKey())
+      .setParam("project", "unknown")
+      .execute();
+  }
+
+  @Test
+  public void fail_when_missing_administer_permission_on_project() {
+    UserDto user = db.users().insertUser();
+    AlmSettingDto almSetting = db.almSettings().insertAzureAlmSetting();
+    ComponentDto project = db.components().insertPrivateProject();
+    userSession.logIn(user).addProjectPermission(USER, project);
+
+    expectedException.expect(ForbiddenException.class);
+
+    ws.newRequest()
+      .setParam("almSetting", almSetting.getKey())
+      .setParam("project", project.getKey())
+      .execute();
+  }
+
+  @Test
+  public void definition() {
+    WebService.Action def = ws.getDef();
+
+    assertThat(def.since()).isEqualTo("8.1");
+    assertThat(def.isPost()).isTrue();
+    assertThat(def.params())
+      .extracting(WebService.Param::key, WebService.Param::isRequired)
+      .containsExactlyInAnyOrder(tuple("almSetting", true), tuple("project", true));
+  }
+
+}
index b461504d0610897c64a42a5a5df2b67f1580d47e..b99978ec45e9a7ded2438b1499edf4312749b105 100644 (file)
@@ -107,7 +107,6 @@ 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/delete_binding">Further information about this action online (including a response example)</a>
@@ -125,7 +124,7 @@ public class AlmSettingsService extends BaseService {
    * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_settings/get_binding">Further information about this action online (including a response example)</a>
    * @since 8.1
    */
-  public AlmSettings.GetBindingWsResponse getBinding(GetGithubBindingRequest request) {
+  public AlmSettings.GetBindingWsResponse getBinding(GetBindingRequest request) {
     return call(
       new GetRequest(path("get_binding"))
         .setParam("project", request.getProject())
@@ -158,6 +157,19 @@ public class AlmSettingsService extends BaseService {
       AlmSettings.ListDefinitionsWsResponse.parser());
   }
 
+  /**
+   * This is a POST request.
+   * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_settings/set_azure_binding">Further information about this action online (including a response example)</a>
+   * @since 8.1
+   */
+  public void setAzureBinding(SetAzureBindingRequest request) {
+    call(
+      new PostRequest(path("set_azure_binding"))
+        .setParam("almSetting", request.getAlmSetting())
+        .setParam("project", request.getProject())
+        .setMediaType(MediaTypes.JSON)).content();
+  }
+
   /**
    * This is a POST request.
    * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_settings/set_github_binding">Further information about this action online (including a response example)</a>
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/GetBindingRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/GetBindingRequest.java
new file mode 100644 (file)
index 0000000..8fa1984
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * 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/get_github_binding">Further information about this action online (including a response example)</a>
+ * @since 8.1
+ */
+@Generated("sonar-ws-generator")
+public class GetBindingRequest {
+
+  private String project;
+
+  /**
+   * This is a mandatory parameter.
+   */
+  public GetBindingRequest setProject(String project) {
+    this.project = project;
+    return this;
+  }
+
+  public String getProject() {
+    return project;
+  }
+}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/GetGithubBindingRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/GetGithubBindingRequest.java
deleted file mode 100644 (file)
index d38e17c..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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/get_github_binding">Further information about this action online (including a response example)</a>
- * @since 8.1
- */
-@Generated("sonar-ws-generator")
-public class GetGithubBindingRequest {
-
-  private String project;
-
-  /**
-   * This is a mandatory parameter.
-   */
-  public GetGithubBindingRequest setProject(String project) {
-    this.project = project;
-    return this;
-  }
-
-  public String getProject() {
-    return project;
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/SetAzureBindingRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/almsettings/SetAzureBindingRequest.java
new file mode 100644 (file)
index 0000000..ecdbedd
--- /dev/null
@@ -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/set_azure_binding">Further information about this action online (including a response example)</a>
+ * @since 8.1
+ */
+@Generated("sonar-ws-generator")
+public class SetAzureBindingRequest {
+
+  private String almSetting;
+  private String project;
+
+  /**
+   * This is a mandatory parameter.
+   */
+  public SetAzureBindingRequest setAlmSetting(String almSetting) {
+    this.almSetting = almSetting;
+    return this;
+  }
+
+  public String getAlmSetting() {
+    return almSetting;
+  }
+
+  /**
+   * This is a mandatory parameter.
+   */
+  public SetAzureBindingRequest setProject(String project) {
+    this.project = project;
+    return this;
+  }
+
+  public String getProject() {
+    return project;
+  }
+
+}