]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-15548 - Backend ITs for QG delegation
authorBelen Pruvost <belen.pruvost@sonarsource.com>
Thu, 21 Oct 2021 12:50:17 +0000 (14:50 +0200)
committersonartech <sonartech@sonarsource.com>
Fri, 22 Oct 2021 20:03:28 +0000 (20:03 +0000)
sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/AddGroupRequest.java [new file with mode: 0644]
sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/AddUserRequest.java [new file with mode: 0644]
sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/QualitygatesService.java
sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/RemoveGroupRequest.java [new file with mode: 0644]
sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/RemoveUserRequest.java [new file with mode: 0644]
sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SearchGroupsRequest.java [new file with mode: 0644]
sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SearchUsersRequest.java [new file with mode: 0644]

diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/AddGroupRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/AddGroupRequest.java
new file mode 100644 (file)
index 0000000..cf8aa70
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2021 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.qualitygates;
+
+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/qualitygates/add_group">Further information about this action online (including a response example)</a>
+ * @since 9.2
+ */
+@Generated("sonar-ws-generator")
+public class AddGroupRequest {
+
+  private String group;
+  private String qualityGate;
+
+  /**
+   * This is a mandatory parameter.
+   * Example value: "sonar-administrators"
+   */
+  public AddGroupRequest setGroup(String group) {
+    this.group = group;
+    return this;
+  }
+
+  public String getGroup() {
+    return group;
+  }
+
+  /**
+   * This is a mandatory parameter.
+   * Example value: "SonarSource Way"
+   */
+  public AddGroupRequest setQualityGate(String qualityGate) {
+    this.qualityGate = qualityGate;
+    return this;
+  }
+
+  public String getQualityGate() {
+    return qualityGate;
+  }
+}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/AddUserRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/AddUserRequest.java
new file mode 100644 (file)
index 0000000..c2926d9
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2021 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.qualitygates;
+
+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/qualitygates/add_user">Further information about this action online (including a response example)</a>
+ * @since 9.2
+ */
+@Generated("sonar-ws-generator")
+public class AddUserRequest {
+
+  private String login;
+  private String qualityGate;
+
+  /**
+   * This is a mandatory parameter.
+   * Example value: "john.doe"
+   */
+  public AddUserRequest setLogin(String login) {
+    this.login = login;
+    return this;
+  }
+
+  public String getLogin() {
+    return login;
+  }
+
+  /**
+   * This is a mandatory parameter.
+   * Example value: "SonarSource Way"
+   */
+  public AddUserRequest setQualityGate(String qualityGate) {
+    this.qualityGate = qualityGate;
+    return this;
+  }
+
+  public String getQualityGate() {
+    return qualityGate;
+  }
+}
index 04dc5a5dbea62c3a0e40f70981068bd1b385bee6..1f7f34eb02187baf94bec0c6c9053e8cb32188cf 100644 (file)
@@ -21,6 +21,7 @@ package org.sonarqube.ws.client.qualitygates;
 
 import javax.annotation.Generated;
 import org.sonarqube.ws.MediaTypes;
+import org.sonarqube.ws.Qualitygates;
 import org.sonarqube.ws.Qualitygates.CreateConditionResponse;
 import org.sonarqube.ws.Qualitygates.CreateResponse;
 import org.sonarqube.ws.Qualitygates.GetByProjectResponse;
@@ -282,4 +283,104 @@ public class QualitygatesService extends BaseService {
         .setParam("op", request.getOp()),
       UpdateConditionResponse.parser());
   }
+
+  /**
+   *
+   * This is part of the internal API.
+   * This is a POST request.
+   * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/add_user">Further information about this action online (including a response example)</a>
+   * @since 9.2
+   */
+  public void addUser(AddUserRequest request) {
+    call(
+      new PostRequest(path("add_user"))
+        .setParam("login", request.getLogin())
+        .setParam("gateName", request.getQualityGate())
+        .setMediaType(MediaTypes.JSON)
+    ).content();
+  }
+
+  /**
+   *
+   * This is part of the internal API.
+   * This is a GET request.
+   * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/search_users">Further information about this action online (including a response example)</a>
+   * @since 9.2
+   */
+  public Qualitygates.SearchUsersResponse searchUsers(SearchUsersRequest request) {
+    return call(
+      new GetRequest(path("search_users"))
+        .setParam("p", request.getP())
+        .setParam("ps", request.getPs())
+        .setParam("q", request.getQ())
+        .setParam("gateName", request.getQualityGate())
+        .setParam("selected", request.getSelected()),
+      Qualitygates.SearchUsersResponse.parser());
+  }
+
+  /**
+   *
+   * This is part of the internal API.
+   * This is a POST request.
+   * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/remove_user">Further information about this action online (including a response example)</a>
+   * @since 9.2
+   */
+  public void removeUser(RemoveUserRequest request) {
+    call(
+      new PostRequest(path("remove_user"))
+        .setParam("login", request.getLogin())
+        .setParam("gateName", request.getQualityGate())
+        .setMediaType(MediaTypes.JSON)
+    ).content();
+  }
+
+  /**
+   *
+   * This is part of the internal API.
+   * This is a POST request.
+   * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/add_group">Further information about this action online (including a response example)</a>
+   * @since 9.2
+   */
+  public void addGroup(AddGroupRequest request) {
+    call(
+      new PostRequest(path("add_group"))
+        .setParam("groupName", request.getGroup())
+        .setParam("gateName", request.getQualityGate())
+        .setMediaType(MediaTypes.JSON)
+    ).content();
+  }
+
+  /**
+   *
+   * This is part of the internal API.
+   * This is a GET request.
+   * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/search_groups">Further information about this action online (including a response example)</a>
+   * @since 9.2
+   */
+  public Qualitygates.SearchGroupsResponse searchGroups(SearchGroupsRequest request) {
+    return call(
+      new GetRequest(path("search_groups"))
+        .setParam("p", request.getP())
+        .setParam("ps", request.getPs())
+        .setParam("q", request.getQ())
+        .setParam("gateName", request.getQualityGate())
+        .setParam("selected", request.getSelected()),
+      Qualitygates.SearchGroupsResponse.parser());
+  }
+
+  /**
+   *
+   * This is part of the internal API.
+   * This is a POST request.
+   * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/remove_group">Further information about this action online (including a response example)</a>
+   * @since 9.2
+   */
+  public void removeGroup(RemoveGroupRequest request) {
+    call(
+      new PostRequest(path("remove_group"))
+        .setParam("groupName", request.getGroup())
+        .setParam("gateName", request.getQualityGate())
+        .setMediaType(MediaTypes.JSON)
+    ).content();
+  }
 }
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/RemoveGroupRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/RemoveGroupRequest.java
new file mode 100644 (file)
index 0000000..44f23a5
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2021 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.qualitygates;
+
+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/qualitygate/remove_group">Further information about this action online (including a response example)</a>
+ * @since 9.2
+ */
+@Generated("sonar-ws-generator")
+public class RemoveGroupRequest {
+
+  private String group;
+  private String qualityGate;
+
+  /**
+   * This is a mandatory parameter.
+   * Example value: "sonar-administrators"
+   */
+  public RemoveGroupRequest setGroup(String group) {
+    this.group = group;
+    return this;
+  }
+
+  public String getGroup() {
+    return group;
+  }
+
+  /**
+   * This is a mandatory parameter.
+   * Example value: "SonarSource Way"
+   */
+  public RemoveGroupRequest setQualityGate(String qualityGate) {
+    this.qualityGate = qualityGate;
+    return this;
+  }
+
+  public String getQualityGate() {
+    return qualityGate;
+  }
+}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/RemoveUserRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/RemoveUserRequest.java
new file mode 100644 (file)
index 0000000..b3947fe
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2021 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.qualitygates;
+
+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/qualitygates/remove_user">Further information about this action online (including a response example)</a>
+ * @since 9.2
+ */
+@Generated("sonar-ws-generator")
+public class RemoveUserRequest {
+
+  private String login;
+  private String qualityGate;
+
+  /**
+   * This is a mandatory parameter.
+   * Example value: "john.doe"
+   */
+  public RemoveUserRequest setLogin(String login) {
+    this.login = login;
+    return this;
+  }
+
+  public String getLogin() {
+    return login;
+  }
+
+  /**
+   * This is a mandatory parameter.
+   * Example value: "Recommended quality gate"
+   */
+  public RemoveUserRequest setQualityGate(String qualityGate) {
+    this.qualityGate = qualityGate;
+    return this;
+  }
+
+  public String getQualityGate() {
+    return qualityGate;
+  }
+}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SearchGroupsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SearchGroupsRequest.java
new file mode 100644 (file)
index 0000000..8570a71
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2021 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.qualitygates;
+
+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/qualitygates/search_groups">Further information about this action online (including a response example)</a>
+ * @since 9.2
+ */
+@Generated("sonar-ws-generator")
+public class SearchGroupsRequest {
+
+  private String p;
+  private String ps;
+  private String q;
+  private String qualityGate;
+  private String selected;
+
+  /**
+   * Example value: "42"
+   */
+  public SearchGroupsRequest setP(String p) {
+    this.p = p;
+    return this;
+  }
+
+  public String getP() {
+    return p;
+  }
+
+  /**
+   * Example value: "20"
+   */
+  public SearchGroupsRequest setPs(String ps) {
+    this.ps = ps;
+    return this;
+  }
+
+  public String getPs() {
+    return ps;
+  }
+
+  /**
+   * Example value: "sonar"
+   */
+  public SearchGroupsRequest setQ(String q) {
+    this.q = q;
+    return this;
+  }
+
+  public String getQ() {
+    return q;
+  }
+
+  /**
+   * This is a mandatory parameter.
+   * Example value: "SonarSource Way"
+   */
+  public SearchGroupsRequest setQualityGate(String qualityGate) {
+    this.qualityGate = qualityGate;
+    return this;
+  }
+
+  public String getQualityGate() {
+    return qualityGate;
+  }
+
+  /**
+   * Possible values:
+   * <ul>
+   *   <li>"all"</li>
+   *   <li>"deselected"</li>
+   *   <li>"selected"</li>
+   * </ul>
+   */
+  public SearchGroupsRequest setSelected(String selected) {
+    this.selected = selected;
+    return this;
+  }
+
+  public String getSelected() {
+    return selected;
+  }
+}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SearchUsersRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SearchUsersRequest.java
new file mode 100644 (file)
index 0000000..70fc44e
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2021 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.qualitygates;
+
+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/qualitygates/search_users">Further information about this action online (including a response example)</a>
+ * @since 9.2
+ */
+@Generated("sonar-ws-generator")
+public class SearchUsersRequest {
+
+  private String p;
+  private String ps;
+  private String q;
+  private String qualityGate;
+  private String selected;
+
+  /**
+   * Example value: "42"
+   */
+  public SearchUsersRequest setP(String p) {
+    this.p = p;
+    return this;
+  }
+
+  public String getP() {
+    return p;
+  }
+
+  /**
+   * Example value: "20"
+   */
+  public SearchUsersRequest setPs(String ps) {
+    this.ps = ps;
+    return this;
+  }
+
+  public String getPs() {
+    return ps;
+  }
+
+  /**
+   * Example value: "freddy"
+   */
+  public SearchUsersRequest setQ(String q) {
+    this.q = q;
+    return this;
+  }
+
+  public String getQ() {
+    return q;
+  }
+
+  /**
+   * This is a mandatory parameter.
+   * Example value: "Recommended quality gate"
+   */
+  public SearchUsersRequest setQualityGate(String qualityGate) {
+    this.qualityGate = qualityGate;
+    return this;
+  }
+
+  public String getQualityGate() {
+    return qualityGate;
+  }
+
+  /**
+   * Possible values:
+   * <ul>
+   *   <li>"all"</li>
+   *   <li>"deselected"</li>
+   *   <li>"selected"</li>
+   * </ul>
+   */
+  public SearchUsersRequest setSelected(String selected) {
+    this.selected = selected;
+    return this;
+  }
+
+  public String getSelected() {
+    return selected;
+  }
+}