aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2019-04-19 13:18:24 +0200
committerSonarTech <sonartech@sonarsource.com>2019-04-29 20:21:07 +0200
commitd79cd20db14afdc65967ec478c9ea5869d40a9d4 (patch)
tree15e24b79ce5793d3e1383918879cae3125437634 /sonar-ws
parent1914f2976d3697ea60c69dd5297c717bc03f9198 (diff)
downloadsonarqube-d79cd20db14afdc65967ec478c9ea5869d40a9d4.tar.gz
sonarqube-d79cd20db14afdc65967ec478c9ea5869d40a9d4.zip
SONAR-12000 add secret to WS api/webhooks/create and api/webhooks/update
Diffstat (limited to 'sonar-ws')
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/CreateRequest.java14
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/UpdateRequest.java14
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/WebhooksService.java8
-rw-r--r--sonar-ws/src/main/protobuf/ws-webhooks.proto1
4 files changed, 31 insertions, 6 deletions
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/CreateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/CreateRequest.java
index e9e974e96bf..737638bd945 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/CreateRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/CreateRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.webhooks;
-import java.util.List;
import javax.annotation.Generated;
/**
@@ -34,6 +33,7 @@ public class CreateRequest {
private String name;
private String organization;
private String project;
+ private String secret;
private String url;
/**
@@ -75,6 +75,18 @@ public class CreateRequest {
}
/**
+ * Example value: "your_secret"
+ */
+ public CreateRequest setSecret(String secret) {
+ this.secret = secret;
+ return this;
+ }
+
+ public String getSecret() {
+ return secret;
+ }
+
+ /**
* This is a mandatory parameter.
* Example value: "https://www.my-webhook-listener.com/sonar"
*/
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/UpdateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/UpdateRequest.java
index 289062ce9d4..11615e3e6b0 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/UpdateRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/UpdateRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.webhooks;
-import java.util.List;
import javax.annotation.Generated;
/**
@@ -32,6 +31,7 @@ import javax.annotation.Generated;
public class UpdateRequest {
private String name;
+ private String secret;
private String url;
private String webhook;
@@ -49,6 +49,18 @@ public class UpdateRequest {
}
/**
+ * Example value: "your_secret"
+ */
+ public UpdateRequest setSecret(String secret) {
+ this.secret = secret;
+ return this;
+ }
+
+ public String getSecret() {
+ return secret;
+ }
+
+ /**
* This is a mandatory parameter.
* Example value: "https://www.my-webhook-listener.com/sonar"
*/
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/WebhooksService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/WebhooksService.java
index e55e891b0a3..f61621a7516 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/WebhooksService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/WebhooksService.java
@@ -53,6 +53,7 @@ public class WebhooksService extends BaseService {
.setParam("name", request.getName())
.setParam("organization", request.getOrganization())
.setParam("project", request.getProject())
+ .setParam("secret", request.getSecret())
.setParam("url", request.getUrl()),
CreateWsResponse.parser());
}
@@ -68,8 +69,7 @@ public class WebhooksService extends BaseService {
call(
new PostRequest(path("delete"))
.setParam("webhook", request.getWebhook())
- .setMediaType(MediaTypes.JSON)
- ).content();
+ .setMediaType(MediaTypes.JSON)).content();
}
/**
@@ -130,9 +130,9 @@ public class WebhooksService extends BaseService {
call(
new PostRequest(path("update"))
.setParam("name", request.getName())
+ .setParam("secret", request.getSecret())
.setParam("url", request.getUrl())
.setParam("webhook", request.getWebhook())
- .setMediaType(MediaTypes.JSON)
- ).content();
+ .setMediaType(MediaTypes.JSON)).content();
}
}
diff --git a/sonar-ws/src/main/protobuf/ws-webhooks.proto b/sonar-ws/src/main/protobuf/ws-webhooks.proto
index 81e45aa24fd..f8642e7c5ef 100644
--- a/sonar-ws/src/main/protobuf/ws-webhooks.proto
+++ b/sonar-ws/src/main/protobuf/ws-webhooks.proto
@@ -54,6 +54,7 @@ message CreateWsResponse {
optional string key = 1;
optional string name = 2;
optional string url = 3;
+ optional string secret = 4;
}
}