]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-12673 additional ITs
authorMichal Duda <michal.duda@sonarsource.com>
Fri, 29 Nov 2019 11:07:41 +0000 (12:07 +0100)
committerSonarTech <sonartech@sonarsource.com>
Mon, 9 Dec 2019 19:46:18 +0000 (20:46 +0100)
sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesService.java
sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/SetAutomaticDeletionProtectionRequest.java [new file with mode: 0644]

index d1459a480092fe7bd7e8822c3fe0bff5261a5fc7..7509be1cfc55185aa9dc61ff93fc69491b377487 100644 (file)
  */
 package org.sonarqube.ws.client.projectbranches;
 
-import java.util.stream.Collectors;
 import javax.annotation.Generated;
 import org.sonarqube.ws.MediaTypes;
+import org.sonarqube.ws.ProjectBranches.ListWsResponse;
 import org.sonarqube.ws.client.BaseService;
 import org.sonarqube.ws.client.GetRequest;
 import org.sonarqube.ws.client.PostRequest;
 import org.sonarqube.ws.client.WsConnector;
-import org.sonarqube.ws.ProjectBranches.ListWsResponse;
 
 /**
  * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_branches">Further information about this web service online</a>
@@ -50,8 +49,7 @@ public class ProjectBranchesService extends BaseService {
       new PostRequest(path("delete"))
         .setParam("branch", request.getBranch())
         .setParam("project", request.getProject())
-        .setMediaType(MediaTypes.JSON)
-      ).content();
+        .setMediaType(MediaTypes.JSON)).content();
   }
 
   /**
@@ -80,7 +78,15 @@ public class ProjectBranchesService extends BaseService {
       new PostRequest(path("rename"))
         .setParam("name", request.getName())
         .setParam("project", request.getProject())
-        .setMediaType(MediaTypes.JSON)
-      ).content();
+        .setMediaType(MediaTypes.JSON)).content();
+  }
+
+  public void setAutomaticDeletionProtection(SetAutomaticDeletionProtectionRequest request) {
+    call(
+      new PostRequest(path("set_automatic_deletion_protection"))
+        .setParam("project", request.getProject())
+        .setParam("branch", request.getBranch())
+        .setParam("value", request.getValue())
+        .setMediaType(MediaTypes.JSON)).content();
   }
 }
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/SetAutomaticDeletionProtectionRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/SetAutomaticDeletionProtectionRequest.java
new file mode 100644 (file)
index 0000000..6ca1384
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * 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.projectbranches;
+
+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/project_branches/set_automatic_deletion_protection">Further information about this action online (including a response example)</a>
+ * @since 8.1
+ */
+@Generated("sonar-ws-generator")
+public class SetAutomaticDeletionProtectionRequest {
+
+  private String branch;
+  private String project;
+  private String value;
+
+  /**
+   * This is a mandatory parameter.
+   * Example value: "feature/my_branch"
+   */
+  public SetAutomaticDeletionProtectionRequest setBranch(String branch) {
+    this.branch = branch;
+    return this;
+  }
+
+  public String getBranch() {
+    return branch;
+  }
+
+  /**
+   * This is a mandatory parameter.
+   * Example value: "my_project"
+   */
+  public SetAutomaticDeletionProtectionRequest setProject(String project) {
+    this.project = project;
+    return this;
+  }
+
+  public String getProject() {
+    return project;
+  }
+
+  /**
+   * This is a mandatory parameter.
+   * Example value: "true"
+   * Possible values:
+   * <ul>
+   *   <li>"true"</li>
+   *   <li>"false"</li>
+   *   <li>"yes"</li>
+   *   <li>"no"</li>
+   * </ul>
+   */
+  public SetAutomaticDeletionProtectionRequest setValue(String value) {
+    this.value = value;
+    return this;
+  }
+
+  public String getValue() {
+    return value;
+  }
+}