aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws
diff options
context:
space:
mode:
authorDaniel Schwarz <daniel.schwarz@sonarsource.com>2017-04-24 16:19:23 +0200
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>2017-04-27 14:25:54 +0200
commite453a6e3fdb6f7bb929ba43030a27c7ca062535e (patch)
treecbb170111cad0e226b98a5349d5f43ec125c87b5 /sonar-ws
parent6cb11d0e16a33960b6c699f9122d486655f30f84 (diff)
downloadsonarqube-e453a6e3fdb6f7bb929ba43030a27c7ca062535e.tar.gz
sonarqube-e453a6e3fdb6f7bb929ba43030a27c7ca062535e.zip
SONAR-9091 add visibility flag to api/components/create
Diffstat (limited to 'sonar-ws')
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/project/CreateRequest.java19
-rw-r--r--sonar-ws/src/main/protobuf/ws-projects.proto1
2 files changed, 20 insertions, 0 deletions
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/project/CreateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/CreateRequest.java
index 962e04f2150..8a03fff7c13 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/project/CreateRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/CreateRequest.java
@@ -19,10 +19,14 @@
*/
package org.sonarqube.ws.client.project;
+import java.util.Optional;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
+import static com.google.common.base.Preconditions.checkArgument;
+import static java.util.Arrays.asList;
+
@Immutable
public class CreateRequest {
@@ -30,12 +34,15 @@ public class CreateRequest {
private final String key;
private final String name;
private final String branch;
+ @CheckForNull
+ private final String visibility;
private CreateRequest(Builder builder) {
this.organization = builder.organization;
this.key = builder.key;
this.name = builder.name;
this.branch = builder.branch;
+ this.visibility = builder.visibility;
}
@CheckForNull
@@ -56,6 +63,10 @@ public class CreateRequest {
return branch;
}
+ public Optional<String> getVisibility() {
+ return Optional.ofNullable(visibility);
+ }
+
public static Builder builder() {
return new Builder();
}
@@ -65,6 +76,8 @@ public class CreateRequest {
private String key;
private String name;
private String branch;
+ @CheckForNull
+ private String visibility;
private Builder() {
}
@@ -89,6 +102,12 @@ public class CreateRequest {
return this;
}
+ public Builder setVisibility(@Nullable String visibility) {
+ checkArgument(visibility == null || asList("private", "public").contains(visibility), "Unexpected visibility '" + visibility + "'");
+ this.visibility = visibility;
+ return this;
+ }
+
public CreateRequest build() {
return new CreateRequest(this);
}
diff --git a/sonar-ws/src/main/protobuf/ws-projects.proto b/sonar-ws/src/main/protobuf/ws-projects.proto
index 86ed442a8d6..2836db8c48c 100644
--- a/sonar-ws/src/main/protobuf/ws-projects.proto
+++ b/sonar-ws/src/main/protobuf/ws-projects.proto
@@ -54,6 +54,7 @@ message CreateWsResponse {
optional string key = 1;
optional string name = 2;
optional string qualifier = 3;
+ optional string visibility = 4;
}
}