aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws
diff options
context:
space:
mode:
authoralain <108417558+alain-kermis-sonarsource@users.noreply.github.com>2022-10-14 10:32:20 +0200
committersonartech <sonartech@sonarsource.com>2022-10-14 20:03:03 +0000
commit3c7451c35cfa599c09362de51b5ab61a1c7089d1 (patch)
tree8fe8e1169563526c7ec4b4f7917f336985f56665 /sonar-ws
parenta6c2784ec425431f4f899c2595ae6deb5c4b255c (diff)
downloadsonarqube-3c7451c35cfa599c09362de51b5ab61a1c7089d1.tar.gz
sonarqube-3c7451c35cfa599c09362de51b5ab61a1c7089d1.zip
SONAR-9539 Sanitize api/rules/create web service
Diffstat (limited to 'sonar-ws')
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/rules/RulesService.java26
1 files changed, 25 insertions, 1 deletions
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/RulesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/RulesService.java
index 8d486db2dd7..e6571d37b4a 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/RulesService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/RulesService.java
@@ -60,11 +60,35 @@ public class RulesService extends BaseService {
* This is part of the internal API.
* This is a POST request.
* @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/rules/create">Further information about this action online (including a response example)</a>
- * @since 4.4
+ * @since 9.7
*/
public void create(CreateRequest request) {
call(
new PostRequest(path("create"))
+ .setParam("customKey", request.getCustomKey())
+ .setParam("markdownDescription", request.getMarkdownDescription())
+ .setParam("name", request.getName())
+ .setParam("params", request.getParams() == null ? null : request.getParams().stream().collect(Collectors.joining(",")))
+ .setParam("preventReactivation", request.getPreventReactivation())
+ .setParam("severity", request.getSeverity())
+ .setParam("status", request.getStatus())
+ .setParam("templateKey", request.getTemplateKey())
+ .setParam("type", request.getType()),
+ CreateResponse.parser());
+ }
+
+ /**
+ *
+ * This is part of the internal API.
+ * This is a POST request.
+ * This method is used specifically for sending requests using deprecated parameters for SQ before 9.7.
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/rules/create">Further information about this action online (including a response example)</a>
+ * @since 4.4
+ */
+ @Deprecated
+ public void createForSQBefore97(CreateRequest request) {
+ call(
+ new PostRequest(path("create"))
.setParam("custom_key", request.getCustomKey())
.setParam("markdown_description", request.getMarkdownDescription())
.setParam("name", request.getName())