diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2017-11-24 14:00:02 +0100 |
---|---|---|
committer | Daniel Schwarz <bartfastiel@users.noreply.github.com> | 2017-11-29 20:24:11 +0100 |
commit | 12f9e1c990deb948912f4da725b0e8c49cdac163 (patch) | |
tree | 4d212a23c401d17af32c2794f2b6d4793f5b53a3 /sonar-ws/src | |
parent | 10fe82e5c55f29460d1a3a46f6f32215af68a3f8 (diff) | |
download | sonarqube-12f9e1c990deb948912f4da725b0e8c49cdac163.tar.gz sonarqube-12f9e1c990deb948912f4da725b0e8c49cdac163.zip |
Merge sonar-ws-generated into sonar-ws
Diffstat (limited to 'sonar-ws/src')
338 files changed, 31714 insertions, 0 deletions
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/MediaTypes.java b/sonar-ws/src/main/java/org/sonarqube/ws/MediaTypes.java new file mode 100644 index 00000000000..08783ca593e --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/MediaTypes.java @@ -0,0 +1,85 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +import com.google.common.base.Strings; +import com.google.common.collect.ImmutableMap; +import java.util.Locale; +import java.util.Map; +import org.apache.commons.io.FilenameUtils; + +/** + * @since 5.3 + */ +public final class MediaTypes { + + public static final String JSON = "application/json"; + public static final String XML = "application/xml"; + public static final String TXT = "text/plain"; + public static final String PROTOBUF = "application/x-protobuf"; + public static final String ZIP = "application/zip"; + public static final String JAVASCRIPT = "application/javascript"; + public static final String HTML = "text/html"; + public static final String DEFAULT = "application/octet-stream"; + + private static final Map<String, String> MAP = new ImmutableMap.Builder<String, String>() + .put("js", JAVASCRIPT) + .put("json", JSON) + .put("zip", "application/zip") + .put("tgz", "application/tgz") + .put("ps", "application/postscript") + .put("jnlp", "application/jnlp") + .put("jar", "application/java-archive") + .put("xls", "application/vnd.ms-excel") + .put("ppt", "application/vnd.ms-powerpoint") + .put("tar", "application/x-tar") + .put("xml", XML) + .put("dtd", "application/xml-dtd") + .put("xslt", "application/xslt+xml") + .put("bmp", "image/bmp") + .put("gif", "image/gif") + .put("jpg", "image/jpeg") + .put("jpeg", "image/jpeg") + .put("tiff", "image/tiff") + .put("png", "image/png") + .put("svg", "image/svg+xml") + .put("ico", "image/x-icon") + .put("txt", TXT) + .put("csv", "text/csv") + .put("properties", "text/plain") + .put("rtf", "text/rtf") + .put("html", HTML) + .put("css", "text/css") + .put("tsv", "text/tab-separated-values") + .build(); + + private MediaTypes() { + // only static methods + } + + public static String getByFilename(String filename) { + String extension = FilenameUtils.getExtension(filename); + String mime = null; + if (!Strings.isNullOrEmpty(extension)) { + mime = MAP.get(extension.toLowerCase(Locale.ENGLISH)); + } + return mime != null ? mime : DEFAULT; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/BaseRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/BaseRequest.java new file mode 100644 index 00000000000..8b5fbcff005 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/BaseRequest.java @@ -0,0 +1,211 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +import com.google.common.collect.LinkedListMultimap; +import com.google.common.collect.ListMultimap; +import java.util.Collection; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.function.Function; +import java.util.stream.Collectors; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; +import org.sonarqube.ws.MediaTypes; + +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Strings.isNullOrEmpty; +import static java.util.Collections.singletonList; +import static java.util.Collections.unmodifiableSet; +import static java.util.Objects.requireNonNull; + +abstract class BaseRequest<SELF extends BaseRequest> implements WsRequest { + + private final String path; + + private String mediaType = MediaTypes.JSON; + + private final DefaultParameters parameters = new DefaultParameters(); + private final DefaultHeaders headers = new DefaultHeaders(); + + BaseRequest(String path) { + this.path = path; + } + + @Override + public String getPath() { + return path; + } + + @Override + public String getMediaType() { + return mediaType; + } + + /** + * Expected media type of response. Default is {@link MediaTypes#JSON}. + */ + public SELF setMediaType(String s) { + requireNonNull(s, "media type of response cannot be null"); + this.mediaType = s; + return (SELF) this; + } + + public SELF setParam(String key, @Nullable String value) { + return setSingleValueParam(key, value); + } + + public SELF setParam(String key, @Nullable Integer value) { + return setSingleValueParam(key, value); + } + + public SELF setParam(String key, @Nullable Long value) { + return setSingleValueParam(key, value); + } + + public SELF setParam(String key, @Nullable Float value) { + return setSingleValueParam(key, value); + } + + public SELF setParam(String key, @Nullable Boolean value) { + return setSingleValueParam(key, value); + } + + private SELF setSingleValueParam(String key, @Nullable Object value) { + checkArgument(!isNullOrEmpty(key), "a WS parameter key cannot be null"); + if (value == null) { + return (SELF) this; + } + parameters.setValue(key, value.toString()); + + return (SELF) this; + } + + public SELF setParam(String key, @Nullable Collection<? extends Object> values) { + checkArgument(!isNullOrEmpty(key), "a WS parameter key cannot be null"); + if (values == null || values.isEmpty()) { + return (SELF) this; + } + + parameters.setValues(key, values.stream() + .filter(Objects::nonNull) + .map(Object::toString) + .filter(value -> !value.isEmpty()) + .collect(Collectors.toList())); + + return (SELF) this; + } + + @Override + public Map<String, String> getParams() { + return parameters.keyValues.keySet().stream() + .collect(Collectors.toMap( + Function.identity(), + key -> parameters.keyValues.get(key).get(0), + (v1, v2) -> { + throw new IllegalStateException(String.format("Duplicate key '%s' in request", v1)); + }, + LinkedHashMap::new)); + } + + @Override + public Parameters getParameters() { + return parameters; + } + + @Override + public Headers getHeaders() { + return headers; + } + + public SELF setHeader(String name, @Nullable String value) { + requireNonNull(name, "Header name can't be null"); + headers.setValue(name, value); + return (SELF) this; + } + + private static class DefaultParameters implements Parameters { + // preserve insertion order + private final ListMultimap<String, String> keyValues = LinkedListMultimap.create(); + + @Override + @CheckForNull + public String getValue(String key) { + return keyValues.containsKey(key) ? keyValues.get(key).get(0) : null; + } + + @Override + public List<String> getValues(String key) { + return keyValues.get(key); + } + + @Override + public Set<String> getKeys() { + return keyValues.keySet(); + } + + private DefaultParameters setValue(String key, String value) { + checkArgument(!isNullOrEmpty(key)); + checkArgument(value != null); + + keyValues.putAll(key, singletonList(value)); + return this; + } + + private DefaultParameters setValues(String key, Collection<String> values) { + checkArgument(!isNullOrEmpty(key)); + checkArgument(values != null && !values.isEmpty()); + + this.keyValues.putAll(key, values.stream().map(Object::toString).filter(Objects::nonNull).collect(Collectors.toList())); + + return this; + } + } + + private static class DefaultHeaders implements Headers { + private final Map<String, String> keyValues = new HashMap<>(); + + @Override + public Optional<String> getValue(String name) { + return Optional.ofNullable(keyValues.get(name)); + } + + private DefaultHeaders setValue(String name, @Nullable String value) { + checkArgument(!isNullOrEmpty(name)); + + if (value == null) { + keyValues.remove(name); + } else { + keyValues.put(name, value); + } + return this; + } + + @Override + public Set<String> getNames() { + return unmodifiableSet(keyValues.keySet()); + } + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/BaseResponse.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/BaseResponse.java new file mode 100644 index 00000000000..039754f8571 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/BaseResponse.java @@ -0,0 +1,50 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +import static java.net.HttpURLConnection.HTTP_NO_CONTENT; + +abstract class BaseResponse implements WsResponse { + + @Override + public boolean isSuccessful() { + return code() >= 200 && code() < 300; + } + + @Override + public WsResponse failIfNotSuccessful() { + if (!isSuccessful()) { + String content = content(); + close(); + throw new HttpException(requestUrl(), code(), content); + } + return this; + } + + @Override + public boolean hasContent() { + return code() != HTTP_NO_CONTENT; + } + + @Override + public void close() { + // override if needed + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/BaseService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/BaseService.java new file mode 100644 index 00000000000..4c6a0e9449e --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/BaseService.java @@ -0,0 +1,73 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +import com.google.protobuf.Message; +import com.google.protobuf.Parser; +import java.io.InputStream; +import java.util.Collection; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; +import org.apache.commons.io.IOUtils; +import org.sonarqube.ws.MediaTypes; + +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Strings.isNullOrEmpty; + +public abstract class BaseService { + + private final WsConnector wsConnector; + protected final String controller; + + public BaseService(WsConnector wsConnector, String controllerPath) { + checkArgument(!isNullOrEmpty(controllerPath)); + this.wsConnector = wsConnector; + this.controller = controllerPath; + } + + protected <T extends Message> T call(BaseRequest request, Parser<T> parser) { + request.setMediaType(MediaTypes.PROTOBUF); + WsResponse response = call(request); + return convert(response, parser); + } + + protected WsResponse call(WsRequest request) { + return wsConnector.call(request).failIfNotSuccessful(); + } + + public <T extends Message> T convert(WsResponse response, Parser<T> parser) { + try (InputStream byteStream = response.contentStream()) { + byte[] bytes = IOUtils.toByteArray(byteStream); + // HTTP header "Content-Type" is not verified. It may be different than protobuf. + return parser.parseFrom(bytes); + } catch (Exception e) { + throw new IllegalStateException("Fail to parse protobuf response of " + response.requestUrl(), e); + } + } + + protected String path(String action) { + return String.format("%s/%s", controller, action); + } + + @CheckForNull + protected static String inlineMultipleParamValue(@Nullable Collection<String> values) { + return values == null ? null : String.join(",", values); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/GetRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/GetRequest.java new file mode 100644 index 00000000000..02a1f2ac32f --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/GetRequest.java @@ -0,0 +1,34 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +/** + * @since 5.3 + */ +public class GetRequest extends BaseRequest<GetRequest> { + public GetRequest(String path) { + super(path); + } + + @Override + public Method getMethod() { + return Method.GET; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/Headers.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/Headers.java new file mode 100644 index 00000000000..b289789a1f2 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/Headers.java @@ -0,0 +1,36 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +import java.util.Optional; +import java.util.Set; + +/** + * HTTP headers + * + * @since 6.6 + */ +public interface Headers { + + Optional<String> getValue(String name); + + Set<String> getNames(); + +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/HttpException.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/HttpException.java new file mode 100644 index 00000000000..d456faeb473 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/HttpException.java @@ -0,0 +1,52 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +/** + * @since 5.3 + */ +public class HttpException extends RuntimeException { + + private final String url; + private final int code; + private final String content; + + public HttpException(String url, int code, String content) { + super(String.format("Error %d on %s : %s", code, url, content)); + this.url = url; + this.code = code; + this.content = content; + } + + public String content() { + return content; + } + + public String url() { + return url; + } + + /** + * @see java.net.HttpURLConnection constants + */ + public int code() { + return code; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/Parameters.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/Parameters.java new file mode 100644 index 00000000000..ae692ab103f --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/Parameters.java @@ -0,0 +1,36 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +import java.util.List; +import java.util.Set; +import javax.annotation.CheckForNull; + +public interface Parameters { + /** + * In the case of a multi value parameter, returns the first element + */ + @CheckForNull + String getValue(String key); + + List<String> getValues(String key); + + Set<String> getKeys(); +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/PostRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/PostRequest.java new file mode 100644 index 00000000000..13cbdd5c996 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/PostRequest.java @@ -0,0 +1,69 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +import java.io.File; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * @since 5.3 + */ +public class PostRequest extends BaseRequest<PostRequest> { + + private final Map<String, Part> parts = new LinkedHashMap<>(); + + public PostRequest(String path) { + super(path); + } + + @Override + public Method getMethod() { + return Method.POST; + } + + public PostRequest setPart(String name, Part part) { + this.parts.put(name, part); + return this; + } + + public Map<String, Part> getParts() { + return parts; + } + + public static class Part { + private final String mediaType; + private final File file; + + public Part(String mediaType, File file) { + this.mediaType = mediaType; + this.file = file; + } + + public String getMediaType() { + return mediaType; + } + + public File getFile() { + return file; + } + } + +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/WsConnector.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/WsConnector.java new file mode 100644 index 00000000000..b203d18be98 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/WsConnector.java @@ -0,0 +1,40 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +/** + * @since 5.3 + */ +public interface WsConnector { + + /** + * Server base URL, always with trailing slash, for instance "http://localhost:9000/" + */ + String baseUrl(); + + /** + * @throws IllegalStateException if the request could not be executed due to + * a connectivity problem or timeout. Because networks can + * fail during an exchange, it is possible that the remote server + * accepted the request before the failure + */ + WsResponse call(WsRequest wsRequest); + +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/WsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/WsRequest.java new file mode 100644 index 00000000000..9907ae7b39e --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/WsRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +import java.util.Map; + +/** + * @since 5.3 + */ +public interface WsRequest { + + Method getMethod(); + + String getPath(); + + String getMediaType(); + + /** + * + * In case of multi value parameters, returns the first value + * + * @deprecated since 6.1. Use {@link #getParameters()} instead + */ + @Deprecated + Map<String, String> getParams(); + + Parameters getParameters(); + + Headers getHeaders(); + + enum Method { + GET, POST + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/WsResponse.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/WsResponse.java new file mode 100644 index 00000000000..fcaed89123f --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/WsResponse.java @@ -0,0 +1,65 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +import java.io.Closeable; +import java.io.InputStream; +import java.io.Reader; + +/** + * @since 5.3 + */ +public interface WsResponse extends Closeable { + + /** + * The absolute requested URL + */ + String requestUrl(); + + /** + * HTTP status code + */ + int code(); + + /** + * Returns true if the code is in [200..300), which means the request was + * successfully received, understood, and accepted. + */ + boolean isSuccessful() ; + + /** + * Throws a {@link HttpException} if {@link #isSuccessful()} is false. + */ + WsResponse failIfNotSuccessful(); + + String contentType(); + + boolean hasContent(); + + InputStream contentStream(); + + Reader contentReader(); + + String content(); + + @Override + void close(); + +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/analysisreports/AnalysisReportsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/analysisreports/AnalysisReportsService.java new file mode 100644 index 00000000000..817c0d13363 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/analysisreports/AnalysisReportsService.java @@ -0,0 +1,53 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.analysisreports; + +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Get details about Compute Engine tasks. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/analysis_reports">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class AnalysisReportsService extends BaseService { + + public AnalysisReportsService(WsConnector wsConnector) { + super(wsConnector, "api/analysis_reports"); + } + + /** + * Check if the queue of Compute Engine is empty + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/analysis_reports/is_queue_empty">Further information about this action online (including a response example)</a> + * @since 5.1 + */ + public String isQueueEmpty() { + return call( + new GetRequest(path("is_queue_empty")) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/analysisreports/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/analysisreports/package-info.java new file mode 100644 index 00000000000..126c8ae900c --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/analysisreports/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.analysisreports; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/authentication/AuthenticationService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/authentication/AuthenticationService.java new file mode 100644 index 00000000000..170476f2277 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/authentication/AuthenticationService.java @@ -0,0 +1,86 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.authentication; + +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Handle authentication. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/authentication">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class AuthenticationService extends BaseService { + + public AuthenticationService(WsConnector wsConnector) { + super(wsConnector, "api/authentication"); + } + + /** + * Authenticate a user. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/authentication/login">Further information about this action online (including a response example)</a> + * @since 6.0 + */ + public void login(LoginRequest request) { + call( + new PostRequest(path("login")) + .setParam("login", request.getLogin()) + .setParam("password", request.getPassword()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Logout a user. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/authentication/logout">Further information about this action online (including a response example)</a> + * @since 6.3 + */ + public void logout() { + call( + new PostRequest(path("logout")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Check credentials. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/authentication/validate">Further information about this action online (including a response example)</a> + * @since 3.3 + */ + public String validate() { + return call( + new GetRequest(path("validate")) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/authentication/LoginRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/authentication/LoginRequest.java new file mode 100644 index 00000000000..46d6e0b2e13 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/authentication/LoginRequest.java @@ -0,0 +1,65 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.authentication; + +import javax.annotation.Generated; + +/** + * Authenticate a user. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/authentication/login">Further information about this action online (including a response example)</a> + * @since 6.0 + */ +@Generated("sonar-ws-generator") +public class LoginRequest { + + private String login; + private String password; + + /** + * Login of the user + * + * This is a mandatory parameter. + */ + public LoginRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * Password of the user + * + * This is a mandatory parameter. + */ + public LoginRequest setPassword(String password) { + this.password = password; + return this; + } + + public String getPassword() { + return password; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/authentication/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/authentication/package-info.java new file mode 100644 index 00000000000..61fd208d68c --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/authentication/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.authentication; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/batch/BatchService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/batch/BatchService.java new file mode 100644 index 00000000000..82e6e3f90fd --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/batch/BatchService.java @@ -0,0 +1,105 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.batch; + +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.WsConnector; +import org.sonarqube.ws.Batch.WsProjectResponse; + +/** + * Get JAR files and referentials for batch + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/batch">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class BatchService extends BaseService { + + public BatchService(WsConnector wsConnector) { + super(wsConnector, "batch"); + } + + /** + * Download a JAR file listed in the index (see batch/index) + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/batch/file">Further information about this action online (including a response example)</a> + * @since 4.4 + */ + public String file(FileRequest request) { + return call( + new GetRequest(path("file")) + .setParam("name", request.getName()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * List the JAR files to be downloaded by scanners + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/batch/index">Further information about this action online (including a response example)</a> + * @since 4.4 + */ + public String index() { + return call( + new GetRequest(path("index")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Return open issues + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/batch/issues">Further information about this action online (including a response example)</a> + * @since 5.1 + */ + public String issues(IssuesRequest request) { + return call( + new GetRequest(path("issues")) + .setParam("branch", request.getBranch()) + .setParam("key", request.getKey()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Return project repository + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/batch/project">Further information about this action online (including a response example)</a> + * @since 4.5 + */ + public WsProjectResponse project(ProjectRequest request) { + return call( + new GetRequest(path("project")) + .setParam("branch", request.getBranch()) + .setParam("issues_mode", request.getIssuesMode()) + .setParam("key", request.getKey()) + .setParam("profile", request.getProfile()), + WsProjectResponse.parser()); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/batch/FileRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/batch/FileRequest.java new file mode 100644 index 00000000000..45941e25018 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/batch/FileRequest.java @@ -0,0 +1,50 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.batch; + +import javax.annotation.Generated; + +/** + * Download a JAR file listed in the index (see batch/index) + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/batch/file">Further information about this action online (including a response example)</a> + * @since 4.4 + */ +@Generated("sonar-ws-generator") +public class FileRequest { + + private String name; + + /** + * File name + * + * Example value: "batch-library-2.3.jar" + */ + public FileRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/batch/IssuesRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/batch/IssuesRequest.java new file mode 100644 index 00000000000..7bbbfcb81f2 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/batch/IssuesRequest.java @@ -0,0 +1,66 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.batch; + +import javax.annotation.Generated; + +/** + * Return open issues + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/batch/issues">Further information about this action online (including a response example)</a> + * @since 5.1 + */ +@Generated("sonar-ws-generator") +public class IssuesRequest { + + private String branch; + private String key; + + /** + * Branch key + * + * Example value: "feature/my_branch" + */ + public IssuesRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * Project, module or file key + * + * This is a mandatory parameter. + * Example value: "my_project" + */ + public IssuesRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/batch/ProjectRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/batch/ProjectRequest.java new file mode 100644 index 00000000000..9e89bac81f5 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/batch/ProjectRequest.java @@ -0,0 +1,102 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.batch; + +import javax.annotation.Generated; + +/** + * Return project repository + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/batch/project">Further information about this action online (including a response example)</a> + * @since 4.5 + */ +@Generated("sonar-ws-generator") +public class ProjectRequest { + + private String branch; + private String issuesMode; + private String key; + private String profile; + + /** + * Branch key + * + * Example value: "feature/my_branch" + */ + public ProjectRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * Issues mode or not + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public ProjectRequest setIssuesMode(String issuesMode) { + this.issuesMode = issuesMode; + return this; + } + + public String getIssuesMode() { + return issuesMode; + } + + /** + * Project or module key + * + * This is a mandatory parameter. + * Example value: "my_project" + */ + public ProjectRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Profile name + * + * Example value: "SonarQube Way" + */ + public ProjectRequest setProfile(String profile) { + this.profile = profile; + return this; + } + + public String getProfile() { + return profile; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/batch/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/batch/package-info.java new file mode 100644 index 00000000000..53ebb046e2e --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/batch/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.batch; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/ActivityRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/ActivityRequest.java new file mode 100644 index 00000000000..f762c393527 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/ActivityRequest.java @@ -0,0 +1,207 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.ce; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Search for tasks.<br> Requires the system administration permission, or project administration permission if componentId is set. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/activity">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class ActivityRequest { + + private String componentId; + private String componentQuery; + private String maxExecutedAt; + private String minSubmittedAt; + private String onlyCurrents; + private String p; + private String ps; + private String q; + private List<String> status; + private String type; + + /** + * Id of the component (project) to filter on + * + * Example value: "AU-TpxcA-iU5OvuD2FL0" + */ + public ActivityRequest setComponentId(String componentId) { + this.componentId = componentId; + return this; + } + + public String getComponentId() { + return componentId; + } + + /** + * Limit search to: <ul><li>component names that contain the supplied string</li><li>component keys that are exactly the same as the supplied string</li></ul>Must not be set together with componentId.<br />Deprecated and replaced by 'q' + * + * Example value: "Apache" + * @deprecated since 5.5 + */ + @Deprecated + public ActivityRequest setComponentQuery(String componentQuery) { + this.componentQuery = componentQuery; + return this; + } + + public String getComponentQuery() { + return componentQuery; + } + + /** + * Maximum date of end of task processing (inclusive) + * + * Example value: "2017-11-23T15:56:03+0100" + */ + public ActivityRequest setMaxExecutedAt(String maxExecutedAt) { + this.maxExecutedAt = maxExecutedAt; + return this; + } + + public String getMaxExecutedAt() { + return maxExecutedAt; + } + + /** + * Minimum date of task submission (inclusive) + * + * Example value: "2017-11-23T15:56:03+0100" + */ + public ActivityRequest setMinSubmittedAt(String minSubmittedAt) { + this.minSubmittedAt = minSubmittedAt; + return this; + } + + public String getMinSubmittedAt() { + return minSubmittedAt; + } + + /** + * Filter on the last tasks (only the most recent finished task by project) + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public ActivityRequest setOnlyCurrents(String onlyCurrents) { + this.onlyCurrents = onlyCurrents; + return this; + } + + public String getOnlyCurrents() { + return onlyCurrents; + } + + /** + * Deprecated parameter + * + * @deprecated since 5.5 + */ + @Deprecated + public ActivityRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 1000 + * + * Example value: "20" + */ + public ActivityRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to: <ul><li>component names that contain the supplied string</li><li>component keys that are exactly the same as the supplied string</li><li>task ids that are exactly the same as the supplied string</li></ul>Must not be set together with componentId + * + * Example value: "Apache" + */ + public ActivityRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Comma separated list of task statuses + * + * Example value: "IN_PROGRESS,SUCCESS" + * Possible values: + * <ul> + * <li>"SUCCESS"</li> + * <li>"FAILED"</li> + * <li>"CANCELED"</li> + * <li>"PENDING"</li> + * <li>"IN_PROGRESS"</li> + * </ul> + */ + public ActivityRequest setStatus(List<String> status) { + this.status = status; + return this; + } + + public List<String> getStatus() { + return status; + } + + /** + * Task type + * + * Example value: "REPORT" + * Possible values: + * <ul> + * <li>"REPORT"</li> + * </ul> + */ + public ActivityRequest setType(String type) { + this.type = type; + return this; + } + + public String getType() { + return type; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/ActivityStatusRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/ActivityStatusRequest.java new file mode 100644 index 00000000000..c48673a36a9 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/ActivityStatusRequest.java @@ -0,0 +1,65 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.ce; + +import javax.annotation.Generated; + +/** + * Return CE activity related metrics.<br>Requires 'Administer System' permission or 'Administer' rights on the specified project. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/activity_status">Further information about this action online (including a response example)</a> + * @since 5.5 + */ +@Generated("sonar-ws-generator") +public class ActivityStatusRequest { + + private String componentId; + private String componentKey; + + /** + * Id of the component (project) to filter on + * + * Example value: "AU-TpxcA-iU5OvuD2FL0" + */ + public ActivityStatusRequest setComponentId(String componentId) { + this.componentId = componentId; + return this; + } + + public String getComponentId() { + return componentId; + } + + /** + * Key of the component (project) to filter on + * + * Example value: "my_project" + */ + public ActivityStatusRequest setComponentKey(String componentKey) { + this.componentKey = componentKey; + return this; + } + + public String getComponentKey() { + return componentKey; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CancelRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CancelRequest.java new file mode 100644 index 00000000000..bcdc60a077d --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CancelRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.ce; + +import javax.annotation.Generated; + +/** + * Cancels a pending task.<br/>In-progress tasks cannot be canceled.<br/>Requires one of the following permissions:<ul><li>'Administer System'</li><li>'Administer' rights on the project related to the task</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/cancel">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class CancelRequest { + + private String id; + + /** + * Id of the task to cancel. + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public CancelRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeService.java new file mode 100644 index 00000000000..85bb0d8ce1d --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeService.java @@ -0,0 +1,198 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.ce; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.Ce.ActivityResponse; +import org.sonarqube.ws.Ce.ActivityStatusWsResponse; +import org.sonarqube.ws.Ce.ComponentResponse; +import org.sonarqube.ws.Ce.SubmitResponse; +import org.sonarqube.ws.Ce.TaskResponse; +import org.sonarqube.ws.Ce.TaskTypesWsResponse; +import org.sonarqube.ws.Ce.WorkerCountResponse; + +/** + * Get information on Compute Engine tasks. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class CeService extends BaseService { + + public CeService(WsConnector wsConnector) { + super(wsConnector, "api/ce"); + } + + /** + * Search for tasks.<br> Requires the system administration permission, or project administration permission if componentId is set. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/activity">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public ActivityResponse activity(ActivityRequest request) { + return call( + new GetRequest(path("activity")) + .setParam("componentId", request.getComponentId()) + .setParam("componentQuery", request.getComponentQuery()) + .setParam("maxExecutedAt", request.getMaxExecutedAt()) + .setParam("minSubmittedAt", request.getMinSubmittedAt()) + .setParam("onlyCurrents", request.getOnlyCurrents()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setParam("status", request.getStatus() == null ? null : request.getStatus().stream().collect(Collectors.joining(","))) + .setParam("type", request.getType()), + ActivityResponse.parser()); + } + + /** + * Return CE activity related metrics.<br>Requires 'Administer System' permission or 'Administer' rights on the specified project. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/activity_status">Further information about this action online (including a response example)</a> + * @since 5.5 + */ + public ActivityStatusWsResponse activityStatus(ActivityStatusRequest request) { + return call( + new GetRequest(path("activity_status")) + .setParam("componentId", request.getComponentId()) + .setParam("componentKey", request.getComponentKey()), + ActivityStatusWsResponse.parser()); + } + + /** + * Cancels a pending task.<br/>In-progress tasks cannot be canceled.<br/>Requires one of the following permissions:<ul><li>'Administer System'</li><li>'Administer' rights on the project related to the task</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/cancel">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void cancel(CancelRequest request) { + call( + new PostRequest(path("cancel")) + .setParam("id", request.getId()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Cancels all pending tasks. Requires system administration permission. In-progress tasks are not canceled. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/cancel_all">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void cancelAll() { + call( + new PostRequest(path("cancel_all")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get the pending tasks, in-progress tasks and the last executed task of a given component (usually a project).<br>Requires the following permission: 'Browse' on the specified component.<br>Either 'componentId' or 'component' must be provided. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/component">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public ComponentResponse component(ComponentRequest request) { + return call( + new GetRequest(path("component")) + .setParam("component", request.getComponent()) + .setParam("componentId", request.getComponentId()), + ComponentResponse.parser()); + } + + /** + * Submits a scanner report to the queue. Report is processed asynchronously. Requires analysis permission. If the project does not exist, then the provisioning permission is also required. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/submit">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public SubmitResponse submit(SubmitRequest request) { + return call( + new PostRequest(path("submit")) + .setParam("characteristic", request.getCharacteristic()) + .setParam("organization", request.getOrganization()) + .setParam("projectBranch", request.getProjectBranch()) + .setParam("projectKey", request.getProjectKey()) + .setParam("projectName", request.getProjectName()) + .setParam("report", request.getReport()), + SubmitResponse.parser()); + } + + /** + * Give Compute Engine task details such as type, status, duration and associated component.<br />Requires 'Administer System' or 'Execute Analysis' permission.<br/>Since 6.1, field "logs" is deprecated and its value is always false. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/task">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public TaskResponse task(TaskRequest request) { + return call( + new GetRequest(path("task")) + .setParam("additionalFields", request.getAdditionalFields() == null ? null : request.getAdditionalFields().stream().collect(Collectors.joining(","))) + .setParam("id", request.getId()), + TaskResponse.parser()); + } + + /** + * List available task types + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/task_types">Further information about this action online (including a response example)</a> + * @since 5.5 + */ + public TaskTypesWsResponse taskTypes() { + return call( + new GetRequest(path("task_types")), + TaskTypesWsResponse.parser()); + } + + /** + * Return number of Compute Engine workers.<br/>Requires the system administration permission + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/worker_count">Further information about this action online (including a response example)</a> + * @since 6.5 + */ + public WorkerCountResponse workerCount() { + return call( + new GetRequest(path("worker_count")), + WorkerCountResponse.parser()); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/ComponentRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/ComponentRequest.java new file mode 100644 index 00000000000..9e9805b0390 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/ComponentRequest.java @@ -0,0 +1,63 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.ce; + +import javax.annotation.Generated; + +/** + * Get the pending tasks, in-progress tasks and the last executed task of a given component (usually a project).<br>Requires the following permission: 'Browse' on the specified component.<br>Either 'componentId' or 'component' must be provided. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/component">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class ComponentRequest { + + private String component; + private String componentId; + + /** + * Example value: "my_project" + */ + public ComponentRequest setComponent(String component) { + this.component = component; + return this; + } + + public String getComponent() { + return component; + } + + /** + * Example value: "AU-Tpxb--iU5OvuD2FLy" + * @deprecated since 6.6 + */ + @Deprecated + public ComponentRequest setComponentId(String componentId) { + this.componentId = componentId; + return this; + } + + public String getComponentId() { + return componentId; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/SubmitRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/SubmitRequest.java new file mode 100644 index 00000000000..69f3241c40b --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/SubmitRequest.java @@ -0,0 +1,127 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.ce; + +import javax.annotation.Generated; + +/** + * Submits a scanner report to the queue. Report is processed asynchronously. Requires analysis permission. If the project does not exist, then the provisioning permission is also required. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/submit">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class SubmitRequest { + + private String characteristic; + private String organization; + private String projectBranch; + private String projectKey; + private String projectName; + private String report; + + /** + * Optional characteristic of the analysis. Can be repeated to define multiple characteristics. + * + * Example value: "branchType=long" + */ + public SubmitRequest setCharacteristic(String characteristic) { + this.characteristic = characteristic; + return this; + } + + public String getCharacteristic() { + return characteristic; + } + + /** + * Key of the organization the project belongs to + * + * This is part of the internal API. + * Example value: "my-org" + */ + public SubmitRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Optional branch of project + * + * Example value: "branch-1.x" + */ + public SubmitRequest setProjectBranch(String projectBranch) { + this.projectBranch = projectBranch; + return this; + } + + public String getProjectBranch() { + return projectBranch; + } + + /** + * Key of project + * + * This is a mandatory parameter. + * Example value: "my_project" + */ + public SubmitRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } + + /** + * Optional name of the project, used only if the project does not exist yet. + * + * Example value: "My Project" + */ + public SubmitRequest setProjectName(String projectName) { + this.projectName = projectName; + return this; + } + + public String getProjectName() { + return projectName; + } + + /** + * Report file. Format is not an API, it changes among SonarQube versions. + * + * This is a mandatory parameter. + */ + public SubmitRequest setReport(String report) { + this.report = report; + return this; + } + + public String getReport() { + return report; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/TaskRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/TaskRequest.java new file mode 100644 index 00000000000..e21b304cdc2 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/TaskRequest.java @@ -0,0 +1,71 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.ce; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Give Compute Engine task details such as type, status, duration and associated component.<br />Requires 'Administer System' or 'Execute Analysis' permission.<br/>Since 6.1, field "logs" is deprecated and its value is always false. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/task">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class TaskRequest { + + private List<String> additionalFields; + private String id; + + /** + * Comma-separated list of the optional fields to be returned in response. + * + * Possible values: + * <ul> + * <li>"stacktrace"</li> + * <li>"scannerContext"</li> + * </ul> + */ + public TaskRequest setAdditionalFields(List<String> additionalFields) { + this.additionalFields = additionalFields; + return this; + } + + public List<String> getAdditionalFields() { + return additionalFields; + } + + /** + * Id of task + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public TaskRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/package-info.java new file mode 100644 index 00000000000..9971fa2fd54 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.ce; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/components/AppRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/components/AppRequest.java new file mode 100644 index 00000000000..3e89464c0dd --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/components/AppRequest.java @@ -0,0 +1,83 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.components; + +import javax.annotation.Generated; + +/** + * Coverage data required for rendering the component viewer.<br>Requires the following permission: 'Browse'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/components/app">Further information about this action online (including a response example)</a> + * @since 4.4 + */ +@Generated("sonar-ws-generator") +public class AppRequest { + + private String branch; + private String component; + private String componentId; + + /** + * Branch key + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public AppRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * Component key + * + * Example value: "my_project" + */ + public AppRequest setComponent(String component) { + this.component = component; + return this; + } + + public String getComponent() { + return component; + } + + /** + * Component ID + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + * @deprecated since 6.4 + */ + @Deprecated + public AppRequest setComponentId(String componentId) { + this.componentId = componentId; + return this; + } + + public String getComponentId() { + return componentId; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/components/ComponentsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/components/ComponentsService.java new file mode 100644 index 00000000000..6058084acf7 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/components/ComponentsService.java @@ -0,0 +1,162 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.components; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.WsConnector; +import org.sonarqube.ws.Components.SearchWsResponse; +import org.sonarqube.ws.Components.SearchProjectsWsResponse; +import org.sonarqube.ws.Components.ShowWsResponse; +import org.sonarqube.ws.Components.SuggestionsWsResponse; +import org.sonarqube.ws.Components.TreeWsResponse; + +/** + * Get information about a component (file, directory, project, ...) and its ancestors or descendants. Update a project or module key. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/components">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class ComponentsService extends BaseService { + + public ComponentsService(WsConnector wsConnector) { + super(wsConnector, "api/components"); + } + + /** + * Coverage data required for rendering the component viewer.<br>Requires the following permission: 'Browse'. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/components/app">Further information about this action online (including a response example)</a> + * @since 4.4 + */ + public String app(AppRequest request) { + return call( + new GetRequest(path("app")) + .setParam("branch", request.getBranch()) + .setParam("component", request.getComponent()) + .setParam("componentId", request.getComponentId()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Search for components + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/components/search">Further information about this action online (including a response example)</a> + * @since 6.3 + */ + public SearchWsResponse search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("language", request.getLanguage()) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setParam("qualifiers", request.getQualifiers() == null ? null : request.getQualifiers().stream().collect(Collectors.joining(","))), + SearchWsResponse.parser()); + } + + /** + * Search for projects + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/components/search_projects">Further information about this action online (including a response example)</a> + * @since 6.2 + */ + public SearchProjectsWsResponse searchProjects(SearchProjectsRequest request) { + return call( + new GetRequest(path("search_projects")) + .setParam("asc", request.getAsc()) + .setParam("f", request.getF() == null ? null : request.getF().stream().collect(Collectors.joining(","))) + .setParam("facets", request.getFacets() == null ? null : request.getFacets().stream().collect(Collectors.joining(","))) + .setParam("filter", request.getFilter()) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("s", request.getS()), + SearchProjectsWsResponse.parser()); + } + + /** + * Returns a component (file, directory, project, view?) and its ancestors. The ancestors are ordered from the parent to the root project. The 'componentId' or 'component' parameter must be provided.<br>Requires the following permission: 'Browse' on the project of the specified component. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/components/show">Further information about this action online (including a response example)</a> + * @since 5.4 + */ + public ShowWsResponse show(ShowRequest request) { + return call( + new GetRequest(path("show")) + .setParam("branch", request.getBranch()) + .setParam("component", request.getComponent()) + .setParam("componentId", request.getComponentId()), + ShowWsResponse.parser()); + } + + /** + * Internal WS for the top-right search engine. The result will contain component search results, grouped by their qualifiers.<p>Each result contains:<ul><li>the organization key</li><li>the component key</li><li>the component's name (unescaped)</li><li>optionally a display name, which puts emphasis to matching characters (this text contains html tags and parts of the html-escaped name)</li></ul> + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/components/suggestions">Further information about this action online (including a response example)</a> + * @since 4.2 + */ + public SuggestionsWsResponse suggestions(SuggestionsRequest request) { + return call( + new GetRequest(path("suggestions")) + .setParam("more", request.getMore()) + .setParam("recentlyBrowsed", request.getRecentlyBrowsed() == null ? null : request.getRecentlyBrowsed().stream().collect(Collectors.joining(","))) + .setParam("s", request.getS()), + SuggestionsWsResponse.parser()); + } + + /** + * Navigate through components based on the chosen strategy. The componentId or the component parameter must be provided.<br>Requires the following permission: 'Browse' on the specified project.<br>When limiting search with the q parameter, directories are not returned. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/components/tree">Further information about this action online (including a response example)</a> + * @since 5.4 + */ + public TreeWsResponse tree(TreeRequest request) { + return call( + new GetRequest(path("tree")) + .setParam("asc", request.getAsc()) + .setParam("branch", request.getBranch()) + .setParam("component", request.getComponent()) + .setParam("componentId", request.getComponentId()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setParam("qualifiers", request.getQualifiers() == null ? null : request.getQualifiers().stream().collect(Collectors.joining(","))) + .setParam("s", request.getS() == null ? null : request.getS().stream().collect(Collectors.joining(","))) + .setParam("strategy", request.getStrategy()), + TreeWsResponse.parser()); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/components/SearchProjectsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/components/SearchProjectsRequest.java new file mode 100644 index 00000000000..32af863b2f8 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/components/SearchProjectsRequest.java @@ -0,0 +1,201 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.components; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Search for projects + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/components/search_projects">Further information about this action online (including a response example)</a> + * @since 6.2 + */ +@Generated("sonar-ws-generator") +public class SearchProjectsRequest { + + private String asc; + private List<String> f; + private List<String> facets; + private String filter; + private String organization; + private String p; + private String ps; + private String s; + + /** + * Ascending sort + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public SearchProjectsRequest setAsc(String asc) { + this.asc = asc; + return this; + } + + public String getAsc() { + return asc; + } + + /** + * Comma-separated list of the fields to be returned in response + * + * Possible values: + * <ul> + * <li>"analysisDate"</li> + * <li>"leakPeriodDate"</li> + * </ul> + */ + public SearchProjectsRequest setF(List<String> f) { + this.f = f; + return this; + } + + public List<String> getF() { + return f; + } + + /** + * Comma-separated list of the facets to be computed. No facet is computed by default. + * + * Possible values: + * <ul> + * <li>"alert_status"</li> + * <li>"coverage"</li> + * <li>"duplicated_lines_density"</li> + * <li>"languages"</li> + * <li>"ncloc"</li> + * <li>"new_coverage"</li> + * <li>"new_duplicated_lines_density"</li> + * <li>"new_lines"</li> + * <li>"new_maintainability_rating"</li> + * <li>"new_reliability_rating"</li> + * <li>"new_security_rating"</li> + * <li>"reliability_rating"</li> + * <li>"security_rating"</li> + * <li>"sqale_rating"</li> + * <li>"tags"</li> + * </ul> + */ + public SearchProjectsRequest setFacets(List<String> facets) { + this.facets = facets; + return this; + } + + public List<String> getFacets() { + return facets; + } + + /** + * Filter of projects on name, key, measure value, quality gate, language, tag or whether a project is a favorite or not.<br>The filter must be encoded to form a valid URL (for example '=' must be replaced by '%3D').<br>Examples of use:<ul> <li>to filter my favorite projects with a failed quality gate and a coverage greater than or equals to 60% and a coverage strictly lower than 80%:<br> <code>filter="alert_status = ERROR and isFavorite and coverage >= 60 and coverage < 80"</code></li> <li>to filter projects with a reliability, security and maintainability rating equals or worse than B:<br> <code>filter="reliability_rating>=2 and security_rating>=2 and sqale_rating>=2"</code></li> <li>to filter projects without duplication data:<br> <code>filter="duplicated_lines_density = NO_DATA"</code></li></ul>To filter on project name or key, use the 'query' keyword, for instance : <code>filter='query = "Sonar"'</code>.<br><br>To filter on a numeric metric, provide the metric key.<br>These are the supported metric keys:<br><ul><li>alert_status</li><li>coverage</li><li>duplicated_lines_density</li><li>lines</li><li>ncloc</li><li>ncloc_language_distribution</li><li>new_coverage</li><li>new_duplicated_lines_density</li><li>new_lines</li><li>new_maintainability_rating</li><li>new_reliability_rating</li><li>new_security_rating</li><li>reliability_rating</li><li>security_rating</li><li>sqale_rating</li></ul><br>To filter on a rating, provide the corresponding metric key (ex: reliability_rating for reliability rating).<br>The possible values are:<ul> <li>'1' for rating A</li> <li>'2' for rating B</li> <li>'3' for rating C</li> <li>'4' for rating D</li> <li>'5' for rating E</li></ul>To filter on a Quality Gate status use the metric key 'alert_status'. Only the '=' operator can be used.<br>The possible values are:<ul> <li>'OK' for Passed</li> <li>'WARN' for Warning</li> <li>'ERROR' for Failed</li></ul>To filter on language keys use the language key: <ul> <li>to filter on a single language you can use 'language = java'</li> <li>to filter on several languages you must use 'language IN (java, js)'</li></ul>Use the WS api/languages/list to find the key of a language.<br> To filter on tags use the 'tag' keyword:<ul> <li>to filter on one tag you can use <code>tag = finance</code></li> <li>to filter on several tags you must use <code>tag in (offshore, java)</code></li></ul> + * + */ + public SearchProjectsRequest setFilter(String filter) { + this.filter = filter; + return this; + } + + public String getFilter() { + return filter; + } + + /** + * the organization to search projects in + * + * This is part of the internal API. + */ + public SearchProjectsRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchProjectsRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public SearchProjectsRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Sort projects by numeric metric key, quality gate status (using 'alert_status'), last analysis date (using 'analysisDate'), or by project name. + * + * Possible values: + * <ul> + * <li>"alert_status"</li> + * <li>"analysisDate"</li> + * <li>"coverage"</li> + * <li>"duplicated_lines_density"</li> + * <li>"lines"</li> + * <li>"name"</li> + * <li>"ncloc"</li> + * <li>"ncloc_language_distribution"</li> + * <li>"new_coverage"</li> + * <li>"new_duplicated_lines_density"</li> + * <li>"new_lines"</li> + * <li>"new_maintainability_rating"</li> + * <li>"new_reliability_rating"</li> + * <li>"new_security_rating"</li> + * <li>"reliability_rating"</li> + * <li>"security_rating"</li> + * <li>"sqale_rating"</li> + * </ul> + */ + public SearchProjectsRequest setS(String s) { + this.s = s; + return this; + } + + public String getS() { + return s; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/components/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/components/SearchRequest.java new file mode 100644 index 00000000000..9420c8fc72c --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/components/SearchRequest.java @@ -0,0 +1,135 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.components; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Search for components + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/components/search">Further information about this action online (including a response example)</a> + * @since 6.3 + */ +@Generated("sonar-ws-generator") +public class SearchRequest { + + private String language; + private String organization; + private String p; + private String ps; + private String q; + private List<String> qualifiers; + + /** + * Language key. If provided, only components for the given language are returned. + * + * Example value: "" + */ + public SearchRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * Organization key + * + * This is part of the internal API. + * Example value: "my-org" + */ + public SearchRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0. + * + * Example value: "20" + */ + public SearchRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to: <ul><li>component names that contain the supplied string</li><li>component keys that are exactly the same as the supplied string</li></ul> + * + * Example value: "sonar" + */ + public SearchRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Comma-separated list of component qualifiers. Filter the results with the specified qualifiers. Possible values are:<ul><li>BRC - Sub-projects</li><li>DIR - Directories</li><li>FIL - Files</li><li>TRK - Projects</li><li>UTS - Test Files</li></ul> + * + * This is a mandatory parameter. + * Possible values: + * <ul> + * <li>"BRC"</li> + * <li>"DIR"</li> + * <li>"FIL"</li> + * <li>"TRK"</li> + * <li>"UTS"</li> + * </ul> + */ + public SearchRequest setQualifiers(List<String> qualifiers) { + this.qualifiers = qualifiers; + return this; + } + + public List<String> getQualifiers() { + return qualifiers; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/components/ShowRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/components/ShowRequest.java new file mode 100644 index 00000000000..e3caebb7ce1 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/components/ShowRequest.java @@ -0,0 +1,83 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.components; + +import javax.annotation.Generated; + +/** + * Returns a component (file, directory, project, view?) and its ancestors. The ancestors are ordered from the parent to the root project. The 'componentId' or 'component' parameter must be provided.<br>Requires the following permission: 'Browse' on the project of the specified component. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/components/show">Further information about this action online (including a response example)</a> + * @since 5.4 + */ +@Generated("sonar-ws-generator") +public class ShowRequest { + + private String branch; + private String component; + private String componentId; + + /** + * Branch key + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public ShowRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * Component key + * + * Example value: "my_project" + */ + public ShowRequest setComponent(String component) { + this.component = component; + return this; + } + + public String getComponent() { + return component; + } + + /** + * Component id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + * @deprecated since 6.4 + */ + @Deprecated + public ShowRequest setComponentId(String componentId) { + this.componentId = componentId; + return this; + } + + public String getComponentId() { + return componentId; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/components/SuggestionsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/components/SuggestionsRequest.java new file mode 100644 index 00000000000..a00335e09c9 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/components/SuggestionsRequest.java @@ -0,0 +1,90 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.components; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Internal WS for the top-right search engine. The result will contain component search results, grouped by their qualifiers.<p>Each result contains:<ul><li>the organization key</li><li>the component key</li><li>the component's name (unescaped)</li><li>optionally a display name, which puts emphasis to matching characters (this text contains html tags and parts of the html-escaped name)</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/components/suggestions">Further information about this action online (including a response example)</a> + * @since 4.2 + */ +@Generated("sonar-ws-generator") +public class SuggestionsRequest { + + private String more; + private List<String> recentlyBrowsed; + private String s; + + /** + * Category, for which to display the next 20 results (skipping the first 6 results) + * + * Possible values: + * <ul> + * <li>"VW"</li> + * <li>"SVW"</li> + * <li>"APP"</li> + * <li>"TRK"</li> + * <li>"BRC"</li> + * <li>"FIL"</li> + * <li>"UTS"</li> + * </ul> + */ + public SuggestionsRequest setMore(String more) { + this.more = more; + return this; + } + + public String getMore() { + return more; + } + + /** + * Comma separated list of component keys, that have recently been browsed by the user. Only the first 50 items will be used. Order is not taken into account. + * + * Example value: "org.sonarsource:sonarqube,some.other:project" + */ + public SuggestionsRequest setRecentlyBrowsed(List<String> recentlyBrowsed) { + this.recentlyBrowsed = recentlyBrowsed; + return this; + } + + public List<String> getRecentlyBrowsed() { + return recentlyBrowsed; + } + + /** + * Search query: can contain several search tokens separated by spaces. + * + * Example value: "sonar" + */ + public SuggestionsRequest setS(String s) { + this.s = s; + return this; + } + + public String getS() { + return s; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/components/TreeRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/components/TreeRequest.java new file mode 100644 index 00000000000..5aaa5f1c4d2 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/components/TreeRequest.java @@ -0,0 +1,213 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.components; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Navigate through components based on the chosen strategy. The componentId or the component parameter must be provided.<br>Requires the following permission: 'Browse' on the specified project.<br>When limiting search with the q parameter, directories are not returned. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/components/tree">Further information about this action online (including a response example)</a> + * @since 5.4 + */ +@Generated("sonar-ws-generator") +public class TreeRequest { + + private String asc; + private String branch; + private String component; + private String componentId; + private String p; + private String ps; + private String q; + private List<String> qualifiers; + private List<String> s; + private String strategy; + + /** + * Ascending sort + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public TreeRequest setAsc(String asc) { + this.asc = asc; + return this; + } + + public String getAsc() { + return asc; + } + + /** + * Branch key + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public TreeRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * Base component key. The search is based on this component. + * + * Example value: "my_project" + */ + public TreeRequest setComponent(String component) { + this.component = component; + return this; + } + + public String getComponent() { + return component; + } + + /** + * Base component id. The search is based on this component. + * + * Example value: "AU-TpxcA-iU5OvuD2FLz" + * @deprecated since 6.4 + */ + @Deprecated + public TreeRequest setComponentId(String componentId) { + this.componentId = componentId; + return this; + } + + public String getComponentId() { + return componentId; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public TreeRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public TreeRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to: <ul><li>component names that contain the supplied string</li><li>component keys that are exactly the same as the supplied string</li></ul> + * + * Example value: "FILE_NAM" + */ + public TreeRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Comma-separated list of component qualifiers. Filter the results with the specified qualifiers. Possible values are:<ul><li>BRC - Sub-projects</li><li>DIR - Directories</li><li>FIL - Files</li><li>TRK - Projects</li><li>UTS - Test Files</li></ul> + * + * Possible values: + * <ul> + * <li>"BRC"</li> + * <li>"DIR"</li> + * <li>"FIL"</li> + * <li>"TRK"</li> + * <li>"UTS"</li> + * </ul> + */ + public TreeRequest setQualifiers(List<String> qualifiers) { + this.qualifiers = qualifiers; + return this; + } + + public List<String> getQualifiers() { + return qualifiers; + } + + /** + * Comma-separated list of sort fields + * + * Example value: "name, path" + * Possible values: + * <ul> + * <li>"name"</li> + * <li>"path"</li> + * <li>"qualifier"</li> + * </ul> + */ + public TreeRequest setS(List<String> s) { + this.s = s; + return this; + } + + public List<String> getS() { + return s; + } + + /** + * Strategy to search for base component descendants:<ul><li>children: return the children components of the base component. Grandchildren components are not returned</li><li>all: return all the descendants components of the base component. Grandchildren are returned.</li><li>leaves: return all the descendant components (files, in general) which don't have other children. They are the leaves of the component tree.</li></ul> + * + * Possible values: + * <ul> + * <li>"all"</li> + * <li>"children"</li> + * <li>"leaves"</li> + * </ul> + */ + public TreeRequest setStrategy(String strategy) { + this.strategy = strategy; + return this; + } + + public String getStrategy() { + return strategy; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/components/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/components/package-info.java new file mode 100644 index 00000000000..f9d52cab322 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/components/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.components; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/CreateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/CreateRequest.java new file mode 100644 index 00000000000..820646e3e2b --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/CreateRequest.java @@ -0,0 +1,126 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.custommeasures; + +import javax.annotation.Generated; + +/** + * Create a custom measure.<br /> The project id or the project key must be provided (only project and module custom measures can be created). The metric id or the metric key must be provided.<br/>Requires 'Administer System' permission or 'Administer' permission on the project. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/custom_measures/create">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class CreateRequest { + + private String description; + private String metricId; + private String metricKey; + private String projectId; + private String projectKey; + private String value; + + /** + * Description + * + * Example value: "Team size growing." + */ + public CreateRequest setDescription(String description) { + this.description = description; + return this; + } + + public String getDescription() { + return description; + } + + /** + * Metric id + * + * Example value: "16" + */ + public CreateRequest setMetricId(String metricId) { + this.metricId = metricId; + return this; + } + + public String getMetricId() { + return metricId; + } + + /** + * Metric key + * + * Example value: "ncloc" + */ + public CreateRequest setMetricKey(String metricKey) { + this.metricKey = metricKey; + return this; + } + + public String getMetricKey() { + return metricKey; + } + + /** + * Project id + * + * Example value: "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + */ + public CreateRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public CreateRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } + + /** + * Measure value. Value type depends on metric type:<ul><li>INT - type: integer</li><li>FLOAT - type: double</li><li>PERCENT - type: double</li><li>BOOL - the possible values are true or false</li><li>STRING - type: string</li><li>MILLISEC - type: integer</li><li>DATA - type: string</li><li>LEVEL - the possible values are OK, WARN, ERROR</li><li>DISTRIB - type: string</li><li>RATING - type: double</li><li>WORK_DUR - long representing the number of minutes</li></ul> + * + * This is a mandatory parameter. + * Example value: "47" + */ + public CreateRequest setValue(String value) { + this.value = value; + return this; + } + + public String getValue() { + return value; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/CustomMeasuresService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/CustomMeasuresService.java new file mode 100644 index 00000000000..335d0a8db17 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/CustomMeasuresService.java @@ -0,0 +1,132 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.custommeasures; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Manage custom measures for a project. See also api/metrics. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/custom_measures">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class CustomMeasuresService extends BaseService { + + public CustomMeasuresService(WsConnector wsConnector) { + super(wsConnector, "api/custom_measures"); + } + + /** + * Create a custom measure.<br /> The project id or the project key must be provided (only project and module custom measures can be created). The metric id or the metric key must be provided.<br/>Requires 'Administer System' permission or 'Administer' permission on the project. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/custom_measures/create">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void create(CreateRequest request) { + call( + new PostRequest(path("create")) + .setParam("description", request.getDescription()) + .setParam("metricId", request.getMetricId()) + .setParam("metricKey", request.getMetricKey()) + .setParam("projectId", request.getProjectId()) + .setParam("projectKey", request.getProjectKey()) + .setParam("value", request.getValue()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Delete a custom measure.<br /> Requires 'Administer System' permission or 'Administer' permission on the project. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/custom_measures/delete">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void delete(DeleteRequest request) { + call( + new PostRequest(path("delete")) + .setParam("id", request.getId()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * List all custom metrics for which no custom measure already exists on a given project.<br /> The project id or project key must be provided.<br />Requires 'Administer System' permission or 'Administer' permission on the project. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/custom_measures/metrics">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public String metrics(MetricsRequest request) { + return call( + new GetRequest(path("metrics")) + .setParam("projectId", request.getProjectId()) + .setParam("projectKey", request.getProjectKey()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * List custom measures. The project id or project key must be provided.<br />Requires 'Administer System' permission or 'Administer' permission on the project. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/custom_measures/search">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public String search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("f", request.getF() == null ? null : request.getF().stream().collect(Collectors.joining(","))) + .setParam("p", request.getP()) + .setParam("projectId", request.getProjectId()) + .setParam("projectKey", request.getProjectKey()) + .setParam("ps", request.getPs()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Update a custom measure. Value and/or description must be provided<br />Requires 'Administer System' permission or 'Administer' permission on the project. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/custom_measures/update">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void update(UpdateRequest request) { + call( + new PostRequest(path("update")) + .setParam("description", request.getDescription()) + .setParam("id", request.getId()) + .setParam("value", request.getValue()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/DeleteRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/DeleteRequest.java new file mode 100644 index 00000000000..202abee92b6 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/DeleteRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.custommeasures; + +import javax.annotation.Generated; + +/** + * Delete a custom measure.<br /> Requires 'Administer System' permission or 'Administer' permission on the project. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/custom_measures/delete">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class DeleteRequest { + + private String id; + + /** + * Id + * + * This is a mandatory parameter. + * Example value: "24" + */ + public DeleteRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/MetricsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/MetricsRequest.java new file mode 100644 index 00000000000..390587e77d4 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/MetricsRequest.java @@ -0,0 +1,65 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.custommeasures; + +import javax.annotation.Generated; + +/** + * List all custom metrics for which no custom measure already exists on a given project.<br /> The project id or project key must be provided.<br />Requires 'Administer System' permission or 'Administer' permission on the project. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/custom_measures/metrics">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class MetricsRequest { + + private String projectId; + private String projectKey; + + /** + * Project id + * + * Example value: "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + */ + public MetricsRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public MetricsRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/SearchRequest.java new file mode 100644 index 00000000000..73bdf19938e --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/SearchRequest.java @@ -0,0 +1,122 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.custommeasures; + +import java.util.List; +import javax.annotation.Generated; + +/** + * List custom measures. The project id or project key must be provided.<br />Requires 'Administer System' permission or 'Administer' permission on the project. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/custom_measures/search">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class SearchRequest { + + private List<String> f; + private String p; + private String projectId; + private String projectKey; + private String ps; + + /** + * Comma-separated list of the fields to be returned in response. All the fields are returned by default. + * + * Possible values: + * <ul> + * <li>"projectId"</li> + * <li>"projectKey"</li> + * <li>"value"</li> + * <li>"description"</li> + * <li>"metric"</li> + * <li>"createdAt"</li> + * <li>"updatedAt"</li> + * <li>"user"</li> + * <li>"pending"</li> + * </ul> + */ + public SearchRequest setF(List<String> f) { + this.f = f; + return this; + } + + public List<String> getF() { + return f; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Project id + * + * Example value: "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + */ + public SearchRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public SearchRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public SearchRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/UpdateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/UpdateRequest.java new file mode 100644 index 00000000000..d19835b436f --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/UpdateRequest.java @@ -0,0 +1,79 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.custommeasures; + +import javax.annotation.Generated; + +/** + * Update a custom measure. Value and/or description must be provided<br />Requires 'Administer System' permission or 'Administer' permission on the project. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/custom_measures/update">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class UpdateRequest { + + private String description; + private String id; + private String value; + + /** + * Example value: "Team size growing." + */ + public UpdateRequest setDescription(String description) { + this.description = description; + return this; + } + + public String getDescription() { + return description; + } + + /** + * id + * + * This is a mandatory parameter. + * Example value: "42" + */ + public UpdateRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } + + /** + * Measure value. Value type depends on metric type:<ul><li>INT - type: integer</li><li>FLOAT - type: double</li><li>PERCENT - type: double</li><li>BOOL - the possible values are true or false</li><li>STRING - type: string</li><li>MILLISEC - type: integer</li><li>DATA - type: string</li><li>LEVEL - the possible values are OK, WARN, ERROR</li><li>DISTRIB - type: string</li><li>RATING - type: double</li><li>WORK_DUR - long representing the number of minutes</li></ul> + * + * Example value: "true" + */ + public UpdateRequest setValue(String value) { + this.value = value; + return this; + } + + public String getValue() { + return value; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/package-info.java new file mode 100644 index 00000000000..54c68868c23 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.custommeasures; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/duplications/DuplicationsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/duplications/DuplicationsService.java new file mode 100644 index 00000000000..4072315d103 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/duplications/DuplicationsService.java @@ -0,0 +1,55 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.duplications; + +import javax.annotation.Generated; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.WsConnector; +import org.sonarqube.ws.Duplications.ShowResponse; + +/** + * Get duplication information for a project. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/duplications">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class DuplicationsService extends BaseService { + + public DuplicationsService(WsConnector wsConnector) { + super(wsConnector, "api/duplications"); + } + + /** + * Get duplications. Require Browse permission on file's project + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/duplications/show">Further information about this action online (including a response example)</a> + * @since 4.4 + */ + public ShowResponse show(ShowRequest request) { + return call( + new GetRequest(path("show")) + .setParam("branch", request.getBranch()) + .setParam("key", request.getKey()) + .setParam("uuid", request.getUuid()), + ShowResponse.parser()); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/duplications/ShowRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/duplications/ShowRequest.java new file mode 100644 index 00000000000..1e8e40b72c1 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/duplications/ShowRequest.java @@ -0,0 +1,83 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.duplications; + +import javax.annotation.Generated; + +/** + * Get duplications. Require Browse permission on file's project + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/duplications/show">Further information about this action online (including a response example)</a> + * @since 4.4 + */ +@Generated("sonar-ws-generator") +public class ShowRequest { + + private String branch; + private String key; + private String uuid; + + /** + * Branch key + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public ShowRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * File key + * + * Example value: "my_project:/src/foo/Bar.php" + */ + public ShowRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * File ID. If provided, 'key' must not be provided. + * + * Example value: "584a89f2-8037-4f7b-b82c-8b45d2d63fb2" + * @deprecated since 6.5 + */ + @Deprecated + public ShowRequest setUuid(String uuid) { + this.uuid = uuid; + return this; + } + + public String getUuid() { + return uuid; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/duplications/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/duplications/package-info.java new file mode 100644 index 00000000000..cbd34e1eec1 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/duplications/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.duplications; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/editions/ApplyLicenseRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/editions/ApplyLicenseRequest.java new file mode 100644 index 00000000000..1f73cdb993b --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/editions/ApplyLicenseRequest.java @@ -0,0 +1,50 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.editions; + +import javax.annotation.Generated; + +/** + * Apply changes to SonarQube to match the specified license. Clear error message of previous automatic install of an edition, if there is any. Require 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/editions/apply_license">Further information about this action online (including a response example)</a> + * @since 6.7 + */ +@Generated("sonar-ws-generator") +public class ApplyLicenseRequest { + + private String license; + + /** + * the license + * + * This is a mandatory parameter. + */ + public ApplyLicenseRequest setLicense(String license) { + this.license = license; + return this; + } + + public String getLicense() { + return license; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/editions/EditionsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/editions/EditionsService.java new file mode 100644 index 00000000000..8f7f8ecb797 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/editions/EditionsService.java @@ -0,0 +1,131 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.editions; + +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.Editions.FormDataResponse; +import org.sonarqube.ws.Editions.PreviewResponse; +import org.sonarqube.ws.Editions.StatusResponse; + +/** + * Manage SonarSource commercial editions. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/editions">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class EditionsService extends BaseService { + + public EditionsService(WsConnector wsConnector) { + super(wsConnector, "api/editions"); + } + + /** + * Apply changes to SonarQube to match the specified license. Clear error message of previous automatic install of an edition, if there is any. Require 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/editions/apply_license">Further information about this action online (including a response example)</a> + * @since 6.7 + */ + public String applyLicense(ApplyLicenseRequest request) { + return call( + new PostRequest(path("apply_license")) + .setParam("license", request.getLicense()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Clear error message of last install of an edition (if any). Require 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/editions/clear_error_message">Further information about this action online (including a response example)</a> + * @since 6.7 + */ + public void clearErrorMessage() { + call( + new PostRequest(path("clear_error_message")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Provide data to prefill license request forms: the server ID and the total number of lines of code. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/editions/form_data">Further information about this action online (including a response example)</a> + * @since 6.7 + */ + public FormDataResponse formData() { + return call( + new GetRequest(path("form_data")), + FormDataResponse.parser()); + } + + /** + * Preview the changes to SonarQube to match the specified license. Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/editions/preview">Further information about this action online (including a response example)</a> + * @since 6.7 + */ + public PreviewResponse preview(PreviewRequest request) { + return call( + new PostRequest(path("preview")) + .setParam("license", request.getLicense()), + PreviewResponse.parser()); + } + + /** + * Provide status of SonarSource commercial edition of the current SonarQube. Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/editions/status">Further information about this action online (including a response example)</a> + * @since 6.7 + */ + public StatusResponse status() { + return call( + new GetRequest(path("status")), + StatusResponse.parser()); + } + + /** + * Uninstall the currently installed edition. Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/editions/uninstall">Further information about this action online (including a response example)</a> + * @since 6.7 + */ + public void uninstall() { + call( + new PostRequest(path("uninstall")) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/editions/PreviewRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/editions/PreviewRequest.java new file mode 100644 index 00000000000..a7eaea6bf95 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/editions/PreviewRequest.java @@ -0,0 +1,50 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.editions; + +import javax.annotation.Generated; + +/** + * Preview the changes to SonarQube to match the specified license. Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/editions/preview">Further information about this action online (including a response example)</a> + * @since 6.7 + */ +@Generated("sonar-ws-generator") +public class PreviewRequest { + + private String license; + + /** + * the license + * + * This is a mandatory parameter. + */ + public PreviewRequest setLicense(String license) { + this.license = license; + return this; + } + + public String getLicense() { + return license; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/editions/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/editions/package-info.java new file mode 100644 index 00000000000..e600294d249 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/editions/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.editions; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/emails/EmailsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/emails/EmailsService.java new file mode 100644 index 00000000000..ba055245b67 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/emails/EmailsService.java @@ -0,0 +1,56 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.emails; + +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Manage emails + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/emails">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class EmailsService extends BaseService { + + public EmailsService(WsConnector wsConnector) { + super(wsConnector, "api/emails"); + } + + /** + * Test email configuration by sending an email<br>Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/emails/send">Further information about this action online (including a response example)</a> + * @since 6.1 + */ + public void send(SendRequest request) { + call( + new PostRequest(path("send")) + .setParam("message", request.getMessage()) + .setParam("subject", request.getSubject()) + .setParam("to", request.getTo()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/emails/SendRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/emails/SendRequest.java new file mode 100644 index 00000000000..62499e9d5ed --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/emails/SendRequest.java @@ -0,0 +1,81 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.emails; + +import javax.annotation.Generated; + +/** + * Test email configuration by sending an email<br>Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/emails/send">Further information about this action online (including a response example)</a> + * @since 6.1 + */ +@Generated("sonar-ws-generator") +public class SendRequest { + + private String message; + private String subject; + private String to; + + /** + * Content of the email + * + * This is a mandatory parameter. + */ + public SendRequest setMessage(String message) { + this.message = message; + return this; + } + + public String getMessage() { + return message; + } + + /** + * Subject of the email + * + * Example value: "Test Message from SonarQube" + */ + public SendRequest setSubject(String subject) { + this.subject = subject; + return this; + } + + public String getSubject() { + return subject; + } + + /** + * Email address + * + * This is a mandatory parameter. + * Example value: "john@doo.com" + */ + public SendRequest setTo(String to) { + this.to = to; + return this; + } + + public String getTo() { + return to; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/emails/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/emails/package-info.java new file mode 100644 index 00000000000..2219eedc11c --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/emails/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.emails; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/AddRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/AddRequest.java new file mode 100644 index 00000000000..d4e18905fca --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/AddRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.favorites; + +import javax.annotation.Generated; + +/** + * Add a component (project, directory, file etc.) as favorite for the authenticated user.<br>Requires authentication and the following permission: 'Browse' on the project of the specified component. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/favorites/add">Further information about this action online (including a response example)</a> + * @since 6.3 + */ +@Generated("sonar-ws-generator") +public class AddRequest { + + private String component; + + /** + * Component key + * + * This is a mandatory parameter. + * Example value: "my_project:/src/foo/Bar.php" + */ + public AddRequest setComponent(String component) { + this.component = component; + return this; + } + + public String getComponent() { + return component; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/FavoritesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/FavoritesService.java new file mode 100644 index 00000000000..1780e219093 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/FavoritesService.java @@ -0,0 +1,88 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.favorites; + +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.Favorites.SearchResponse; + +/** + * Manage user favorites + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/favorites">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class FavoritesService extends BaseService { + + public FavoritesService(WsConnector wsConnector) { + super(wsConnector, "api/favorites"); + } + + /** + * Add a component (project, directory, file etc.) as favorite for the authenticated user.<br>Requires authentication and the following permission: 'Browse' on the project of the specified component. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/favorites/add">Further information about this action online (including a response example)</a> + * @since 6.3 + */ + public void add(AddRequest request) { + call( + new PostRequest(path("add")) + .setParam("component", request.getComponent()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Remove a component (project, directory, file etc.) as favorite for the authenticated user.<br>Requires authentication. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/favorites/remove">Further information about this action online (including a response example)</a> + * @since 6.3 + */ + public void remove(RemoveRequest request) { + call( + new PostRequest(path("remove")) + .setParam("component", request.getComponent()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Search for the authenticated user favorites.<br>Requires authentication. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/favorites/search">Further information about this action online (including a response example)</a> + * @since 6.3 + */ + public SearchResponse search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()), + SearchResponse.parser()); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/RemoveRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/RemoveRequest.java new file mode 100644 index 00000000000..a70356c2b87 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/RemoveRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.favorites; + +import javax.annotation.Generated; + +/** + * Remove a component (project, directory, file etc.) as favorite for the authenticated user.<br>Requires authentication. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/favorites/remove">Further information about this action online (including a response example)</a> + * @since 6.3 + */ +@Generated("sonar-ws-generator") +public class RemoveRequest { + + private String component; + + /** + * Component key + * + * This is a mandatory parameter. + * Example value: "my_project" + */ + public RemoveRequest setComponent(String component) { + this.component = component; + return this; + } + + public String getComponent() { + return component; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/SearchRequest.java new file mode 100644 index 00000000000..fb5fd19f689 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/SearchRequest.java @@ -0,0 +1,65 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.favorites; + +import javax.annotation.Generated; + +/** + * Search for the authenticated user favorites.<br>Requires authentication. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/favorites/search">Further information about this action online (including a response example)</a> + * @since 6.3 + */ +@Generated("sonar-ws-generator") +public class SearchRequest { + + private String p; + private String ps; + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public SearchRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/package-info.java new file mode 100644 index 00000000000..3a3d70569a0 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.favorites; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/favourites/FavouritesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/favourites/FavouritesService.java new file mode 100644 index 00000000000..5c09bfb13bb --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/favourites/FavouritesService.java @@ -0,0 +1,57 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.favourites; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Removed since 6.3, please use api/favorites instead + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/favourites">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class FavouritesService extends BaseService { + + public FavouritesService(WsConnector wsConnector) { + super(wsConnector, "api/favourites"); + } + + /** + * The web service is removed and you're invited to use api/favorites instead + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/favourites/index">Further information about this action online (including a response example)</a> + * @since 2.6 + * @deprecated since 6.3 + */ + @Deprecated + public String index() { + return call( + new GetRequest(path("index")) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/favourites/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/favourites/package-info.java new file mode 100644 index 00000000000..49cec47934d --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/favourites/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.favourites; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/AddCommentRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/AddCommentRequest.java new file mode 100644 index 00000000000..ee6f39a0b92 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/AddCommentRequest.java @@ -0,0 +1,67 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.issues; + +import javax.annotation.Generated; + +/** + * Add a comment.<br/>Requires authentication and the following permission: 'Browse' on the project of the specified issue. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/add_comment">Further information about this action online (including a response example)</a> + * @since 3.6 + */ +@Generated("sonar-ws-generator") +public class AddCommentRequest { + + private String issue; + private String text; + + /** + * Issue key + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public AddCommentRequest setIssue(String issue) { + this.issue = issue; + return this; + } + + public String getIssue() { + return issue; + } + + /** + * Comment text + * + * This is a mandatory parameter. + * Example value: "Won't fix because it doesn't apply to the context" + */ + public AddCommentRequest setText(String text) { + this.text = text; + return this; + } + + public String getText() { + return text; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/AssignRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/AssignRequest.java new file mode 100644 index 00000000000..587dd26f47b --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/AssignRequest.java @@ -0,0 +1,89 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.issues; + +import javax.annotation.Generated; + +/** + * Assign/Unassign an issue. Requires authentication and Browse permission on project + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/assign">Further information about this action online (including a response example)</a> + * @since 3.6 + */ +@Generated("sonar-ws-generator") +public class AssignRequest { + + private String assignee; + private String issue; + private String me; + + /** + * Login of the assignee. When not set, it will unassign the issue. Use '_me' to assign to current user + * + * Example value: "admin" + */ + public AssignRequest setAssignee(String assignee) { + this.assignee = assignee; + return this; + } + + public String getAssignee() { + return assignee; + } + + /** + * Issue key + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public AssignRequest setIssue(String issue) { + this.issue = issue; + return this; + } + + public String getIssue() { + return issue; + } + + /** + * (deprecated) Assign the issue to the logged-in user. Replaced by the parameter assignee=_me + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + * @deprecated since 5.2 + */ + @Deprecated + public AssignRequest setMe(String me) { + this.me = me; + return this; + } + + public String getMe() { + return me; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/AuthorsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/AuthorsRequest.java new file mode 100644 index 00000000000..031c45f9ebb --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/AuthorsRequest.java @@ -0,0 +1,65 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.issues; + +import javax.annotation.Generated; + +/** + * Search SCM accounts which match a given query + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/authors">Further information about this action online (including a response example)</a> + * @since 5.1 + */ +@Generated("sonar-ws-generator") +public class AuthorsRequest { + + private String ps; + private String q; + + /** + * The size of the list to return + * + * Example value: "25" + */ + public AuthorsRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * A pattern to match SCM accounts against + * + * Example value: "luke" + */ + public AuthorsRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/BulkChangeRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/BulkChangeRequest.java new file mode 100644 index 00000000000..4ec3a531e85 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/BulkChangeRequest.java @@ -0,0 +1,216 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.issues; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Bulk change on issues.<br/>Requires authentication. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/bulk_change">Further information about this action online (including a response example)</a> + * @since 3.7 + */ +@Generated("sonar-ws-generator") +public class BulkChangeRequest { + + private String addTags; + private String assign; + private String comment; + private String doTransition; + private List<String> issues; + private String plan; + private String removeTags; + private String sendNotifications; + private String setSeverity; + private String setType; + + /** + * Add tags + * + * Example value: "security,java8" + */ + public BulkChangeRequest setAddTags(String addTags) { + this.addTags = addTags; + return this; + } + + public String getAddTags() { + return addTags; + } + + /** + * To assign the list of issues to a specific user (login), or un-assign all the issues + * + * Example value: "john.smith" + */ + public BulkChangeRequest setAssign(String assign) { + this.assign = assign; + return this; + } + + public String getAssign() { + return assign; + } + + /** + * To add a comment to a list of issues + * + * Example value: "Here is my comment" + */ + public BulkChangeRequest setComment(String comment) { + this.comment = comment; + return this; + } + + public String getComment() { + return comment; + } + + /** + * Transition + * + * Example value: "reopen" + * Possible values: + * <ul> + * <li>"confirm"</li> + * <li>"unconfirm"</li> + * <li>"reopen"</li> + * <li>"resolve"</li> + * <li>"falsepositive"</li> + * <li>"wontfix"</li> + * <li>"close"</li> + * </ul> + */ + public BulkChangeRequest setDoTransition(String doTransition) { + this.doTransition = doTransition; + return this; + } + + public String getDoTransition() { + return doTransition; + } + + /** + * Comma-separated list of issue keys + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy,AU-TpxcA-iU5OvuD2FLz" + */ + public BulkChangeRequest setIssues(List<String> issues) { + this.issues = issues; + return this; + } + + public List<String> getIssues() { + return issues; + } + + /** + * In 5.5, action plans are dropped. Has no effect. To plan the list of issues to a specific action plan (key), or unlink all the issues from an action plan + * + * @deprecated since 5.5 + */ + @Deprecated + public BulkChangeRequest setPlan(String plan) { + this.plan = plan; + return this; + } + + public String getPlan() { + return plan; + } + + /** + * Remove tags + * + * Example value: "security,java8" + */ + public BulkChangeRequest setRemoveTags(String removeTags) { + this.removeTags = removeTags; + return this; + } + + public String getRemoveTags() { + return removeTags; + } + + /** + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public BulkChangeRequest setSendNotifications(String sendNotifications) { + this.sendNotifications = sendNotifications; + return this; + } + + public String getSendNotifications() { + return sendNotifications; + } + + /** + * To change the severity of the list of issues + * + * Example value: "BLOCKER" + * Possible values: + * <ul> + * <li>"INFO"</li> + * <li>"MINOR"</li> + * <li>"MAJOR"</li> + * <li>"CRITICAL"</li> + * <li>"BLOCKER"</li> + * </ul> + */ + public BulkChangeRequest setSetSeverity(String setSeverity) { + this.setSeverity = setSeverity; + return this; + } + + public String getSetSeverity() { + return setSeverity; + } + + /** + * To change the type of the list of issues + * + * Example value: "BUG" + * Possible values: + * <ul> + * <li>"CODE_SMELL"</li> + * <li>"BUG"</li> + * <li>"VULNERABILITY"</li> + * </ul> + */ + public BulkChangeRequest setSetType(String setType) { + this.setType = setType; + return this; + } + + public String getSetType() { + return setType; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/ChangelogRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/ChangelogRequest.java new file mode 100644 index 00000000000..b70965837c8 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/ChangelogRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.issues; + +import javax.annotation.Generated; + +/** + * Display changelog of an issue.<br/>Requires the 'Browse' permission on the project of the specified issue. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/changelog">Further information about this action online (including a response example)</a> + * @since 4.1 + */ +@Generated("sonar-ws-generator") +public class ChangelogRequest { + + private String issue; + + /** + * Issue key + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public ChangelogRequest setIssue(String issue) { + this.issue = issue; + return this; + } + + public String getIssue() { + return issue; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/ComponentTagsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/ComponentTagsRequest.java new file mode 100644 index 00000000000..9454932bddc --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/ComponentTagsRequest.java @@ -0,0 +1,81 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.issues; + +import javax.annotation.Generated; + +/** + * List tags for the issues under a given component (including issues on the descendants of the component) + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/component_tags">Further information about this action online (including a response example)</a> + * @since 5.1 + */ +@Generated("sonar-ws-generator") +public class ComponentTagsRequest { + + private String componentUuid; + private String createdAfter; + private String ps; + + /** + * A component UUID + * + * This is a mandatory parameter. + * Example value: "7d8749e8-3070-4903-9188-bdd82933bb92" + */ + public ComponentTagsRequest setComponentUuid(String componentUuid) { + this.componentUuid = componentUuid; + return this; + } + + public String getComponentUuid() { + return componentUuid; + } + + /** + * To retrieve tags on issues created after the given date (inclusive). <br>Either a date (server timezone) or datetime can be provided. + * + * Example value: "2017-10-19 or 2017-10-19T13:00:00+0200" + */ + public ComponentTagsRequest setCreatedAfter(String createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public String getCreatedAfter() { + return createdAfter; + } + + /** + * The maximum size of the list to return + * + * Example value: "25" + */ + public ComponentTagsRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/DeleteCommentRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/DeleteCommentRequest.java new file mode 100644 index 00000000000..36c8f409e1c --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/DeleteCommentRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.issues; + +import javax.annotation.Generated; + +/** + * Delete a comment.<br/>Requires authentication and the following permission: 'Browse' on the project of the specified issue. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/delete_comment">Further information about this action online (including a response example)</a> + * @since 3.6 + */ +@Generated("sonar-ws-generator") +public class DeleteCommentRequest { + + private String comment; + + /** + * Comment key + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public DeleteCommentRequest setComment(String comment) { + this.comment = comment; + return this; + } + + public String getComment() { + return comment; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/DoTransitionRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/DoTransitionRequest.java new file mode 100644 index 00000000000..a7cd1461fb4 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/DoTransitionRequest.java @@ -0,0 +1,76 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.issues; + +import javax.annotation.Generated; + +/** + * Do workflow transition on an issue. Requires authentication and Browse permission on project.<br/>The transitions 'wontfix' and 'falsepositive' require the permission 'Administer Issues'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/do_transition">Further information about this action online (including a response example)</a> + * @since 3.6 + */ +@Generated("sonar-ws-generator") +public class DoTransitionRequest { + + private String issue; + private String transition; + + /** + * Issue key + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public DoTransitionRequest setIssue(String issue) { + this.issue = issue; + return this; + } + + public String getIssue() { + return issue; + } + + /** + * Transition + * + * This is a mandatory parameter. + * Possible values: + * <ul> + * <li>"confirm"</li> + * <li>"unconfirm"</li> + * <li>"reopen"</li> + * <li>"resolve"</li> + * <li>"falsepositive"</li> + * <li>"wontfix"</li> + * <li>"close"</li> + * </ul> + */ + public DoTransitionRequest setTransition(String transition) { + this.transition = transition; + return this; + } + + public String getTransition() { + return transition; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/EditCommentRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/EditCommentRequest.java new file mode 100644 index 00000000000..9052a612295 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/EditCommentRequest.java @@ -0,0 +1,67 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.issues; + +import javax.annotation.Generated; + +/** + * Edit a comment.<br/>Requires authentication and the following permission: 'Browse' on the project of the specified issue. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/edit_comment">Further information about this action online (including a response example)</a> + * @since 3.6 + */ +@Generated("sonar-ws-generator") +public class EditCommentRequest { + + private String comment; + private String text; + + /** + * Comment key + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public EditCommentRequest setComment(String comment) { + this.comment = comment; + return this; + } + + public String getComment() { + return comment; + } + + /** + * Comment text + * + * This is a mandatory parameter. + * Example value: "Won't fix because it doesn't apply to the context" + */ + public EditCommentRequest setText(String text) { + this.text = text; + return this; + } + + public String getText() { + return text; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/IssuesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/IssuesService.java new file mode 100644 index 00000000000..08a21c6cc31 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/IssuesService.java @@ -0,0 +1,322 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.issues; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.Issues.BulkChangeWsResponse; +import org.sonarqube.ws.Issues.ChangelogWsResponse; +import org.sonarqube.ws.Issues.SearchWsResponse; + +/** + * Read and update issues. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class IssuesService extends BaseService { + + public IssuesService(WsConnector wsConnector) { + super(wsConnector, "api/issues"); + } + + /** + * Add a comment.<br/>Requires authentication and the following permission: 'Browse' on the project of the specified issue. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/add_comment">Further information about this action online (including a response example)</a> + * @since 3.6 + */ + public String addComment(AddCommentRequest request) { + return call( + new PostRequest(path("add_comment")) + .setParam("issue", request.getIssue()) + .setParam("text", request.getText()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Assign/Unassign an issue. Requires authentication and Browse permission on project + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/assign">Further information about this action online (including a response example)</a> + * @since 3.6 + */ + public String assign(AssignRequest request) { + return call( + new PostRequest(path("assign")) + .setParam("assignee", request.getAssignee()) + .setParam("issue", request.getIssue()) + .setParam("me", request.getMe()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Search SCM accounts which match a given query + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/authors">Further information about this action online (including a response example)</a> + * @since 5.1 + */ + public String authors(AuthorsRequest request) { + return call( + new GetRequest(path("authors")) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Bulk change on issues.<br/>Requires authentication. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/bulk_change">Further information about this action online (including a response example)</a> + * @since 3.7 + */ + public BulkChangeWsResponse bulkChange(BulkChangeRequest request) { + return call( + new PostRequest(path("bulk_change")) + .setParam("add_tags", request.getAddTags()) + .setParam("assign", request.getAssign()) + .setParam("comment", request.getComment()) + .setParam("do_transition", request.getDoTransition()) + .setParam("issues", request.getIssues() == null ? null : request.getIssues().stream().collect(Collectors.joining(","))) + .setParam("plan", request.getPlan()) + .setParam("remove_tags", request.getRemoveTags()) + .setParam("sendNotifications", request.getSendNotifications()) + .setParam("set_severity", request.getSetSeverity()) + .setParam("set_type", request.getSetType()), + BulkChangeWsResponse.parser()); + } + + /** + * Display changelog of an issue.<br/>Requires the 'Browse' permission on the project of the specified issue. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/changelog">Further information about this action online (including a response example)</a> + * @since 4.1 + */ + public ChangelogWsResponse changelog(ChangelogRequest request) { + return call( + new GetRequest(path("changelog")) + .setParam("issue", request.getIssue()), + ChangelogWsResponse.parser()); + } + + /** + * List tags for the issues under a given component (including issues on the descendants of the component) + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/component_tags">Further information about this action online (including a response example)</a> + * @since 5.1 + */ + public String componentTags(ComponentTagsRequest request) { + return call( + new GetRequest(path("component_tags")) + .setParam("componentUuid", request.getComponentUuid()) + .setParam("createdAfter", request.getCreatedAfter()) + .setParam("ps", request.getPs()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Delete a comment.<br/>Requires authentication and the following permission: 'Browse' on the project of the specified issue. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/delete_comment">Further information about this action online (including a response example)</a> + * @since 3.6 + */ + public String deleteComment(DeleteCommentRequest request) { + return call( + new PostRequest(path("delete_comment")) + .setParam("comment", request.getComment()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Do workflow transition on an issue. Requires authentication and Browse permission on project.<br/>The transitions 'wontfix' and 'falsepositive' require the permission 'Administer Issues'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/do_transition">Further information about this action online (including a response example)</a> + * @since 3.6 + */ + public String doTransition(DoTransitionRequest request) { + return call( + new PostRequest(path("do_transition")) + .setParam("issue", request.getIssue()) + .setParam("transition", request.getTransition()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Edit a comment.<br/>Requires authentication and the following permission: 'Browse' on the project of the specified issue. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/edit_comment">Further information about this action online (including a response example)</a> + * @since 3.6 + */ + public String editComment(EditCommentRequest request) { + return call( + new PostRequest(path("edit_comment")) + .setParam("comment", request.getComment()) + .setParam("text", request.getText()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Search for issues.<br>At most one of the following parameters can be provided at the same time: componentKeys, componentUuids, components, componentRootUuids, componentRoots.<br>Requires the 'Browse' permission on the specified project(s). + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/search">Further information about this action online (including a response example)</a> + * @since 3.6 + */ + public SearchWsResponse search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("additionalFields", request.getAdditionalFields() == null ? null : request.getAdditionalFields().stream().collect(Collectors.joining(","))) + .setParam("asc", request.getAsc()) + .setParam("assigned", request.getAssigned()) + .setParam("assignees", request.getAssignees() == null ? null : request.getAssignees().stream().collect(Collectors.joining(","))) + .setParam("authors", request.getAuthors() == null ? null : request.getAuthors().stream().collect(Collectors.joining(","))) + .setParam("branch", request.getBranch()) + .setParam("componentKeys", request.getComponentKeys() == null ? null : request.getComponentKeys().stream().collect(Collectors.joining(","))) + .setParam("componentRootUuids", request.getComponentRootUuids()) + .setParam("componentRoots", request.getComponentRoots()) + .setParam("componentUuids", request.getComponentUuids() == null ? null : request.getComponentUuids().stream().collect(Collectors.joining(","))) + .setParam("components", request.getComponents()) + .setParam("createdAfter", request.getCreatedAfter()) + .setParam("createdAt", request.getCreatedAt()) + .setParam("createdBefore", request.getCreatedBefore()) + .setParam("createdInLast", request.getCreatedInLast()) + .setParam("directories", request.getDirectories() == null ? null : request.getDirectories().stream().collect(Collectors.joining(","))) + .setParam("facetMode", request.getFacetMode()) + .setParam("facets", request.getFacets() == null ? null : request.getFacets().stream().collect(Collectors.joining(","))) + .setParam("fileUuids", request.getFileUuids() == null ? null : request.getFileUuids().stream().collect(Collectors.joining(","))) + .setParam("issues", request.getIssues() == null ? null : request.getIssues().stream().collect(Collectors.joining(","))) + .setParam("languages", request.getLanguages() == null ? null : request.getLanguages().stream().collect(Collectors.joining(","))) + .setParam("moduleUuids", request.getModuleUuids() == null ? null : request.getModuleUuids().stream().collect(Collectors.joining(","))) + .setParam("onComponentOnly", request.getOnComponentOnly()) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("projectUuids", request.getProjectUuids() == null ? null : request.getProjectUuids().stream().collect(Collectors.joining(","))) + .setParam("projects", request.getProjects() == null ? null : request.getProjects().stream().collect(Collectors.joining(","))) + .setParam("ps", request.getPs()) + .setParam("resolutions", request.getResolutions() == null ? null : request.getResolutions().stream().collect(Collectors.joining(","))) + .setParam("resolved", request.getResolved()) + .setParam("rules", request.getRules() == null ? null : request.getRules().stream().collect(Collectors.joining(","))) + .setParam("s", request.getS()) + .setParam("severities", request.getSeverities() == null ? null : request.getSeverities().stream().collect(Collectors.joining(","))) + .setParam("sinceLeakPeriod", request.getSinceLeakPeriod()) + .setParam("statuses", request.getStatuses() == null ? null : request.getStatuses().stream().collect(Collectors.joining(","))) + .setParam("tags", request.getTags() == null ? null : request.getTags().stream().collect(Collectors.joining(","))) + .setParam("types", request.getTypes() == null ? null : request.getTypes().stream().collect(Collectors.joining(","))), + SearchWsResponse.parser()); + } + + /** + * Change severity.<br/>Requires the following permissions:<ul> <li>'Authentication'</li> <li>'Browse' rights on project of the specified issue</li> <li>'Administer Issues' rights on project of the specified issue</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/set_severity">Further information about this action online (including a response example)</a> + * @since 3.6 + */ + public String setSeverity(SetSeverityRequest request) { + return call( + new PostRequest(path("set_severity")) + .setParam("issue", request.getIssue()) + .setParam("severity", request.getSeverity()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Set tags on an issue. <br/>Requires authentication and Browse permission on project + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/set_tags">Further information about this action online (including a response example)</a> + * @since 5.1 + */ + public String setTags(SetTagsRequest request) { + return call( + new PostRequest(path("set_tags")) + .setParam("issue", request.getIssue()) + .setParam("tags", request.getTags() == null ? null : request.getTags().stream().collect(Collectors.joining(","))) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Change type of issue, for instance from 'code smell' to 'bug'.<br/>Requires the following permissions:<ul> <li>'Authentication'</li> <li>'Browse' rights on project of the specified issue</li> <li>'Administer Issues' rights on project of the specified issue</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/set_type">Further information about this action online (including a response example)</a> + * @since 5.5 + */ + public String setType(SetTypeRequest request) { + return call( + new PostRequest(path("set_type")) + .setParam("issue", request.getIssue()) + .setParam("type", request.getType()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * List tags matching a given query + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/tags">Further information about this action online (including a response example)</a> + * @since 5.1 + */ + public String tags(TagsRequest request) { + return call( + new GetRequest(path("tags")) + .setParam("organization", request.getOrganization()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/SearchRequest.java new file mode 100644 index 00000000000..3e173c152a8 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/SearchRequest.java @@ -0,0 +1,705 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.issues; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Search for issues.<br>At most one of the following parameters can be provided at the same time: componentKeys, componentUuids, components, componentRootUuids, componentRoots.<br>Requires the 'Browse' permission on the specified project(s). + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/search">Further information about this action online (including a response example)</a> + * @since 3.6 + */ +@Generated("sonar-ws-generator") +public class SearchRequest { + + private List<String> additionalFields; + private String asc; + private String assigned; + private List<String> assignees; + private List<String> authors; + private String branch; + private List<String> componentKeys; + private String componentRootUuids; + private String componentRoots; + private List<String> componentUuids; + private String components; + private String createdAfter; + private String createdAt; + private String createdBefore; + private String createdInLast; + private List<String> directories; + private String facetMode; + private List<String> facets; + private List<String> fileUuids; + private List<String> issues; + private List<String> languages; + private List<String> moduleUuids; + private String onComponentOnly; + private String organization; + private String p; + private List<String> projectUuids; + private List<String> projects; + private String ps; + private List<String> resolutions; + private String resolved; + private List<String> rules; + private String s; + private List<String> severities; + private String sinceLeakPeriod; + private List<String> statuses; + private List<String> tags; + private List<String> types; + + /** + * Comma-separated list of the optional fields to be returned in response. Action plans are dropped in 5.5, it is not returned in the response. + * + * Possible values: + * <ul> + * <li>"_all"</li> + * <li>"comments"</li> + * <li>"languages"</li> + * <li>"actionPlans"</li> + * <li>"rules"</li> + * <li>"transitions"</li> + * <li>"actions"</li> + * <li>"users"</li> + * </ul> + */ + public SearchRequest setAdditionalFields(List<String> additionalFields) { + this.additionalFields = additionalFields; + return this; + } + + public List<String> getAdditionalFields() { + return additionalFields; + } + + /** + * Ascending sort + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public SearchRequest setAsc(String asc) { + this.asc = asc; + return this; + } + + public String getAsc() { + return asc; + } + + /** + * To retrieve assigned or unassigned issues + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public SearchRequest setAssigned(String assigned) { + this.assigned = assigned; + return this; + } + + public String getAssigned() { + return assigned; + } + + /** + * Comma-separated list of assignee logins. The value '__me__' can be used as a placeholder for user who performs the request + * + * Example value: "admin,usera,__me__" + */ + public SearchRequest setAssignees(List<String> assignees) { + this.assignees = assignees; + return this; + } + + public List<String> getAssignees() { + return assignees; + } + + /** + * Comma-separated list of SCM accounts + * + * Example value: "torvalds@linux-foundation.org" + */ + public SearchRequest setAuthors(List<String> authors) { + this.authors = authors; + return this; + } + + public List<String> getAuthors() { + return authors; + } + + /** + * Branch key + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public SearchRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * Comma-separated list of component keys. Retrieve issues associated to a specific list of components (and all its descendants). A component can be a portfolio, project, module, directory or file. + * + * Example value: "my_project" + */ + public SearchRequest setComponentKeys(List<String> componentKeys) { + this.componentKeys = componentKeys; + return this; + } + + public List<String> getComponentKeys() { + return componentKeys; + } + + /** + * If used, will have the same meaning as componentUuids AND onComponentOnly=false. + * + * @deprecated since 5.1 + */ + @Deprecated + public SearchRequest setComponentRootUuids(String componentRootUuids) { + this.componentRootUuids = componentRootUuids; + return this; + } + + public String getComponentRootUuids() { + return componentRootUuids; + } + + /** + * If used, will have the same meaning as componentKeys AND onComponentOnly=false. + * + * @deprecated since 5.1 + */ + @Deprecated + public SearchRequest setComponentRoots(String componentRoots) { + this.componentRoots = componentRoots; + return this; + } + + public String getComponentRoots() { + return componentRoots; + } + + /** + * To retrieve issues associated to a specific list of components their sub-components (comma-separated list of component IDs). This parameter is mostly used by the Issues page, please prefer usage of the componentKeys parameter. A component can be a project, module, directory or file. + * + * Example value: "584a89f2-8037-4f7b-b82c-8b45d2d63fb2" + * @deprecated since 6.5 + */ + @Deprecated + public SearchRequest setComponentUuids(List<String> componentUuids) { + this.componentUuids = componentUuids; + return this; + } + + public List<String> getComponentUuids() { + return componentUuids; + } + + /** + * If used, will have the same meaning as componentKeys AND onComponentOnly=true. + * + * @deprecated since 5.1 + */ + @Deprecated + public SearchRequest setComponents(String components) { + this.components = components; + return this; + } + + public String getComponents() { + return components; + } + + /** + * To retrieve issues created after the given date (inclusive). <br>Either a date (server timezone) or datetime can be provided. <br>If this parameter is set, createdSince must not be set + * + * Example value: "2017-10-19 or 2017-10-19T13:00:00+0200" + */ + public SearchRequest setCreatedAfter(String createdAfter) { + this.createdAfter = createdAfter; + return this; + } + + public String getCreatedAfter() { + return createdAfter; + } + + /** + * Datetime to retrieve issues created during a specific analysis + * + * Example value: "2017-10-19T13:00:00+0200" + */ + public SearchRequest setCreatedAt(String createdAt) { + this.createdAt = createdAt; + return this; + } + + public String getCreatedAt() { + return createdAt; + } + + /** + * To retrieve issues created before the given date (inclusive). <br>Either a date (server timezone) or datetime can be provided. + * + * Example value: "2017-10-19 or 2017-10-19T13:00:00+0200" + */ + public SearchRequest setCreatedBefore(String createdBefore) { + this.createdBefore = createdBefore; + return this; + } + + public String getCreatedBefore() { + return createdBefore; + } + + /** + * To retrieve issues created during a time span before the current time (exclusive). Accepted units are 'y' for year, 'm' for month, 'w' for week and 'd' for day. If this parameter is set, createdAfter must not be set + * + * Example value: "1m2w (1 month 2 weeks)" + */ + public SearchRequest setCreatedInLast(String createdInLast) { + this.createdInLast = createdInLast; + return this; + } + + public String getCreatedInLast() { + return createdInLast; + } + + /** + * To retrieve issues associated to a specific list of directories (comma-separated list of directory paths). This parameter is only meaningful when a module is selected. This parameter is mostly used by the Issues page, please prefer usage of the componentKeys parameter. + * + * This is part of the internal API. + * Example value: "src/main/java/org/sonar/server/" + */ + public SearchRequest setDirectories(List<String> directories) { + this.directories = directories; + return this; + } + + public List<String> getDirectories() { + return directories; + } + + /** + * Choose the returned value for facet items, either count of issues or sum of debt.<br/>Since 5.5, 'debt' mode is deprecated and replaced by 'effort' + * + * Possible values: + * <ul> + * <li>"count"</li> + * <li>"effort"</li> + * <li>"debt"</li> + * </ul> + */ + public SearchRequest setFacetMode(String facetMode) { + this.facetMode = facetMode; + return this; + } + + public String getFacetMode() { + return facetMode; + } + + /** + * Comma-separated list of the facets to be computed. No facet is computed by default.<br/>Since 5.5, facet 'actionPlans' is deprecated.<br/>Since 5.5, facet 'reporters' is deprecated. + * + * Possible values: + * <ul> + * <li>"severities"</li> + * <li>"statuses"</li> + * <li>"resolutions"</li> + * <li>"actionPlans"</li> + * <li>"projectUuids"</li> + * <li>"rules"</li> + * <li>"assignees"</li> + * <li>"assigned_to_me"</li> + * <li>"reporters"</li> + * <li>"authors"</li> + * <li>"moduleUuids"</li> + * <li>"fileUuids"</li> + * <li>"directories"</li> + * <li>"languages"</li> + * <li>"tags"</li> + * <li>"types"</li> + * <li>"createdAt"</li> + * </ul> + */ + public SearchRequest setFacets(List<String> facets) { + this.facets = facets; + return this; + } + + public List<String> getFacets() { + return facets; + } + + /** + * To retrieve issues associated to a specific list of files (comma-separated list of file IDs). This parameter is mostly used by the Issues page, please prefer usage of the componentKeys parameter. + * + * This is part of the internal API. + * Example value: "bdd82933-3070-4903-9188-7d8749e8bb92" + */ + public SearchRequest setFileUuids(List<String> fileUuids) { + this.fileUuids = fileUuids; + return this; + } + + public List<String> getFileUuids() { + return fileUuids; + } + + /** + * Comma-separated list of issue keys + * + * Example value: "5bccd6e8-f525-43a2-8d76-fcb13dde79ef" + */ + public SearchRequest setIssues(List<String> issues) { + this.issues = issues; + return this; + } + + public List<String> getIssues() { + return issues; + } + + /** + * Comma-separated list of languages. Available since 4.4 + * + * Example value: "java,js" + */ + public SearchRequest setLanguages(List<String> languages) { + this.languages = languages; + return this; + } + + public List<String> getLanguages() { + return languages; + } + + /** + * To retrieve issues associated to a specific list of modules (comma-separated list of module IDs). This parameter is mostly used by the Issues page, please prefer usage of the componentKeys parameter. + * + * This is part of the internal API. + * Example value: "7d8749e8-3070-4903-9188-bdd82933bb92" + */ + public SearchRequest setModuleUuids(List<String> moduleUuids) { + this.moduleUuids = moduleUuids; + return this; + } + + public List<String> getModuleUuids() { + return moduleUuids; + } + + /** + * Return only issues at a component's level, not on its descendants (modules, directories, files, etc). This parameter is only considered when componentKeys or componentUuids is set. Using the deprecated componentRoots or componentRootUuids parameters will set this parameter to false. Using the deprecated components parameter will set this parameter to true. + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public SearchRequest setOnComponentOnly(String onComponentOnly) { + this.onComponentOnly = onComponentOnly; + return this; + } + + public String getOnComponentOnly() { + return onComponentOnly; + } + + /** + * Organization key + * + * This is part of the internal API. + * Example value: "my-org" + */ + public SearchRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * To retrieve issues associated to a specific list of projects (comma-separated list of project IDs). This parameter is mostly used by the Issues page, please prefer usage of the componentKeys parameter. Portfolios are not supported. If this parameter is set, 'projects' must not be set. + * + * This is part of the internal API. + * Example value: "7d8749e8-3070-4903-9188-bdd82933bb92" + */ + public SearchRequest setProjectUuids(List<String> projectUuids) { + this.projectUuids = projectUuids; + return this; + } + + public List<String> getProjectUuids() { + return projectUuids; + } + + /** + * To retrieve issues associated to a specific list of projects (comma-separated list of project keys). This parameter is mostly used by the Issues page, please prefer usage of the componentKeys parameter. If this parameter is set, projectUuids must not be set. + * + * This is part of the internal API. + * Example value: "my_project" + */ + public SearchRequest setProjects(List<String> projects) { + this.projects = projects; + return this; + } + + public List<String> getProjects() { + return projects; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public SearchRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Comma-separated list of resolutions + * + * Example value: "FIXED,REMOVED" + * Possible values: + * <ul> + * <li>"FALSE-POSITIVE"</li> + * <li>"WONTFIX"</li> + * <li>"FIXED"</li> + * <li>"REMOVED"</li> + * </ul> + */ + public SearchRequest setResolutions(List<String> resolutions) { + this.resolutions = resolutions; + return this; + } + + public List<String> getResolutions() { + return resolutions; + } + + /** + * To match resolved or unresolved issues + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public SearchRequest setResolved(String resolved) { + this.resolved = resolved; + return this; + } + + public String getResolved() { + return resolved; + } + + /** + * Comma-separated list of coding rule keys. Format is <repository>:<rule> + * + * Example value: "squid:AvoidCycles" + */ + public SearchRequest setRules(List<String> rules) { + this.rules = rules; + return this; + } + + public List<String> getRules() { + return rules; + } + + /** + * Sort field + * + * Possible values: + * <ul> + * <li>"CREATION_DATE"</li> + * <li>"UPDATE_DATE"</li> + * <li>"CLOSE_DATE"</li> + * <li>"ASSIGNEE"</li> + * <li>"SEVERITY"</li> + * <li>"STATUS"</li> + * <li>"FILE_LINE"</li> + * </ul> + */ + public SearchRequest setS(String s) { + this.s = s; + return this; + } + + public String getS() { + return s; + } + + /** + * Comma-separated list of severities + * + * Example value: "BLOCKER,CRITICAL" + * Possible values: + * <ul> + * <li>"INFO"</li> + * <li>"MINOR"</li> + * <li>"MAJOR"</li> + * <li>"CRITICAL"</li> + * <li>"BLOCKER"</li> + * </ul> + */ + public SearchRequest setSeverities(List<String> severities) { + this.severities = severities; + return this; + } + + public List<String> getSeverities() { + return severities; + } + + /** + * To retrieve issues created since the leak period.<br>If this parameter is set to a truthy value, createdAfter must not be set and one component id or key must be provided. + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public SearchRequest setSinceLeakPeriod(String sinceLeakPeriod) { + this.sinceLeakPeriod = sinceLeakPeriod; + return this; + } + + public String getSinceLeakPeriod() { + return sinceLeakPeriod; + } + + /** + * Comma-separated list of statuses + * + * Example value: "OPEN,REOPENED" + * Possible values: + * <ul> + * <li>"OPEN"</li> + * <li>"CONFIRMED"</li> + * <li>"REOPENED"</li> + * <li>"RESOLVED"</li> + * <li>"CLOSED"</li> + * </ul> + */ + public SearchRequest setStatuses(List<String> statuses) { + this.statuses = statuses; + return this; + } + + public List<String> getStatuses() { + return statuses; + } + + /** + * Comma-separated list of tags. + * + * Example value: "security,convention" + */ + public SearchRequest setTags(List<String> tags) { + this.tags = tags; + return this; + } + + public List<String> getTags() { + return tags; + } + + /** + * Comma-separated list of types. + * + * Example value: "CODE_SMELL,BUG" + * Possible values: + * <ul> + * <li>"CODE_SMELL"</li> + * <li>"BUG"</li> + * <li>"VULNERABILITY"</li> + * </ul> + */ + public SearchRequest setTypes(List<String> types) { + this.types = types; + return this; + } + + public List<String> getTypes() { + return types; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/SetSeverityRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/SetSeverityRequest.java new file mode 100644 index 00000000000..fd41cefbd5a --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/SetSeverityRequest.java @@ -0,0 +1,74 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.issues; + +import javax.annotation.Generated; + +/** + * Change severity.<br/>Requires the following permissions:<ul> <li>'Authentication'</li> <li>'Browse' rights on project of the specified issue</li> <li>'Administer Issues' rights on project of the specified issue</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/set_severity">Further information about this action online (including a response example)</a> + * @since 3.6 + */ +@Generated("sonar-ws-generator") +public class SetSeverityRequest { + + private String issue; + private String severity; + + /** + * Issue key + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public SetSeverityRequest setIssue(String issue) { + this.issue = issue; + return this; + } + + public String getIssue() { + return issue; + } + + /** + * New severity + * + * This is a mandatory parameter. + * Possible values: + * <ul> + * <li>"INFO"</li> + * <li>"MINOR"</li> + * <li>"MAJOR"</li> + * <li>"CRITICAL"</li> + * <li>"BLOCKER"</li> + * </ul> + */ + public SetSeverityRequest setSeverity(String severity) { + this.severity = severity; + return this; + } + + public String getSeverity() { + return severity; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/SetTagsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/SetTagsRequest.java new file mode 100644 index 00000000000..bc8556f1423 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/SetTagsRequest.java @@ -0,0 +1,67 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.issues; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Set tags on an issue. <br/>Requires authentication and Browse permission on project + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/set_tags">Further information about this action online (including a response example)</a> + * @since 5.1 + */ +@Generated("sonar-ws-generator") +public class SetTagsRequest { + + private String issue; + private List<String> tags; + + /** + * Issue key + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public SetTagsRequest setIssue(String issue) { + this.issue = issue; + return this; + } + + public String getIssue() { + return issue; + } + + /** + * Comma-separated list of tags. All tags are removed if parameter is empty or not set. + * + * Example value: "security,cwe,misra-c" + */ + public SetTagsRequest setTags(List<String> tags) { + this.tags = tags; + return this; + } + + public List<String> getTags() { + return tags; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/SetTypeRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/SetTypeRequest.java new file mode 100644 index 00000000000..e6afe1e31ac --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/SetTypeRequest.java @@ -0,0 +1,72 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.issues; + +import javax.annotation.Generated; + +/** + * Change type of issue, for instance from 'code smell' to 'bug'.<br/>Requires the following permissions:<ul> <li>'Authentication'</li> <li>'Browse' rights on project of the specified issue</li> <li>'Administer Issues' rights on project of the specified issue</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/set_type">Further information about this action online (including a response example)</a> + * @since 5.5 + */ +@Generated("sonar-ws-generator") +public class SetTypeRequest { + + private String issue; + private String type; + + /** + * Issue key + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public SetTypeRequest setIssue(String issue) { + this.issue = issue; + return this; + } + + public String getIssue() { + return issue; + } + + /** + * New type + * + * This is a mandatory parameter. + * Possible values: + * <ul> + * <li>"CODE_SMELL"</li> + * <li>"BUG"</li> + * <li>"VULNERABILITY"</li> + * </ul> + */ + public SetTypeRequest setType(String type) { + this.type = type; + return this; + } + + public String getType() { + return type; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/TagsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/TagsRequest.java new file mode 100644 index 00000000000..382f37d2bd5 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/TagsRequest.java @@ -0,0 +1,81 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.issues; + +import javax.annotation.Generated; + +/** + * List tags matching a given query + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/tags">Further information about this action online (including a response example)</a> + * @since 5.1 + */ +@Generated("sonar-ws-generator") +public class TagsRequest { + + private String organization; + private String ps; + private String q; + + /** + * Organization key + * + * This is part of the internal API. + * Example value: "my-org" + */ + public TagsRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Page size. Must be greater than 0 and less than 100 + * + * Example value: "20" + */ + public TagsRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to tags that contain the supplied string. + * + * Example value: "misra" + */ + public TagsRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/package-info.java new file mode 100644 index 00000000000..54bcbbbe7c4 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.issues; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/l10n/IndexRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/l10n/IndexRequest.java new file mode 100644 index 00000000000..a0329cf1e74 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/l10n/IndexRequest.java @@ -0,0 +1,65 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.l10n; + +import javax.annotation.Generated; + +/** + * Get all localization messages for a given locale + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/l10n/index">Further information about this action online (including a response example)</a> + * @since 4.4 + */ +@Generated("sonar-ws-generator") +public class IndexRequest { + + private String locale; + private String ts; + + /** + * BCP47 language tag, used to override the browser Accept-Language header + * + * Example value: "fr-CH" + */ + public IndexRequest setLocale(String locale) { + this.locale = locale; + return this; + } + + public String getLocale() { + return locale; + } + + /** + * Date of the last cache update. + * + * Example value: "2014-06-04T09:31:42+0000" + */ + public IndexRequest setTs(String ts) { + this.ts = ts; + return this; + } + + public String getTs() { + return ts; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/l10n/L10nService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/l10n/L10nService.java new file mode 100644 index 00000000000..f85e7cf7677 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/l10n/L10nService.java @@ -0,0 +1,55 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.l10n; + +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Manage localization. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/l10n">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class L10nService extends BaseService { + + public L10nService(WsConnector wsConnector) { + super(wsConnector, "api/l10n"); + } + + /** + * Get all localization messages for a given locale + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/l10n/index">Further information about this action online (including a response example)</a> + * @since 4.4 + */ + public String index(IndexRequest request) { + return call( + new GetRequest(path("index")) + .setParam("locale", request.getLocale()) + .setParam("ts", request.getTs()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/l10n/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/l10n/package-info.java new file mode 100644 index 00000000000..ee4983df47a --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/l10n/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.l10n; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/languages/LanguagesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/languages/LanguagesService.java new file mode 100644 index 00000000000..e529b9dac18 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/languages/LanguagesService.java @@ -0,0 +1,55 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.languages; + +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Get the list of programming languages supported in this instance. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/languages">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class LanguagesService extends BaseService { + + public LanguagesService(WsConnector wsConnector) { + super(wsConnector, "api/languages"); + } + + /** + * List supported programming languages + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/languages/list">Further information about this action online (including a response example)</a> + * @since 5.1 + */ + public String list(ListRequest request) { + return call( + new GetRequest(path("list")) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/languages/ListRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/languages/ListRequest.java new file mode 100644 index 00000000000..e8d40e1638c --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/languages/ListRequest.java @@ -0,0 +1,65 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.languages; + +import javax.annotation.Generated; + +/** + * List supported programming languages + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/languages/list">Further information about this action online (including a response example)</a> + * @since 5.1 + */ +@Generated("sonar-ws-generator") +public class ListRequest { + + private String ps; + private String q; + + /** + * The size of the list to return, 0 for all languages + * + * Example value: "25" + */ + public ListRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * A pattern to match language keys/names against + * + * Example value: "java" + */ + public ListRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/languages/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/languages/package-info.java new file mode 100644 index 00000000000..8dafd59b3ba --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/languages/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.languages; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/measures/ComponentRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/measures/ComponentRequest.java new file mode 100644 index 00000000000..7b08703dc9a --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/measures/ComponentRequest.java @@ -0,0 +1,152 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.measures; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Return component with specified measures. The componentId or the component parameter must be provided.<br>Requires the following permission: 'Browse' on the project of specified component. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/measures/component">Further information about this action online (including a response example)</a> + * @since 5.4 + */ +@Generated("sonar-ws-generator") +public class ComponentRequest { + + private List<String> additionalFields; + private String branch; + private String component; + private String componentId; + private String developerId; + private String developerKey; + private String metricKeys; + + /** + * Comma-separated list of additional fields that can be returned in the response. + * + * Example value: "periods,metrics" + * Possible values: + * <ul> + * <li>"metrics"</li> + * <li>"periods"</li> + * </ul> + */ + public ComponentRequest setAdditionalFields(List<String> additionalFields) { + this.additionalFields = additionalFields; + return this; + } + + public List<String> getAdditionalFields() { + return additionalFields; + } + + /** + * Branch key + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public ComponentRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * Component key + * + * Example value: "my_project" + */ + public ComponentRequest setComponent(String component) { + this.component = component; + return this; + } + + public String getComponent() { + return component; + } + + /** + * Component id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + * @deprecated since 6.6 + */ + @Deprecated + public ComponentRequest setComponentId(String componentId) { + this.componentId = componentId; + return this; + } + + public String getComponentId() { + return componentId; + } + + /** + * Deprecated parameter, used previously with the Developer Cockpit plugin. No measures are returned if parameter is set. + * + * @deprecated since 6.4 + */ + @Deprecated + public ComponentRequest setDeveloperId(String developerId) { + this.developerId = developerId; + return this; + } + + public String getDeveloperId() { + return developerId; + } + + /** + * Deprecated parameter, used previously with the Developer Cockpit plugin. No measures are returned if parameter is set. + * + * @deprecated since 6.4 + */ + @Deprecated + public ComponentRequest setDeveloperKey(String developerKey) { + this.developerKey = developerKey; + return this; + } + + public String getDeveloperKey() { + return developerKey; + } + + /** + * Metric keys + * + * This is a mandatory parameter. + * Example value: "ncloc,complexity,violations" + */ + public ComponentRequest setMetricKeys(String metricKeys) { + this.metricKeys = metricKeys; + return this; + } + + public String getMetricKeys() { + return metricKeys; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/measures/ComponentTreeRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/measures/ComponentTreeRequest.java new file mode 100644 index 00000000000..24ddb21cc9e --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/measures/ComponentTreeRequest.java @@ -0,0 +1,335 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.measures; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Navigate through components based on the chosen strategy with specified measures. The baseComponentId or the component parameter must be provided.<br>Requires the following permission: 'Browse' on the specified project.<br>When limiting search with the q parameter, directories are not returned. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/measures/component_tree">Further information about this action online (including a response example)</a> + * @since 5.4 + */ +@Generated("sonar-ws-generator") +public class ComponentTreeRequest { + + private List<String> additionalFields; + private String asc; + private String baseComponentId; + private String branch; + private String component; + private String developerId; + private String developerKey; + private String metricKeys; + private String metricPeriodSort; + private String metricSort; + private String metricSortFilter; + private String p; + private String ps; + private String q; + private List<String> qualifiers; + private List<String> s; + private String strategy; + + /** + * Comma-separated list of additional fields that can be returned in the response. + * + * Example value: "periods,metrics" + * Possible values: + * <ul> + * <li>"metrics"</li> + * <li>"periods"</li> + * </ul> + */ + public ComponentTreeRequest setAdditionalFields(List<String> additionalFields) { + this.additionalFields = additionalFields; + return this; + } + + public List<String> getAdditionalFields() { + return additionalFields; + } + + /** + * Ascending sort + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public ComponentTreeRequest setAsc(String asc) { + this.asc = asc; + return this; + } + + public String getAsc() { + return asc; + } + + /** + * Base component id. The search is based on this component. + * + * Example value: "AU-TpxcA-iU5OvuD2FLz" + * @deprecated since 6.6 + */ + @Deprecated + public ComponentTreeRequest setBaseComponentId(String baseComponentId) { + this.baseComponentId = baseComponentId; + return this; + } + + public String getBaseComponentId() { + return baseComponentId; + } + + /** + * Branch key + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public ComponentTreeRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * Component key. The search is based on this component. + * + * Example value: "my_project" + */ + public ComponentTreeRequest setComponent(String component) { + this.component = component; + return this; + } + + public String getComponent() { + return component; + } + + /** + * Deprecated parameter, used previously with the Developer Cockpit plugin. No measures are returned if parameter is set. + * + * @deprecated since 6.4 + */ + @Deprecated + public ComponentTreeRequest setDeveloperId(String developerId) { + this.developerId = developerId; + return this; + } + + public String getDeveloperId() { + return developerId; + } + + /** + * Deprecated parameter, used previously with the Developer Cockpit plugin. No measures are returned if parameter is set. + * + * @deprecated since 6.4 + */ + @Deprecated + public ComponentTreeRequest setDeveloperKey(String developerKey) { + this.developerKey = developerKey; + return this; + } + + public String getDeveloperKey() { + return developerKey; + } + + /** + * Metric keys. Types DISTRIB, DATA are not allowed + * + * This is a mandatory parameter. + * Example value: "ncloc,complexity,violations" + */ + public ComponentTreeRequest setMetricKeys(String metricKeys) { + this.metricKeys = metricKeys; + return this; + } + + public String getMetricKeys() { + return metricKeys; + } + + /** + * Sort measures by leak period or not ?. The 's' parameter must contain the 'metricPeriod' value. + * + * Possible values: + * <ul> + * <li>"1"</li> + * </ul> + */ + public ComponentTreeRequest setMetricPeriodSort(String metricPeriodSort) { + this.metricPeriodSort = metricPeriodSort; + return this; + } + + public String getMetricPeriodSort() { + return metricPeriodSort; + } + + /** + * Metric key to sort by. The 's' parameter must contain the 'metric' or 'metricPeriod' value. It must be part of the 'metricKeys' parameter + * + * Example value: "ncloc" + */ + public ComponentTreeRequest setMetricSort(String metricSort) { + this.metricSort = metricSort; + return this; + } + + public String getMetricSort() { + return metricSort; + } + + /** + * Filter components. Sort must be on a metric. Possible values are: <ul><li>all: return all components</li><li>withMeasuresOnly: filter out components that do not have a measure on the sorted metric</li></ul> + * + * Possible values: + * <ul> + * <li>"all"</li> + * <li>"withMeasuresOnly"</li> + * </ul> + */ + public ComponentTreeRequest setMetricSortFilter(String metricSortFilter) { + this.metricSortFilter = metricSortFilter; + return this; + } + + public String getMetricSortFilter() { + return metricSortFilter; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public ComponentTreeRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public ComponentTreeRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to: <ul><li>component names that contain the supplied string</li><li>component keys that are exactly the same as the supplied string</li></ul> + * + * Example value: "FILE_NAM" + */ + public ComponentTreeRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Comma-separated list of component qualifiers. Filter the results with the specified qualifiers. Possible values are:<ul><li>BRC - Sub-projects</li><li>DIR - Directories</li><li>FIL - Files</li><li>TRK - Projects</li><li>UTS - Test Files</li></ul> + * + * Possible values: + * <ul> + * <li>"BRC"</li> + * <li>"DIR"</li> + * <li>"FIL"</li> + * <li>"TRK"</li> + * <li>"UTS"</li> + * </ul> + */ + public ComponentTreeRequest setQualifiers(List<String> qualifiers) { + this.qualifiers = qualifiers; + return this; + } + + public List<String> getQualifiers() { + return qualifiers; + } + + /** + * Comma-separated list of sort fields + * + * Example value: "name,path" + * Possible values: + * <ul> + * <li>"metric"</li> + * <li>"metricPeriod"</li> + * <li>"name"</li> + * <li>"path"</li> + * <li>"qualifier"</li> + * </ul> + */ + public ComponentTreeRequest setS(List<String> s) { + this.s = s; + return this; + } + + public List<String> getS() { + return s; + } + + /** + * Strategy to search for base component descendants:<ul><li>children: return the children components of the base component. Grandchildren components are not returned</li><li>all: return all the descendants components of the base component. Grandchildren are returned.</li><li>leaves: return all the descendant components (files, in general) which don't have other children. They are the leaves of the component tree.</li></ul> + * + * Possible values: + * <ul> + * <li>"all"</li> + * <li>"children"</li> + * <li>"leaves"</li> + * </ul> + */ + public ComponentTreeRequest setStrategy(String strategy) { + this.strategy = strategy; + return this; + } + + public String getStrategy() { + return strategy; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/measures/MeasuresService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/measures/MeasuresService.java new file mode 100644 index 00000000000..5fd6d045afb --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/measures/MeasuresService.java @@ -0,0 +1,131 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.measures; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.WsConnector; +import org.sonarqube.ws.Measures.ComponentWsResponse; +import org.sonarqube.ws.Measures.ComponentTreeWsResponse; +import org.sonarqube.ws.Measures.SearchWsResponse; +import org.sonarqube.ws.Measures.SearchHistoryResponse; + +/** + * Get components or children with specified measures. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/measures">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class MeasuresService extends BaseService { + + public MeasuresService(WsConnector wsConnector) { + super(wsConnector, "api/measures"); + } + + /** + * Return component with specified measures. The componentId or the component parameter must be provided.<br>Requires the following permission: 'Browse' on the project of specified component. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/measures/component">Further information about this action online (including a response example)</a> + * @since 5.4 + */ + public ComponentWsResponse component(ComponentRequest request) { + return call( + new GetRequest(path("component")) + .setParam("additionalFields", request.getAdditionalFields() == null ? null : request.getAdditionalFields().stream().collect(Collectors.joining(","))) + .setParam("branch", request.getBranch()) + .setParam("component", request.getComponent()) + .setParam("componentId", request.getComponentId()) + .setParam("developerId", request.getDeveloperId()) + .setParam("developerKey", request.getDeveloperKey()) + .setParam("metricKeys", request.getMetricKeys()), + ComponentWsResponse.parser()); + } + + /** + * Navigate through components based on the chosen strategy with specified measures. The baseComponentId or the component parameter must be provided.<br>Requires the following permission: 'Browse' on the specified project.<br>When limiting search with the q parameter, directories are not returned. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/measures/component_tree">Further information about this action online (including a response example)</a> + * @since 5.4 + */ + public ComponentTreeWsResponse componentTree(ComponentTreeRequest request) { + return call( + new GetRequest(path("component_tree")) + .setParam("additionalFields", request.getAdditionalFields() == null ? null : request.getAdditionalFields().stream().collect(Collectors.joining(","))) + .setParam("asc", request.getAsc()) + .setParam("baseComponentId", request.getBaseComponentId()) + .setParam("branch", request.getBranch()) + .setParam("component", request.getComponent()) + .setParam("developerId", request.getDeveloperId()) + .setParam("developerKey", request.getDeveloperKey()) + .setParam("metricKeys", request.getMetricKeys()) + .setParam("metricPeriodSort", request.getMetricPeriodSort()) + .setParam("metricSort", request.getMetricSort()) + .setParam("metricSortFilter", request.getMetricSortFilter()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setParam("qualifiers", request.getQualifiers() == null ? null : request.getQualifiers().stream().collect(Collectors.joining(","))) + .setParam("s", request.getS() == null ? null : request.getS().stream().collect(Collectors.joining(","))) + .setParam("strategy", request.getStrategy()), + ComponentTreeWsResponse.parser()); + } + + /** + * Search for project measures ordered by project names.<br>At most 100 projects can be provided.<br>Returns the projects with the 'Browse' permission. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/measures/search">Further information about this action online (including a response example)</a> + * @since 6.2 + */ + public SearchWsResponse search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("metricKeys", request.getMetricKeys()) + .setParam("projectKeys", request.getProjectKeys() == null ? null : request.getProjectKeys().stream().collect(Collectors.joining(","))), + SearchWsResponse.parser()); + } + + /** + * Search measures history of a component.<br>Measures are ordered chronologically.<br>Pagination applies to the number of measures for each metric.<br>Requires the following permission: 'Browse' on the specified component + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/measures/search_history">Further information about this action online (including a response example)</a> + * @since 6.3 + */ + public SearchHistoryResponse searchHistory(SearchHistoryRequest request) { + return call( + new GetRequest(path("search_history")) + .setParam("branch", request.getBranch()) + .setParam("component", request.getComponent()) + .setParam("from", request.getFrom()) + .setParam("metrics", request.getMetrics() == null ? null : request.getMetrics().stream().collect(Collectors.joining(","))) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("to", request.getTo()), + SearchHistoryResponse.parser()); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/measures/SearchHistoryRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/measures/SearchHistoryRequest.java new file mode 100644 index 00000000000..75968c2913b --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/measures/SearchHistoryRequest.java @@ -0,0 +1,144 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.measures; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Search measures history of a component.<br>Measures are ordered chronologically.<br>Pagination applies to the number of measures for each metric.<br>Requires the following permission: 'Browse' on the specified component + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/measures/search_history">Further information about this action online (including a response example)</a> + * @since 6.3 + */ +@Generated("sonar-ws-generator") +public class SearchHistoryRequest { + + private String branch; + private String component; + private String from; + private List<String> metrics; + private String p; + private String ps; + private String to; + + /** + * Branch key + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public SearchHistoryRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * Component key + * + * This is a mandatory parameter. + * Example value: "my_project" + */ + public SearchHistoryRequest setComponent(String component) { + this.component = component; + return this; + } + + public String getComponent() { + return component; + } + + /** + * Filter measures created after the given date (inclusive). <br>Either a date (server timezone) or datetime can be provided + * + * Example value: "2017-10-19 or 2017-10-19T13:00:00+0200" + */ + public SearchHistoryRequest setFrom(String from) { + this.from = from; + return this; + } + + public String getFrom() { + return from; + } + + /** + * Comma-separated list of metric keys + * + * This is a mandatory parameter. + * Example value: "ncloc,coverage,new_violations" + */ + public SearchHistoryRequest setMetrics(List<String> metrics) { + this.metrics = metrics; + return this; + } + + public List<String> getMetrics() { + return metrics; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchHistoryRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 1000 + * + * Example value: "20" + */ + public SearchHistoryRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Filter measures created before the given date (inclusive). <br>Either a date (server timezone) or datetime can be provided + * + * Example value: "2017-10-19 or 2017-10-19T13:00:00+0200" + */ + public SearchHistoryRequest setTo(String to) { + this.to = to; + return this; + } + + public String getTo() { + return to; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/measures/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/measures/SearchRequest.java new file mode 100644 index 00000000000..bae1b77e66e --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/measures/SearchRequest.java @@ -0,0 +1,68 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.measures; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Search for project measures ordered by project names.<br>At most 100 projects can be provided.<br>Returns the projects with the 'Browse' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/measures/search">Further information about this action online (including a response example)</a> + * @since 6.2 + */ +@Generated("sonar-ws-generator") +public class SearchRequest { + + private String metricKeys; + private List<String> projectKeys; + + /** + * Metric keys + * + * This is a mandatory parameter. + * Example value: "ncloc,complexity,violations" + */ + public SearchRequest setMetricKeys(String metricKeys) { + this.metricKeys = metricKeys; + return this; + } + + public String getMetricKeys() { + return metricKeys; + } + + /** + * Comma-separated list of project, view or sub-view keys + * + * This is a mandatory parameter. + * Example value: "my_project,another_project" + */ + public SearchRequest setProjectKeys(List<String> projectKeys) { + this.projectKeys = projectKeys; + return this; + } + + public List<String> getProjectKeys() { + return projectKeys; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/measures/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/measures/package-info.java new file mode 100644 index 00000000000..9f1f8db5423 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/measures/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.measures; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/metrics/CreateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/metrics/CreateRequest.java new file mode 100644 index 00000000000..f531e324524 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/metrics/CreateRequest.java @@ -0,0 +1,127 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.metrics; + +import javax.annotation.Generated; + +/** + * Create custom metric.<br /> Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/metrics/create">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class CreateRequest { + + private String description; + private String domain; + private String key; + private String name; + private String type; + + /** + * Description + * + * Example value: "Size of the team" + */ + public CreateRequest setDescription(String description) { + this.description = description; + return this; + } + + public String getDescription() { + return description; + } + + /** + * Domain + * + * Example value: "Tests" + */ + public CreateRequest setDomain(String domain) { + this.domain = domain; + return this; + } + + public String getDomain() { + return domain; + } + + /** + * Key + * + * This is a mandatory parameter. + * Example value: "team_size" + */ + public CreateRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Name + * + * This is a mandatory parameter. + * Example value: "Team Size" + */ + public CreateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * Metric type key + * + * This is a mandatory parameter. + * Example value: "INT" + * Possible values: + * <ul> + * <li>"INT"</li> + * <li>"FLOAT"</li> + * <li>"PERCENT"</li> + * <li>"BOOL"</li> + * <li>"STRING"</li> + * <li>"MILLISEC"</li> + * <li>"DATA"</li> + * <li>"LEVEL"</li> + * <li>"DISTRIB"</li> + * <li>"RATING"</li> + * <li>"WORK_DUR"</li> + * </ul> + */ + public CreateRequest setType(String type) { + this.type = type; + return this; + } + + public String getType() { + return type; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/metrics/DeleteRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/metrics/DeleteRequest.java new file mode 100644 index 00000000000..8a6fd1b57ba --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/metrics/DeleteRequest.java @@ -0,0 +1,65 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.metrics; + +import javax.annotation.Generated; + +/** + * Delete metrics and associated measures. Delete only custom metrics.<br />Ids or keys must be provided. <br />Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/metrics/delete">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class DeleteRequest { + + private String ids; + private String keys; + + /** + * Metrics ids to delete. + * + * Example value: "5, 23, 42" + */ + public DeleteRequest setIds(String ids) { + this.ids = ids; + return this; + } + + public String getIds() { + return ids; + } + + /** + * Metrics keys to delete + * + * Example value: "team_size, business_value" + */ + public DeleteRequest setKeys(String keys) { + this.keys = keys; + return this; + } + + public String getKeys() { + return keys; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/metrics/MetricsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/metrics/MetricsService.java new file mode 100644 index 00000000000..edd4ddddceb --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/metrics/MetricsService.java @@ -0,0 +1,147 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.metrics; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Get information on automatic metrics, and manage custom metrics. See also api/custom_measures. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/metrics">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class MetricsService extends BaseService { + + public MetricsService(WsConnector wsConnector) { + super(wsConnector, "api/metrics"); + } + + /** + * Create custom metric.<br /> Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/metrics/create">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void create(CreateRequest request) { + call( + new PostRequest(path("create")) + .setParam("description", request.getDescription()) + .setParam("domain", request.getDomain()) + .setParam("key", request.getKey()) + .setParam("name", request.getName()) + .setParam("type", request.getType()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Delete metrics and associated measures. Delete only custom metrics.<br />Ids or keys must be provided. <br />Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/metrics/delete">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void delete(DeleteRequest request) { + call( + new PostRequest(path("delete")) + .setParam("ids", request.getIds()) + .setParam("keys", request.getKeys()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * List all custom metric domains. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/metrics/domains">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public String domains() { + return call( + new GetRequest(path("domains")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Search for metrics + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/metrics/search">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public String search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("f", request.getF() == null ? null : request.getF().stream().collect(Collectors.joining(","))) + .setParam("isCustom", request.getIsCustom()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * List all available metric types. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/metrics/types">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public String types() { + return call( + new GetRequest(path("types")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Update a custom metric.<br /> Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/metrics/update">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void update(UpdateRequest request) { + call( + new PostRequest(path("update")) + .setParam("description", request.getDescription()) + .setParam("domain", request.getDomain()) + .setParam("id", request.getId()) + .setParam("key", request.getKey()) + .setParam("name", request.getName()) + .setParam("type", request.getType()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/metrics/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/metrics/SearchRequest.java new file mode 100644 index 00000000000..78de3b5affc --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/metrics/SearchRequest.java @@ -0,0 +1,106 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.metrics; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Search for metrics + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/metrics/search">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class SearchRequest { + + private List<String> f; + private String isCustom; + private String p; + private String ps; + + /** + * Comma-separated list of the fields to be returned in response. All the fields are returned by default. + * + * Possible values: + * <ul> + * <li>"name"</li> + * <li>"description"</li> + * <li>"domain"</li> + * <li>"direction"</li> + * <li>"qualitative"</li> + * <li>"hidden"</li> + * <li>"custom"</li> + * <li>"decimalScale"</li> + * </ul> + */ + public SearchRequest setF(List<String> f) { + this.f = f; + return this; + } + + public List<String> getF() { + return f; + } + + /** + * Choose custom metrics following 3 cases:<ul><li>true: only custom metrics are returned</li><li>false: only non custom metrics are returned</li><li>not specified: all metrics are returned</li></ul> + * + * Example value: "true" + */ + public SearchRequest setIsCustom(String isCustom) { + this.isCustom = isCustom; + return this; + } + + public String getIsCustom() { + return isCustom; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public SearchRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/metrics/UpdateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/metrics/UpdateRequest.java new file mode 100644 index 00000000000..7fa7e924408 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/metrics/UpdateRequest.java @@ -0,0 +1,139 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.metrics; + +import javax.annotation.Generated; + +/** + * Update a custom metric.<br /> Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/metrics/update">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class UpdateRequest { + + private String description; + private String domain; + private String id; + private String key; + private String name; + private String type; + + /** + * Description + * + * Example value: "Size of the team" + */ + public UpdateRequest setDescription(String description) { + this.description = description; + return this; + } + + public String getDescription() { + return description; + } + + /** + * Domain + * + * Example value: "Tests" + */ + public UpdateRequest setDomain(String domain) { + this.domain = domain; + return this; + } + + public String getDomain() { + return domain; + } + + /** + * Id of the custom metric to update + * + * This is a mandatory parameter. + * Example value: "42" + */ + public UpdateRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } + + /** + * Key + * + * Example value: "team_size" + */ + public UpdateRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Name + * + */ + public UpdateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * Metric type key + * + * Example value: "INT" + * Possible values: + * <ul> + * <li>"INT"</li> + * <li>"FLOAT"</li> + * <li>"PERCENT"</li> + * <li>"BOOL"</li> + * <li>"STRING"</li> + * <li>"MILLISEC"</li> + * <li>"DATA"</li> + * <li>"LEVEL"</li> + * <li>"DISTRIB"</li> + * <li>"RATING"</li> + * <li>"WORK_DUR"</li> + * </ul> + */ + public UpdateRequest setType(String type) { + this.type = type; + return this; + } + + public String getType() { + return type; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/metrics/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/metrics/package-info.java new file mode 100644 index 00000000000..fc0260329a7 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/metrics/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.metrics; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/navigation/ComponentRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/navigation/ComponentRequest.java new file mode 100644 index 00000000000..0aa9560a93a --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/navigation/ComponentRequest.java @@ -0,0 +1,66 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.navigation; + +import javax.annotation.Generated; + +/** + * Get information concerning component navigation for the current user. Requires the 'Browse' permission on the component's project. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/navigation/component">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class ComponentRequest { + + private String branch; + private String component; + + /** + * Branch key + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public ComponentRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * A component key. + * + * Example value: "my_project" + */ + public ComponentRequest setComponent(String component) { + this.component = component; + return this; + } + + public String getComponent() { + return component; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/navigation/NavigationService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/navigation/NavigationService.java new file mode 100644 index 00000000000..c26b4642733 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/navigation/NavigationService.java @@ -0,0 +1,101 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.navigation; + +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Get information required to build navigation UI components + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/navigation">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class NavigationService extends BaseService { + + public NavigationService(WsConnector wsConnector) { + super(wsConnector, "api/navigation"); + } + + /** + * Get information concerning component navigation for the current user. Requires the 'Browse' permission on the component's project. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/navigation/component">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public String component(ComponentRequest request) { + return call( + new GetRequest(path("component")) + .setParam("branch", request.getBranch()) + .setParam("component", request.getComponent()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get information concerning global navigation for the current user. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/navigation/global">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public String global() { + return call( + new GetRequest(path("global")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get information concerning organization navigation for the current user + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/navigation/organization">Further information about this action online (including a response example)</a> + * @since 6.3 + */ + public String organization(OrganizationRequest request) { + return call( + new GetRequest(path("organization")) + .setParam("organization", request.getOrganization()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get configuration information for the settings page:<ul> <li>List plugin-contributed pages</li> <li>Show update center (or not)</li></ul> + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/navigation/settings">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public String settings() { + return call( + new GetRequest(path("settings")) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/navigation/OrganizationRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/navigation/OrganizationRequest.java new file mode 100644 index 00000000000..44e77279a60 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/navigation/OrganizationRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.navigation; + +import javax.annotation.Generated; + +/** + * Get information concerning organization navigation for the current user + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/navigation/organization">Further information about this action online (including a response example)</a> + * @since 6.3 + */ +@Generated("sonar-ws-generator") +public class OrganizationRequest { + + private String organization; + + /** + * the organization key + * + * This is a mandatory parameter. + * Example value: "my-org" + */ + public OrganizationRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/navigation/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/navigation/package-info.java new file mode 100644 index 00000000000..c64db1d660c --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/navigation/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.navigation; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/AddRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/AddRequest.java new file mode 100644 index 00000000000..31d6f0bccbd --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/AddRequest.java @@ -0,0 +1,98 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.notifications; + +import javax.annotation.Generated; + +/** + * Add a notification for the authenticated user.<br>Requires one of the following permissions:<ul> <li>Authentication if no login is provided. If a project is provided, requires the 'Browse' permission on the specified project.</li> <li>System administration if a login is provided. If a project is provided, requires the 'Browse' permission on the specified project.</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/notifications/add">Further information about this action online (including a response example)</a> + * @since 6.3 + */ +@Generated("sonar-ws-generator") +public class AddRequest { + + private String channel; + private String login; + private String project; + private String type; + + /** + * Channel through which the notification is sent. For example, notifications can be sent by email. + * + * Possible values: + * <ul> + * <li>"EmailNotificationChannel"</li> + * </ul> + */ + public AddRequest setChannel(String channel) { + this.channel = channel; + return this; + } + + public String getChannel() { + return channel; + } + + /** + * User login + * + */ + public AddRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public AddRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } + + /** + * Notification type. Possible values are for:<ul> <li>Global notifications: CeReportTaskFailure, ChangesOnMyIssue, NewAlerts, NewFalsePositiveIssue, NewIssues, SQ-MyNewIssues</li> <li>Per project notifications: CeReportTaskFailure, ChangesOnMyIssue, NewAlerts, NewFalsePositiveIssue, NewIssues, SQ-MyNewIssues</li></ul> + * + * This is a mandatory parameter. + * Example value: "SQ-MyNewIssues" + */ + public AddRequest setType(String type) { + this.type = type; + return this; + } + + public String getType() { + return type; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/ListRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/ListRequest.java new file mode 100644 index 00000000000..a9d0344b995 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/ListRequest.java @@ -0,0 +1,49 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.notifications; + +import javax.annotation.Generated; + +/** + * List notifications of the authenticated user.<br>Requires one of the following permissions:<ul> <li>Authentication if no login is provided</li> <li>System administration if a login is provided</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/notifications/list">Further information about this action online (including a response example)</a> + * @since 6.3 + */ +@Generated("sonar-ws-generator") +public class ListRequest { + + private String login; + + /** + * User login + * + */ + public ListRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/NotificationsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/NotificationsService.java new file mode 100644 index 00000000000..81986d4d004 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/NotificationsService.java @@ -0,0 +1,93 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.notifications; + +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.Notifications.ListResponse; + +/** + * Manage notifications of the authenticated user + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/notifications">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class NotificationsService extends BaseService { + + public NotificationsService(WsConnector wsConnector) { + super(wsConnector, "api/notifications"); + } + + /** + * Add a notification for the authenticated user.<br>Requires one of the following permissions:<ul> <li>Authentication if no login is provided. If a project is provided, requires the 'Browse' permission on the specified project.</li> <li>System administration if a login is provided. If a project is provided, requires the 'Browse' permission on the specified project.</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/notifications/add">Further information about this action online (including a response example)</a> + * @since 6.3 + */ + public void add(AddRequest request) { + call( + new PostRequest(path("add")) + .setParam("channel", request.getChannel()) + .setParam("login", request.getLogin()) + .setParam("project", request.getProject()) + .setParam("type", request.getType()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * List notifications of the authenticated user.<br>Requires one of the following permissions:<ul> <li>Authentication if no login is provided</li> <li>System administration if a login is provided</li></ul> + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/notifications/list">Further information about this action online (including a response example)</a> + * @since 6.3 + */ + public ListResponse list(ListRequest request) { + return call( + new GetRequest(path("list")) + .setParam("login", request.getLogin()), + ListResponse.parser()); + } + + /** + * Remove a notification for the authenticated user.<br>Requires one of the following permissions:<ul> <li>Authentication if no login is provided</li> <li>System administration if a login is provided</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/notifications/remove">Further information about this action online (including a response example)</a> + * @since 6.3 + */ + public void remove(RemoveRequest request) { + call( + new PostRequest(path("remove")) + .setParam("channel", request.getChannel()) + .setParam("login", request.getLogin()) + .setParam("project", request.getProject()) + .setParam("type", request.getType()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/RemoveRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/RemoveRequest.java new file mode 100644 index 00000000000..a676877084c --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/RemoveRequest.java @@ -0,0 +1,98 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.notifications; + +import javax.annotation.Generated; + +/** + * Remove a notification for the authenticated user.<br>Requires one of the following permissions:<ul> <li>Authentication if no login is provided</li> <li>System administration if a login is provided</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/notifications/remove">Further information about this action online (including a response example)</a> + * @since 6.3 + */ +@Generated("sonar-ws-generator") +public class RemoveRequest { + + private String channel; + private String login; + private String project; + private String type; + + /** + * Channel through which the notification is sent. For example, notifications can be sent by email. + * + * Possible values: + * <ul> + * <li>"EmailNotificationChannel"</li> + * </ul> + */ + public RemoveRequest setChannel(String channel) { + this.channel = channel; + return this; + } + + public String getChannel() { + return channel; + } + + /** + * User login + * + */ + public RemoveRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public RemoveRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } + + /** + * Notification type. Possible values are for:<ul> <li>Global notifications: CeReportTaskFailure, ChangesOnMyIssue, NewAlerts, NewFalsePositiveIssue, NewIssues, SQ-MyNewIssues</li> <li>Per project notifications: CeReportTaskFailure, ChangesOnMyIssue, NewAlerts, NewFalsePositiveIssue, NewIssues, SQ-MyNewIssues</li></ul> + * + * This is a mandatory parameter. + * Example value: "SQ-MyNewIssues" + */ + public RemoveRequest setType(String type) { + this.type = type; + return this; + } + + public String getType() { + return type; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/package-info.java new file mode 100644 index 00000000000..5123440ea4f --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.notifications; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/AddMemberRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/AddMemberRequest.java new file mode 100644 index 00000000000..71dee854e0f --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/AddMemberRequest.java @@ -0,0 +1,67 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.organizations; + +import javax.annotation.Generated; + +/** + * Add a user as a member of an organization.<br>Requires 'Administer System' permission on the specified organization. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/organizations/add_member">Further information about this action online (including a response example)</a> + * @since 6.4 + */ +@Generated("sonar-ws-generator") +public class AddMemberRequest { + + private String login; + private String organization; + + /** + * User login + * + * This is a mandatory parameter. + * Example value: "ray.bradbury" + */ + public AddMemberRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * Organization key + * + * This is a mandatory parameter. + * Example value: "my-org" + */ + public AddMemberRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/CreateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/CreateRequest.java new file mode 100644 index 00000000000..5d377f21c46 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/CreateRequest.java @@ -0,0 +1,111 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.organizations; + +import javax.annotation.Generated; + +/** + * Create an organization.<br />Requires 'Administer System' permission unless any logged in user is allowed to create an organization (see appropriate setting). Organization support must be enabled. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/organizations/create">Further information about this action online (including a response example)</a> + * @since 6.2 + */ +@Generated("sonar-ws-generator") +public class CreateRequest { + + private String avatar; + private String description; + private String key; + private String name; + private String url; + + /** + * URL of the organization avatar.<br/> It must be less than 256 chars long. + * + * Example value: "https://www.foo.com/foo.png" + */ + public CreateRequest setAvatar(String avatar) { + this.avatar = avatar; + return this; + } + + public String getAvatar() { + return avatar; + } + + /** + * Description of the organization.<br/> It must be less than 256 chars long. + * + * Example value: "The Foo company produces quality software for Bar." + */ + public CreateRequest setDescription(String description) { + this.description = description; + return this; + } + + public String getDescription() { + return description; + } + + /** + * Key of the organization. <br />The key is unique to the whole SonarQube. <br/>When not specified, the key is computed from the name. <br />Otherwise, it must be between 2 and 32 chars long. All chars must be lower-case letters (a to z), digits or dash (but dash can neither be trailing nor heading) + * + * Example value: "foo-company" + */ + public CreateRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Name of the organization. <br />It must be between 2 and 64 chars longs. + * + * This is a mandatory parameter. + * Example value: "Foo Company" + */ + public CreateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * URL of the organization.<br/> It must be less than 256 chars long. + * + * Example value: "https://www.foo.com" + */ + public CreateRequest setUrl(String url) { + this.url = url; + return this; + } + + public String getUrl() { + return url; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/DeleteRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/DeleteRequest.java new file mode 100644 index 00000000000..3607e9c6092 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/DeleteRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.organizations; + +import javax.annotation.Generated; + +/** + * Delete an organization.<br/>Require 'Administer System' permission on the specified organization. Organization support must be enabled. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/organizations/delete">Further information about this action online (including a response example)</a> + * @since 6.2 + */ +@Generated("sonar-ws-generator") +public class DeleteRequest { + + private String organization; + + /** + * Organization key + * + * This is a mandatory parameter. + * Example value: "foo-company" + */ + public DeleteRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/OrganizationsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/OrganizationsService.java new file mode 100644 index 00000000000..70afb5c2f2a --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/OrganizationsService.java @@ -0,0 +1,215 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.organizations; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.Organizations.AddMemberWsResponse; +import org.sonarqube.ws.Organizations.CreateWsResponse; +import org.sonarqube.ws.Organizations.SearchWsResponse; +import org.sonarqube.ws.Organizations.SearchMembersWsResponse; +import org.sonarqube.ws.Organizations.UpdateWsResponse; + +/** + * Manage organizations. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/organizations">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class OrganizationsService extends BaseService { + + public OrganizationsService(WsConnector wsConnector) { + super(wsConnector, "api/organizations"); + } + + /** + * Add a user as a member of an organization.<br>Requires 'Administer System' permission on the specified organization. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/organizations/add_member">Further information about this action online (including a response example)</a> + * @since 6.4 + */ + public AddMemberWsResponse addMember(AddMemberRequest request) { + return call( + new PostRequest(path("add_member")) + .setParam("login", request.getLogin()) + .setParam("organization", request.getOrganization()), + AddMemberWsResponse.parser()); + } + + /** + * Create an organization.<br />Requires 'Administer System' permission unless any logged in user is allowed to create an organization (see appropriate setting). Organization support must be enabled. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/organizations/create">Further information about this action online (including a response example)</a> + * @since 6.2 + */ + public CreateWsResponse create(CreateRequest request) { + return call( + new PostRequest(path("create")) + .setParam("avatar", request.getAvatar()) + .setParam("description", request.getDescription()) + .setParam("key", request.getKey()) + .setParam("name", request.getName()) + .setParam("url", request.getUrl()), + CreateWsResponse.parser()); + } + + /** + * Delete an organization.<br/>Require 'Administer System' permission on the specified organization. Organization support must be enabled. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/organizations/delete">Further information about this action online (including a response example)</a> + * @since 6.2 + */ + public void delete(DeleteRequest request) { + call( + new PostRequest(path("delete")) + .setParam("organization", request.getOrganization()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Enable support of organizations.<br />'Administer System' permission is required. The logged-in user will be flagged as root and will be able to manage organizations and other root users. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/organizations/enable_support">Further information about this action online (including a response example)</a> + * @since 6.3 + */ + public void enableSupport() { + call( + new PostRequest(path("enable_support")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Remove a member from an organization.<br>Requires 'Administer System' permission on the specified organization. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/organizations/remove_member">Further information about this action online (including a response example)</a> + * @since 6.4 + */ + public void removeMember(RemoveMemberRequest request) { + call( + new PostRequest(path("remove_member")) + .setParam("login", request.getLogin()) + .setParam("organization", request.getOrganization()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Search for organizations + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/organizations/search">Further information about this action online (including a response example)</a> + * @since 6.2 + */ + public SearchWsResponse search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("organizations", request.getOrganizations() == null ? null : request.getOrganizations().stream().collect(Collectors.joining(","))) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()), + SearchWsResponse.parser()); + } + + /** + * Search members of an organization + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/organizations/search_members">Further information about this action online (including a response example)</a> + * @since 6.4 + */ + public SearchMembersWsResponse searchMembers(SearchMembersRequest request) { + return call( + new GetRequest(path("search_members")) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setParam("selected", request.getSelected()), + SearchMembersWsResponse.parser()); + } + + /** + * List keys of the organizations for which the currently authenticated user has the System Administer permission for. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/organizations/search_my_organizations">Further information about this action online (including a response example)</a> + * @since 6.3 + */ + public String searchMyOrganizations() { + return call( + new GetRequest(path("search_my_organizations")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Update an organization.<br/>Require 'Administer System' permission. Organization support must be enabled. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/organizations/update">Further information about this action online (including a response example)</a> + * @since 6.2 + */ + public void update(UpdateRequest request) { + call( + new PostRequest(path("update")) + .setParam("avatar", request.getAvatar()) + .setParam("description", request.getDescription()) + .setParam("key", request.getKey()) + .setParam("name", request.getName()) + .setParam("url", request.getUrl()), + UpdateWsResponse.parser()); + } + + /** + * Update the default visibility for new projects of the specified organization. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/organizations/update_project_visibility">Further information about this action online (including a response example)</a> + * @since 6.4 + */ + public void updateProjectVisibility(UpdateProjectVisibilityRequest request) { + call( + new PostRequest(path("update_project_visibility")) + .setParam("organization", request.getOrganization()) + .setParam("projectVisibility", request.getProjectVisibility()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/RemoveMemberRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/RemoveMemberRequest.java new file mode 100644 index 00000000000..5bb2a89013d --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/RemoveMemberRequest.java @@ -0,0 +1,67 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.organizations; + +import javax.annotation.Generated; + +/** + * Remove a member from an organization.<br>Requires 'Administer System' permission on the specified organization. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/organizations/remove_member">Further information about this action online (including a response example)</a> + * @since 6.4 + */ +@Generated("sonar-ws-generator") +public class RemoveMemberRequest { + + private String login; + private String organization; + + /** + * User login + * + * This is a mandatory parameter. + * Example value: "ray.bradbury" + */ + public RemoveMemberRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * Organization key + * + * This is a mandatory parameter. + * Example value: "my-org" + */ + public RemoveMemberRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/SearchMembersRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/SearchMembersRequest.java new file mode 100644 index 00000000000..36378eb522f --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/SearchMembersRequest.java @@ -0,0 +1,115 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.organizations; + +import javax.annotation.Generated; + +/** + * Search members of an organization + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/organizations/search_members">Further information about this action online (including a response example)</a> + * @since 6.4 + */ +@Generated("sonar-ws-generator") +public class SearchMembersRequest { + + private String organization; + private String p; + private String ps; + private String q; + private String selected; + + /** + * Organization key + * + * This is part of the internal API. + */ + public SearchMembersRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchMembersRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public SearchMembersRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to names or logins that contain the supplied string. + * + * Example value: "orwe" + */ + public SearchMembersRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Depending on the value, show only selected items (selected=selected) or deselected items (selected=deselected). + * + * This is part of the internal API. + * Possible values: + * <ul> + * <li>"selected"</li> + * <li>"deselected"</li> + * </ul> + */ + public SearchMembersRequest 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/organizations/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/SearchRequest.java new file mode 100644 index 00000000000..3a0f7d0ccaa --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/SearchRequest.java @@ -0,0 +1,102 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.organizations; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Search for organizations + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/organizations/search">Further information about this action online (including a response example)</a> + * @since 6.2 + */ +@Generated("sonar-ws-generator") +public class SearchRequest { + + private String member; + private List<String> organizations; + private String p; + private String ps; + + /** + * Filter organizations based on whether the authenticated user is a member + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public SearchRequest setMember(String member) { + this.member = member; + return this; + } + + public String getMember() { + return member; + } + + /** + * Comma-separated list of organization keys + * + * Example value: "my-org-1,foocorp" + */ + public SearchRequest setOrganizations(List<String> organizations) { + this.organizations = organizations; + return this; + } + + public List<String> getOrganizations() { + return organizations; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public SearchRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/UpdateProjectVisibilityRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/UpdateProjectVisibilityRequest.java new file mode 100644 index 00000000000..6312e3b0148 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/UpdateProjectVisibilityRequest.java @@ -0,0 +1,71 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.organizations; + +import javax.annotation.Generated; + +/** + * Update the default visibility for new projects of the specified organization. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/organizations/update_project_visibility">Further information about this action online (including a response example)</a> + * @since 6.4 + */ +@Generated("sonar-ws-generator") +public class UpdateProjectVisibilityRequest { + + private String organization; + private String projectVisibility; + + /** + * Organization key + * + * This is a mandatory parameter. + * Example value: "foo-company" + */ + public UpdateProjectVisibilityRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Default visibility for projects + * + * This is a mandatory parameter. + * Possible values: + * <ul> + * <li>"private"</li> + * <li>"public"</li> + * </ul> + */ + public UpdateProjectVisibilityRequest setProjectVisibility(String projectVisibility) { + this.projectVisibility = projectVisibility; + return this; + } + + public String getProjectVisibility() { + return projectVisibility; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/UpdateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/UpdateRequest.java new file mode 100644 index 00000000000..5a68f8ce565 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/UpdateRequest.java @@ -0,0 +1,111 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.organizations; + +import javax.annotation.Generated; + +/** + * Update an organization.<br/>Require 'Administer System' permission. Organization support must be enabled. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/organizations/update">Further information about this action online (including a response example)</a> + * @since 6.2 + */ +@Generated("sonar-ws-generator") +public class UpdateRequest { + + private String avatar; + private String description; + private String key; + private String name; + private String url; + + /** + * URL of the organization avatar.<br/> It must be less than 256 chars long. + * + * Example value: "https://www.foo.com/foo.png" + */ + public UpdateRequest setAvatar(String avatar) { + this.avatar = avatar; + return this; + } + + public String getAvatar() { + return avatar; + } + + /** + * Description of the organization.<br/> It must be less than 256 chars long. + * + * Example value: "The Foo company produces quality software for Bar." + */ + public UpdateRequest setDescription(String description) { + this.description = description; + return this; + } + + public String getDescription() { + return description; + } + + /** + * Organization key + * + * This is a mandatory parameter. + * Example value: "foo-company" + */ + public UpdateRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Name of the organization. <br />It must be between 2 and 64 chars longs. + * + * Example value: "Foo Company" + */ + public UpdateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * URL of the organization.<br/> It must be less than 256 chars long. + * + * Example value: "https://www.foo.com" + */ + public UpdateRequest setUrl(String url) { + this.url = url; + return this; + } + + public String getUrl() { + return url; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/package-info.java new file mode 100644 index 00000000000..73e9af0ac8e --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.organizations; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddGroupRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddGroupRequest.java new file mode 100644 index 00000000000..0e0f1dc7714 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddGroupRequest.java @@ -0,0 +1,126 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import javax.annotation.Generated; + +/** + * Add permission to a group.<br /> This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.<br /> The group name or group id must be provided. <br />Requires one of the following permissions:<ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/add_group">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class AddGroupRequest { + + private String groupId; + private String groupName; + private String organization; + private String permission; + private String projectId; + private String projectKey; + + /** + * Group id + * + * Example value: "42" + */ + public AddGroupRequest setGroupId(String groupId) { + this.groupId = groupId; + return this; + } + + public String getGroupId() { + return groupId; + } + + /** + * Group name or 'anyone' (case insensitive) + * + * Example value: "sonar-administrators" + */ + public AddGroupRequest setGroupName(String groupName) { + this.groupName = groupName; + return this; + } + + public String getGroupName() { + return groupName; + } + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public AddGroupRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Permission<ul><li>Possible values for global permissions: admin, profileadmin, gateadmin, scan, provisioning</li><li>Possible values for project permissions admin, codeviewer, issueadmin, scan, user</li></ul> + * + * This is a mandatory parameter. + */ + public AddGroupRequest setPermission(String permission) { + this.permission = permission; + return this; + } + + public String getPermission() { + return permission; + } + + /** + * Project id + * + * Example value: "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + */ + public AddGroupRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public AddGroupRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddGroupToTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddGroupToTemplateRequest.java new file mode 100644 index 00000000000..a0327360dc1 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddGroupToTemplateRequest.java @@ -0,0 +1,134 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import javax.annotation.Generated; + +/** + * Add a group to a permission template.<br /> The group id or group name must be provided. <br />Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/add_group_to_template">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class AddGroupToTemplateRequest { + + private String groupId; + private String groupName; + private String organization; + private String permission; + private String templateId; + private String templateName; + + /** + * Group id + * + * Example value: "42" + */ + public AddGroupToTemplateRequest setGroupId(String groupId) { + this.groupId = groupId; + return this; + } + + public String getGroupId() { + return groupId; + } + + /** + * Group name or 'anyone' (case insensitive) + * + * Example value: "sonar-administrators" + */ + public AddGroupToTemplateRequest setGroupName(String groupName) { + this.groupName = groupName; + return this; + } + + public String getGroupName() { + return groupName; + } + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public AddGroupToTemplateRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Permission<ul><li>Possible values for project permissions admin, codeviewer, issueadmin, scan, user</li></ul> + * + * This is a mandatory parameter. + * Possible values: + * <ul> + * <li>"admin"</li> + * <li>"codeviewer"</li> + * <li>"issueadmin"</li> + * <li>"scan"</li> + * <li>"user"</li> + * </ul> + */ + public AddGroupToTemplateRequest setPermission(String permission) { + this.permission = permission; + return this; + } + + public String getPermission() { + return permission; + } + + /** + * Template id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public AddGroupToTemplateRequest setTemplateId(String templateId) { + this.templateId = templateId; + return this; + } + + public String getTemplateId() { + return templateId; + } + + /** + * Template name + * + * Example value: "Default Permission Template for Projects" + */ + public AddGroupToTemplateRequest setTemplateName(String templateName) { + this.templateName = templateName; + return this; + } + + public String getTemplateName() { + return templateName; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddProjectCreatorToTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddProjectCreatorToTemplateRequest.java new file mode 100644 index 00000000000..8a73942deb5 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddProjectCreatorToTemplateRequest.java @@ -0,0 +1,104 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import javax.annotation.Generated; + +/** + * Add a project creator to a permission template.<br>Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/add_project_creator_to_template">Further information about this action online (including a response example)</a> + * @since 6.0 + */ +@Generated("sonar-ws-generator") +public class AddProjectCreatorToTemplateRequest { + + private String organization; + private String permission; + private String templateId; + private String templateName; + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public AddProjectCreatorToTemplateRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Permission<ul><li>Possible values for project permissions admin, codeviewer, issueadmin, scan, user</li></ul> + * + * This is a mandatory parameter. + * Possible values: + * <ul> + * <li>"admin"</li> + * <li>"codeviewer"</li> + * <li>"issueadmin"</li> + * <li>"scan"</li> + * <li>"user"</li> + * </ul> + */ + public AddProjectCreatorToTemplateRequest setPermission(String permission) { + this.permission = permission; + return this; + } + + public String getPermission() { + return permission; + } + + /** + * Template id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public AddProjectCreatorToTemplateRequest setTemplateId(String templateId) { + this.templateId = templateId; + return this; + } + + public String getTemplateId() { + return templateId; + } + + /** + * Template name + * + * Example value: "Default Permission Template for Projects" + */ + public AddProjectCreatorToTemplateRequest setTemplateName(String templateName) { + this.templateName = templateName; + return this; + } + + public String getTemplateName() { + return templateName; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddUserRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddUserRequest.java new file mode 100644 index 00000000000..34683ef98a5 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddUserRequest.java @@ -0,0 +1,112 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import javax.annotation.Generated; + +/** + * Add permission to a user.<br /> This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.<br />Requires one of the following permissions:<ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/add_user">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class AddUserRequest { + + private String login; + private String organization; + private String permission; + private String projectId; + private String projectKey; + + /** + * User login + * + * This is a mandatory parameter. + * Example value: "g.hopper" + */ + public AddUserRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * Key of organization, cannot be used at the same time with projectId and projectKey + * + * This is part of the internal API. + * Example value: "my-org" + */ + public AddUserRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Permission<ul><li>Possible values for global permissions: admin, profileadmin, gateadmin, scan, provisioning</li><li>Possible values for project permissions admin, codeviewer, issueadmin, scan, user</li></ul> + * + * This is a mandatory parameter. + */ + public AddUserRequest setPermission(String permission) { + this.permission = permission; + return this; + } + + public String getPermission() { + return permission; + } + + /** + * Project id + * + * Example value: "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + */ + public AddUserRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public AddUserRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddUserToTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddUserToTemplateRequest.java new file mode 100644 index 00000000000..711d0785616 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddUserToTemplateRequest.java @@ -0,0 +1,120 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import javax.annotation.Generated; + +/** + * Add a user to a permission template.<br /> Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/add_user_to_template">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class AddUserToTemplateRequest { + + private String login; + private String organization; + private String permission; + private String templateId; + private String templateName; + + /** + * User login + * + * This is a mandatory parameter. + * Example value: "g.hopper" + */ + public AddUserToTemplateRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public AddUserToTemplateRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Permission<ul><li>Possible values for project permissions admin, codeviewer, issueadmin, scan, user</li></ul> + * + * This is a mandatory parameter. + * Possible values: + * <ul> + * <li>"admin"</li> + * <li>"codeviewer"</li> + * <li>"issueadmin"</li> + * <li>"scan"</li> + * <li>"user"</li> + * </ul> + */ + public AddUserToTemplateRequest setPermission(String permission) { + this.permission = permission; + return this; + } + + public String getPermission() { + return permission; + } + + /** + * Template id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public AddUserToTemplateRequest setTemplateId(String templateId) { + this.templateId = templateId; + return this; + } + + public String getTemplateId() { + return templateId; + } + + /** + * Template name + * + * Example value: "Default Permission Template for Projects" + */ + public AddUserToTemplateRequest setTemplateName(String templateName) { + this.templateName = templateName; + return this; + } + + public String getTemplateName() { + return templateName; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/ApplyTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/ApplyTemplateRequest.java new file mode 100644 index 00000000000..3bff1df9ae3 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/ApplyTemplateRequest.java @@ -0,0 +1,111 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import javax.annotation.Generated; + +/** + * Apply a permission template to one project.<br>The project id or project key must be provided.<br>The template id or name must be provided.<br>Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/apply_template">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class ApplyTemplateRequest { + + private String organization; + private String projectId; + private String projectKey; + private String templateId; + private String templateName; + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public ApplyTemplateRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Project id + * + * Example value: "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + */ + public ApplyTemplateRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public ApplyTemplateRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } + + /** + * Template id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public ApplyTemplateRequest setTemplateId(String templateId) { + this.templateId = templateId; + return this; + } + + public String getTemplateId() { + return templateId; + } + + /** + * Template name + * + * Example value: "Default Permission Template for Projects" + */ + public ApplyTemplateRequest setTemplateName(String templateName) { + this.templateName = templateName; + return this; + } + + public String getTemplateName() { + return templateName; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/BulkApplyTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/BulkApplyTemplateRequest.java new file mode 100644 index 00000000000..1cf0304ee2a --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/BulkApplyTemplateRequest.java @@ -0,0 +1,186 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Apply a permission template to several projects.<br />The template id or name must be provided.<br />Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/bulk_apply_template">Further information about this action online (including a response example)</a> + * @since 5.5 + */ +@Generated("sonar-ws-generator") +public class BulkApplyTemplateRequest { + + private String analyzedBefore; + private String onProvisionedOnly; + private String organization; + private List<String> projects; + private String q; + private List<String> qualifiers; + private String templateId; + private String templateName; + private String visibility; + + /** + * Filter the projects for which last analysis is older than the given date (exclusive).<br> Either a date (server timezone) or datetime can be provided. + * + * Example value: "2017-10-19 or 2017-10-19T13:00:00+0200" + */ + public BulkApplyTemplateRequest setAnalyzedBefore(String analyzedBefore) { + this.analyzedBefore = analyzedBefore; + return this; + } + + public String getAnalyzedBefore() { + return analyzedBefore; + } + + /** + * Filter the projects that are provisioned + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public BulkApplyTemplateRequest setOnProvisionedOnly(String onProvisionedOnly) { + this.onProvisionedOnly = onProvisionedOnly; + return this; + } + + public String getOnProvisionedOnly() { + return onProvisionedOnly; + } + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public BulkApplyTemplateRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Comma-separated list of project keys + * + * Example value: "my_project,another_project" + */ + public BulkApplyTemplateRequest setProjects(List<String> projects) { + this.projects = projects; + return this; + } + + public List<String> getProjects() { + return projects; + } + + /** + * Limit search to: <ul><li>project names that contain the supplied string</li><li>project keys that are exactly the same as the supplied string</li></ul> + * + * Example value: "apac" + */ + public BulkApplyTemplateRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Comma-separated list of component qualifiers. Filter the results with the specified qualifiers. Possible values are:<ul><li>TRK - Projects</li></ul> + * + * Possible values: + * <ul> + * <li>"TRK"</li> + * </ul> + */ + public BulkApplyTemplateRequest setQualifiers(List<String> qualifiers) { + this.qualifiers = qualifiers; + return this; + } + + public List<String> getQualifiers() { + return qualifiers; + } + + /** + * Template id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public BulkApplyTemplateRequest setTemplateId(String templateId) { + this.templateId = templateId; + return this; + } + + public String getTemplateId() { + return templateId; + } + + /** + * Template name + * + * Example value: "Default Permission Template for Projects" + */ + public BulkApplyTemplateRequest setTemplateName(String templateName) { + this.templateName = templateName; + return this; + } + + public String getTemplateName() { + return templateName; + } + + /** + * Filter the projects that should be visible to everyone (public), or only specific user/groups (private).<br/>If no visibility is specified, the default project visibility of the organization will be used. + * + * This is part of the internal API. + * Possible values: + * <ul> + * <li>"private"</li> + * <li>"public"</li> + * </ul> + */ + public BulkApplyTemplateRequest setVisibility(String visibility) { + this.visibility = visibility; + return this; + } + + public String getVisibility() { + return visibility; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/CreateTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/CreateTemplateRequest.java new file mode 100644 index 00000000000..10108165727 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/CreateTemplateRequest.java @@ -0,0 +1,97 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import javax.annotation.Generated; + +/** + * Create a permission template.<br />Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/create_template">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class CreateTemplateRequest { + + private String description; + private String name; + private String organization; + private String projectKeyPattern; + + /** + * Description + * + * Example value: "Permissions for all projects related to the financial service" + */ + public CreateTemplateRequest setDescription(String description) { + this.description = description; + return this; + } + + public String getDescription() { + return description; + } + + /** + * Name + * + * This is a mandatory parameter. + * Example value: "Financial Service Permissions" + */ + public CreateTemplateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public CreateTemplateRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Project key pattern. Must be a valid Java regular expression + * + * Example value: ".*\\.finance\\..*" + */ + public CreateTemplateRequest setProjectKeyPattern(String projectKeyPattern) { + this.projectKeyPattern = projectKeyPattern; + return this; + } + + public String getProjectKeyPattern() { + return projectKeyPattern; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/DeleteTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/DeleteTemplateRequest.java new file mode 100644 index 00000000000..376b80659a6 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/DeleteTemplateRequest.java @@ -0,0 +1,81 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import javax.annotation.Generated; + +/** + * Delete a permission template.<br />Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/delete_template">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class DeleteTemplateRequest { + + private String organization; + private String templateId; + private String templateName; + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public DeleteTemplateRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Template id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public DeleteTemplateRequest setTemplateId(String templateId) { + this.templateId = templateId; + return this; + } + + public String getTemplateId() { + return templateId; + } + + /** + * Template name + * + * Example value: "Default Permission Template for Projects" + */ + public DeleteTemplateRequest setTemplateName(String templateName) { + this.templateName = templateName; + return this; + } + + public String getTemplateName() { + return templateName; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/GroupsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/GroupsRequest.java new file mode 100644 index 00000000000..cce100871e6 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/GroupsRequest.java @@ -0,0 +1,140 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import javax.annotation.Generated; + +/** + * Lists the groups with their permissions.<br>This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.<br> This service defaults to all groups, but can be limited to groups with a specific permission by providing the desired permission.<br>Requires one of the following permissions:<ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/groups">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class GroupsRequest { + + private String organization; + private String p; + private String permission; + private String projectId; + private String projectKey; + private String ps; + private String q; + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public GroupsRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public GroupsRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Permission<ul><li>Possible values for global permissions: admin, profileadmin, gateadmin, scan, provisioning</li><li>Possible values for project permissions admin, codeviewer, issueadmin, scan, user</li></ul> + * + */ + public GroupsRequest setPermission(String permission) { + this.permission = permission; + return this; + } + + public String getPermission() { + return permission; + } + + /** + * Project id + * + * Example value: "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + */ + public GroupsRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public GroupsRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } + + /** + * Page size. Must be greater than 0 and less than 100 + * + * Example value: "20" + */ + public GroupsRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to group names that contain the supplied string. When this parameter is not set, only groups having at least one permission are returned. + * + * Example value: "sonar" + */ + public GroupsRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/PermissionsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/PermissionsService.java new file mode 100644 index 00000000000..f06f173c020 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/PermissionsService.java @@ -0,0 +1,507 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.Permissions.CreateTemplateWsResponse; +import org.sonarqube.ws.Permissions.WsGroupsResponse; +import org.sonarqube.ws.Permissions.WsSearchGlobalPermissionsResponse; +import org.sonarqube.ws.Permissions.SearchProjectPermissionsWsResponse; +import org.sonarqube.ws.Permissions.SearchTemplatesWsResponse; +import org.sonarqube.ws.Permissions.WsTemplateGroupsResponse; +import org.sonarqube.ws.Permissions.UpdateTemplateWsResponse; +import org.sonarqube.ws.Permissions.UsersWsResponse; + +/** + * Manage permission templates, and the granting and revoking of permissions at the global and project levels. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class PermissionsService extends BaseService { + + public PermissionsService(WsConnector wsConnector) { + super(wsConnector, "api/permissions"); + } + + /** + * Add permission to a group.<br /> This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.<br /> The group name or group id must be provided. <br />Requires one of the following permissions:<ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/add_group">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void addGroup(AddGroupRequest request) { + call( + new PostRequest(path("add_group")) + .setParam("groupId", request.getGroupId()) + .setParam("groupName", request.getGroupName()) + .setParam("organization", request.getOrganization()) + .setParam("permission", request.getPermission()) + .setParam("projectId", request.getProjectId()) + .setParam("projectKey", request.getProjectKey()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Add a group to a permission template.<br /> The group id or group name must be provided. <br />Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/add_group_to_template">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void addGroupToTemplate(AddGroupToTemplateRequest request) { + call( + new PostRequest(path("add_group_to_template")) + .setParam("groupId", request.getGroupId()) + .setParam("groupName", request.getGroupName()) + .setParam("organization", request.getOrganization()) + .setParam("permission", request.getPermission()) + .setParam("templateId", request.getTemplateId()) + .setParam("templateName", request.getTemplateName()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Add a project creator to a permission template.<br>Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/add_project_creator_to_template">Further information about this action online (including a response example)</a> + * @since 6.0 + */ + public void addProjectCreatorToTemplate(AddProjectCreatorToTemplateRequest request) { + call( + new PostRequest(path("add_project_creator_to_template")) + .setParam("organization", request.getOrganization()) + .setParam("permission", request.getPermission()) + .setParam("templateId", request.getTemplateId()) + .setParam("templateName", request.getTemplateName()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Add permission to a user.<br /> This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.<br />Requires one of the following permissions:<ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/add_user">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void addUser(AddUserRequest request) { + call( + new PostRequest(path("add_user")) + .setParam("login", request.getLogin()) + .setParam("organization", request.getOrganization()) + .setParam("permission", request.getPermission()) + .setParam("projectId", request.getProjectId()) + .setParam("projectKey", request.getProjectKey()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Add a user to a permission template.<br /> Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/add_user_to_template">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void addUserToTemplate(AddUserToTemplateRequest request) { + call( + new PostRequest(path("add_user_to_template")) + .setParam("login", request.getLogin()) + .setParam("organization", request.getOrganization()) + .setParam("permission", request.getPermission()) + .setParam("templateId", request.getTemplateId()) + .setParam("templateName", request.getTemplateName()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Apply a permission template to one project.<br>The project id or project key must be provided.<br>The template id or name must be provided.<br>Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/apply_template">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void applyTemplate(ApplyTemplateRequest request) { + call( + new PostRequest(path("apply_template")) + .setParam("organization", request.getOrganization()) + .setParam("projectId", request.getProjectId()) + .setParam("projectKey", request.getProjectKey()) + .setParam("templateId", request.getTemplateId()) + .setParam("templateName", request.getTemplateName()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Apply a permission template to several projects.<br />The template id or name must be provided.<br />Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/bulk_apply_template">Further information about this action online (including a response example)</a> + * @since 5.5 + */ + public void bulkApplyTemplate(BulkApplyTemplateRequest request) { + call( + new PostRequest(path("bulk_apply_template")) + .setParam("analyzedBefore", request.getAnalyzedBefore()) + .setParam("onProvisionedOnly", request.getOnProvisionedOnly()) + .setParam("organization", request.getOrganization()) + .setParam("projects", request.getProjects() == null ? null : request.getProjects().stream().collect(Collectors.joining(","))) + .setParam("q", request.getQ()) + .setParam("qualifiers", request.getQualifiers() == null ? null : request.getQualifiers().stream().collect(Collectors.joining(","))) + .setParam("templateId", request.getTemplateId()) + .setParam("templateName", request.getTemplateName()) + .setParam("visibility", request.getVisibility()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Create a permission template.<br />Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/create_template">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public CreateTemplateWsResponse createTemplate(CreateTemplateRequest request) { + return call( + new PostRequest(path("create_template")) + .setParam("description", request.getDescription()) + .setParam("name", request.getName()) + .setParam("organization", request.getOrganization()) + .setParam("projectKeyPattern", request.getProjectKeyPattern()), + CreateTemplateWsResponse.parser()); + } + + /** + * Delete a permission template.<br />Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/delete_template">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void deleteTemplate(DeleteTemplateRequest request) { + call( + new PostRequest(path("delete_template")) + .setParam("organization", request.getOrganization()) + .setParam("templateId", request.getTemplateId()) + .setParam("templateName", request.getTemplateName()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Lists the groups with their permissions.<br>This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.<br> This service defaults to all groups, but can be limited to groups with a specific permission by providing the desired permission.<br>Requires one of the following permissions:<ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li></ul> + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/groups">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public WsGroupsResponse groups(GroupsRequest request) { + return call( + new GetRequest(path("groups")) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("permission", request.getPermission()) + .setParam("projectId", request.getProjectId()) + .setParam("projectKey", request.getProjectKey()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()), + WsGroupsResponse.parser()); + } + + /** + * Remove a permission from a group.<br /> This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.<br /> The group id or group name must be provided, not both.<br />Requires one of the following permissions:<ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/remove_group">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void removeGroup(RemoveGroupRequest request) { + call( + new PostRequest(path("remove_group")) + .setParam("groupId", request.getGroupId()) + .setParam("groupName", request.getGroupName()) + .setParam("organization", request.getOrganization()) + .setParam("permission", request.getPermission()) + .setParam("projectId", request.getProjectId()) + .setParam("projectKey", request.getProjectKey()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Remove a group from a permission template.<br /> The group id or group name must be provided. <br />Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/remove_group_from_template">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void removeGroupFromTemplate(RemoveGroupFromTemplateRequest request) { + call( + new PostRequest(path("remove_group_from_template")) + .setParam("groupId", request.getGroupId()) + .setParam("groupName", request.getGroupName()) + .setParam("organization", request.getOrganization()) + .setParam("permission", request.getPermission()) + .setParam("templateId", request.getTemplateId()) + .setParam("templateName", request.getTemplateName()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Remove a project creator from a permission template.<br>Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/remove_project_creator_from_template">Further information about this action online (including a response example)</a> + * @since 6.0 + */ + public void removeProjectCreatorFromTemplate(RemoveProjectCreatorFromTemplateRequest request) { + call( + new PostRequest(path("remove_project_creator_from_template")) + .setParam("organization", request.getOrganization()) + .setParam("permission", request.getPermission()) + .setParam("templateId", request.getTemplateId()) + .setParam("templateName", request.getTemplateName()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Remove permission from a user.<br /> This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.<br /> Requires one of the following permissions:<ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/remove_user">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void removeUser(RemoveUserRequest request) { + call( + new PostRequest(path("remove_user")) + .setParam("login", request.getLogin()) + .setParam("organization", request.getOrganization()) + .setParam("permission", request.getPermission()) + .setParam("projectId", request.getProjectId()) + .setParam("projectKey", request.getProjectKey()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Remove a user from a permission template.<br /> Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/remove_user_from_template">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void removeUserFromTemplate(RemoveUserFromTemplateRequest request) { + call( + new PostRequest(path("remove_user_from_template")) + .setParam("login", request.getLogin()) + .setParam("organization", request.getOrganization()) + .setParam("permission", request.getPermission()) + .setParam("templateId", request.getTemplateId()) + .setParam("templateName", request.getTemplateName()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * List global permissions. <br />Requires the following permission: 'Administer System' + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/search_global_permissions">Further information about this action online (including a response example)</a> + * @since 5.2 + * @deprecated since 6.5 + */ + @Deprecated + public WsSearchGlobalPermissionsResponse searchGlobalPermissions(SearchGlobalPermissionsRequest request) { + return call( + new GetRequest(path("search_global_permissions")) + .setParam("organization", request.getOrganization()), + WsSearchGlobalPermissionsResponse.parser()); + } + + /** + * List project permissions. A project can be a technical project, a view or a developer.<br />Requires one of the following permissions:<ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li></ul> + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/search_project_permissions">Further information about this action online (including a response example)</a> + * @since 5.2 + * @deprecated since 6.5 + */ + @Deprecated + public SearchProjectPermissionsWsResponse searchProjectPermissions(SearchProjectPermissionsRequest request) { + return call( + new GetRequest(path("search_project_permissions")) + .setParam("p", request.getP()) + .setParam("projectId", request.getProjectId()) + .setParam("projectKey", request.getProjectKey()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setParam("qualifier", request.getQualifier()), + SearchProjectPermissionsWsResponse.parser()); + } + + /** + * List permission templates.<br />Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/search_templates">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public SearchTemplatesWsResponse searchTemplates(SearchTemplatesRequest request) { + return call( + new GetRequest(path("search_templates")) + .setParam("organization", request.getOrganization()) + .setParam("q", request.getQ()), + SearchTemplatesWsResponse.parser()); + } + + /** + * Set a permission template as default.<br />Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/set_default_template">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void setDefaultTemplate(SetDefaultTemplateRequest request) { + call( + new PostRequest(path("set_default_template")) + .setParam("organization", request.getOrganization()) + .setParam("qualifier", request.getQualifier()) + .setParam("templateId", request.getTemplateId()) + .setParam("templateName", request.getTemplateName()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Lists the groups with their permission as individual groups rather than through user affiliation on the chosen template.<br />This service defaults to all groups, but can be limited to groups with a specific permission by providing the desired permission.<br>Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/template_groups">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public WsTemplateGroupsResponse templateGroups(TemplateGroupsRequest request) { + return call( + new GetRequest(path("template_groups")) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("permission", request.getPermission()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setParam("templateId", request.getTemplateId()) + .setParam("templateName", request.getTemplateName()), + WsTemplateGroupsResponse.parser()); + } + + /** + * Lists the users with their permission as individual users rather than through group affiliation on the chosen template. <br />This service defaults to all users, but can be limited to users with a specific permission by providing the desired permission.<br>Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/template_users">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public String templateUsers(TemplateUsersRequest request) { + return call( + new GetRequest(path("template_users")) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("permission", request.getPermission()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setParam("templateId", request.getTemplateId()) + .setParam("templateName", request.getTemplateName()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Update a permission template.<br />Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/update_template">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public UpdateTemplateWsResponse updateTemplate(UpdateTemplateRequest request) { + return call( + new PostRequest(path("update_template")) + .setParam("description", request.getDescription()) + .setParam("id", request.getId()) + .setParam("name", request.getName()) + .setParam("projectKeyPattern", request.getProjectKeyPattern()), + UpdateTemplateWsResponse.parser()); + } + + /** + * Lists the users with their permissions as individual users rather than through group affiliation.<br>This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.<br> This service defaults to all users, but can be limited to users with a specific permission by providing the desired permission.<br>Requires one of the following permissions:<ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li></ul> + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/users">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public UsersWsResponse users(UsersRequest request) { + return call( + new GetRequest(path("users")) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("permission", request.getPermission()) + .setParam("projectId", request.getProjectId()) + .setParam("projectKey", request.getProjectKey()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()), + UsersWsResponse.parser()); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveGroupFromTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveGroupFromTemplateRequest.java new file mode 100644 index 00000000000..02ef3eb41a8 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveGroupFromTemplateRequest.java @@ -0,0 +1,134 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import javax.annotation.Generated; + +/** + * Remove a group from a permission template.<br /> The group id or group name must be provided. <br />Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/remove_group_from_template">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class RemoveGroupFromTemplateRequest { + + private String groupId; + private String groupName; + private String organization; + private String permission; + private String templateId; + private String templateName; + + /** + * Group id + * + * Example value: "42" + */ + public RemoveGroupFromTemplateRequest setGroupId(String groupId) { + this.groupId = groupId; + return this; + } + + public String getGroupId() { + return groupId; + } + + /** + * Group name or 'anyone' (case insensitive) + * + * Example value: "sonar-administrators" + */ + public RemoveGroupFromTemplateRequest setGroupName(String groupName) { + this.groupName = groupName; + return this; + } + + public String getGroupName() { + return groupName; + } + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public RemoveGroupFromTemplateRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Permission<ul><li>Possible values for project permissions admin, codeviewer, issueadmin, scan, user</li></ul> + * + * This is a mandatory parameter. + * Possible values: + * <ul> + * <li>"admin"</li> + * <li>"codeviewer"</li> + * <li>"issueadmin"</li> + * <li>"scan"</li> + * <li>"user"</li> + * </ul> + */ + public RemoveGroupFromTemplateRequest setPermission(String permission) { + this.permission = permission; + return this; + } + + public String getPermission() { + return permission; + } + + /** + * Template id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public RemoveGroupFromTemplateRequest setTemplateId(String templateId) { + this.templateId = templateId; + return this; + } + + public String getTemplateId() { + return templateId; + } + + /** + * Template name + * + * Example value: "Default Permission Template for Projects" + */ + public RemoveGroupFromTemplateRequest setTemplateName(String templateName) { + this.templateName = templateName; + return this; + } + + public String getTemplateName() { + return templateName; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveGroupRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveGroupRequest.java new file mode 100644 index 00000000000..0e2f25e2749 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveGroupRequest.java @@ -0,0 +1,126 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import javax.annotation.Generated; + +/** + * Remove a permission from a group.<br /> This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.<br /> The group id or group name must be provided, not both.<br />Requires one of the following permissions:<ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/remove_group">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class RemoveGroupRequest { + + private String groupId; + private String groupName; + private String organization; + private String permission; + private String projectId; + private String projectKey; + + /** + * Group id + * + * Example value: "42" + */ + public RemoveGroupRequest setGroupId(String groupId) { + this.groupId = groupId; + return this; + } + + public String getGroupId() { + return groupId; + } + + /** + * Group name or 'anyone' (case insensitive) + * + * Example value: "sonar-administrators" + */ + public RemoveGroupRequest setGroupName(String groupName) { + this.groupName = groupName; + return this; + } + + public String getGroupName() { + return groupName; + } + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public RemoveGroupRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Permission<ul><li>Possible values for global permissions: admin, profileadmin, gateadmin, scan, provisioning</li><li>Possible values for project permissions admin, codeviewer, issueadmin, scan, user</li></ul> + * + * This is a mandatory parameter. + */ + public RemoveGroupRequest setPermission(String permission) { + this.permission = permission; + return this; + } + + public String getPermission() { + return permission; + } + + /** + * Project id + * + * Example value: "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + */ + public RemoveGroupRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public RemoveGroupRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveProjectCreatorFromTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveProjectCreatorFromTemplateRequest.java new file mode 100644 index 00000000000..04a389bb762 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveProjectCreatorFromTemplateRequest.java @@ -0,0 +1,104 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import javax.annotation.Generated; + +/** + * Remove a project creator from a permission template.<br>Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/remove_project_creator_from_template">Further information about this action online (including a response example)</a> + * @since 6.0 + */ +@Generated("sonar-ws-generator") +public class RemoveProjectCreatorFromTemplateRequest { + + private String organization; + private String permission; + private String templateId; + private String templateName; + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public RemoveProjectCreatorFromTemplateRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Permission<ul><li>Possible values for project permissions admin, codeviewer, issueadmin, scan, user</li></ul> + * + * This is a mandatory parameter. + * Possible values: + * <ul> + * <li>"admin"</li> + * <li>"codeviewer"</li> + * <li>"issueadmin"</li> + * <li>"scan"</li> + * <li>"user"</li> + * </ul> + */ + public RemoveProjectCreatorFromTemplateRequest setPermission(String permission) { + this.permission = permission; + return this; + } + + public String getPermission() { + return permission; + } + + /** + * Template id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public RemoveProjectCreatorFromTemplateRequest setTemplateId(String templateId) { + this.templateId = templateId; + return this; + } + + public String getTemplateId() { + return templateId; + } + + /** + * Template name + * + * Example value: "Default Permission Template for Projects" + */ + public RemoveProjectCreatorFromTemplateRequest setTemplateName(String templateName) { + this.templateName = templateName; + return this; + } + + public String getTemplateName() { + return templateName; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveUserFromTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveUserFromTemplateRequest.java new file mode 100644 index 00000000000..3fb6752d2b7 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveUserFromTemplateRequest.java @@ -0,0 +1,120 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import javax.annotation.Generated; + +/** + * Remove a user from a permission template.<br /> Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/remove_user_from_template">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class RemoveUserFromTemplateRequest { + + private String login; + private String organization; + private String permission; + private String templateId; + private String templateName; + + /** + * User login + * + * This is a mandatory parameter. + * Example value: "g.hopper" + */ + public RemoveUserFromTemplateRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public RemoveUserFromTemplateRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Permission<ul><li>Possible values for project permissions admin, codeviewer, issueadmin, scan, user</li></ul> + * + * This is a mandatory parameter. + * Possible values: + * <ul> + * <li>"admin"</li> + * <li>"codeviewer"</li> + * <li>"issueadmin"</li> + * <li>"scan"</li> + * <li>"user"</li> + * </ul> + */ + public RemoveUserFromTemplateRequest setPermission(String permission) { + this.permission = permission; + return this; + } + + public String getPermission() { + return permission; + } + + /** + * Template id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public RemoveUserFromTemplateRequest setTemplateId(String templateId) { + this.templateId = templateId; + return this; + } + + public String getTemplateId() { + return templateId; + } + + /** + * Template name + * + * Example value: "Default Permission Template for Projects" + */ + public RemoveUserFromTemplateRequest setTemplateName(String templateName) { + this.templateName = templateName; + return this; + } + + public String getTemplateName() { + return templateName; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveUserRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveUserRequest.java new file mode 100644 index 00000000000..3f96820b415 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveUserRequest.java @@ -0,0 +1,112 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import javax.annotation.Generated; + +/** + * Remove permission from a user.<br /> This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.<br /> Requires one of the following permissions:<ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/remove_user">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class RemoveUserRequest { + + private String login; + private String organization; + private String permission; + private String projectId; + private String projectKey; + + /** + * User login + * + * This is a mandatory parameter. + * Example value: "g.hopper" + */ + public RemoveUserRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public RemoveUserRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Permission<ul><li>Possible values for global permissions: admin, profileadmin, gateadmin, scan, provisioning</li><li>Possible values for project permissions admin, codeviewer, issueadmin, scan, user</li></ul> + * + * This is a mandatory parameter. + */ + public RemoveUserRequest setPermission(String permission) { + this.permission = permission; + return this; + } + + public String getPermission() { + return permission; + } + + /** + * Project id + * + * Example value: "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + */ + public RemoveUserRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public RemoveUserRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/SearchGlobalPermissionsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/SearchGlobalPermissionsRequest.java new file mode 100644 index 00000000000..8c80f3ee37f --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/SearchGlobalPermissionsRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import javax.annotation.Generated; + +/** + * List global permissions. <br />Requires the following permission: 'Administer System' + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/search_global_permissions">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class SearchGlobalPermissionsRequest { + + private String organization; + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public SearchGlobalPermissionsRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/SearchProjectPermissionsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/SearchProjectPermissionsRequest.java new file mode 100644 index 00000000000..a7c8a41f8ba --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/SearchProjectPermissionsRequest.java @@ -0,0 +1,128 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import javax.annotation.Generated; + +/** + * List project permissions. A project can be a technical project, a view or a developer.<br />Requires one of the following permissions:<ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/search_project_permissions">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class SearchProjectPermissionsRequest { + + private String p; + private String projectId; + private String projectKey; + private String ps; + private String q; + private String qualifier; + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchProjectPermissionsRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Project id + * + * Example value: "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + */ + public SearchProjectPermissionsRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public SearchProjectPermissionsRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } + + /** + * Page size. Must be greater than 0. + * + * Example value: "20" + */ + public SearchProjectPermissionsRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to: <ul><li>project names that contain the supplied string</li><li>project keys that are exactly the same as the supplied string</li></ul> + * + * Example value: "apac" + */ + public SearchProjectPermissionsRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Project qualifier. Filter the results with the specified qualifier. Possible values are:<ul><li>TRK - Projects</li></ul> + * + * Possible values: + * <ul> + * <li>"TRK"</li> + * </ul> + */ + public SearchProjectPermissionsRequest setQualifier(String qualifier) { + this.qualifier = qualifier; + return this; + } + + public String getQualifier() { + return qualifier; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/SearchTemplatesRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/SearchTemplatesRequest.java new file mode 100644 index 00000000000..b6516a869ff --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/SearchTemplatesRequest.java @@ -0,0 +1,66 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import javax.annotation.Generated; + +/** + * List permission templates.<br />Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/search_templates">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class SearchTemplatesRequest { + + private String organization; + private String q; + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public SearchTemplatesRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Limit search to permission template names that contain the supplied string. + * + * Example value: "defau" + */ + public SearchTemplatesRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/SetDefaultTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/SetDefaultTemplateRequest.java new file mode 100644 index 00000000000..c20a6379972 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/SetDefaultTemplateRequest.java @@ -0,0 +1,99 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import javax.annotation.Generated; + +/** + * Set a permission template as default.<br />Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/set_default_template">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class SetDefaultTemplateRequest { + + private String organization; + private String qualifier; + private String templateId; + private String templateName; + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public SetDefaultTemplateRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Project qualifier. Filter the results with the specified qualifier. Possible values are:<ul><li>TRK - Projects</li></ul> + * + * Possible values: + * <ul> + * <li>"TRK"</li> + * </ul> + */ + public SetDefaultTemplateRequest setQualifier(String qualifier) { + this.qualifier = qualifier; + return this; + } + + public String getQualifier() { + return qualifier; + } + + /** + * Template id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public SetDefaultTemplateRequest setTemplateId(String templateId) { + this.templateId = templateId; + return this; + } + + public String getTemplateId() { + return templateId; + } + + /** + * Template name + * + * Example value: "Default Permission Template for Projects" + */ + public SetDefaultTemplateRequest setTemplateName(String templateName) { + this.templateName = templateName; + return this; + } + + public String getTemplateName() { + return templateName; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/TemplateGroupsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/TemplateGroupsRequest.java new file mode 100644 index 00000000000..f487c178803 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/TemplateGroupsRequest.java @@ -0,0 +1,149 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import javax.annotation.Generated; + +/** + * Lists the groups with their permission as individual groups rather than through user affiliation on the chosen template.<br />This service defaults to all groups, but can be limited to groups with a specific permission by providing the desired permission.<br>Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/template_groups">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class TemplateGroupsRequest { + + private String organization; + private String p; + private String permission; + private String ps; + private String q; + private String templateId; + private String templateName; + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public TemplateGroupsRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public TemplateGroupsRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Permission<ul><li>Possible values for project permissions admin, codeviewer, issueadmin, scan, user</li></ul> + * + * This is a mandatory parameter. + * Possible values: + * <ul> + * <li>"admin"</li> + * <li>"codeviewer"</li> + * <li>"issueadmin"</li> + * <li>"scan"</li> + * <li>"user"</li> + * </ul> + */ + public TemplateGroupsRequest setPermission(String permission) { + this.permission = permission; + return this; + } + + public String getPermission() { + return permission; + } + + /** + * Page size. Must be greater than 0 and less than 100 + * + * Example value: "20" + */ + public TemplateGroupsRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to group names that contain the supplied string. <br/>When this parameter is not set, only group having at least one permission are returned. + * + * Example value: "eri" + */ + public TemplateGroupsRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Template id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public TemplateGroupsRequest setTemplateId(String templateId) { + this.templateId = templateId; + return this; + } + + public String getTemplateId() { + return templateId; + } + + /** + * Template name + * + * Example value: "Default Permission Template for Projects" + */ + public TemplateGroupsRequest setTemplateName(String templateName) { + this.templateName = templateName; + return this; + } + + public String getTemplateName() { + return templateName; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/TemplateUsersRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/TemplateUsersRequest.java new file mode 100644 index 00000000000..06b4f0dc829 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/TemplateUsersRequest.java @@ -0,0 +1,148 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import javax.annotation.Generated; + +/** + * Lists the users with their permission as individual users rather than through group affiliation on the chosen template. <br />This service defaults to all users, but can be limited to users with a specific permission by providing the desired permission.<br>Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/template_users">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class TemplateUsersRequest { + + private String organization; + private String p; + private String permission; + private String ps; + private String q; + private String templateId; + private String templateName; + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public TemplateUsersRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public TemplateUsersRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Permission<ul><li>Possible values for project permissions admin, codeviewer, issueadmin, scan, user</li></ul> + * + * Possible values: + * <ul> + * <li>"admin"</li> + * <li>"codeviewer"</li> + * <li>"issueadmin"</li> + * <li>"scan"</li> + * <li>"user"</li> + * </ul> + */ + public TemplateUsersRequest setPermission(String permission) { + this.permission = permission; + return this; + } + + public String getPermission() { + return permission; + } + + /** + * Page size. Must be greater than 0 and less than 100 + * + * Example value: "20" + */ + public TemplateUsersRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to user names that contain the supplied string. <br/>When this parameter is not set, only users having at least one permission are returned. + * + * Example value: "eri" + */ + public TemplateUsersRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Template id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public TemplateUsersRequest setTemplateId(String templateId) { + this.templateId = templateId; + return this; + } + + public String getTemplateId() { + return templateId; + } + + /** + * Template name + * + * Example value: "Default Permission Template for Projects" + */ + public TemplateUsersRequest setTemplateName(String templateName) { + this.templateName = templateName; + return this; + } + + public String getTemplateName() { + return templateName; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/UpdateTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/UpdateTemplateRequest.java new file mode 100644 index 00000000000..c24840900e8 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/UpdateTemplateRequest.java @@ -0,0 +1,96 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import javax.annotation.Generated; + +/** + * Update a permission template.<br />Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/update_template">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class UpdateTemplateRequest { + + private String description; + private String id; + private String name; + private String projectKeyPattern; + + /** + * Description + * + * Example value: "Permissions for all projects related to the financial service" + */ + public UpdateTemplateRequest setDescription(String description) { + this.description = description; + return this; + } + + public String getDescription() { + return description; + } + + /** + * Id + * + * This is a mandatory parameter. + * Example value: "af8cb8cc-1e78-4c4e-8c00-ee8e814009a5" + */ + public UpdateTemplateRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } + + /** + * Name + * + * Example value: "Financial Service Permissions" + */ + public UpdateTemplateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * Project key pattern. Must be a valid Java regular expression + * + * Example value: ".*\\.finance\\..*" + */ + public UpdateTemplateRequest setProjectKeyPattern(String projectKeyPattern) { + this.projectKeyPattern = projectKeyPattern; + return this; + } + + public String getProjectKeyPattern() { + return projectKeyPattern; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/UsersRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/UsersRequest.java new file mode 100644 index 00000000000..5b3e6486c64 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/UsersRequest.java @@ -0,0 +1,140 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.permissions; + +import javax.annotation.Generated; + +/** + * Lists the users with their permissions as individual users rather than through group affiliation.<br>This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.<br> This service defaults to all users, but can be limited to users with a specific permission by providing the desired permission.<br>Requires one of the following permissions:<ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/permissions/users">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class UsersRequest { + + private String organization; + private String p; + private String permission; + private String projectId; + private String projectKey; + private String ps; + private String q; + + /** + * Key of organization, used when group name is set + * + * This is part of the internal API. + * Example value: "my-org" + */ + public UsersRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public UsersRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Permission<ul><li>Possible values for global permissions: admin, profileadmin, gateadmin, scan, provisioning</li><li>Possible values for project permissions admin, codeviewer, issueadmin, scan, user</li></ul> + * + */ + public UsersRequest setPermission(String permission) { + this.permission = permission; + return this; + } + + public String getPermission() { + return permission; + } + + /** + * Project id + * + * Example value: "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + */ + public UsersRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public UsersRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } + + /** + * Page size. Must be greater than 0 and less than 100 + * + * Example value: "20" + */ + public UsersRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to user names that contain the supplied string. <br/>When this parameter is not set, only users having at least one permission are returned. + * + * Example value: "eri" + */ + public UsersRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/package-info.java new file mode 100644 index 00000000000..c2d92162d1f --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.permissions; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/InstallRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/InstallRequest.java new file mode 100644 index 00000000000..7071deb6fdd --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/InstallRequest.java @@ -0,0 +1,50 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.plugins; + +import javax.annotation.Generated; + +/** + * Installs the latest version of a plugin specified by its key.<br/>Plugin information is retrieved from Update Center.<br/>Requires user to be authenticated with Administer System permissions + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/plugins/install">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class InstallRequest { + + private String key; + + /** + * The key identifying the plugin to install + * + * This is a mandatory parameter. + */ + public InstallRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/InstalledRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/InstalledRequest.java new file mode 100644 index 00000000000..0e488b7912a --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/InstalledRequest.java @@ -0,0 +1,54 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.plugins; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Get the list of all the plugins installed on the SonarQube instance, sorted by plugin name. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/plugins/installed">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class InstalledRequest { + + private List<String> f; + + /** + * Comma-separated list of the additional fields to be returned in response. No additional field is returned by default. Possible values are:<ul><li>category - category as defined in the Update Center. A connection to the Update Center is needed</li></lu> + * + * Possible values: + * <ul> + * <li>"category"</li> + * </ul> + */ + public InstalledRequest setF(List<String> f) { + this.f = f; + return this; + } + + public List<String> getF() { + return f; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/PluginsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/PluginsService.java new file mode 100644 index 00000000000..f69d312f2dd --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/PluginsService.java @@ -0,0 +1,164 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.plugins; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Manage the plugins on the server, including installing, uninstalling, and upgrading. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/plugins">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class PluginsService extends BaseService { + + public PluginsService(WsConnector wsConnector) { + super(wsConnector, "api/plugins"); + } + + /** + * Get the list of all the plugins available for installation on the SonarQube instance, sorted by plugin name.<br/>Plugin information is retrieved from Update Center. Date and time at which Update Center was last refreshed is provided in the response.<br/>Update status values are: <ul><li>COMPATIBLE: plugin is compatible with current SonarQube instance.</li><li>INCOMPATIBLE: plugin is not compatible with current SonarQube instance.</li><li>REQUIRES_SYSTEM_UPGRADE: plugin requires SonarQube to be upgraded before being installed.</li><li>DEPS_REQUIRE_SYSTEM_UPGRADE: at least one plugin on which the plugin is dependent requires SonarQube to be upgraded.</li></ul>Require 'Administer System' permission. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/plugins/available">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public String available() { + return call( + new GetRequest(path("available")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Cancels any operation pending on any plugin (install, update or uninstall)<br/>Requires user to be authenticated with Administer System permissions + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/plugins/cancel_all">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void cancelAll() { + call( + new PostRequest(path("cancel_all")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Installs the latest version of a plugin specified by its key.<br/>Plugin information is retrieved from Update Center.<br/>Requires user to be authenticated with Administer System permissions + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/plugins/install">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void install(InstallRequest request) { + call( + new PostRequest(path("install")) + .setParam("key", request.getKey()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get the list of all the plugins installed on the SonarQube instance, sorted by plugin name. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/plugins/installed">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public String installed(InstalledRequest request) { + return call( + new GetRequest(path("installed")) + .setParam("f", request.getF() == null ? null : request.getF().stream().collect(Collectors.joining(","))) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get the list of plugins which will either be installed or removed at the next startup of the SonarQube instance, sorted by plugin name.<br/>Require 'Administer System' permission. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/plugins/pending">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public String pending() { + return call( + new GetRequest(path("pending")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Uninstalls the plugin specified by its key.<br/>Requires user to be authenticated with Administer System permissions. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/plugins/uninstall">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void uninstall(UninstallRequest request) { + call( + new PostRequest(path("uninstall")) + .setParam("key", request.getKey()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Updates a plugin specified by its key to the latest version compatible with the SonarQube instance.<br/>Plugin information is retrieved from Update Center.<br/>Requires user to be authenticated with Administer System permissions + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/plugins/update">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void update(UpdateRequest request) { + call( + new PostRequest(path("update")) + .setParam("key", request.getKey()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Lists plugins installed on the SonarQube instance for which at least one newer version is available, sorted by plugin name.<br/>Each newer version is listed, ordered from the oldest to the newest, with its own update/compatibility status.<br/>Plugin information is retrieved from Update Center. Date and time at which Update Center was last refreshed is provided in the response.<br/>Update status values are: [COMPATIBLE, INCOMPATIBLE, REQUIRES_UPGRADE, DEPS_REQUIRE_UPGRADE].<br/>Require 'Administer System' permission. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/plugins/updates">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public String updates() { + return call( + new GetRequest(path("updates")) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/UninstallRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/UninstallRequest.java new file mode 100644 index 00000000000..0d2c1a5a947 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/UninstallRequest.java @@ -0,0 +1,50 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.plugins; + +import javax.annotation.Generated; + +/** + * Uninstalls the plugin specified by its key.<br/>Requires user to be authenticated with Administer System permissions. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/plugins/uninstall">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class UninstallRequest { + + private String key; + + /** + * The key identifying the plugin to uninstall + * + * This is a mandatory parameter. + */ + public UninstallRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/UpdateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/UpdateRequest.java new file mode 100644 index 00000000000..d79280307b3 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/UpdateRequest.java @@ -0,0 +1,50 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.plugins; + +import javax.annotation.Generated; + +/** + * Updates a plugin specified by its key to the latest version compatible with the SonarQube instance.<br/>Plugin information is retrieved from Update Center.<br/>Requires user to be authenticated with Administer System permissions + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/plugins/update">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class UpdateRequest { + + private String key; + + /** + * The key identifying the plugin to update + * + * This is a mandatory parameter. + */ + public UpdateRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/package-info.java new file mode 100644 index 00000000000..d5fcdab6ddf --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.plugins; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/profiles/ProfilesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/profiles/ProfilesService.java new file mode 100644 index 00000000000..9fba324adc2 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/profiles/ProfilesService.java @@ -0,0 +1,74 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.profiles; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Removed since 6.3, please use api/qualityprofiles instead + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/profiles">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class ProfilesService extends BaseService { + + public ProfilesService(WsConnector wsConnector) { + super(wsConnector, "api/profiles"); + } + + /** + * Get a profile.<br/>The web service is removed and you're invited to use api/qualityprofiles/search instead + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/profiles/index">Further information about this action online (including a response example)</a> + * @since 3.3 + * @deprecated since 5.2 + */ + @Deprecated + public String index() { + return call( + new GetRequest(path("index")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get a list of profiles.<br/>The web service is removed and you're invited to use api/qualityprofiles/search instead + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/profiles/list">Further information about this action online (including a response example)</a> + * @since 3.3 + * @deprecated since 5.2 + */ + @Deprecated + public String list() { + return call( + new GetRequest(path("list")) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/profiles/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/profiles/package-info.java new file mode 100644 index 00000000000..1d4569b89bc --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/profiles/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.profiles; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/CreateEventRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/CreateEventRequest.java new file mode 100644 index 00000000000..2067c95641f --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/CreateEventRequest.java @@ -0,0 +1,86 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projectanalyses; + +import javax.annotation.Generated; + +/** + * Create a project analysis event.<br>Only event of category 'VERSION' and 'OTHER' can be created.<br>Requires one of the following permissions:<ul> <li>'Administer System'</li> <li>'Administer' rights on the specified project</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_analyses/create_event">Further information about this action online (including a response example)</a> + * @since 6.3 + */ +@Generated("sonar-ws-generator") +public class CreateEventRequest { + + private String analysis; + private String category; + private String name; + + /** + * Analysis key + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public CreateEventRequest setAnalysis(String analysis) { + this.analysis = analysis; + return this; + } + + public String getAnalysis() { + return analysis; + } + + /** + * Category + * + * Possible values: + * <ul> + * <li>"VERSION"</li> + * <li>"OTHER"</li> + * </ul> + */ + public CreateEventRequest setCategory(String category) { + this.category = category; + return this; + } + + public String getCategory() { + return category; + } + + /** + * Name + * + * This is a mandatory parameter. + * Example value: "5.6" + */ + public CreateEventRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/DeleteEventRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/DeleteEventRequest.java new file mode 100644 index 00000000000..26e730c9a2c --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/DeleteEventRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projectanalyses; + +import javax.annotation.Generated; + +/** + * Delete a project analysis event.<br>Only event of category 'VERSION' and 'OTHER' can be deleted.<br>Requires one of the following permissions:<ul> <li>'Administer System'</li> <li>'Administer' rights on the specified project</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_analyses/delete_event">Further information about this action online (including a response example)</a> + * @since 6.3 + */ +@Generated("sonar-ws-generator") +public class DeleteEventRequest { + + private String event; + + /** + * Event key + * + * This is a mandatory parameter. + * Example value: "AU-TpxcA-iU5OvuD2FLz" + */ + public DeleteEventRequest setEvent(String event) { + this.event = event; + return this; + } + + public String getEvent() { + return event; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/DeleteRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/DeleteRequest.java new file mode 100644 index 00000000000..952c2075bf6 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/DeleteRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projectanalyses; + +import javax.annotation.Generated; + +/** + * Delete a project analysis.<br>Requires one of the following permissions:<ul> <li>'Administer System'</li> <li>'Administer' rights on the project of the specified analysis</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_analyses/delete">Further information about this action online (including a response example)</a> + * @since 6.3 + */ +@Generated("sonar-ws-generator") +public class DeleteRequest { + + private String analysis; + + /** + * Analysis key + * + * This is a mandatory parameter. + * Example value: "AU-TpxcA-iU5OvuD2FL1" + */ + public DeleteRequest setAnalysis(String analysis) { + this.analysis = analysis; + return this; + } + + public String getAnalysis() { + return analysis; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/ProjectAnalysesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/ProjectAnalysesService.java new file mode 100644 index 00000000000..2e3718dde49 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/ProjectAnalysesService.java @@ -0,0 +1,128 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projectanalyses; + +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.ProjectAnalyses.CreateEventResponse; +import org.sonarqube.ws.ProjectAnalyses.SearchResponse; +import org.sonarqube.ws.ProjectAnalyses.UpdateEventResponse; + +/** + * Manage project analyses. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_analyses">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class ProjectAnalysesService extends BaseService { + + public ProjectAnalysesService(WsConnector wsConnector) { + super(wsConnector, "api/project_analyses"); + } + + /** + * Create a project analysis event.<br>Only event of category 'VERSION' and 'OTHER' can be created.<br>Requires one of the following permissions:<ul> <li>'Administer System'</li> <li>'Administer' rights on the specified project</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_analyses/create_event">Further information about this action online (including a response example)</a> + * @since 6.3 + */ + public CreateEventResponse createEvent(CreateEventRequest request) { + return call( + new PostRequest(path("create_event")) + .setParam("analysis", request.getAnalysis()) + .setParam("category", request.getCategory()) + .setParam("name", request.getName()), + CreateEventResponse.parser()); + } + + /** + * Delete a project analysis.<br>Requires one of the following permissions:<ul> <li>'Administer System'</li> <li>'Administer' rights on the project of the specified analysis</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_analyses/delete">Further information about this action online (including a response example)</a> + * @since 6.3 + */ + public void delete(DeleteRequest request) { + call( + new PostRequest(path("delete")) + .setParam("analysis", request.getAnalysis()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Delete a project analysis event.<br>Only event of category 'VERSION' and 'OTHER' can be deleted.<br>Requires one of the following permissions:<ul> <li>'Administer System'</li> <li>'Administer' rights on the specified project</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_analyses/delete_event">Further information about this action online (including a response example)</a> + * @since 6.3 + */ + public void deleteEvent(DeleteEventRequest request) { + call( + new PostRequest(path("delete_event")) + .setParam("event", request.getEvent()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Search a project analyses and attached events.<br>Requires the following permission: 'Browse' on the specified project + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_analyses/search">Further information about this action online (including a response example)</a> + * @since 6.3 + */ + public SearchResponse search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("branch", request.getBranch()) + .setParam("category", request.getCategory()) + .setParam("from", request.getFrom()) + .setParam("p", request.getP()) + .setParam("project", request.getProject()) + .setParam("ps", request.getPs()) + .setParam("to", request.getTo()), + SearchResponse.parser()); + } + + /** + * Update a project analysis event.<br>Only events of category 'VERSION' and 'OTHER' can be updated.<br>Requires one of the following permissions:<ul> <li>'Administer System'</li> <li>'Administer' rights on the specified project</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_analyses/update_event">Further information about this action online (including a response example)</a> + * @since 6.3 + */ + public UpdateEventResponse updateEvent(UpdateEventRequest request) { + return call( + new PostRequest(path("update_event")) + .setParam("event", request.getEvent()) + .setParam("name", request.getName()), + UpdateEventResponse.parser()); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/SearchRequest.java new file mode 100644 index 00000000000..5f44cc4dfe9 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/SearchRequest.java @@ -0,0 +1,149 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projectanalyses; + +import javax.annotation.Generated; + +/** + * Search a project analyses and attached events.<br>Requires the following permission: 'Browse' on the specified project + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_analyses/search">Further information about this action online (including a response example)</a> + * @since 6.3 + */ +@Generated("sonar-ws-generator") +public class SearchRequest { + + private String branch; + private String category; + private String from; + private String p; + private String project; + private String ps; + private String to; + + /** + * Branch key + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public SearchRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * Event category. Filter analyses that have at least one event of the category specified. + * + * Example value: "OTHER" + * Possible values: + * <ul> + * <li>"VERSION"</li> + * <li>"OTHER"</li> + * <li>"QUALITY_PROFILE"</li> + * <li>"QUALITY_GATE"</li> + * </ul> + */ + public SearchRequest setCategory(String category) { + this.category = category; + return this; + } + + public String getCategory() { + return category; + } + + /** + * Filter analyses created after the given date (inclusive). <br>Either a date (server timezone) or datetime can be provided + * + * Example value: "2013-05-01" + */ + public SearchRequest setFrom(String from) { + this.from = from; + return this; + } + + public String getFrom() { + return from; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Project key + * + * This is a mandatory parameter. + * Example value: "my_project" + */ + public SearchRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public SearchRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Filter analyses created before the given date (inclusive). <br>Either a date (server timezone) or datetime can be provided + * + * Example value: "2017-10-19 or 2017-10-19T13:00:00+0200" + */ + public SearchRequest setTo(String to) { + this.to = to; + return this; + } + + public String getTo() { + return to; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/UpdateEventRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/UpdateEventRequest.java new file mode 100644 index 00000000000..52107933793 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/UpdateEventRequest.java @@ -0,0 +1,66 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projectanalyses; + +import javax.annotation.Generated; + +/** + * Update a project analysis event.<br>Only events of category 'VERSION' and 'OTHER' can be updated.<br>Requires one of the following permissions:<ul> <li>'Administer System'</li> <li>'Administer' rights on the specified project</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_analyses/update_event">Further information about this action online (including a response example)</a> + * @since 6.3 + */ +@Generated("sonar-ws-generator") +public class UpdateEventRequest { + + private String event; + private String name; + + /** + * Event key + * + * This is a mandatory parameter. + * Example value: "AU-TpxcA-iU5OvuD2FL5" + */ + public UpdateEventRequest setEvent(String event) { + this.event = event; + return this; + } + + public String getEvent() { + return event; + } + + /** + * New name + * + * Example value: "5.6" + */ + public UpdateEventRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/package-info.java new file mode 100644 index 00000000000..81b12f75d62 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.projectanalyses; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/DeleteRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/DeleteRequest.java new file mode 100644 index 00000000000..6a11d73ecc4 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/DeleteRequest.java @@ -0,0 +1,67 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +/** + * Delete a non-main branch of a project.<br/>Requires 'Administer' rights on the specified project. + * + * 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/delete">Further information about this action online (including a response example)</a> + * @since 6.6 + */ +@Generated("sonar-ws-generator") +public class DeleteRequest { + + private String branch; + private String project; + + /** + * Name of the branch + * + * This is a mandatory parameter. + * Example value: "branch1" + */ + public DeleteRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * Project key + * + * This is a mandatory parameter. + * Example value: "my_project" + */ + public DeleteRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/ListRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/ListRequest.java new file mode 100644 index 00000000000..d090fe3541a --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/ListRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +/** + * List the branches of a project.<br/>Requires 'Administer' rights on the specified project. + * + * 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/list">Further information about this action online (including a response example)</a> + * @since 6.6 + */ +@Generated("sonar-ws-generator") +public class ListRequest { + + private String project; + + /** + * Project key + * + * This is a mandatory parameter. + * Example value: "my_project" + */ + public ListRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesService.java new file mode 100644 index 00000000000..65d7ba82530 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesService.java @@ -0,0 +1,89 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; +import org.sonarqube.ws.MediaTypes; +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; + +/** + * Manage branch (only available when the Branch plugin is installed) + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_branches">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class ProjectBranchesService extends BaseService { + + public ProjectBranchesService(WsConnector wsConnector) { + super(wsConnector, "api/project_branches"); + } + + /** + * Delete a non-main branch of a project.<br/>Requires 'Administer' rights on the specified project. + * + * 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/delete">Further information about this action online (including a response example)</a> + * @since 6.6 + */ + public String delete(DeleteRequest request) { + return call( + new PostRequest(path("delete")) + .setParam("branch", request.getBranch()) + .setParam("project", request.getProject()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * List the branches of a project.<br/>Requires 'Administer' rights on the specified project. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_branches/list">Further information about this action online (including a response example)</a> + * @since 6.6 + */ + public ListWsResponse list(ListRequest request) { + return call( + new GetRequest(path("list")) + .setParam("project", request.getProject()), + ListWsResponse.parser()); + } + + /** + * Rename the main branch of a project.<br/>Requires 'Administer' permission on the specified project. + * + * 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/rename">Further information about this action online (including a response example)</a> + * @since 6.6 + */ + public void rename(RenameRequest request) { + call( + new PostRequest(path("rename")) + .setParam("name", request.getName()) + .setParam("project", request.getProject()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/RenameRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/RenameRequest.java new file mode 100644 index 00000000000..5fcae6747cf --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/RenameRequest.java @@ -0,0 +1,67 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +/** + * Rename the main branch of a project.<br/>Requires 'Administer' permission on the specified project. + * + * 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/rename">Further information about this action online (including a response example)</a> + * @since 6.6 + */ +@Generated("sonar-ws-generator") +public class RenameRequest { + + private String name; + private String project; + + /** + * New name of the main branch + * + * This is a mandatory parameter. + * Example value: "branch1" + */ + public RenameRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * Project key + * + * This is a mandatory parameter. + * Example value: "my_project" + */ + public RenameRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/package-info.java new file mode 100644 index 00000000000..148ff98162a --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.projectbranches; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/CreateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/CreateRequest.java new file mode 100644 index 00000000000..a1eb6b33e60 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/CreateRequest.java @@ -0,0 +1,97 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projectlinks; + +import javax.annotation.Generated; + +/** + * Create a new project link.<br>Requires 'Administer' permission on the specified project, or global 'Administer' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_links/create">Further information about this action online (including a response example)</a> + * @since 6.1 + */ +@Generated("sonar-ws-generator") +public class CreateRequest { + + private String name; + private String projectId; + private String projectKey; + private String url; + + /** + * Link name + * + * This is a mandatory parameter. + * Example value: "Custom" + */ + public CreateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * Project id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public CreateRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public CreateRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } + + /** + * Link url + * + * This is a mandatory parameter. + * Example value: "http://example.com" + */ + public CreateRequest setUrl(String url) { + this.url = url; + return this; + } + + public String getUrl() { + return url; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/DeleteRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/DeleteRequest.java new file mode 100644 index 00000000000..84d04b7ad92 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/DeleteRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projectlinks; + +import javax.annotation.Generated; + +/** + * Delete existing project link.<br>Requires 'Administer' permission on the specified project, or global 'Administer' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_links/delete">Further information about this action online (including a response example)</a> + * @since 6.1 + */ +@Generated("sonar-ws-generator") +public class DeleteRequest { + + private String id; + + /** + * Link id + * + * This is a mandatory parameter. + * Example value: "17" + */ + public DeleteRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/ProjectLinksService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/ProjectLinksService.java new file mode 100644 index 00000000000..bfb20b9ab1a --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/ProjectLinksService.java @@ -0,0 +1,91 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projectlinks; + +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.ProjectLinks.CreateWsResponse; +import org.sonarqube.ws.ProjectLinks.SearchWsResponse; + +/** + * Manage projects links. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_links">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class ProjectLinksService extends BaseService { + + public ProjectLinksService(WsConnector wsConnector) { + super(wsConnector, "api/project_links"); + } + + /** + * Create a new project link.<br>Requires 'Administer' permission on the specified project, or global 'Administer' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_links/create">Further information about this action online (including a response example)</a> + * @since 6.1 + */ + public CreateWsResponse create(CreateRequest request) { + return call( + new PostRequest(path("create")) + .setParam("name", request.getName()) + .setParam("projectId", request.getProjectId()) + .setParam("projectKey", request.getProjectKey()) + .setParam("url", request.getUrl()), + CreateWsResponse.parser()); + } + + /** + * Delete existing project link.<br>Requires 'Administer' permission on the specified project, or global 'Administer' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_links/delete">Further information about this action online (including a response example)</a> + * @since 6.1 + */ + public void delete(DeleteRequest request) { + call( + new PostRequest(path("delete")) + .setParam("id", request.getId()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * List links of a project.<br>The 'projectId' or 'projectKey' must be provided.<br>Requires one of the following permissions:<ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li><li>'Browse' on the specified project</li></ul> + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_links/search">Further information about this action online (including a response example)</a> + * @since 6.1 + */ + public SearchWsResponse search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("projectId", request.getProjectId()) + .setParam("projectKey", request.getProjectKey()), + SearchWsResponse.parser()); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/SearchRequest.java new file mode 100644 index 00000000000..f86f84a91f7 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/SearchRequest.java @@ -0,0 +1,65 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projectlinks; + +import javax.annotation.Generated; + +/** + * List links of a project.<br>The 'projectId' or 'projectKey' must be provided.<br>Requires one of the following permissions:<ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li><li>'Browse' on the specified project</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_links/search">Further information about this action online (including a response example)</a> + * @since 6.1 + */ +@Generated("sonar-ws-generator") +public class SearchRequest { + + private String projectId; + private String projectKey; + + /** + * Project Id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public SearchRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * Project Key + * + * Example value: "my_project" + */ + public SearchRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/package-info.java new file mode 100644 index 00000000000..01d51ffb385 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.projectlinks; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/BulkDeleteRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/BulkDeleteRequest.java new file mode 100644 index 00000000000..cdd0d7e73a2 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/BulkDeleteRequest.java @@ -0,0 +1,174 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projects; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Delete one or several projects.<br />Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/projects/bulk_delete">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class BulkDeleteRequest { + + private String analyzedBefore; + private String onProvisionedOnly; + private String organization; + private List<String> projectIds; + private List<String> projects; + private String q; + private List<String> qualifiers; + private String visibility; + + /** + * Filter the projects for which last analysis is older than the given date (exclusive).<br> Either a date (server timezone) or datetime can be provided. + * + * Example value: "2017-10-19 or 2017-10-19T13:00:00+0200" + */ + public BulkDeleteRequest setAnalyzedBefore(String analyzedBefore) { + this.analyzedBefore = analyzedBefore; + return this; + } + + public String getAnalyzedBefore() { + return analyzedBefore; + } + + /** + * Filter the projects that are provisioned + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public BulkDeleteRequest setOnProvisionedOnly(String onProvisionedOnly) { + this.onProvisionedOnly = onProvisionedOnly; + return this; + } + + public String getOnProvisionedOnly() { + return onProvisionedOnly; + } + + /** + * The key of the organization + * + * This is part of the internal API. + */ + public BulkDeleteRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Comma-separated list of project ids + * + * Example value: "AU-Tpxb--iU5OvuD2FLy,AU-TpxcA-iU5OvuD2FLz" + * @deprecated since 6.4 + */ + @Deprecated + public BulkDeleteRequest setProjectIds(List<String> projectIds) { + this.projectIds = projectIds; + return this; + } + + public List<String> getProjectIds() { + return projectIds; + } + + /** + * Comma-separated list of project keys + * + * Example value: "my_project,another_project" + */ + public BulkDeleteRequest setProjects(List<String> projects) { + this.projects = projects; + return this; + } + + public List<String> getProjects() { + return projects; + } + + /** + * Limit to: <ul><li>component names that contain the supplied string</li><li>component keys that contain the supplied string</li></ul> + * + * Example value: "sonar" + */ + public BulkDeleteRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Comma-separated list of component qualifiers. Filter the results with the specified qualifiers + * + * Possible values: + * <ul> + * <li>"TRK"</li> + * <li>"VW"</li> + * <li>"APP"</li> + * </ul> + */ + public BulkDeleteRequest setQualifiers(List<String> qualifiers) { + this.qualifiers = qualifiers; + return this; + } + + public List<String> getQualifiers() { + return qualifiers; + } + + /** + * Filter the projects that should be visible to everyone (public), or only specific user/groups (private).<br/>If no visibility is specified, the default project visibility of the organization will be used. + * + * This is part of the internal API. + * Possible values: + * <ul> + * <li>"private"</li> + * <li>"public"</li> + * </ul> + */ + public BulkDeleteRequest setVisibility(String visibility) { + this.visibility = visibility; + return this; + } + + public String getVisibility() { + return visibility; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/BulkUpdateKeyRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/BulkUpdateKeyRequest.java new file mode 100644 index 00000000000..a8c6cab5645 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/BulkUpdateKeyRequest.java @@ -0,0 +1,120 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projects; + +import javax.annotation.Generated; + +/** + * Bulk update a project or module key and all its sub-components keys. The bulk update allows to replace a part of the current key by another string on the current project and all its sub-modules.<br>It's possible to simulate the bulk update by setting the parameter 'dryRun' at true. No key is updated with a dry run.<br>Ex: to rename a project with key 'my_project' to 'my_new_project' and all its sub-components keys, call the WS with parameters:<ul> <li>project: my_project</li> <li>from: my_</li> <li>to: my_new_</li></ul>Either 'projectId' or 'project' must be provided.<br> Requires one of the following permissions: <ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/projects/bulk_update_key">Further information about this action online (including a response example)</a> + * @since 6.1 + */ +@Generated("sonar-ws-generator") +public class BulkUpdateKeyRequest { + + private String dryRun; + private String from; + private String project; + private String projectId; + private String to; + + /** + * Simulate bulk update. No component key is updated. + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public BulkUpdateKeyRequest setDryRun(String dryRun) { + this.dryRun = dryRun; + return this; + } + + public String getDryRun() { + return dryRun; + } + + /** + * String to match in components keys + * + * This is a mandatory parameter. + * Example value: "_old" + */ + public BulkUpdateKeyRequest setFrom(String from) { + this.from = from; + return this; + } + + public String getFrom() { + return from; + } + + /** + * Project or module key + * + * Example value: "my_old_project" + */ + public BulkUpdateKeyRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } + + /** + * Project or module ID + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + * @deprecated since 6.4 + */ + @Deprecated + public BulkUpdateKeyRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * String replacement in components keys + * + * This is a mandatory parameter. + * Example value: "_new" + */ + public BulkUpdateKeyRequest setTo(String to) { + this.to = to; + return this; + } + + public String getTo() { + return to; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/CreateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/CreateRequest.java new file mode 100644 index 00000000000..6ba628ab9cd --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/CreateRequest.java @@ -0,0 +1,117 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projects; + +import javax.annotation.Generated; + +/** + * Create a project.<br/>Requires 'Create Projects' permission + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/projects/create">Further information about this action online (including a response example)</a> + * @since 4.0 + */ +@Generated("sonar-ws-generator") +public class CreateRequest { + + private String branch; + private String name; + private String organization; + private String project; + private String visibility; + + /** + * SCM Branch of the project. The key of the project will become key:branch, for instance 'SonarQube:branch-5.0' + * + * Example value: "branch-5.0" + */ + public CreateRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * Name of the project + * + * This is a mandatory parameter. + * Example value: "SonarQube" + */ + public CreateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * The key of the organization + * + * This is part of the internal API. + */ + public CreateRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Key of the project + * + * This is a mandatory parameter. + * Example value: "my_project" + */ + public CreateRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } + + /** + * Whether the created project should be visible to everyone, or only specific user/groups.<br/>If no visibility is specified, the default project visibility of the organization will be used. + * + * This is part of the internal API. + * Possible values: + * <ul> + * <li>"private"</li> + * <li>"public"</li> + * </ul> + */ + public CreateRequest setVisibility(String visibility) { + this.visibility = visibility; + return this; + } + + public String getVisibility() { + return visibility; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/DeleteRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/DeleteRequest.java new file mode 100644 index 00000000000..b2472b60179 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/DeleteRequest.java @@ -0,0 +1,67 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projects; + +import javax.annotation.Generated; + +/** + * Delete a project.<br> Requires 'Administer System' permission or 'Administer' permission on the project. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/projects/delete">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class DeleteRequest { + + private String project; + private String projectId; + + /** + * Project key + * + * Example value: "my_project" + */ + public DeleteRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } + + /** + * Project ID + * + * Example value: "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + * @deprecated since 6.4 + */ + @Deprecated + public DeleteRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/GhostsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/GhostsRequest.java new file mode 100644 index 00000000000..44c54ea6c10 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/GhostsRequest.java @@ -0,0 +1,118 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projects; + +import java.util.List; +import javax.annotation.Generated; + +/** + * List ghost projects.<br> With the current architecture, it's no more possible to have invisible ghost projects. Therefore, the web service is deprecated.<br> Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/projects/ghosts">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class GhostsRequest { + + private List<String> f; + private String organization; + private String p; + private String ps; + private String q; + + /** + * Comma-separated list of the fields to be returned in response. All the fields are returned by default. + * + * Possible values: + * <ul> + * <li>"name"</li> + * <li>"creationDate"</li> + * <li>"visibility"</li> + * <li>"uuid"</li> + * <li>"key"</li> + * </ul> + */ + public GhostsRequest setF(List<String> f) { + this.f = f; + return this; + } + + public List<String> getF() { + return f; + } + + /** + * Organization key + * + * This is part of the internal API. + */ + public GhostsRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public GhostsRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public GhostsRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to names or keys that contain the supplied string. + * + * Example value: "sonar" + */ + public GhostsRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/IndexRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/IndexRequest.java new file mode 100644 index 00000000000..29d0bf49324 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/IndexRequest.java @@ -0,0 +1,168 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projects; + +import javax.annotation.Generated; + +/** + * This web service is deprecated, please use api/components/search instead + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/projects/index">Further information about this action online (including a response example)</a> + * @since 2.10 + */ +@Generated("sonar-ws-generator") +public class IndexRequest { + + private String desc; + private String format; + private String libs; + private String project; + private String search; + private String subprojects; + private String versions; + private String views; + + /** + * Since 6.3, this parameter has no effect + * + * @deprecated since 6.3 + */ + @Deprecated + public IndexRequest setDesc(String desc) { + this.desc = desc; + return this; + } + + public String getDesc() { + return desc; + } + + /** + * Only json response format is available + * + * Possible values: + * <ul> + * <li>"json"</li> + * </ul> + */ + public IndexRequest setFormat(String format) { + this.format = format; + return this; + } + + public String getFormat() { + return format; + } + + /** + * Since 6.3, this parameter has no effect + * + * @deprecated since 6.3 + */ + @Deprecated + public IndexRequest setLibs(String libs) { + this.libs = libs; + return this; + } + + public String getLibs() { + return libs; + } + + /** + * key or ID of the project + * + * Example value: "my_project" + */ + public IndexRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } + + /** + * Substring of project name, case insensitive. Ignored if the parameter key is set + * + * Example value: "Sonar" + */ + public IndexRequest setSearch(String search) { + this.search = search; + return this; + } + + public String getSearch() { + return search; + } + + /** + * Load sub-projects. Ignored if the parameter key is set + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public IndexRequest setSubprojects(String subprojects) { + this.subprojects = subprojects; + return this; + } + + public String getSubprojects() { + return subprojects; + } + + /** + * Since 6.3, this parameter has no effect + * + * @deprecated since 6.3 + */ + @Deprecated + public IndexRequest setVersions(String versions) { + this.versions = versions; + return this; + } + + public String getVersions() { + return versions; + } + + /** + * Since 6.3, this parameter has no effect + * + * @deprecated since 6.3 + */ + @Deprecated + public IndexRequest setViews(String views) { + this.views = views; + return this; + } + + public String getViews() { + return views; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/ProjectsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/ProjectsService.java new file mode 100644 index 00000000000..5eb04423714 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/ProjectsService.java @@ -0,0 +1,266 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projects; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.Projects.BulkUpdateKeyWsResponse; +import org.sonarqube.ws.Projects.CreateWsResponse; +import org.sonarqube.ws.Projects.SearchWsResponse; +import org.sonarqube.ws.Projects.SearchMyProjectsWsResponse; + +/** + * Manage project existence. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/projects">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class ProjectsService extends BaseService { + + public ProjectsService(WsConnector wsConnector) { + super(wsConnector, "api/projects"); + } + + /** + * Delete one or several projects.<br />Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/projects/bulk_delete">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void bulkDelete(BulkDeleteRequest request) { + call( + new PostRequest(path("bulk_delete")) + .setParam("analyzedBefore", request.getAnalyzedBefore()) + .setParam("onProvisionedOnly", request.getOnProvisionedOnly()) + .setParam("organization", request.getOrganization()) + .setParam("projectIds", request.getProjectIds() == null ? null : request.getProjectIds().stream().collect(Collectors.joining(","))) + .setParam("projects", request.getProjects() == null ? null : request.getProjects().stream().collect(Collectors.joining(","))) + .setParam("q", request.getQ()) + .setParam("qualifiers", request.getQualifiers() == null ? null : request.getQualifiers().stream().collect(Collectors.joining(","))) + .setParam("visibility", request.getVisibility()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Bulk update a project or module key and all its sub-components keys. The bulk update allows to replace a part of the current key by another string on the current project and all its sub-modules.<br>It's possible to simulate the bulk update by setting the parameter 'dryRun' at true. No key is updated with a dry run.<br>Ex: to rename a project with key 'my_project' to 'my_new_project' and all its sub-components keys, call the WS with parameters:<ul> <li>project: my_project</li> <li>from: my_</li> <li>to: my_new_</li></ul>Either 'projectId' or 'project' must be provided.<br> Requires one of the following permissions: <ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/projects/bulk_update_key">Further information about this action online (including a response example)</a> + * @since 6.1 + */ + public BulkUpdateKeyWsResponse bulkUpdateKey(BulkUpdateKeyRequest request) { + return call( + new PostRequest(path("bulk_update_key")) + .setParam("dryRun", request.getDryRun()) + .setParam("from", request.getFrom()) + .setParam("project", request.getProject()) + .setParam("projectId", request.getProjectId()) + .setParam("to", request.getTo()), + BulkUpdateKeyWsResponse.parser()); + } + + /** + * Create a project.<br/>Requires 'Create Projects' permission + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/projects/create">Further information about this action online (including a response example)</a> + * @since 4.0 + */ + public CreateWsResponse create(CreateRequest request) { + return call( + new PostRequest(path("create")) + .setParam("branch", request.getBranch()) + .setParam("name", request.getName()) + .setParam("organization", request.getOrganization()) + .setParam("project", request.getProject()) + .setParam("visibility", request.getVisibility()), + CreateWsResponse.parser()); + } + + /** + * Delete a project.<br> Requires 'Administer System' permission or 'Administer' permission on the project. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/projects/delete">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void delete(DeleteRequest request) { + call( + new PostRequest(path("delete")) + .setParam("project", request.getProject()) + .setParam("projectId", request.getProjectId()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * List ghost projects.<br> With the current architecture, it's no more possible to have invisible ghost projects. Therefore, the web service is deprecated.<br> Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/projects/ghosts">Further information about this action online (including a response example)</a> + * @since 5.2 + * @deprecated since 6.6 + */ + @Deprecated + public String ghosts(GhostsRequest request) { + return call( + new GetRequest(path("ghosts")) + .setParam("f", request.getF() == null ? null : request.getF().stream().collect(Collectors.joining(","))) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * This web service is deprecated, please use api/components/search instead + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/projects/index">Further information about this action online (including a response example)</a> + * @since 2.10 + * @deprecated since 6.3 + */ + @Deprecated + public String index(IndexRequest request) { + return call( + new GetRequest(path("index")) + .setParam("desc", request.getDesc()) + .setParam("format", request.getFormat()) + .setParam("libs", request.getLibs()) + .setParam("project", request.getProject()) + .setParam("search", request.getSearch()) + .setParam("subprojects", request.getSubprojects()) + .setParam("versions", request.getVersions()) + .setParam("views", request.getViews()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get the list of provisioned projects.<br> Web service is deprecated. Use api/projects/search instead, with onProvisionedOnly=true.<br> Require 'Create Projects' permission. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/projects/provisioned">Further information about this action online (including a response example)</a> + * @since 5.2 + * @deprecated since 6.6 + */ + @Deprecated + public String provisioned(ProvisionedRequest request) { + return call( + new GetRequest(path("provisioned")) + .setParam("f", request.getF() == null ? null : request.getF().stream().collect(Collectors.joining(","))) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Search for projects or views to administrate them.<br>Requires 'System Administrator' permission + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/projects/search">Further information about this action online (including a response example)</a> + * @since 6.3 + */ + public SearchWsResponse search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("analyzedBefore", request.getAnalyzedBefore()) + .setParam("onProvisionedOnly", request.getOnProvisionedOnly()) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("projectIds", request.getProjectIds() == null ? null : request.getProjectIds().stream().collect(Collectors.joining(","))) + .setParam("projects", request.getProjects() == null ? null : request.getProjects().stream().collect(Collectors.joining(","))) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setParam("qualifiers", request.getQualifiers() == null ? null : request.getQualifiers().stream().collect(Collectors.joining(","))) + .setParam("visibility", request.getVisibility()), + SearchWsResponse.parser()); + } + + /** + * Return list of projects for which the current user has 'Administer' permission. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/projects/search_my_projects">Further information about this action online (including a response example)</a> + * @since 6.0 + */ + public SearchMyProjectsWsResponse searchMyProjects(SearchMyProjectsRequest request) { + return call( + new GetRequest(path("search_my_projects")) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()), + SearchMyProjectsWsResponse.parser()); + } + + /** + * Update a project or module key and all its sub-components keys.<br>Either 'from' or 'projectId' must be provided.<br> Requires one of the following permissions: <ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/projects/update_key">Further information about this action online (including a response example)</a> + * @since 6.1 + */ + public void updateKey(UpdateKeyRequest request) { + call( + new PostRequest(path("update_key")) + .setParam("from", request.getFrom()) + .setParam("projectId", request.getProjectId()) + .setParam("to", request.getTo()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Updates visibility of a project.<br>Requires 'Project administer' permission on the specified project + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/projects/update_visibility">Further information about this action online (including a response example)</a> + * @since 6.4 + */ + public void updateVisibility(UpdateVisibilityRequest request) { + call( + new PostRequest(path("update_visibility")) + .setParam("project", request.getProject()) + .setParam("visibility", request.getVisibility()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/ProvisionedRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/ProvisionedRequest.java new file mode 100644 index 00000000000..39c2d8a254a --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/ProvisionedRequest.java @@ -0,0 +1,118 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projects; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Get the list of provisioned projects.<br> Web service is deprecated. Use api/projects/search instead, with onProvisionedOnly=true.<br> Require 'Create Projects' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/projects/provisioned">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class ProvisionedRequest { + + private List<String> f; + private String organization; + private String p; + private String ps; + private String q; + + /** + * Comma-separated list of the fields to be returned in response. All the fields are returned by default. + * + * Possible values: + * <ul> + * <li>"name"</li> + * <li>"creationDate"</li> + * <li>"visibility"</li> + * <li>"uuid"</li> + * <li>"key"</li> + * </ul> + */ + public ProvisionedRequest setF(List<String> f) { + this.f = f; + return this; + } + + public List<String> getF() { + return f; + } + + /** + * The key of the organization + * + * This is part of the internal API. + */ + public ProvisionedRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public ProvisionedRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public ProvisionedRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to names or keys that contain the supplied string. + * + * Example value: "sonar" + */ + public ProvisionedRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/SearchMyProjectsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/SearchMyProjectsRequest.java new file mode 100644 index 00000000000..708b8ad6ab9 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/SearchMyProjectsRequest.java @@ -0,0 +1,65 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projects; + +import javax.annotation.Generated; + +/** + * Return list of projects for which the current user has 'Administer' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/projects/search_my_projects">Further information about this action online (including a response example)</a> + * @since 6.0 + */ +@Generated("sonar-ws-generator") +public class SearchMyProjectsRequest { + + private String p; + private String ps; + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchMyProjectsRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public SearchMyProjectsRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/SearchRequest.java new file mode 100644 index 00000000000..9aee0c0c236 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/SearchRequest.java @@ -0,0 +1,204 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projects; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Search for projects or views to administrate them.<br>Requires 'System Administrator' permission + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/projects/search">Further information about this action online (including a response example)</a> + * @since 6.3 + */ +@Generated("sonar-ws-generator") +public class SearchRequest { + + private String analyzedBefore; + private String onProvisionedOnly; + private String organization; + private String p; + private List<String> projectIds; + private List<String> projects; + private String ps; + private String q; + private List<String> qualifiers; + private String visibility; + + /** + * Filter the projects for which last analysis is older than the given date (exclusive).<br> Either a date (server timezone) or datetime can be provided. + * + * Example value: "2017-10-19 or 2017-10-19T13:00:00+0200" + */ + public SearchRequest setAnalyzedBefore(String analyzedBefore) { + this.analyzedBefore = analyzedBefore; + return this; + } + + public String getAnalyzedBefore() { + return analyzedBefore; + } + + /** + * Filter the projects that are provisioned + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public SearchRequest setOnProvisionedOnly(String onProvisionedOnly) { + this.onProvisionedOnly = onProvisionedOnly; + return this; + } + + public String getOnProvisionedOnly() { + return onProvisionedOnly; + } + + /** + * The key of the organization + * + * This is part of the internal API. + */ + public SearchRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Comma-separated list of project ids + * + * Example value: "AU-Tpxb--iU5OvuD2FLy,AU-TpxcA-iU5OvuD2FLz" + * @deprecated since 6.6 + */ + @Deprecated + public SearchRequest setProjectIds(List<String> projectIds) { + this.projectIds = projectIds; + return this; + } + + public List<String> getProjectIds() { + return projectIds; + } + + /** + * Comma-separated list of project keys + * + * Example value: "my_project,another_project" + */ + public SearchRequest setProjects(List<String> projects) { + this.projects = projects; + return this; + } + + public List<String> getProjects() { + return projects; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public SearchRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to: <ul><li>component names that contain the supplied string</li><li>component keys that contain the supplied string</li></ul> + * + * Example value: "sonar" + */ + public SearchRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Comma-separated list of component qualifiers. Filter the results with the specified qualifiers + * + * Possible values: + * <ul> + * <li>"TRK"</li> + * <li>"VW"</li> + * <li>"APP"</li> + * </ul> + */ + public SearchRequest setQualifiers(List<String> qualifiers) { + this.qualifiers = qualifiers; + return this; + } + + public List<String> getQualifiers() { + return qualifiers; + } + + /** + * Filter the projects that should be visible to everyone (public), or only specific user/groups (private).<br/>If no visibility is specified, the default project visibility of the organization will be used. + * + * This is part of the internal API. + * Possible values: + * <ul> + * <li>"private"</li> + * <li>"public"</li> + * </ul> + */ + public SearchRequest setVisibility(String visibility) { + this.visibility = visibility; + return this; + } + + public String getVisibility() { + return visibility; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/UpdateKeyRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/UpdateKeyRequest.java new file mode 100644 index 00000000000..a32f9a91ec4 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/UpdateKeyRequest.java @@ -0,0 +1,83 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projects; + +import javax.annotation.Generated; + +/** + * Update a project or module key and all its sub-components keys.<br>Either 'from' or 'projectId' must be provided.<br> Requires one of the following permissions: <ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/projects/update_key">Further information about this action online (including a response example)</a> + * @since 6.1 + */ +@Generated("sonar-ws-generator") +public class UpdateKeyRequest { + + private String from; + private String projectId; + private String to; + + /** + * Project or module key + * + * Example value: "my_old_project" + */ + public UpdateKeyRequest setFrom(String from) { + this.from = from; + return this; + } + + public String getFrom() { + return from; + } + + /** + * Project or module id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + * @deprecated since 6.4 + */ + @Deprecated + public UpdateKeyRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * New component key + * + * This is a mandatory parameter. + * Example value: "my_new_project" + */ + public UpdateKeyRequest setTo(String to) { + this.to = to; + return this; + } + + public String getTo() { + return to; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/UpdateVisibilityRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/UpdateVisibilityRequest.java new file mode 100644 index 00000000000..fa1a0284878 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/UpdateVisibilityRequest.java @@ -0,0 +1,71 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projects; + +import javax.annotation.Generated; + +/** + * Updates visibility of a project.<br>Requires 'Project administer' permission on the specified project + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/projects/update_visibility">Further information about this action online (including a response example)</a> + * @since 6.4 + */ +@Generated("sonar-ws-generator") +public class UpdateVisibilityRequest { + + private String project; + private String visibility; + + /** + * Project key + * + * This is a mandatory parameter. + * Example value: "my_project" + */ + public UpdateVisibilityRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } + + /** + * New visibility + * + * This is a mandatory parameter. + * Possible values: + * <ul> + * <li>"private"</li> + * <li>"public"</li> + * </ul> + */ + public UpdateVisibilityRequest setVisibility(String visibility) { + this.visibility = visibility; + return this; + } + + public String getVisibility() { + return visibility; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/package-info.java new file mode 100644 index 00000000000..0e38452b189 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.projects; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projecttags/ProjectTagsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projecttags/ProjectTagsService.java new file mode 100644 index 00000000000..006352b6428 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projecttags/ProjectTagsService.java @@ -0,0 +1,74 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projecttags; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.ProjectTags.SearchResponse; + +/** + * Manage project tags + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_tags">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class ProjectTagsService extends BaseService { + + public ProjectTagsService(WsConnector wsConnector) { + super(wsConnector, "api/project_tags"); + } + + /** + * Search tags + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_tags/search">Further information about this action online (including a response example)</a> + * @since 6.4 + */ + public SearchResponse search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()), + SearchResponse.parser()); + } + + /** + * Set tags on a project.<br>Requires the following permission: 'Administer' rights on the specified project + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_tags/set">Further information about this action online (including a response example)</a> + * @since 6.4 + */ + public void set(SetRequest request) { + call( + new PostRequest(path("set")) + .setParam("project", request.getProject()) + .setParam("tags", request.getTags() == null ? null : request.getTags().stream().collect(Collectors.joining(","))) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projecttags/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projecttags/SearchRequest.java new file mode 100644 index 00000000000..1a28e65dca6 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projecttags/SearchRequest.java @@ -0,0 +1,65 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projecttags; + +import javax.annotation.Generated; + +/** + * Search tags + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_tags/search">Further information about this action online (including a response example)</a> + * @since 6.4 + */ +@Generated("sonar-ws-generator") +public class SearchRequest { + + private String ps; + private String q; + + /** + * Page size. Must be greater than 0 and less than 100 + * + * Example value: "20" + */ + public SearchRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to tags that contain the supplied string. + * + * Example value: "off" + */ + public SearchRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projecttags/SetRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projecttags/SetRequest.java new file mode 100644 index 00000000000..75cc51d6acd --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projecttags/SetRequest.java @@ -0,0 +1,68 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.projecttags; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Set tags on a project.<br>Requires the following permission: 'Administer' rights on the specified project + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_tags/set">Further information about this action online (including a response example)</a> + * @since 6.4 + */ +@Generated("sonar-ws-generator") +public class SetRequest { + + private String project; + private List<String> tags; + + /** + * Project key + * + * This is a mandatory parameter. + * Example value: "my_project" + */ + public SetRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } + + /** + * Comma-separated list of tags + * + * This is a mandatory parameter. + * Example value: "finance, offshore" + */ + public SetRequest setTags(List<String> tags) { + this.tags = tags; + return this; + } + + public List<String> getTags() { + return tags; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projecttags/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projecttags/package-info.java new file mode 100644 index 00000000000..f2bb28b5447 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projecttags/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.projecttags; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/properties/IndexRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/properties/IndexRequest.java new file mode 100644 index 00000000000..5293ed0be82 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/properties/IndexRequest.java @@ -0,0 +1,83 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.properties; + +import javax.annotation.Generated; + +/** + * This web service is deprecated, please use api/settings/values instead. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/properties/index">Further information about this action online (including a response example)</a> + * @since 2.6 + */ +@Generated("sonar-ws-generator") +public class IndexRequest { + + private String format; + private String id; + private String resource; + + /** + * Only json response format is available + * + * Possible values: + * <ul> + * <li>"json"</li> + * </ul> + */ + public IndexRequest setFormat(String format) { + this.format = format; + return this; + } + + public String getFormat() { + return format; + } + + /** + * Setting key + * + * Example value: "sonar.test.inclusions" + */ + public IndexRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } + + /** + * Component key or database id + * + * Example value: "my_project" + */ + public IndexRequest setResource(String resource) { + this.resource = resource; + return this; + } + + public String getResource() { + return resource; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/properties/PropertiesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/properties/PropertiesService.java new file mode 100644 index 00000000000..081c709bfed --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/properties/PropertiesService.java @@ -0,0 +1,58 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.properties; + +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * This web service is deprecated, please use api/settings instead. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/properties">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class PropertiesService extends BaseService { + + public PropertiesService(WsConnector wsConnector) { + super(wsConnector, "api/properties"); + } + + /** + * This web service is deprecated, please use api/settings/values instead. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/properties/index">Further information about this action online (including a response example)</a> + * @since 2.6 + * @deprecated since 6.3 + */ + @Deprecated + public String index(IndexRequest request) { + return call( + new GetRequest(path("index")) + .setParam("format", request.getFormat()) + .setParam("id", request.getId()) + .setParam("resource", request.getResource()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/properties/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/properties/package-info.java new file mode 100644 index 00000000000..9c38b2f7e4c --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/properties/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.properties; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CopyRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CopyRequest.java new file mode 100644 index 00000000000..a3e3b0b3bc1 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CopyRequest.java @@ -0,0 +1,67 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +/** + * Copy a Quality Gate.<br>Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/copy">Further information about this action online (including a response example)</a> + * @since 4.3 + */ +@Generated("sonar-ws-generator") +public class CopyRequest { + + private String id; + private String name; + + /** + * The ID of the source quality gate + * + * This is a mandatory parameter. + * Example value: "1" + */ + public CopyRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } + + /** + * The name of the quality gate to create + * + * This is a mandatory parameter. + * Example value: "My Quality Gate" + */ + public CopyRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CreateConditionRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CreateConditionRequest.java new file mode 100644 index 00000000000..89b2854e628 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CreateConditionRequest.java @@ -0,0 +1,137 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +/** + * Add a new condition to a quality gate.<br>Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/create_condition">Further information about this action online (including a response example)</a> + * @since 4.3 + */ +@Generated("sonar-ws-generator") +public class CreateConditionRequest { + + private String error; + private String gateId; + private String metric; + private String op; + private String period; + private String warning; + + /** + * Condition error threshold + * + * Example value: "10" + */ + public CreateConditionRequest setError(String error) { + this.error = error; + return this; + } + + public String getError() { + return error; + } + + /** + * ID of the quality gate + * + * This is a mandatory parameter. + * Example value: "1" + */ + public CreateConditionRequest setGateId(String gateId) { + this.gateId = gateId; + return this; + } + + public String getGateId() { + return gateId; + } + + /** + * Condition metric + * + * This is a mandatory parameter. + * Example value: "blocker_violations" + */ + public CreateConditionRequest setMetric(String metric) { + this.metric = metric; + return this; + } + + public String getMetric() { + return metric; + } + + /** + * Condition operator:<br/><ul><li>EQ = equals</li><li>NE = is not</li><li>LT = is lower than</li><li>GT = is greater than</li></ui> + * + * Example value: "EQ" + * Possible values: + * <ul> + * <li>"LT"</li> + * <li>"GT"</li> + * <li>"EQ"</li> + * <li>"NE"</li> + * </ul> + */ + public CreateConditionRequest setOp(String op) { + this.op = op; + return this; + } + + public String getOp() { + return op; + } + + /** + * Condition period. If not set, the absolute value is considered. + * + * Possible values: + * <ul> + * <li>"1"</li> + * </ul> + */ + public CreateConditionRequest setPeriod(String period) { + this.period = period; + return this; + } + + public String getPeriod() { + return period; + } + + /** + * Condition warning threshold + * + * Example value: "5" + */ + public CreateConditionRequest setWarning(String warning) { + this.warning = warning; + return this; + } + + public String getWarning() { + return warning; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CreateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CreateRequest.java new file mode 100644 index 00000000000..f289e50136f --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CreateRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +/** + * Create a Quality Gate.<br>Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/create">Further information about this action online (including a response example)</a> + * @since 4.3 + */ +@Generated("sonar-ws-generator") +public class CreateRequest { + + private String name; + + /** + * The name of the quality gate to create + * + * This is a mandatory parameter. + * Example value: "My Quality Gate" + */ + public CreateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DeleteConditionRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DeleteConditionRequest.java new file mode 100644 index 00000000000..83acf9f781e --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DeleteConditionRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +/** + * Delete a condition from a quality gate.<br>Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/delete_condition">Further information about this action online (including a response example)</a> + * @since 4.3 + */ +@Generated("sonar-ws-generator") +public class DeleteConditionRequest { + + private String id; + + /** + * Condition ID + * + * This is a mandatory parameter. + * Example value: "2" + */ + public DeleteConditionRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DeselectRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DeselectRequest.java new file mode 100644 index 00000000000..d73cbc2cb26 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DeselectRequest.java @@ -0,0 +1,67 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +/** + * Remove the association of a project from a quality gate.<br>Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/deselect">Further information about this action online (including a response example)</a> + * @since 4.3 + */ +@Generated("sonar-ws-generator") +public class DeselectRequest { + + private String projectId; + private String projectKey; + + /** + * Project id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + * @deprecated since 6.1 + */ + @Deprecated + public DeselectRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public DeselectRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DestroyRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DestroyRequest.java new file mode 100644 index 00000000000..e3307cbffc4 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DestroyRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +/** + * Delete a Quality Gate.<br>Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/destroy">Further information about this action online (including a response example)</a> + * @since 4.3 + */ +@Generated("sonar-ws-generator") +public class DestroyRequest { + + private String id; + + /** + * ID of the quality gate to delete + * + * This is a mandatory parameter. + * Example value: "1" + */ + public DestroyRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/GetByProjectRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/GetByProjectRequest.java new file mode 100644 index 00000000000..cc370d7a13e --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/GetByProjectRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +/** + * Get the quality gate of a project.<br />Requires one of the following permissions:<ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li><li>'Browse' on the specified project</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/get_by_project">Further information about this action online (including a response example)</a> + * @since 6.1 + */ +@Generated("sonar-ws-generator") +public class GetByProjectRequest { + + private String project; + + /** + * Project key + * + * This is a mandatory parameter. + * Example value: "my_project" + */ + public GetByProjectRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ProjectStatusRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ProjectStatusRequest.java new file mode 100644 index 00000000000..f37e3215cc2 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ProjectStatusRequest.java @@ -0,0 +1,80 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +/** + * Get the quality gate status of a project or a Compute Engine task.<br />Either 'analysisId', 'projectId' or 'projectKey' must be provided<br />The different statuses returned are: OK, WARN, ERROR, NONE. The NONE status is returned when there is no quality gate associated with the analysis.<br />Returns an HTTP code 404 if the analysis associated with the task is not found or does not exist.<br />Requires one of the following permissions:<ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li><li>'Browse' on the specified project</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/project_status">Further information about this action online (including a response example)</a> + * @since 5.3 + */ +@Generated("sonar-ws-generator") +public class ProjectStatusRequest { + + private String analysisId; + private String projectId; + private String projectKey; + + /** + * Analysis id + * + * Example value: "AU-TpxcA-iU5OvuD2FL1" + */ + public ProjectStatusRequest setAnalysisId(String analysisId) { + this.analysisId = analysisId; + return this; + } + + public String getAnalysisId() { + return analysisId; + } + + /** + * Project id + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public ProjectStatusRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public ProjectStatusRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/QualitygatesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/QualitygatesService.java new file mode 100644 index 00000000000..87627760a1b --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/QualitygatesService.java @@ -0,0 +1,332 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.Qualitygates; +import org.sonarqube.ws.Qualitygates.AppResponse; +import org.sonarqube.ws.Qualitygates.CreateConditionResponse; +import org.sonarqube.ws.Qualitygates.CreateResponse; +import org.sonarqube.ws.Qualitygates.GetByProjectResponse; +import org.sonarqube.ws.Qualitygates.ProjectStatusResponse; +import org.sonarqube.ws.Qualitygates.UpdateConditionResponse; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Manage quality gates, including conditions and project association. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class QualitygatesService extends BaseService { + + public QualitygatesService(WsConnector wsConnector) { + super(wsConnector, "api/qualitygates"); + } + + /** + * Get initialization items for the admin UI. For internal use + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/app">Further information about this action online (including a response example)</a> + * @since 4.3 + */ + public AppResponse app() { + return call( + new GetRequest(path("app")), + AppResponse.parser()); + } + + /** + * Copy a Quality Gate.<br>Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/copy">Further information about this action online (including a response example)</a> + * @since 4.3 + */ + public void copy(CopyRequest request) { + call( + new PostRequest(path("copy")) + .setParam("id", request.getId()) + .setParam("name", request.getName()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Create a Quality Gate.<br>Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/create">Further information about this action online (including a response example)</a> + * @since 4.3 + */ + public Qualitygates.CreateResponse create(CreateRequest request) { + return call( + new PostRequest(path("create")) + .setParam("name", request.getName()), + CreateResponse.parser()); + } + + /** + * Add a new condition to a quality gate.<br>Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/create_condition">Further information about this action online (including a response example)</a> + * @since 4.3 + */ + public CreateConditionResponse createCondition(CreateConditionRequest request) { + return call( + new PostRequest(path("create_condition")) + .setParam("error", request.getError()) + .setParam("gateId", request.getGateId()) + .setParam("metric", request.getMetric()) + .setParam("op", request.getOp()) + .setParam("period", request.getPeriod()) + .setParam("warning", request.getWarning()), + CreateConditionResponse.parser()); + } + + /** + * Delete a condition from a quality gate.<br>Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/delete_condition">Further information about this action online (including a response example)</a> + * @since 4.3 + */ + public void deleteCondition(DeleteConditionRequest request) { + call( + new PostRequest(path("delete_condition")) + .setParam("id", request.getId()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Remove the association of a project from a quality gate.<br>Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/deselect">Further information about this action online (including a response example)</a> + * @since 4.3 + */ + public void deselect(DeselectRequest request) { + call( + new PostRequest(path("deselect")) + .setParam("projectId", request.getProjectId()) + .setParam("projectKey", request.getProjectKey()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Delete a Quality Gate.<br>Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/destroy">Further information about this action online (including a response example)</a> + * @since 4.3 + */ + public void destroy(DestroyRequest request) { + call( + new PostRequest(path("destroy")) + .setParam("id", request.getId()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get the quality gate of a project.<br />Requires one of the following permissions:<ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li><li>'Browse' on the specified project</li></ul> + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/get_by_project">Further information about this action online (including a response example)</a> + * @since 6.1 + */ + public GetByProjectResponse getByProject(GetByProjectRequest request) { + return call( + new GetRequest(path("get_by_project")) + .setParam("project", request.getProject()), + GetByProjectResponse.parser()); + } + + /** + * Get a list of quality gates + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/list">Further information about this action online (including a response example)</a> + * @since 4.3 + */ + public String list() { + return call( + new GetRequest(path("list")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get the quality gate status of a project or a Compute Engine task.<br />Either 'analysisId', 'projectId' or 'projectKey' must be provided<br />The different statuses returned are: OK, WARN, ERROR, NONE. The NONE status is returned when there is no quality gate associated with the analysis.<br />Returns an HTTP code 404 if the analysis associated with the task is not found or does not exist.<br />Requires one of the following permissions:<ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li><li>'Browse' on the specified project</li></ul> + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/project_status">Further information about this action online (including a response example)</a> + * @since 5.3 + */ + public ProjectStatusResponse projectStatus(ProjectStatusRequest request) { + return call( + new GetRequest(path("project_status")) + .setParam("analysisId", request.getAnalysisId()) + .setParam("projectId", request.getProjectId()) + .setParam("projectKey", request.getProjectKey()), + ProjectStatusResponse.parser()); + } + + /** + * Rename a Quality Gate.<br>Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/rename">Further information about this action online (including a response example)</a> + * @since 4.3 + */ + public void rename(RenameRequest request) { + call( + new PostRequest(path("rename")) + .setParam("id", request.getId()) + .setParam("name", request.getName()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Search for projects associated (or not) to a quality gate.<br/>Only authorized projects for current user will be returned. + * + * 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">Further information about this action online (including a response example)</a> + * @since 4.3 + */ + public String search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("gateId", request.getGateId()) + .setParam("page", request.getPage()) + .setParam("pageSize", request.getPageSize()) + .setParam("query", request.getQuery()) + .setParam("selected", request.getSelected()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Associate a project to a quality gate.<br>The 'projectId' or 'projectKey' must be provided.<br>Project id as a numeric value is deprecated since 6.1. Please use the id similar to 'AU-TpxcA-iU5OvuD2FLz'.<br>Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/select">Further information about this action online (including a response example)</a> + * @since 4.3 + */ + public void select(SelectRequest request) { + call( + new PostRequest(path("select")) + .setParam("gateId", request.getGateId()) + .setParam("projectId", request.getProjectId()) + .setParam("projectKey", request.getProjectKey()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Set a quality gate as the default quality gate.<br>Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/set_as_default">Further information about this action online (including a response example)</a> + * @since 4.3 + */ + public void setAsDefault(SetAsDefaultRequest request) { + call( + new PostRequest(path("set_as_default")) + .setParam("id", request.getId()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Display the details of a quality gate + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/show">Further information about this action online (including a response example)</a> + * @since 4.3 + */ + public String show(ShowRequest request) { + return call( + new GetRequest(path("show")) + .setParam("id", request.getId()) + .setParam("name", request.getName()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Unset a quality gate as the default quality gate.<br>Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/unset_default">Further information about this action online (including a response example)</a> + * @since 4.3 + */ + public void unsetDefault(UnsetDefaultRequest request) { + call( + new PostRequest(path("unset_default")) + .setParam("id", request.getId()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Update a condition attached to a quality gate.<br>Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/update_condition">Further information about this action online (including a response example)</a> + * @since 4.3 + */ + public void updateCondition(UpdateConditionRequest request) { + call( + new PostRequest(path("update_condition")) + .setParam("error", request.getError()) + .setParam("id", request.getId()) + .setParam("metric", request.getMetric()) + .setParam("op", request.getOp()) + .setParam("period", request.getPeriod()) + .setParam("warning", request.getWarning()), + UpdateConditionResponse.parser()); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/RenameRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/RenameRequest.java new file mode 100644 index 00000000000..5893c1f8019 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/RenameRequest.java @@ -0,0 +1,67 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +/** + * Rename a Quality Gate.<br>Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/rename">Further information about this action online (including a response example)</a> + * @since 4.3 + */ +@Generated("sonar-ws-generator") +public class RenameRequest { + + private String id; + private String name; + + /** + * ID of the quality gate to rename + * + * This is a mandatory parameter. + * Example value: "1" + */ + public RenameRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } + + /** + * New name of the quality gate + * + * This is a mandatory parameter. + * Example value: "My Quality Gate" + */ + public RenameRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SearchRequest.java new file mode 100644 index 00000000000..1ffb4086282 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SearchRequest.java @@ -0,0 +1,116 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +/** + * Search for projects associated (or not) to a quality gate.<br/>Only authorized projects for current user will be returned. + * + * 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">Further information about this action online (including a response example)</a> + * @since 4.3 + */ +@Generated("sonar-ws-generator") +public class SearchRequest { + + private String gateId; + private String page; + private String pageSize; + private String query; + private String selected; + + /** + * Quality Gate ID + * + * This is a mandatory parameter. + * Example value: "1" + */ + public SearchRequest setGateId(String gateId) { + this.gateId = gateId; + return this; + } + + public String getGateId() { + return gateId; + } + + /** + * Page number + * + * Example value: "2" + */ + public SearchRequest setPage(String page) { + this.page = page; + return this; + } + + public String getPage() { + return page; + } + + /** + * Page size + * + * Example value: "10" + */ + public SearchRequest setPageSize(String pageSize) { + this.pageSize = pageSize; + return this; + } + + public String getPageSize() { + return pageSize; + } + + /** + * To search for projects containing this string. If this parameter is set, "selected" is set to "all". + * + * Example value: "abc" + */ + public SearchRequest setQuery(String query) { + this.query = query; + return this; + } + + public String getQuery() { + return query; + } + + /** + * Depending on the value, show only selected items (selected=selected), deselected items (selected=deselected), or all items with their selection status (selected=all). + * + * Possible values: + * <ul> + * <li>"all"</li> + * <li>"deselected"</li> + * <li>"selected"</li> + * </ul> + */ + public SearchRequest 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/SelectRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SelectRequest.java new file mode 100644 index 00000000000..0e8e0ab770d --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SelectRequest.java @@ -0,0 +1,81 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +/** + * Associate a project to a quality gate.<br>The 'projectId' or 'projectKey' must be provided.<br>Project id as a numeric value is deprecated since 6.1. Please use the id similar to 'AU-TpxcA-iU5OvuD2FLz'.<br>Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/select">Further information about this action online (including a response example)</a> + * @since 4.3 + */ +@Generated("sonar-ws-generator") +public class SelectRequest { + + private String gateId; + private String projectId; + private String projectKey; + + /** + * Quality gate id + * + * This is a mandatory parameter. + * Example value: "1" + */ + public SelectRequest setGateId(String gateId) { + this.gateId = gateId; + return this; + } + + public String getGateId() { + return gateId; + } + + /** + * Project id. Project id as an numeric value is deprecated since 6.1 + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public SelectRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + public String getProjectId() { + return projectId; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public SelectRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SetAsDefaultRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SetAsDefaultRequest.java new file mode 100644 index 00000000000..0029fa4d1c0 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SetAsDefaultRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +/** + * Set a quality gate as the default quality gate.<br>Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/set_as_default">Further information about this action online (including a response example)</a> + * @since 4.3 + */ +@Generated("sonar-ws-generator") +public class SetAsDefaultRequest { + + private String id; + + /** + * ID of the quality gate to set as default + * + * This is a mandatory parameter. + * Example value: "1" + */ + public SetAsDefaultRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ShowRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ShowRequest.java new file mode 100644 index 00000000000..340a18173c0 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ShowRequest.java @@ -0,0 +1,65 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +/** + * Display the details of a quality gate + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/show">Further information about this action online (including a response example)</a> + * @since 4.3 + */ +@Generated("sonar-ws-generator") +public class ShowRequest { + + private String id; + private String name; + + /** + * ID of the quality gate. Either id or name must be set + * + * Example value: "1" + */ + public ShowRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } + + /** + * Name of the quality gate. Either id or name must be set + * + * Example value: "My Quality Gate" + */ + public ShowRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/UnsetDefaultRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/UnsetDefaultRequest.java new file mode 100644 index 00000000000..71dfd1d6c8a --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/UnsetDefaultRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +/** + * Unset a quality gate as the default quality gate.<br>Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/unset_default">Further information about this action online (including a response example)</a> + * @since 4.3 + */ +@Generated("sonar-ws-generator") +public class UnsetDefaultRequest { + + private String id; + + /** + * ID of the quality gate to unset as default + * + * This is a mandatory parameter. + * Example value: "1" + */ + public UnsetDefaultRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/UpdateConditionRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/UpdateConditionRequest.java new file mode 100644 index 00000000000..1245b100344 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/UpdateConditionRequest.java @@ -0,0 +1,137 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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; + +/** + * Update a condition attached to a quality gate.<br>Requires the 'Administer Quality Gates' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/update_condition">Further information about this action online (including a response example)</a> + * @since 4.3 + */ +@Generated("sonar-ws-generator") +public class UpdateConditionRequest { + + private String error; + private String id; + private String metric; + private String op; + private String period; + private String warning; + + /** + * Condition error threshold + * + * Example value: "10" + */ + public UpdateConditionRequest setError(String error) { + this.error = error; + return this; + } + + public String getError() { + return error; + } + + /** + * Condition ID + * + * This is a mandatory parameter. + * Example value: "10" + */ + public UpdateConditionRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } + + /** + * Condition metric + * + * This is a mandatory parameter. + * Example value: "blocker_violations" + */ + public UpdateConditionRequest setMetric(String metric) { + this.metric = metric; + return this; + } + + public String getMetric() { + return metric; + } + + /** + * Condition operator:<br/><ul><li>EQ = equals</li><li>NE = is not</li><li>LT = is lower than</li><li>GT = is greater than</li></ui> + * + * Example value: "EQ" + * Possible values: + * <ul> + * <li>"LT"</li> + * <li>"GT"</li> + * <li>"EQ"</li> + * <li>"NE"</li> + * </ul> + */ + public UpdateConditionRequest setOp(String op) { + this.op = op; + return this; + } + + public String getOp() { + return op; + } + + /** + * Condition period. If not set, the absolute value is considered. + * + * Possible values: + * <ul> + * <li>"1"</li> + * </ul> + */ + public UpdateConditionRequest setPeriod(String period) { + this.period = period; + return this; + } + + public String getPeriod() { + return period; + } + + /** + * Condition warning threshold + * + * Example value: "5" + */ + public UpdateConditionRequest setWarning(String warning) { + this.warning = warning; + return this; + } + + public String getWarning() { + return warning; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/package-info.java new file mode 100644 index 00000000000..130a03c1334 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.qualitygates; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ActivateRuleRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ActivateRuleRequest.java new file mode 100644 index 00000000000..b69c226b404 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ActivateRuleRequest.java @@ -0,0 +1,125 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import javax.annotation.Generated; + +/** + * Activate a rule on a Quality Profile.<br> Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/activate_rule">Further information about this action online (including a response example)</a> + * @since 4.4 + */ +@Generated("sonar-ws-generator") +public class ActivateRuleRequest { + + private String key; + private String params; + private String reset; + private String rule; + private String severity; + + /** + * Quality Profile key. Can be obtained through <code>api/qualityprofiles/search</code> + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public ActivateRuleRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Parameters as semi-colon list of <code>key=value</code>. Ignored if parameter reset is true. + * + * Example value: "params=key1=v1;key2=v2" + */ + public ActivateRuleRequest setParams(String params) { + this.params = params; + return this; + } + + public String getParams() { + return params; + } + + /** + * Reset severity and parameters of activated rule. Set the values defined on parent profile or from rule default values. + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public ActivateRuleRequest setReset(String reset) { + this.reset = reset; + return this; + } + + public String getReset() { + return reset; + } + + /** + * Rule key + * + * This is a mandatory parameter. + * Example value: "squid:AvoidCycles" + */ + public ActivateRuleRequest setRule(String rule) { + this.rule = rule; + return this; + } + + public String getRule() { + return rule; + } + + /** + * Severity. Ignored if parameter reset is true. + * + * Possible values: + * <ul> + * <li>"INFO"</li> + * <li>"MINOR"</li> + * <li>"MAJOR"</li> + * <li>"CRITICAL"</li> + * <li>"BLOCKER"</li> + * </ul> + */ + public ActivateRuleRequest setSeverity(String severity) { + this.severity = severity; + return this; + } + + public String getSeverity() { + return severity; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ActivateRulesRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ActivateRulesRequest.java new file mode 100644 index 00000000000..32f6e1ad881 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ActivateRulesRequest.java @@ -0,0 +1,421 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Bulk-activate rules on one quality profile.<br> Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/activate_rules">Further information about this action online (including a response example)</a> + * @since 4.4 + */ +@Generated("sonar-ws-generator") +public class ActivateRulesRequest { + + private String activation; + private List<String> activeSeverities; + private String asc; + private String availableSince; + private String compareToProfile; + private List<String> inheritance; + private String isTemplate; + private List<String> languages; + private String organization; + private String q; + private String qprofile; + private List<String> repositories; + private String ruleKey; + private String s; + private List<String> severities; + private List<String> statuses; + private List<String> tags; + private String targetKey; + private String targetSeverity; + private String templateKey; + private List<String> types; + + /** + * Filter rules that are activated or deactivated on the selected Quality profile. Ignored if the parameter 'qprofile' is not set. + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public ActivateRulesRequest setActivation(String activation) { + this.activation = activation; + return this; + } + + public String getActivation() { + return activation; + } + + /** + * Comma-separated list of activation severities, i.e the severity of rules in Quality profiles. + * + * Example value: "CRITICAL,BLOCKER" + * Possible values: + * <ul> + * <li>"INFO"</li> + * <li>"MINOR"</li> + * <li>"MAJOR"</li> + * <li>"CRITICAL"</li> + * <li>"BLOCKER"</li> + * </ul> + */ + public ActivateRulesRequest setActiveSeverities(List<String> activeSeverities) { + this.activeSeverities = activeSeverities; + return this; + } + + public List<String> getActiveSeverities() { + return activeSeverities; + } + + /** + * Ascending sort + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public ActivateRulesRequest setAsc(String asc) { + this.asc = asc; + return this; + } + + public String getAsc() { + return asc; + } + + /** + * Filters rules added since date. Format is yyyy-MM-dd + * + * Example value: "2014-06-22" + */ + public ActivateRulesRequest setAvailableSince(String availableSince) { + this.availableSince = availableSince; + return this; + } + + public String getAvailableSince() { + return availableSince; + } + + /** + * Quality profile key to filter rules that are activated. Meant to compare easily to profile set in 'qprofile' + * + * This is part of the internal API. + * Example value: "AU-TpxcA-iU5OvuD2FLz" + */ + public ActivateRulesRequest setCompareToProfile(String compareToProfile) { + this.compareToProfile = compareToProfile; + return this; + } + + public String getCompareToProfile() { + return compareToProfile; + } + + /** + * Comma-separated list of values of inheritance for a rule within a quality profile. Used only if the parameter 'activation' is set. + * + * Example value: "INHERITED,OVERRIDES" + * Possible values: + * <ul> + * <li>"NONE"</li> + * <li>"INHERITED"</li> + * <li>"OVERRIDES"</li> + * </ul> + */ + public ActivateRulesRequest setInheritance(List<String> inheritance) { + this.inheritance = inheritance; + return this; + } + + public List<String> getInheritance() { + return inheritance; + } + + /** + * Filter template rules + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public ActivateRulesRequest setIsTemplate(String isTemplate) { + this.isTemplate = isTemplate; + return this; + } + + public String getIsTemplate() { + return isTemplate; + } + + /** + * Comma-separated list of languages + * + * Example value: "java,js" + */ + public ActivateRulesRequest setLanguages(List<String> languages) { + this.languages = languages; + return this; + } + + public List<String> getLanguages() { + return languages; + } + + /** + * Organization key + * + * This is part of the internal API. + * Example value: "my-org" + */ + public ActivateRulesRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * UTF-8 search query + * + * Example value: "xpath" + */ + public ActivateRulesRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Quality profile key to filter on. Used only if the parameter 'activation' is set. + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public ActivateRulesRequest setQprofile(String qprofile) { + this.qprofile = qprofile; + return this; + } + + public String getQprofile() { + return qprofile; + } + + /** + * Comma-separated list of repositories + * + * Example value: "checkstyle,findbugs" + */ + public ActivateRulesRequest setRepositories(List<String> repositories) { + this.repositories = repositories; + return this; + } + + public List<String> getRepositories() { + return repositories; + } + + /** + * Key of rule to search for + * + * Example value: "squid:S001" + */ + public ActivateRulesRequest setRuleKey(String ruleKey) { + this.ruleKey = ruleKey; + return this; + } + + public String getRuleKey() { + return ruleKey; + } + + /** + * Sort field + * + * Example value: "name" + * Possible values: + * <ul> + * <li>"name"</li> + * <li>"updatedAt"</li> + * <li>"createdAt"</li> + * <li>"key"</li> + * </ul> + */ + public ActivateRulesRequest setS(String s) { + this.s = s; + return this; + } + + public String getS() { + return s; + } + + /** + * Comma-separated list of default severities. Not the same than severity of rules in Quality profiles. + * + * Example value: "CRITICAL,BLOCKER" + * Possible values: + * <ul> + * <li>"INFO"</li> + * <li>"MINOR"</li> + * <li>"MAJOR"</li> + * <li>"CRITICAL"</li> + * <li>"BLOCKER"</li> + * </ul> + */ + public ActivateRulesRequest setSeverities(List<String> severities) { + this.severities = severities; + return this; + } + + public List<String> getSeverities() { + return severities; + } + + /** + * Comma-separated list of status codes + * + * Example value: "READY" + * Possible values: + * <ul> + * <li>"BETA"</li> + * <li>"DEPRECATED"</li> + * <li>"READY"</li> + * <li>"REMOVED"</li> + * </ul> + */ + public ActivateRulesRequest setStatuses(List<String> statuses) { + this.statuses = statuses; + return this; + } + + public List<String> getStatuses() { + return statuses; + } + + /** + * Comma-separated list of tags. Returned rules match any of the tags (OR operator) + * + * Example value: "security,java8" + */ + public ActivateRulesRequest setTags(List<String> tags) { + this.tags = tags; + return this; + } + + public List<String> getTags() { + return tags; + } + + /** + * Quality Profile key on which the rule activation is done. To retrieve a quality profile key please see <code>api/qualityprofiles/search</code> + * + * This is a mandatory parameter. + * Example value: "AU-TpxcA-iU5OvuD2FL0" + */ + public ActivateRulesRequest setTargetKey(String targetKey) { + this.targetKey = targetKey; + return this; + } + + public String getTargetKey() { + return targetKey; + } + + /** + * Severity to set on the activated rules + * + * Possible values: + * <ul> + * <li>"INFO"</li> + * <li>"MINOR"</li> + * <li>"MAJOR"</li> + * <li>"CRITICAL"</li> + * <li>"BLOCKER"</li> + * </ul> + */ + public ActivateRulesRequest setTargetSeverity(String targetSeverity) { + this.targetSeverity = targetSeverity; + return this; + } + + public String getTargetSeverity() { + return targetSeverity; + } + + /** + * Key of the template rule to filter on. Used to search for the custom rules based on this template. + * + * Example value: "java:S001" + */ + public ActivateRulesRequest setTemplateKey(String templateKey) { + this.templateKey = templateKey; + return this; + } + + public String getTemplateKey() { + return templateKey; + } + + /** + * Comma-separated list of types. Returned rules match any of the tags (OR operator) + * + * Example value: "BUG" + * Possible values: + * <ul> + * <li>"CODE_SMELL"</li> + * <li>"BUG"</li> + * <li>"VULNERABILITY"</li> + * </ul> + */ + public ActivateRulesRequest setTypes(List<String> types) { + this.types = types; + return this; + } + + public List<String> getTypes() { + return types; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddGroupRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddGroupRequest.java new file mode 100644 index 00000000000..458a5e98f1b --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddGroupRequest.java @@ -0,0 +1,98 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import javax.annotation.Generated; + +/** + * Allow a group to edit a Quality Profile.<br>Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/add_group">Further information about this action online (including a response example)</a> + * @since 6.6 + */ +@Generated("sonar-ws-generator") +public class AddGroupRequest { + + private String group; + private String language; + private String organization; + private String qualityProfile; + + /** + * Group name + * + * This is a mandatory parameter. + * Example value: "sonar-administrators" + */ + public AddGroupRequest setGroup(String group) { + this.group = group; + return this; + } + + public String getGroup() { + return group; + } + + /** + * Quality profile language + * + * This is a mandatory parameter. + */ + public AddGroupRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public AddGroupRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Quality Profile name + * + * This is a mandatory parameter. + * Example value: "Recommended quality profile" + */ + public AddGroupRequest setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public String getQualityProfile() { + return qualityProfile; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddProjectRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddProjectRequest.java new file mode 100644 index 00000000000..5c056b0e2b0 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddProjectRequest.java @@ -0,0 +1,129 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import javax.annotation.Generated; + +/** + * Associate a project with a quality profile.<br> Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li> <li>Administer right on the specified project</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/add_project">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class AddProjectRequest { + + private String key; + private String language; + private String organization; + private String project; + private String projectUuid; + private String qualityProfile; + + /** + * Quality profile key + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + * @deprecated since 6.6 + */ + @Deprecated + public AddProjectRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Quality profile language. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate. + * + */ + public AddProjectRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public AddProjectRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public AddProjectRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } + + /** + * Project ID. Either this parameter or 'project' must be set. + * + * Example value: "AU-TpxcA-iU5OvuD2FL5" + * @deprecated since 6.5 + */ + @Deprecated + public AddProjectRequest setProjectUuid(String projectUuid) { + this.projectUuid = projectUuid; + return this; + } + + public String getProjectUuid() { + return projectUuid; + } + + /** + * Quality profile name. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate. + * + * Example value: "Sonar way" + */ + public AddProjectRequest setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public String getQualityProfile() { + return qualityProfile; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddUserRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddUserRequest.java new file mode 100644 index 00000000000..3e7d4888b6c --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddUserRequest.java @@ -0,0 +1,98 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import javax.annotation.Generated; + +/** + * Allow a user to edit a Quality Profile.<br>Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/add_user">Further information about this action online (including a response example)</a> + * @since 6.6 + */ +@Generated("sonar-ws-generator") +public class AddUserRequest { + + private String language; + private String login; + private String organization; + private String qualityProfile; + + /** + * Quality profile language + * + * This is a mandatory parameter. + */ + public AddUserRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * User login + * + * This is a mandatory parameter. + * Example value: "john.doe" + */ + public AddUserRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public AddUserRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Quality Profile name + * + * This is a mandatory parameter. + * Example value: "Recommended quality profile" + */ + public AddUserRequest setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public String getQualityProfile() { + return qualityProfile; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/BackupRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/BackupRequest.java new file mode 100644 index 00000000000..da842fd3a1c --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/BackupRequest.java @@ -0,0 +1,97 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import javax.annotation.Generated; + +/** + * Backup a quality profile in XML form. The exported profile can be restored through api/qualityprofiles/restore. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/backup">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class BackupRequest { + + private String key; + private String language; + private String organization; + private String qualityProfile; + + /** + * Quality profile key + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + * @deprecated since 6.6 + */ + @Deprecated + public BackupRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Quality profile language. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate. + * + */ + public BackupRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public BackupRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Quality profile name. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate. + * + * Example value: "Sonar way" + */ + public BackupRequest setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public String getQualityProfile() { + return qualityProfile; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ChangeParentRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ChangeParentRequest.java new file mode 100644 index 00000000000..4dc39a59141 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ChangeParentRequest.java @@ -0,0 +1,129 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import javax.annotation.Generated; + +/** + * Change a quality profile's parent.<br>Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/change_parent">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class ChangeParentRequest { + + private String key; + private String language; + private String organization; + private String parentKey; + private String parentQualityProfile; + private String qualityProfile; + + /** + * Quality profile key + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + * @deprecated since 6.6 + */ + @Deprecated + public ChangeParentRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Quality profile language. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate. + * + */ + public ChangeParentRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public ChangeParentRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * New parent profile key.<br> If no profile is provided, the inheritance link with current parent profile (if any) is broken, which deactivates all rules which come from the parent and are not overridden. + * + * Example value: "AU-TpxcA-iU5OvuD2FLz" + * @deprecated since 6.6 + */ + @Deprecated + public ChangeParentRequest setParentKey(String parentKey) { + this.parentKey = parentKey; + return this; + } + + public String getParentKey() { + return parentKey; + } + + /** + * Quality profile name. If this parameter is set, 'parentKey' must not be set and 'language' must be set to disambiguate. + * + * Example value: "Sonar way" + */ + public ChangeParentRequest setParentQualityProfile(String parentQualityProfile) { + this.parentQualityProfile = parentQualityProfile; + return this; + } + + public String getParentQualityProfile() { + return parentQualityProfile; + } + + /** + * Quality profile name. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate. + * + * Example value: "Sonar way" + */ + public ChangeParentRequest setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public String getQualityProfile() { + return qualityProfile; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ChangelogRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ChangelogRequest.java new file mode 100644 index 00000000000..0e615b74b6e --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ChangelogRequest.java @@ -0,0 +1,157 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import javax.annotation.Generated; + +/** + * Get the history of changes on a quality profile: rule activation/deactivation, change in parameters/severity. Events are ordered by date in descending order (most recent first). + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/changelog">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class ChangelogRequest { + + private String key; + private String language; + private String organization; + private String p; + private String ps; + private String qualityProfile; + private String since; + private String to; + + /** + * Quality profile key + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + * @deprecated since 6.6 + */ + @Deprecated + public ChangelogRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Quality profile language. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate. + * + */ + public ChangelogRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public ChangelogRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public ChangelogRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public ChangelogRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Quality profile name. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate. + * + * Example value: "Sonar way" + */ + public ChangelogRequest setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public String getQualityProfile() { + return qualityProfile; + } + + /** + * Start date for the changelog. <br>Either a date (server timezone) or datetime can be provided. + * + * Example value: "2017-10-19 or 2017-10-19T13:00:00+0200" + */ + public ChangelogRequest setSince(String since) { + this.since = since; + return this; + } + + public String getSince() { + return since; + } + + /** + * End date for the changelog. <br>Either a date (server timezone) or datetime can be provided. + * + * Example value: "2017-10-19 or 2017-10-19T13:00:00+0200" + */ + public ChangelogRequest setTo(String to) { + this.to = to; + return this; + } + + public String getTo() { + return to; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/CompareRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/CompareRequest.java new file mode 100644 index 00000000000..e13c2942c96 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/CompareRequest.java @@ -0,0 +1,67 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import javax.annotation.Generated; + +/** + * Compare two quality profiles. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/compare">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class CompareRequest { + + private String leftKey; + private String rightKey; + + /** + * Profile key. + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public CompareRequest setLeftKey(String leftKey) { + this.leftKey = leftKey; + return this; + } + + public String getLeftKey() { + return leftKey; + } + + /** + * Another profile key. + * + * This is a mandatory parameter. + * Example value: "AU-TpxcA-iU5OvuD2FLz" + */ + public CompareRequest setRightKey(String rightKey) { + this.rightKey = rightKey; + return this; + } + + public String getRightKey() { + return rightKey; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/CopyRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/CopyRequest.java new file mode 100644 index 00000000000..7a7f63b521b --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/CopyRequest.java @@ -0,0 +1,67 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import javax.annotation.Generated; + +/** + * Copy a quality profile.<br> Requires to be logged in and the 'Administer Quality Profiles' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/copy">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class CopyRequest { + + private String fromKey; + private String toName; + + /** + * Quality profile key + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public CopyRequest setFromKey(String fromKey) { + this.fromKey = fromKey; + return this; + } + + public String getFromKey() { + return fromKey; + } + + /** + * Name for the new quality profile. + * + * This is a mandatory parameter. + * Example value: "My Sonar way" + */ + public CopyRequest setToName(String toName) { + this.toName = toName; + return this; + } + + public String getToName() { + return toName; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/CreateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/CreateRequest.java new file mode 100644 index 00000000000..b3cfa60be88 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/CreateRequest.java @@ -0,0 +1,83 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import javax.annotation.Generated; + +/** + * Create a quality profile.<br>Requires to be logged in and the 'Administer Quality Profiles' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/create">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class CreateRequest { + + private String language; + private String name; + private String organization; + + /** + * Quality profile language + * + * This is a mandatory parameter. + * Example value: "js" + */ + public CreateRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * Quality profile name + * + * This is a mandatory parameter. + * Example value: "My Sonar way" + */ + public CreateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public CreateRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeactivateRuleRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeactivateRuleRequest.java new file mode 100644 index 00000000000..e1b5b3e62aa --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeactivateRuleRequest.java @@ -0,0 +1,67 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import javax.annotation.Generated; + +/** + * Deactivate a rule on a quality profile.<br> Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/deactivate_rule">Further information about this action online (including a response example)</a> + * @since 4.4 + */ +@Generated("sonar-ws-generator") +public class DeactivateRuleRequest { + + private String key; + private String rule; + + /** + * Quality Profile key. Can be obtained through <code>api/qualityprofiles/search</code> + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public DeactivateRuleRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Rule key + * + * This is a mandatory parameter. + * Example value: "squid:AvoidCycles" + */ + public DeactivateRuleRequest setRule(String rule) { + this.rule = rule; + return this; + } + + public String getRule() { + return rule; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeactivateRulesRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeactivateRulesRequest.java new file mode 100644 index 00000000000..93b63ba09a8 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeactivateRulesRequest.java @@ -0,0 +1,399 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Bulk deactivate rules on Quality profiles.<br>Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/deactivate_rules">Further information about this action online (including a response example)</a> + * @since 4.4 + */ +@Generated("sonar-ws-generator") +public class DeactivateRulesRequest { + + private String activation; + private List<String> activeSeverities; + private String asc; + private String availableSince; + private String compareToProfile; + private List<String> inheritance; + private String isTemplate; + private List<String> languages; + private String organization; + private String q; + private String qprofile; + private List<String> repositories; + private String ruleKey; + private String s; + private List<String> severities; + private List<String> statuses; + private List<String> tags; + private String targetKey; + private String templateKey; + private List<String> types; + + /** + * Filter rules that are activated or deactivated on the selected Quality profile. Ignored if the parameter 'qprofile' is not set. + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public DeactivateRulesRequest setActivation(String activation) { + this.activation = activation; + return this; + } + + public String getActivation() { + return activation; + } + + /** + * Comma-separated list of activation severities, i.e the severity of rules in Quality profiles. + * + * Example value: "CRITICAL,BLOCKER" + * Possible values: + * <ul> + * <li>"INFO"</li> + * <li>"MINOR"</li> + * <li>"MAJOR"</li> + * <li>"CRITICAL"</li> + * <li>"BLOCKER"</li> + * </ul> + */ + public DeactivateRulesRequest setActiveSeverities(List<String> activeSeverities) { + this.activeSeverities = activeSeverities; + return this; + } + + public List<String> getActiveSeverities() { + return activeSeverities; + } + + /** + * Ascending sort + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public DeactivateRulesRequest setAsc(String asc) { + this.asc = asc; + return this; + } + + public String getAsc() { + return asc; + } + + /** + * Filters rules added since date. Format is yyyy-MM-dd + * + * Example value: "2014-06-22" + */ + public DeactivateRulesRequest setAvailableSince(String availableSince) { + this.availableSince = availableSince; + return this; + } + + public String getAvailableSince() { + return availableSince; + } + + /** + * Quality profile key to filter rules that are activated. Meant to compare easily to profile set in 'qprofile' + * + * This is part of the internal API. + * Example value: "AU-TpxcA-iU5OvuD2FLz" + */ + public DeactivateRulesRequest setCompareToProfile(String compareToProfile) { + this.compareToProfile = compareToProfile; + return this; + } + + public String getCompareToProfile() { + return compareToProfile; + } + + /** + * Comma-separated list of values of inheritance for a rule within a quality profile. Used only if the parameter 'activation' is set. + * + * Example value: "INHERITED,OVERRIDES" + * Possible values: + * <ul> + * <li>"NONE"</li> + * <li>"INHERITED"</li> + * <li>"OVERRIDES"</li> + * </ul> + */ + public DeactivateRulesRequest setInheritance(List<String> inheritance) { + this.inheritance = inheritance; + return this; + } + + public List<String> getInheritance() { + return inheritance; + } + + /** + * Filter template rules + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public DeactivateRulesRequest setIsTemplate(String isTemplate) { + this.isTemplate = isTemplate; + return this; + } + + public String getIsTemplate() { + return isTemplate; + } + + /** + * Comma-separated list of languages + * + * Example value: "java,js" + */ + public DeactivateRulesRequest setLanguages(List<String> languages) { + this.languages = languages; + return this; + } + + public List<String> getLanguages() { + return languages; + } + + /** + * Organization key + * + * This is part of the internal API. + * Example value: "my-org" + */ + public DeactivateRulesRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * UTF-8 search query + * + * Example value: "xpath" + */ + public DeactivateRulesRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Quality profile key to filter on. Used only if the parameter 'activation' is set. + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public DeactivateRulesRequest setQprofile(String qprofile) { + this.qprofile = qprofile; + return this; + } + + public String getQprofile() { + return qprofile; + } + + /** + * Comma-separated list of repositories + * + * Example value: "checkstyle,findbugs" + */ + public DeactivateRulesRequest setRepositories(List<String> repositories) { + this.repositories = repositories; + return this; + } + + public List<String> getRepositories() { + return repositories; + } + + /** + * Key of rule to search for + * + * Example value: "squid:S001" + */ + public DeactivateRulesRequest setRuleKey(String ruleKey) { + this.ruleKey = ruleKey; + return this; + } + + public String getRuleKey() { + return ruleKey; + } + + /** + * Sort field + * + * Example value: "name" + * Possible values: + * <ul> + * <li>"name"</li> + * <li>"updatedAt"</li> + * <li>"createdAt"</li> + * <li>"key"</li> + * </ul> + */ + public DeactivateRulesRequest setS(String s) { + this.s = s; + return this; + } + + public String getS() { + return s; + } + + /** + * Comma-separated list of default severities. Not the same than severity of rules in Quality profiles. + * + * Example value: "CRITICAL,BLOCKER" + * Possible values: + * <ul> + * <li>"INFO"</li> + * <li>"MINOR"</li> + * <li>"MAJOR"</li> + * <li>"CRITICAL"</li> + * <li>"BLOCKER"</li> + * </ul> + */ + public DeactivateRulesRequest setSeverities(List<String> severities) { + this.severities = severities; + return this; + } + + public List<String> getSeverities() { + return severities; + } + + /** + * Comma-separated list of status codes + * + * Example value: "READY" + * Possible values: + * <ul> + * <li>"BETA"</li> + * <li>"DEPRECATED"</li> + * <li>"READY"</li> + * <li>"REMOVED"</li> + * </ul> + */ + public DeactivateRulesRequest setStatuses(List<String> statuses) { + this.statuses = statuses; + return this; + } + + public List<String> getStatuses() { + return statuses; + } + + /** + * Comma-separated list of tags. Returned rules match any of the tags (OR operator) + * + * Example value: "security,java8" + */ + public DeactivateRulesRequest setTags(List<String> tags) { + this.tags = tags; + return this; + } + + public List<String> getTags() { + return tags; + } + + /** + * Quality Profile key on which the rule deactivation is done. To retrieve a profile key please see <code>api/qualityprofiles/search</code> + * + * This is a mandatory parameter. + * Example value: "AU-TpxcA-iU5OvuD2FL1" + */ + public DeactivateRulesRequest setTargetKey(String targetKey) { + this.targetKey = targetKey; + return this; + } + + public String getTargetKey() { + return targetKey; + } + + /** + * Key of the template rule to filter on. Used to search for the custom rules based on this template. + * + * Example value: "java:S001" + */ + public DeactivateRulesRequest setTemplateKey(String templateKey) { + this.templateKey = templateKey; + return this; + } + + public String getTemplateKey() { + return templateKey; + } + + /** + * Comma-separated list of types. Returned rules match any of the tags (OR operator) + * + * Example value: "BUG" + * Possible values: + * <ul> + * <li>"CODE_SMELL"</li> + * <li>"BUG"</li> + * <li>"VULNERABILITY"</li> + * </ul> + */ + public DeactivateRulesRequest setTypes(List<String> types) { + this.types = types; + return this; + } + + public List<String> getTypes() { + return types; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeleteRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeleteRequest.java new file mode 100644 index 00000000000..46c13d2f176 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeleteRequest.java @@ -0,0 +1,97 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import javax.annotation.Generated; + +/** + * Delete a quality profile and all its descendants. The default quality profile cannot be deleted.<br> Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/delete">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class DeleteRequest { + + private String key; + private String language; + private String organization; + private String qualityProfile; + + /** + * Quality profile key + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + * @deprecated since 6.6 + */ + @Deprecated + public DeleteRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Quality profile language. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate. + * + */ + public DeleteRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public DeleteRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Quality profile name. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate. + * + * Example value: "Sonar way" + */ + public DeleteRequest setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public String getQualityProfile() { + return qualityProfile; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ExportRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ExportRequest.java new file mode 100644 index 00000000000..37d2b1798c1 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ExportRequest.java @@ -0,0 +1,98 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import javax.annotation.Generated; + +/** + * Export a quality profile. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/export">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class ExportRequest { + + private String key; + private String language; + private String organization; + private String qualityProfile; + + /** + * Quality profile key + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + * @deprecated since 6.6 + */ + @Deprecated + public ExportRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Quality profile language. If this parameter is set, 'key' must not be set. + * + * Example value: "" + */ + public ExportRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public ExportRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Quality profile name to export. If left empty, the default profile for the language is exported. If this parameter is set, 'key' must not be set. + * + * Example value: "My Sonar way" + */ + public ExportRequest setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public String getQualityProfile() { + return qualityProfile; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/InheritanceRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/InheritanceRequest.java new file mode 100644 index 00000000000..a6581177218 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/InheritanceRequest.java @@ -0,0 +1,97 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import javax.annotation.Generated; + +/** + * Show a quality profile's ancestors and children. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/inheritance">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class InheritanceRequest { + + private String key; + private String language; + private String organization; + private String qualityProfile; + + /** + * Quality profile key + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + * @deprecated since 6.6 + */ + @Deprecated + public InheritanceRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Quality profile language. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate. + * + */ + public InheritanceRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public InheritanceRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Quality profile name. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate. + * + * Example value: "Sonar way" + */ + public InheritanceRequest setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public String getQualityProfile() { + return qualityProfile; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ProjectsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ProjectsRequest.java new file mode 100644 index 00000000000..a7112fba08a --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ProjectsRequest.java @@ -0,0 +1,116 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import javax.annotation.Generated; + +/** + * List projects with their association status regarding a quality profile + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/projects">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class ProjectsRequest { + + private String key; + private String p; + private String ps; + private String q; + private String selected; + + /** + * Quality profile key + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public ProjectsRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public ProjectsRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public ProjectsRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to projects that contain the supplied string. + * + * Example value: "sonar" + */ + public ProjectsRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Depending on the value, show only selected items (selected=selected), deselected items (selected=deselected), or all items with their selection status (selected=all). + * + * Possible values: + * <ul> + * <li>"all"</li> + * <li>"deselected"</li> + * <li>"selected"</li> + * </ul> + */ + public ProjectsRequest 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/qualityprofiles/QualityprofilesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/QualityprofilesService.java new file mode 100644 index 00000000000..9d362c4f070 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/QualityprofilesService.java @@ -0,0 +1,639 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.Qualityprofiles.CopyWsResponse; +import org.sonarqube.ws.Qualityprofiles.CreateWsResponse; +import org.sonarqube.ws.Qualityprofiles.InheritanceWsResponse; +import org.sonarqube.ws.Qualityprofiles.SearchWsResponse; +import org.sonarqube.ws.Qualityprofiles.SearchGroupsResponse; +import org.sonarqube.ws.Qualityprofiles.SearchUsersResponse; +import org.sonarqube.ws.Qualityprofiles.ShowResponse; + +/** + * Manage quality profiles. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class QualityprofilesService extends BaseService { + + public QualityprofilesService(WsConnector wsConnector) { + super(wsConnector, "api/qualityprofiles"); + } + + /** + * Activate a rule on a Quality Profile.<br> Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/activate_rule">Further information about this action online (including a response example)</a> + * @since 4.4 + */ + public void activateRule(ActivateRuleRequest request) { + call( + new PostRequest(path("activate_rule")) + .setParam("key", request.getKey()) + .setParam("params", request.getParams()) + .setParam("reset", request.getReset()) + .setParam("rule", request.getRule()) + .setParam("severity", request.getSeverity()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Bulk-activate rules on one quality profile.<br> Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/activate_rules">Further information about this action online (including a response example)</a> + * @since 4.4 + */ + public void activateRules(ActivateRulesRequest request) { + call( + new PostRequest(path("activate_rules")) + .setParam("activation", request.getActivation()) + .setParam("active_severities", request.getActiveSeverities() == null ? null : request.getActiveSeverities().stream().collect(Collectors.joining(","))) + .setParam("asc", request.getAsc()) + .setParam("available_since", request.getAvailableSince()) + .setParam("compareToProfile", request.getCompareToProfile()) + .setParam("inheritance", request.getInheritance() == null ? null : request.getInheritance().stream().collect(Collectors.joining(","))) + .setParam("is_template", request.getIsTemplate()) + .setParam("languages", request.getLanguages() == null ? null : request.getLanguages().stream().collect(Collectors.joining(","))) + .setParam("organization", request.getOrganization()) + .setParam("q", request.getQ()) + .setParam("qprofile", request.getQprofile()) + .setParam("repositories", request.getRepositories() == null ? null : request.getRepositories().stream().collect(Collectors.joining(","))) + .setParam("rule_key", request.getRuleKey()) + .setParam("s", request.getS()) + .setParam("severities", request.getSeverities() == null ? null : request.getSeverities().stream().collect(Collectors.joining(","))) + .setParam("statuses", request.getStatuses() == null ? null : request.getStatuses().stream().collect(Collectors.joining(","))) + .setParam("tags", request.getTags() == null ? null : request.getTags().stream().collect(Collectors.joining(","))) + .setParam("targetKey", request.getTargetKey()) + .setParam("targetSeverity", request.getTargetSeverity()) + .setParam("template_key", request.getTemplateKey()) + .setParam("types", request.getTypes() == null ? null : request.getTypes().stream().collect(Collectors.joining(","))) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Allow a group to edit a Quality Profile.<br>Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/add_group">Further information about this action online (including a response example)</a> + * @since 6.6 + */ + public void addGroup(AddGroupRequest request) { + call( + new PostRequest(path("add_group")) + .setParam("group", request.getGroup()) + .setParam("language", request.getLanguage()) + .setParam("organization", request.getOrganization()) + .setParam("qualityProfile", request.getQualityProfile()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Associate a project with a quality profile.<br> Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li> <li>Administer right on the specified project</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/add_project">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void addProject(AddProjectRequest request) { + call( + new PostRequest(path("add_project")) + .setParam("key", request.getKey()) + .setParam("language", request.getLanguage()) + .setParam("organization", request.getOrganization()) + .setParam("project", request.getProject()) + .setParam("projectUuid", request.getProjectUuid()) + .setParam("qualityProfile", request.getQualityProfile()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Allow a user to edit a Quality Profile.<br>Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/add_user">Further information about this action online (including a response example)</a> + * @since 6.6 + */ + public void addUser(AddUserRequest request) { + call( + new PostRequest(path("add_user")) + .setParam("language", request.getLanguage()) + .setParam("login", request.getLogin()) + .setParam("organization", request.getOrganization()) + .setParam("qualityProfile", request.getQualityProfile()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Backup a quality profile in XML form. The exported profile can be restored through api/qualityprofiles/restore. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/backup">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public String backup(BackupRequest request) { + return call( + new GetRequest(path("backup")) + .setParam("key", request.getKey()) + .setParam("language", request.getLanguage()) + .setParam("organization", request.getOrganization()) + .setParam("qualityProfile", request.getQualityProfile()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Change a quality profile's parent.<br>Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/change_parent">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void changeParent(ChangeParentRequest request) { + call( + new PostRequest(path("change_parent")) + .setParam("key", request.getKey()) + .setParam("language", request.getLanguage()) + .setParam("organization", request.getOrganization()) + .setParam("parentKey", request.getParentKey()) + .setParam("parentQualityProfile", request.getParentQualityProfile()) + .setParam("qualityProfile", request.getQualityProfile()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get the history of changes on a quality profile: rule activation/deactivation, change in parameters/severity. Events are ordered by date in descending order (most recent first). + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/changelog">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public String changelog(ChangelogRequest request) { + return call( + new GetRequest(path("changelog")) + .setParam("key", request.getKey()) + .setParam("language", request.getLanguage()) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("qualityProfile", request.getQualityProfile()) + .setParam("since", request.getSince()) + .setParam("to", request.getTo()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Compare two quality profiles. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/compare">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public String compare(CompareRequest request) { + return call( + new GetRequest(path("compare")) + .setParam("leftKey", request.getLeftKey()) + .setParam("rightKey", request.getRightKey()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Copy a quality profile.<br> Requires to be logged in and the 'Administer Quality Profiles' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/copy">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void copy(CopyRequest request) { + call( + new PostRequest(path("copy")) + .setParam("fromKey", request.getFromKey()) + .setParam("toName", request.getToName()), + CopyWsResponse.parser()); + } + + /** + * Create a quality profile.<br>Requires to be logged in and the 'Administer Quality Profiles' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/create">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public CreateWsResponse create(CreateRequest request) { + return call( + new PostRequest(path("create")) + .setParam("language", request.getLanguage()) + .setParam("name", request.getName()) + .setParam("organization", request.getOrganization()), + CreateWsResponse.parser()); + } + + /** + * Deactivate a rule on a quality profile.<br> Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/deactivate_rule">Further information about this action online (including a response example)</a> + * @since 4.4 + */ + public void deactivateRule(DeactivateRuleRequest request) { + call( + new PostRequest(path("deactivate_rule")) + .setParam("key", request.getKey()) + .setParam("rule", request.getRule()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Bulk deactivate rules on Quality profiles.<br>Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/deactivate_rules">Further information about this action online (including a response example)</a> + * @since 4.4 + */ + public void deactivateRules(DeactivateRulesRequest request) { + call( + new PostRequest(path("deactivate_rules")) + .setParam("activation", request.getActivation()) + .setParam("active_severities", request.getActiveSeverities() == null ? null : request.getActiveSeverities().stream().collect(Collectors.joining(","))) + .setParam("asc", request.getAsc()) + .setParam("available_since", request.getAvailableSince()) + .setParam("compareToProfile", request.getCompareToProfile()) + .setParam("inheritance", request.getInheritance() == null ? null : request.getInheritance().stream().collect(Collectors.joining(","))) + .setParam("is_template", request.getIsTemplate()) + .setParam("languages", request.getLanguages() == null ? null : request.getLanguages().stream().collect(Collectors.joining(","))) + .setParam("organization", request.getOrganization()) + .setParam("q", request.getQ()) + .setParam("qprofile", request.getQprofile()) + .setParam("repositories", request.getRepositories() == null ? null : request.getRepositories().stream().collect(Collectors.joining(","))) + .setParam("rule_key", request.getRuleKey()) + .setParam("s", request.getS()) + .setParam("severities", request.getSeverities() == null ? null : request.getSeverities().stream().collect(Collectors.joining(","))) + .setParam("statuses", request.getStatuses() == null ? null : request.getStatuses().stream().collect(Collectors.joining(","))) + .setParam("tags", request.getTags() == null ? null : request.getTags().stream().collect(Collectors.joining(","))) + .setParam("targetKey", request.getTargetKey()) + .setParam("template_key", request.getTemplateKey()) + .setParam("types", request.getTypes() == null ? null : request.getTypes().stream().collect(Collectors.joining(","))) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Delete a quality profile and all its descendants. The default quality profile cannot be deleted.<br> Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/delete">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void delete(DeleteRequest request) { + call( + new PostRequest(path("delete")) + .setParam("key", request.getKey()) + .setParam("language", request.getLanguage()) + .setParam("organization", request.getOrganization()) + .setParam("qualityProfile", request.getQualityProfile()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Export a quality profile. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/export">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public String export(ExportRequest request) { + return call( + new GetRequest(path("export")) + .setParam("key", request.getKey()) + .setParam("language", request.getLanguage()) + .setParam("organization", request.getOrganization()) + .setParam("qualityProfile", request.getQualityProfile()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Lists available profile export formats. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/exporters">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public String exporters() { + return call( + new GetRequest(path("exporters")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * List supported importers. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/importers">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public String importers() { + return call( + new GetRequest(path("importers")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Show a quality profile's ancestors and children. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/inheritance">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public InheritanceWsResponse inheritance(InheritanceRequest request) { + return call( + new GetRequest(path("inheritance")) + .setParam("key", request.getKey()) + .setParam("language", request.getLanguage()) + .setParam("organization", request.getOrganization()) + .setParam("qualityProfile", request.getQualityProfile()), + InheritanceWsResponse.parser()); + } + + /** + * List projects with their association status regarding a quality profile + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/projects">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public String projects(ProjectsRequest request) { + return call( + new GetRequest(path("projects")) + .setParam("key", request.getKey()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setParam("selected", request.getSelected()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Remove the ability from a group to edit a Quality Profile.<br>Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/remove_group">Further information about this action online (including a response example)</a> + * @since 6.6 + */ + public void removeGroup(RemoveGroupRequest request) { + call( + new PostRequest(path("remove_group")) + .setParam("group", request.getGroup()) + .setParam("language", request.getLanguage()) + .setParam("organization", request.getOrganization()) + .setParam("qualityProfile", request.getQualityProfile()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Remove a project's association with a quality profile.<br> Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li> <li>Administer right on the specified project</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/remove_project">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void removeProject(RemoveProjectRequest request) { + call( + new PostRequest(path("remove_project")) + .setParam("key", request.getKey()) + .setParam("language", request.getLanguage()) + .setParam("organization", request.getOrganization()) + .setParam("project", request.getProject()) + .setParam("projectUuid", request.getProjectUuid()) + .setParam("qualityProfile", request.getQualityProfile()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Remove the ability from a user to edit a Quality Profile.<br>Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/remove_user">Further information about this action online (including a response example)</a> + * @since 6.6 + */ + public void removeUser(RemoveUserRequest request) { + call( + new PostRequest(path("remove_user")) + .setParam("language", request.getLanguage()) + .setParam("login", request.getLogin()) + .setParam("organization", request.getOrganization()) + .setParam("qualityProfile", request.getQualityProfile()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Rename a quality profile.<br> Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/rename">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void rename(RenameRequest request) { + call( + new PostRequest(path("rename")) + .setParam("key", request.getKey()) + .setParam("name", request.getName()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Restore a quality profile using an XML file. The restored profile name is taken from the backup file, so if a profile with the same name and language already exists, it will be overwritten.<br> Requires to be logged in and the 'Administer Quality Profiles' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/restore">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void restore(RestoreRequest request) { + call( + new PostRequest(path("restore")) + .setParam("backup", request.getBackup()) + .setParam("organization", request.getOrganization()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * This web service has no effect since 6.4. It's no more possible to restore built-in quality profiles because they are automatically updated and read only. Returns HTTP code 410. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/restore_built_in">Further information about this action online (including a response example)</a> + * @since 4.4 + * @deprecated since 6.4 + */ + @Deprecated + public void restoreBuiltIn() { + call( + new PostRequest(path("restore_built_in")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Search quality profiles + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/search">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public SearchWsResponse search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("defaults", request.getDefaults()) + .setParam("language", request.getLanguage()) + .setParam("organization", request.getOrganization()) + .setParam("project", request.getProject()) + .setParam("qualityProfile", request.getQualityProfile()), + SearchWsResponse.parser()); + } + + /** + * List the groups that are allowed to edit a Quality Profile.<br>Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul> + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/search_groups">Further information about this action online (including a response example)</a> + * @since 6.6 + */ + public SearchGroupsResponse searchGroups(SearchGroupsRequest request) { + return call( + new GetRequest(path("search_groups")) + .setParam("language", request.getLanguage()) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setParam("qualityProfile", request.getQualityProfile()) + .setParam("selected", request.getSelected()), + SearchGroupsResponse.parser()); + } + + /** + * List the users that are allowed to edit a Quality Profile.<br>Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul> + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/search_users">Further information about this action online (including a response example)</a> + * @since 6.6 + */ + public SearchUsersResponse searchUsers(SearchUsersRequest request) { + return call( + new GetRequest(path("search_users")) + .setParam("language", request.getLanguage()) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setParam("qualityProfile", request.getQualityProfile()) + .setParam("selected", request.getSelected()), + SearchUsersResponse.parser()); + } + + /** + * Select the default profile for a given language.<br> Requires to be logged in and the 'Administer Quality Profiles' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/set_default">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void setDefault(SetDefaultRequest request) { + call( + new PostRequest(path("set_default")) + .setParam("key", request.getKey()) + .setParam("language", request.getLanguage()) + .setParam("organization", request.getOrganization()) + .setParam("qualityProfile", request.getQualityProfile()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Show a quality profile + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/show">Further information about this action online (including a response example)</a> + * @since 6.5 + */ + public ShowResponse show(ShowRequest request) { + return call( + new GetRequest(path("show")) + .setParam("compareToSonarWay", request.getCompareToSonarWay()) + .setParam("key", request.getKey()), + ShowResponse.parser()); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveGroupRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveGroupRequest.java new file mode 100644 index 00000000000..7fa9feec42a --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveGroupRequest.java @@ -0,0 +1,98 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import javax.annotation.Generated; + +/** + * Remove the ability from a group to edit a Quality Profile.<br>Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/remove_group">Further information about this action online (including a response example)</a> + * @since 6.6 + */ +@Generated("sonar-ws-generator") +public class RemoveGroupRequest { + + private String group; + private String language; + private String organization; + private String qualityProfile; + + /** + * Group name + * + * This is a mandatory parameter. + * Example value: "sonar-administrators" + */ + public RemoveGroupRequest setGroup(String group) { + this.group = group; + return this; + } + + public String getGroup() { + return group; + } + + /** + * Quality profile language + * + * This is a mandatory parameter. + */ + public RemoveGroupRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public RemoveGroupRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Quality Profile name + * + * This is a mandatory parameter. + * Example value: "Recommended quality profile" + */ + public RemoveGroupRequest setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public String getQualityProfile() { + return qualityProfile; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveProjectRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveProjectRequest.java new file mode 100644 index 00000000000..a5b3dbdabe8 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveProjectRequest.java @@ -0,0 +1,129 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import javax.annotation.Generated; + +/** + * Remove a project's association with a quality profile.<br> Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li> <li>Administer right on the specified project</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/remove_project">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class RemoveProjectRequest { + + private String key; + private String language; + private String organization; + private String project; + private String projectUuid; + private String qualityProfile; + + /** + * Quality profile key + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + * @deprecated since 6.6 + */ + @Deprecated + public RemoveProjectRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Quality profile language. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate. + * + */ + public RemoveProjectRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public RemoveProjectRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public RemoveProjectRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } + + /** + * Project ID. Either this parameter, or 'project' must be set. + * + * Example value: "AU-TpxcB-iU5OvuD2FL6" + * @deprecated since 6.5 + */ + @Deprecated + public RemoveProjectRequest setProjectUuid(String projectUuid) { + this.projectUuid = projectUuid; + return this; + } + + public String getProjectUuid() { + return projectUuid; + } + + /** + * Quality profile name. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate. + * + * Example value: "Sonar way" + */ + public RemoveProjectRequest setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public String getQualityProfile() { + return qualityProfile; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveUserRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveUserRequest.java new file mode 100644 index 00000000000..003df6b7f21 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveUserRequest.java @@ -0,0 +1,98 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import javax.annotation.Generated; + +/** + * Remove the ability from a user to edit a Quality Profile.<br>Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/remove_user">Further information about this action online (including a response example)</a> + * @since 6.6 + */ +@Generated("sonar-ws-generator") +public class RemoveUserRequest { + + private String language; + private String login; + private String organization; + private String qualityProfile; + + /** + * Quality profile language + * + * This is a mandatory parameter. + */ + public RemoveUserRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * User login + * + * This is a mandatory parameter. + * Example value: "john.doe" + */ + public RemoveUserRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public RemoveUserRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Quality Profile name + * + * This is a mandatory parameter. + * Example value: "Recommended quality profile" + */ + public RemoveUserRequest setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public String getQualityProfile() { + return qualityProfile; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RenameRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RenameRequest.java new file mode 100644 index 00000000000..5907d37f146 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RenameRequest.java @@ -0,0 +1,67 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import javax.annotation.Generated; + +/** + * Rename a quality profile.<br> Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/rename">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class RenameRequest { + + private String key; + private String name; + + /** + * Quality profile key + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public RenameRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * New quality profile name + * + * This is a mandatory parameter. + * Example value: "My Sonar way" + */ + public RenameRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RestoreRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RestoreRequest.java new file mode 100644 index 00000000000..8a4e292ce7f --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RestoreRequest.java @@ -0,0 +1,66 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import javax.annotation.Generated; + +/** + * Restore a quality profile using an XML file. The restored profile name is taken from the backup file, so if a profile with the same name and language already exists, it will be overwritten.<br> Requires to be logged in and the 'Administer Quality Profiles' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/restore">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class RestoreRequest { + + private String backup; + private String organization; + + /** + * A profile backup file in XML format, as generated by api/qualityprofiles/backup or the former api/profiles/backup. + * + * This is a mandatory parameter. + */ + public RestoreRequest setBackup(String backup) { + this.backup = backup; + return this; + } + + public String getBackup() { + return backup; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public RestoreRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/SearchGroupsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/SearchGroupsRequest.java new file mode 100644 index 00000000000..775a0aa3d34 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/SearchGroupsRequest.java @@ -0,0 +1,147 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import javax.annotation.Generated; + +/** + * List the groups that are allowed to edit a Quality Profile.<br>Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/search_groups">Further information about this action online (including a response example)</a> + * @since 6.6 + */ +@Generated("sonar-ws-generator") +public class SearchGroupsRequest { + + private String language; + private String organization; + private String p; + private String ps; + private String q; + private String qualityProfile; + private String selected; + + /** + * Quality profile language + * + * This is a mandatory parameter. + */ + public SearchGroupsRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public SearchGroupsRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchGroupsRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0. + * + * Example value: "20" + */ + public SearchGroupsRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to group names that contain the supplied string. + * + * Example value: "sonar" + */ + public SearchGroupsRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Quality Profile name + * + * This is a mandatory parameter. + * Example value: "Recommended quality profile" + */ + public SearchGroupsRequest setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public String getQualityProfile() { + return qualityProfile; + } + + /** + * Depending on the value, show only selected items (selected=selected), deselected items (selected=deselected), or all items with their selection status (selected=all). + * + * 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/qualityprofiles/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/SearchRequest.java new file mode 100644 index 00000000000..ddbbd5a82fc --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/SearchRequest.java @@ -0,0 +1,116 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import javax.annotation.Generated; + +/** + * Search quality profiles + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/search">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class SearchRequest { + + private String defaults; + private String language; + private String organization; + private String project; + private String qualityProfile; + + /** + * If set to true, return only the quality profiles marked as default for each language + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public SearchRequest setDefaults(String defaults) { + this.defaults = defaults; + return this; + } + + public String getDefaults() { + return defaults; + } + + /** + * Language key. If provided, only profiles for the given language are returned. + * + */ + public SearchRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public SearchRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Project key + * + * Example value: "my_project" + */ + public SearchRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } + + /** + * Quality profile name + * + * Example value: "SonarQube Way" + */ + public SearchRequest setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public String getQualityProfile() { + return qualityProfile; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/SearchUsersRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/SearchUsersRequest.java new file mode 100644 index 00000000000..10fcabd2010 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/SearchUsersRequest.java @@ -0,0 +1,147 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import javax.annotation.Generated; + +/** + * List the users that are allowed to edit a Quality Profile.<br>Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/search_users">Further information about this action online (including a response example)</a> + * @since 6.6 + */ +@Generated("sonar-ws-generator") +public class SearchUsersRequest { + + private String language; + private String organization; + private String p; + private String ps; + private String q; + private String qualityProfile; + private String selected; + + /** + * Quality profile language + * + * This is a mandatory parameter. + */ + public SearchUsersRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public SearchUsersRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchUsersRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0. + * + * Example value: "20" + */ + public SearchUsersRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to names or logins that contain the supplied string. + * + * Example value: "freddy" + */ + public SearchUsersRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Quality Profile name + * + * This is a mandatory parameter. + * Example value: "Recommended quality profile" + */ + public SearchUsersRequest setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public String getQualityProfile() { + return qualityProfile; + } + + /** + * Depending on the value, show only selected items (selected=selected), deselected items (selected=deselected), or all items with their selection status (selected=all). + * + * 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; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/SetDefaultRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/SetDefaultRequest.java new file mode 100644 index 00000000000..485945b997a --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/SetDefaultRequest.java @@ -0,0 +1,97 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import javax.annotation.Generated; + +/** + * Select the default profile for a given language.<br> Requires to be logged in and the 'Administer Quality Profiles' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/set_default">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class SetDefaultRequest { + + private String key; + private String language; + private String organization; + private String qualityProfile; + + /** + * Quality profile key + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + * @deprecated since 6.6 + */ + @Deprecated + public SetDefaultRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Quality profile language. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate. + * + */ + public SetDefaultRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * Organization key. If no organization is provided, the default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public SetDefaultRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Quality profile name. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate. + * + * Example value: "Sonar way" + */ + public SetDefaultRequest setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public String getQualityProfile() { + return qualityProfile; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ShowRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ShowRequest.java new file mode 100644 index 00000000000..4c89a6754fe --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ShowRequest.java @@ -0,0 +1,73 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.qualityprofiles; + +import javax.annotation.Generated; + +/** + * Show a quality profile + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualityprofiles/show">Further information about this action online (including a response example)</a> + * @since 6.5 + */ +@Generated("sonar-ws-generator") +public class ShowRequest { + + private String compareToSonarWay; + private String key; + + /** + * Add the number of missing rules from the related Sonar way profile in the response + * + * This is part of the internal API. + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public ShowRequest setCompareToSonarWay(String compareToSonarWay) { + this.compareToSonarWay = compareToSonarWay; + return this; + } + + public String getCompareToSonarWay() { + return compareToSonarWay; + } + + /** + * Quality profile key + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public ShowRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/package-info.java new file mode 100644 index 00000000000..a86e3fbe31e --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.qualityprofiles; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/resources/ResourcesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/resources/ResourcesService.java new file mode 100644 index 00000000000..7eaa17f1aa1 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/resources/ResourcesService.java @@ -0,0 +1,57 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.resources; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Removed since 6.3, please use api/components and api/measures instead + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/resources">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class ResourcesService extends BaseService { + + public ResourcesService(WsConnector wsConnector) { + super(wsConnector, "api/resources"); + } + + /** + * The web service is removed and you're invited to use the alternatives: <ul><li>if you need one component without measures: api/components/show</li><li>if you need one component with measures: api/measures/component</li><li>if you need several components without measures: api/components/tree</li><li>if you need several components with measures: api/measures/component_tree</li></ul> + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/resources/index">Further information about this action online (including a response example)</a> + * @since 2.10 + * @deprecated since 5.4 + */ + @Deprecated + public String index() { + return call( + new GetRequest(path("index")) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/resources/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/resources/package-info.java new file mode 100644 index 00000000000..4d0c676f441 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/resources/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.resources; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/roots/RootsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/roots/RootsService.java new file mode 100644 index 00000000000..d5efc1701bf --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/roots/RootsService.java @@ -0,0 +1,86 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.roots; + +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.Roots.SearchResponse; + +/** + * Manage root users + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/roots">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class RootsService extends BaseService { + + public RootsService(WsConnector wsConnector) { + super(wsConnector, "api/roots"); + } + + /** + * Search for root users.<br/>Requires to be root. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/roots/search">Further information about this action online (including a response example)</a> + * @since 6.2 + */ + public SearchResponse search() { + return call( + new GetRequest(path("search")), + SearchResponse.parser()); + } + + /** + * Make the specified user root.<br/>Requires to be root. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/roots/set_root">Further information about this action online (including a response example)</a> + * @since 6.2 + */ + public void setRoot(SetRootRequest request) { + call( + new PostRequest(path("set_root")) + .setParam("login", request.getLogin()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Make the specified user not root.<br/>Requires to be root. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/roots/unset_root">Further information about this action online (including a response example)</a> + * @since 6.2 + */ + public void unsetRoot(UnsetRootRequest request) { + call( + new PostRequest(path("unset_root")) + .setParam("login", request.getLogin()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/roots/SetRootRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/roots/SetRootRequest.java new file mode 100644 index 00000000000..a69170ae3ac --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/roots/SetRootRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.roots; + +import javax.annotation.Generated; + +/** + * Make the specified user root.<br/>Requires to be root. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/roots/set_root">Further information about this action online (including a response example)</a> + * @since 6.2 + */ +@Generated("sonar-ws-generator") +public class SetRootRequest { + + private String login; + + /** + * A user login + * + * This is a mandatory parameter. + * Example value: "admin" + */ + public SetRootRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/roots/UnsetRootRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/roots/UnsetRootRequest.java new file mode 100644 index 00000000000..580dd0bccd3 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/roots/UnsetRootRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.roots; + +import javax.annotation.Generated; + +/** + * Make the specified user not root.<br/>Requires to be root. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/roots/unset_root">Further information about this action online (including a response example)</a> + * @since 6.2 + */ +@Generated("sonar-ws-generator") +public class UnsetRootRequest { + + private String login; + + /** + * A user login + * + * This is a mandatory parameter. + * Example value: "admin" + */ + public UnsetRootRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/roots/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/roots/package-info.java new file mode 100644 index 00000000000..58675691a02 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/roots/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.roots; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/AppRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/AppRequest.java new file mode 100644 index 00000000000..d34a53751f2 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/AppRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.rules; + +import javax.annotation.Generated; + +/** + * Get data required for rendering the page 'Coding Rules'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/rules/app">Further information about this action online (including a response example)</a> + * @since 4.5 + */ +@Generated("sonar-ws-generator") +public class AppRequest { + + private String organization; + + /** + * Organization key + * + * This is part of the internal API. + * Example value: "my-org" + */ + public AppRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/CreateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/CreateRequest.java new file mode 100644 index 00000000000..0f642e23769 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/CreateRequest.java @@ -0,0 +1,213 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.rules; + +import javax.annotation.Generated; + +/** + * Create a custom rule.<br>Requires the 'Administer Quality Profiles' permission + * + * 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 + */ +@Generated("sonar-ws-generator") +public class CreateRequest { + + private String customKey; + private String manualKey; + private String markdownDescription; + private String name; + private String params; + private String preventReactivation; + private String severity; + private String status; + private String templateKey; + private String type; + + /** + * Key of the custom rule + * + * This is a mandatory parameter. + * Example value: "Todo_should_not_be_used" + */ + public CreateRequest setCustomKey(String customKey) { + this.customKey = customKey; + return this; + } + + public String getCustomKey() { + return customKey; + } + + /** + * Manual rules are no more supported. This parameter is ignored + * + * Example value: "Error_handling" + * @deprecated since 5.5 + */ + @Deprecated + public CreateRequest setManualKey(String manualKey) { + this.manualKey = manualKey; + return this; + } + + public String getManualKey() { + return manualKey; + } + + /** + * Rule description + * + * This is a mandatory parameter. + * Example value: "Description of my custom rule" + */ + public CreateRequest setMarkdownDescription(String markdownDescription) { + this.markdownDescription = markdownDescription; + return this; + } + + public String getMarkdownDescription() { + return markdownDescription; + } + + /** + * Rule name + * + * This is a mandatory parameter. + * Example value: "My custom rule" + */ + public CreateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * Parameters as semi-colon list of <key>=<value>, for example 'params=key1=v1;key2=v2' (Only for custom rule) + * + */ + public CreateRequest setParams(String params) { + this.params = params; + return this; + } + + public String getParams() { + return params; + } + + /** + * If set to true and if the rule has been deactivated (status 'REMOVED'), a status 409 will be returned + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public CreateRequest setPreventReactivation(String preventReactivation) { + this.preventReactivation = preventReactivation; + return this; + } + + public String getPreventReactivation() { + return preventReactivation; + } + + /** + * Rule severity + * + * Possible values: + * <ul> + * <li>"INFO"</li> + * <li>"MINOR"</li> + * <li>"MAJOR"</li> + * <li>"CRITICAL"</li> + * <li>"BLOCKER"</li> + * </ul> + */ + public CreateRequest setSeverity(String severity) { + this.severity = severity; + return this; + } + + public String getSeverity() { + return severity; + } + + /** + * Rule status + * + * Possible values: + * <ul> + * <li>"BETA"</li> + * <li>"DEPRECATED"</li> + * <li>"READY"</li> + * <li>"REMOVED"</li> + * </ul> + */ + public CreateRequest setStatus(String status) { + this.status = status; + return this; + } + + public String getStatus() { + return status; + } + + /** + * Key of the template rule in order to create a custom rule (mandatory for custom rule) + * + * Example value: "java:XPath" + */ + public CreateRequest setTemplateKey(String templateKey) { + this.templateKey = templateKey; + return this; + } + + public String getTemplateKey() { + return templateKey; + } + + /** + * Rule type + * + * Possible values: + * <ul> + * <li>"CODE_SMELL"</li> + * <li>"BUG"</li> + * <li>"VULNERABILITY"</li> + * </ul> + */ + public CreateRequest setType(String type) { + this.type = type; + return this; + } + + public String getType() { + return type; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/DeleteRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/DeleteRequest.java new file mode 100644 index 00000000000..8ab35b8a0b9 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/DeleteRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.rules; + +import javax.annotation.Generated; + +/** + * Delete custom rule.<br/>Requires the 'Administer Quality Profiles' permission + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/rules/delete">Further information about this action online (including a response example)</a> + * @since 4.4 + */ +@Generated("sonar-ws-generator") +public class DeleteRequest { + + private String key; + + /** + * Rule key + * + * This is a mandatory parameter. + * Example value: "squid:XPath_1402065390816" + */ + public DeleteRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/RepositoriesRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/RepositoriesRequest.java new file mode 100644 index 00000000000..8b2e6fbe166 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/RepositoriesRequest.java @@ -0,0 +1,65 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.rules; + +import javax.annotation.Generated; + +/** + * List available rule repositories + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/rules/repositories">Further information about this action online (including a response example)</a> + * @since 4.5 + */ +@Generated("sonar-ws-generator") +public class RepositoriesRequest { + + private String language; + private String q; + + /** + * A language key; if provided, only repositories for the given language will be returned + * + * Example value: "java" + */ + public RepositoriesRequest setLanguage(String language) { + this.language = language; + return this; + } + + public String getLanguage() { + return language; + } + + /** + * A pattern to match repository keys/names against + * + * Example value: "squid" + */ + public RepositoriesRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } +} 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 new file mode 100644 index 00000000000..b1ce42cf0cb --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/RulesService.java @@ -0,0 +1,234 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.rules; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.Rules.CreateResponse; +import org.sonarqube.ws.Rules.ListResponse; +import org.sonarqube.ws.Rules.SearchResponse; +import org.sonarqube.ws.Rules.ShowResponse; +import org.sonarqube.ws.Rules.UpdateResponse; + +/** + * Get and update some details of automatic rules, and manage custom rules. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/rules">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class RulesService extends BaseService { + + public RulesService(WsConnector wsConnector) { + super(wsConnector, "api/rules"); + } + + /** + * Get data required for rendering the page 'Coding Rules'. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/rules/app">Further information about this action online (including a response example)</a> + * @since 4.5 + */ + public String app(AppRequest request) { + return call( + new GetRequest(path("app")) + .setParam("organization", request.getOrganization()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Create a custom rule.<br>Requires the 'Administer Quality Profiles' permission + * + * 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 + */ + public void create(CreateRequest request) { + call( + new PostRequest(path("create")) + .setParam("custom_key", request.getCustomKey()) + .setParam("manual_key", request.getManualKey()) + .setParam("markdown_description", request.getMarkdownDescription()) + .setParam("name", request.getName()) + .setParam("params", request.getParams()) + .setParam("prevent_reactivation", request.getPreventReactivation()) + .setParam("severity", request.getSeverity()) + .setParam("status", request.getStatus()) + .setParam("template_key", request.getTemplateKey()) + .setParam("type", request.getType()), + CreateResponse.parser()); + } + + /** + * Delete custom rule.<br/>Requires the 'Administer Quality Profiles' permission + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/rules/delete">Further information about this action online (including a response example)</a> + * @since 4.4 + */ + public void delete(DeleteRequest request) { + call( + new PostRequest(path("delete")) + .setParam("key", request.getKey()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * List rules, excluding the manual rules and the rules with status REMOVED. JSON format is not supported for response. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/rules/list">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public ListResponse list() { + return call( + new GetRequest(path("list")), + ListResponse.parser()); + } + + /** + * List available rule repositories + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/rules/repositories">Further information about this action online (including a response example)</a> + * @since 4.5 + */ + public String repositories(RepositoriesRequest request) { + return call( + new GetRequest(path("repositories")) + .setParam("language", request.getLanguage()) + .setParam("q", request.getQ()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Search for a collection of relevant rules matching a specified query.<br/>Since 5.5, following fields in the response have been deprecated :<ul><li>"effortToFixDescription" becomes "gapDescription"</li><li>"debtRemFnCoeff" becomes "remFnGapMultiplier"</li><li>"defaultDebtRemFnCoeff" becomes "defaultRemFnGapMultiplier"</li><li>"debtRemFnOffset" becomes "remFnBaseEffort"</li><li>"defaultDebtRemFnOffset" becomes "defaultRemFnBaseEffort"</li><li>"debtOverloaded" becomes "remFnOverloaded"</li></ul> + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/rules/search">Further information about this action online (including a response example)</a> + * @since 4.4 + */ + public SearchResponse search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("activation", request.getActivation()) + .setParam("active_severities", request.getActiveSeverities() == null ? null : request.getActiveSeverities().stream().collect(Collectors.joining(","))) + .setParam("asc", request.getAsc()) + .setParam("available_since", request.getAvailableSince()) + .setParam("compareToProfile", request.getCompareToProfile()) + .setParam("f", request.getF() == null ? null : request.getF().stream().collect(Collectors.joining(","))) + .setParam("facets", request.getFacets() == null ? null : request.getFacets().stream().collect(Collectors.joining(","))) + .setParam("inheritance", request.getInheritance() == null ? null : request.getInheritance().stream().collect(Collectors.joining(","))) + .setParam("is_template", request.getIsTemplate()) + .setParam("languages", request.getLanguages() == null ? null : request.getLanguages().stream().collect(Collectors.joining(","))) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setParam("qprofile", request.getQprofile()) + .setParam("repositories", request.getRepositories() == null ? null : request.getRepositories().stream().collect(Collectors.joining(","))) + .setParam("rule_key", request.getRuleKey()) + .setParam("s", request.getS()) + .setParam("severities", request.getSeverities() == null ? null : request.getSeverities().stream().collect(Collectors.joining(","))) + .setParam("statuses", request.getStatuses() == null ? null : request.getStatuses().stream().collect(Collectors.joining(","))) + .setParam("tags", request.getTags() == null ? null : request.getTags().stream().collect(Collectors.joining(","))) + .setParam("template_key", request.getTemplateKey()) + .setParam("types", request.getTypes() == null ? null : request.getTypes().stream().collect(Collectors.joining(","))), + SearchResponse.parser()); + } + + /** + * Get detailed information about a rule<br>Since 5.5, following fields in the response have been deprecated :<ul><li>"effortToFixDescription" becomes "gapDescription"</li><li>"debtRemFnCoeff" becomes "remFnGapMultiplier"</li><li>"defaultDebtRemFnCoeff" becomes "defaultRemFnGapMultiplier"</li><li>"debtRemFnOffset" becomes "remFnBaseEffort"</li><li>"defaultDebtRemFnOffset" becomes "defaultRemFnBaseEffort"</li><li>"debtOverloaded" becomes "remFnOverloaded"</li></ul> + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/rules/show">Further information about this action online (including a response example)</a> + * @since 4.2 + */ + public ShowResponse show(ShowRequest request) { + return call( + new GetRequest(path("show")) + .setParam("actives", request.getActives()) + .setParam("key", request.getKey()) + .setParam("organization", request.getOrganization()), + ShowResponse.parser()); + } + + /** + * List rule tags + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/rules/tags">Further information about this action online (including a response example)</a> + * @since 4.4 + */ + public String tags(TagsRequest request) { + return call( + new GetRequest(path("tags")) + .setParam("organization", request.getOrganization()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Update an existing rule.<br>Requires the 'Administer Quality Profiles' permission + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/rules/update">Further information about this action online (including a response example)</a> + * @since 4.4 + */ + public void update(UpdateRequest request) { + call( + new PostRequest(path("update")) + .setParam("debt_remediation_fn_offset", request.getDebtRemediationFnOffset()) + .setParam("debt_remediation_fn_type", request.getDebtRemediationFnType()) + .setParam("debt_remediation_fy_coeff", request.getDebtRemediationFyCoeff()) + .setParam("debt_sub_characteristic", request.getDebtSubCharacteristic()) + .setParam("key", request.getKey()) + .setParam("markdown_description", request.getMarkdownDescription()) + .setParam("markdown_note", request.getMarkdownNote()) + .setParam("name", request.getName()) + .setParam("organization", request.getOrganization()) + .setParam("params", request.getParams()) + .setParam("remediation_fn_base_effort", request.getRemediationFnBaseEffort()) + .setParam("remediation_fn_type", request.getRemediationFnType()) + .setParam("remediation_fy_gap_multiplier", request.getRemediationFyGapMultiplier()) + .setParam("severity", request.getSeverity()) + .setParam("status", request.getStatus()) + .setParam("tags", request.getTags() == null ? null : request.getTags().stream().collect(Collectors.joining(","))), + UpdateResponse.parser()); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/SearchRequest.java new file mode 100644 index 00000000000..c5e39c9edf4 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/SearchRequest.java @@ -0,0 +1,484 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.rules; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Search for a collection of relevant rules matching a specified query.<br/>Since 5.5, following fields in the response have been deprecated :<ul><li>"effortToFixDescription" becomes "gapDescription"</li><li>"debtRemFnCoeff" becomes "remFnGapMultiplier"</li><li>"defaultDebtRemFnCoeff" becomes "defaultRemFnGapMultiplier"</li><li>"debtRemFnOffset" becomes "remFnBaseEffort"</li><li>"defaultDebtRemFnOffset" becomes "defaultRemFnBaseEffort"</li><li>"debtOverloaded" becomes "remFnOverloaded"</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/rules/search">Further information about this action online (including a response example)</a> + * @since 4.4 + */ +@Generated("sonar-ws-generator") +public class SearchRequest { + + private String activation; + private List<String> activeSeverities; + private String asc; + private String availableSince; + private String compareToProfile; + private List<String> f; + private List<String> facets; + private List<String> inheritance; + private String isTemplate; + private List<String> languages; + private String organization; + private String p; + private String ps; + private String q; + private String qprofile; + private List<String> repositories; + private String ruleKey; + private String s; + private List<String> severities; + private List<String> statuses; + private List<String> tags; + private String templateKey; + private List<String> types; + + /** + * Filter rules that are activated or deactivated on the selected Quality profile. Ignored if the parameter 'qprofile' is not set. + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public SearchRequest setActivation(String activation) { + this.activation = activation; + return this; + } + + public String getActivation() { + return activation; + } + + /** + * Comma-separated list of activation severities, i.e the severity of rules in Quality profiles. + * + * Example value: "CRITICAL,BLOCKER" + * Possible values: + * <ul> + * <li>"INFO"</li> + * <li>"MINOR"</li> + * <li>"MAJOR"</li> + * <li>"CRITICAL"</li> + * <li>"BLOCKER"</li> + * </ul> + */ + public SearchRequest setActiveSeverities(List<String> activeSeverities) { + this.activeSeverities = activeSeverities; + return this; + } + + public List<String> getActiveSeverities() { + return activeSeverities; + } + + /** + * Ascending sort + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public SearchRequest setAsc(String asc) { + this.asc = asc; + return this; + } + + public String getAsc() { + return asc; + } + + /** + * Filters rules added since date. Format is yyyy-MM-dd + * + * Example value: "2014-06-22" + */ + public SearchRequest setAvailableSince(String availableSince) { + this.availableSince = availableSince; + return this; + } + + public String getAvailableSince() { + return availableSince; + } + + /** + * Quality profile key to filter rules that are activated. Meant to compare easily to profile set in 'qprofile' + * + * This is part of the internal API. + * Example value: "AU-TpxcA-iU5OvuD2FLz" + */ + public SearchRequest setCompareToProfile(String compareToProfile) { + this.compareToProfile = compareToProfile; + return this; + } + + public String getCompareToProfile() { + return compareToProfile; + } + + /** + * Comma-separated list of the fields to be returned in response. All the fields are returned by default, except actives.Since 5.5, following fields have been deprecated :<ul><li>"defaultDebtRemFn" becomes "defaultRemFn"</li><li>"debtRemFn" becomes "remFn"</li><li>"effortToFixDescription" becomes "gapDescription"</li><li>"debtOverloaded" becomes "remFnOverloaded"</li></ul> + * + * Example value: "repo,name" + * Possible values: + * <ul> + * <li>"actives"</li> + * <li>"createdAt"</li> + * <li>"debtOverloaded"</li> + * <li>"debtRemFn"</li> + * <li>"defaultDebtRemFn"</li> + * <li>"defaultRemFn"</li> + * <li>"effortToFixDescription"</li> + * <li>"gapDescription"</li> + * <li>"htmlDesc"</li> + * <li>"htmlNote"</li> + * <li>"internalKey"</li> + * <li>"isTemplate"</li> + * <li>"lang"</li> + * <li>"langName"</li> + * <li>"mdDesc"</li> + * <li>"mdNote"</li> + * <li>"name"</li> + * <li>"noteLogin"</li> + * <li>"params"</li> + * <li>"remFn"</li> + * <li>"remFnOverloaded"</li> + * <li>"repo"</li> + * <li>"severity"</li> + * <li>"status"</li> + * <li>"sysTags"</li> + * <li>"tags"</li> + * <li>"templateKey"</li> + * </ul> + */ + public SearchRequest setF(List<String> f) { + this.f = f; + return this; + } + + public List<String> getF() { + return f; + } + + /** + * Comma-separated list of the facets to be computed. No facet is computed by default. + * + * Example value: "languages,repositories" + * Possible values: + * <ul> + * <li>"languages"</li> + * <li>"repositories"</li> + * <li>"tags"</li> + * <li>"severities"</li> + * <li>"active_severities"</li> + * <li>"statuses"</li> + * <li>"types"</li> + * <li>"true"</li> + * </ul> + */ + public SearchRequest setFacets(List<String> facets) { + this.facets = facets; + return this; + } + + public List<String> getFacets() { + return facets; + } + + /** + * Comma-separated list of values of inheritance for a rule within a quality profile. Used only if the parameter 'activation' is set. + * + * Example value: "INHERITED,OVERRIDES" + * Possible values: + * <ul> + * <li>"NONE"</li> + * <li>"INHERITED"</li> + * <li>"OVERRIDES"</li> + * </ul> + */ + public SearchRequest setInheritance(List<String> inheritance) { + this.inheritance = inheritance; + return this; + } + + public List<String> getInheritance() { + return inheritance; + } + + /** + * Filter template rules + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public SearchRequest setIsTemplate(String isTemplate) { + this.isTemplate = isTemplate; + return this; + } + + public String getIsTemplate() { + return isTemplate; + } + + /** + * Comma-separated list of languages + * + * Example value: "java,js" + */ + public SearchRequest setLanguages(List<String> languages) { + this.languages = languages; + return this; + } + + public List<String> getLanguages() { + return languages; + } + + /** + * Organization key + * + * This is part of the internal API. + * Example value: "my-org" + */ + public SearchRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public SearchRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * UTF-8 search query + * + * Example value: "xpath" + */ + public SearchRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Quality profile key to filter on. Used only if the parameter 'activation' is set. + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public SearchRequest setQprofile(String qprofile) { + this.qprofile = qprofile; + return this; + } + + public String getQprofile() { + return qprofile; + } + + /** + * Comma-separated list of repositories + * + * Example value: "checkstyle,findbugs" + */ + public SearchRequest setRepositories(List<String> repositories) { + this.repositories = repositories; + return this; + } + + public List<String> getRepositories() { + return repositories; + } + + /** + * Key of rule to search for + * + * Example value: "squid:S001" + */ + public SearchRequest setRuleKey(String ruleKey) { + this.ruleKey = ruleKey; + return this; + } + + public String getRuleKey() { + return ruleKey; + } + + /** + * Sort field + * + * Example value: "name" + * Possible values: + * <ul> + * <li>"name"</li> + * <li>"updatedAt"</li> + * <li>"createdAt"</li> + * <li>"key"</li> + * </ul> + */ + public SearchRequest setS(String s) { + this.s = s; + return this; + } + + public String getS() { + return s; + } + + /** + * Comma-separated list of default severities. Not the same than severity of rules in Quality profiles. + * + * Example value: "CRITICAL,BLOCKER" + * Possible values: + * <ul> + * <li>"INFO"</li> + * <li>"MINOR"</li> + * <li>"MAJOR"</li> + * <li>"CRITICAL"</li> + * <li>"BLOCKER"</li> + * </ul> + */ + public SearchRequest setSeverities(List<String> severities) { + this.severities = severities; + return this; + } + + public List<String> getSeverities() { + return severities; + } + + /** + * Comma-separated list of status codes + * + * Example value: "READY" + * Possible values: + * <ul> + * <li>"BETA"</li> + * <li>"DEPRECATED"</li> + * <li>"READY"</li> + * <li>"REMOVED"</li> + * </ul> + */ + public SearchRequest setStatuses(List<String> statuses) { + this.statuses = statuses; + return this; + } + + public List<String> getStatuses() { + return statuses; + } + + /** + * Comma-separated list of tags. Returned rules match any of the tags (OR operator) + * + * Example value: "security,java8" + */ + public SearchRequest setTags(List<String> tags) { + this.tags = tags; + return this; + } + + public List<String> getTags() { + return tags; + } + + /** + * Key of the template rule to filter on. Used to search for the custom rules based on this template. + * + * Example value: "java:S001" + */ + public SearchRequest setTemplateKey(String templateKey) { + this.templateKey = templateKey; + return this; + } + + public String getTemplateKey() { + return templateKey; + } + + /** + * Comma-separated list of types. Returned rules match any of the tags (OR operator) + * + * Example value: "BUG" + * Possible values: + * <ul> + * <li>"CODE_SMELL"</li> + * <li>"BUG"</li> + * <li>"VULNERABILITY"</li> + * </ul> + */ + public SearchRequest setTypes(List<String> types) { + this.types = types; + return this; + } + + public List<String> getTypes() { + return types; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/ShowRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/ShowRequest.java new file mode 100644 index 00000000000..83b7caddf6d --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/ShowRequest.java @@ -0,0 +1,88 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.rules; + +import javax.annotation.Generated; + +/** + * Get detailed information about a rule<br>Since 5.5, following fields in the response have been deprecated :<ul><li>"effortToFixDescription" becomes "gapDescription"</li><li>"debtRemFnCoeff" becomes "remFnGapMultiplier"</li><li>"defaultDebtRemFnCoeff" becomes "defaultRemFnGapMultiplier"</li><li>"debtRemFnOffset" becomes "remFnBaseEffort"</li><li>"defaultDebtRemFnOffset" becomes "defaultRemFnBaseEffort"</li><li>"debtOverloaded" becomes "remFnOverloaded"</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/rules/show">Further information about this action online (including a response example)</a> + * @since 4.2 + */ +@Generated("sonar-ws-generator") +public class ShowRequest { + + private String actives; + private String key; + private String organization; + + /** + * Show rule's activations for all profiles ("active rules") + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public ShowRequest setActives(String actives) { + this.actives = actives; + return this; + } + + public String getActives() { + return actives; + } + + /** + * Rule key + * + * This is a mandatory parameter. + * Example value: "javascript:EmptyBlock" + */ + public ShowRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Organization key + * + * This is part of the internal API. + * Example value: "my-org" + */ + public ShowRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/TagsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/TagsRequest.java new file mode 100644 index 00000000000..c2fd9469a68 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/TagsRequest.java @@ -0,0 +1,81 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.rules; + +import javax.annotation.Generated; + +/** + * List rule tags + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/rules/tags">Further information about this action online (including a response example)</a> + * @since 4.4 + */ +@Generated("sonar-ws-generator") +public class TagsRequest { + + private String organization; + private String ps; + private String q; + + /** + * Organization key + * + * This is part of the internal API. + * Example value: "my-org" + */ + public TagsRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Page size. Must be greater than 0 and less than 100 + * + * Example value: "20" + */ + public TagsRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to tags that contain the supplied string. + * + * Example value: "misra" + */ + public TagsRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/UpdateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/UpdateRequest.java new file mode 100644 index 00000000000..1da7042a4b4 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/UpdateRequest.java @@ -0,0 +1,299 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.rules; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Update an existing rule.<br>Requires the 'Administer Quality Profiles' permission + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/rules/update">Further information about this action online (including a response example)</a> + * @since 4.4 + */ +@Generated("sonar-ws-generator") +public class UpdateRequest { + + private String debtRemediationFnOffset; + private String debtRemediationFnType; + private String debtRemediationFyCoeff; + private String debtSubCharacteristic; + private String key; + private String markdownDescription; + private String markdownNote; + private String name; + private String organization; + private String params; + private String remediationFnBaseEffort; + private String remediationFnType; + private String remediationFyGapMultiplier; + private String severity; + private String status; + private List<String> tags; + + /** + * @deprecated since 5.5 + */ + @Deprecated + public UpdateRequest setDebtRemediationFnOffset(String debtRemediationFnOffset) { + this.debtRemediationFnOffset = debtRemediationFnOffset; + return this; + } + + public String getDebtRemediationFnOffset() { + return debtRemediationFnOffset; + } + + /** + * Possible values: + * <ul> + * <li>"LINEAR"</li> + * <li>"LINEAR_OFFSET"</li> + * <li>"CONSTANT_ISSUE"</li> + * </ul> + * @deprecated since 5.5 + */ + @Deprecated + public UpdateRequest setDebtRemediationFnType(String debtRemediationFnType) { + this.debtRemediationFnType = debtRemediationFnType; + return this; + } + + public String getDebtRemediationFnType() { + return debtRemediationFnType; + } + + /** + * @deprecated since 5.5 + */ + @Deprecated + public UpdateRequest setDebtRemediationFyCoeff(String debtRemediationFyCoeff) { + this.debtRemediationFyCoeff = debtRemediationFyCoeff; + return this; + } + + public String getDebtRemediationFyCoeff() { + return debtRemediationFyCoeff; + } + + /** + * Debt characteristics are no more supported. This parameter is ignored. + * + * @deprecated since 5.5 + */ + @Deprecated + public UpdateRequest setDebtSubCharacteristic(String debtSubCharacteristic) { + this.debtSubCharacteristic = debtSubCharacteristic; + return this; + } + + public String getDebtSubCharacteristic() { + return debtSubCharacteristic; + } + + /** + * Key of the rule to update + * + * This is a mandatory parameter. + * Example value: "javascript:NullCheck" + */ + public UpdateRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Rule description (mandatory for custom rule and manual rule) + * + * Example value: "Description of my custom rule" + */ + public UpdateRequest setMarkdownDescription(String markdownDescription) { + this.markdownDescription = markdownDescription; + return this; + } + + public String getMarkdownDescription() { + return markdownDescription; + } + + /** + * Optional note in markdown format. Use empty value to remove current note. Note is not changedif the parameter is not set. + * + * Example value: "my *note*" + */ + public UpdateRequest setMarkdownNote(String markdownNote) { + this.markdownNote = markdownNote; + return this; + } + + public String getMarkdownNote() { + return markdownNote; + } + + /** + * Rule name (mandatory for custom rule) + * + * Example value: "My custom rule" + */ + public UpdateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * Organization key + * + * This is part of the internal API. + * Example value: "my-org" + */ + public UpdateRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * Parameters as semi-colon list of <key>=<value>, for example 'params=key1=v1;key2=v2' (Only when updating a custom rule) + * + */ + public UpdateRequest setParams(String params) { + this.params = params; + return this; + } + + public String getParams() { + return params; + } + + /** + * Base effort of the remediation function of the rule + * + * Example value: "1d" + */ + public UpdateRequest setRemediationFnBaseEffort(String remediationFnBaseEffort) { + this.remediationFnBaseEffort = remediationFnBaseEffort; + return this; + } + + public String getRemediationFnBaseEffort() { + return remediationFnBaseEffort; + } + + /** + * Type of the remediation function of the rule + * + * Possible values: + * <ul> + * <li>"LINEAR"</li> + * <li>"LINEAR_OFFSET"</li> + * <li>"CONSTANT_ISSUE"</li> + * </ul> + */ + public UpdateRequest setRemediationFnType(String remediationFnType) { + this.remediationFnType = remediationFnType; + return this; + } + + public String getRemediationFnType() { + return remediationFnType; + } + + /** + * Gap multiplier of the remediation function of the rule + * + * Example value: "3min" + */ + public UpdateRequest setRemediationFyGapMultiplier(String remediationFyGapMultiplier) { + this.remediationFyGapMultiplier = remediationFyGapMultiplier; + return this; + } + + public String getRemediationFyGapMultiplier() { + return remediationFyGapMultiplier; + } + + /** + * Rule severity (Only when updating a custom rule) + * + * Possible values: + * <ul> + * <li>"INFO"</li> + * <li>"MINOR"</li> + * <li>"MAJOR"</li> + * <li>"CRITICAL"</li> + * <li>"BLOCKER"</li> + * </ul> + */ + public UpdateRequest setSeverity(String severity) { + this.severity = severity; + return this; + } + + public String getSeverity() { + return severity; + } + + /** + * Rule status (Only when updating a custom rule) + * + * Possible values: + * <ul> + * <li>"BETA"</li> + * <li>"DEPRECATED"</li> + * <li>"READY"</li> + * <li>"REMOVED"</li> + * </ul> + */ + public UpdateRequest setStatus(String status) { + this.status = status; + return this; + } + + public String getStatus() { + return status; + } + + /** + * Optional comma-separated list of tags to set. Use blank value to remove current tags. Tags are not changed if the parameter is not set. + * + * Example value: "java8,security" + */ + public UpdateRequest setTags(List<String> tags) { + this.tags = tags; + return this; + } + + public List<String> getTags() { + return tags; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/package-info.java new file mode 100644 index 00000000000..350942a959c --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.rules; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/server/ServerService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/server/ServerService.java new file mode 100644 index 00000000000..79d66460e8e --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/server/ServerService.java @@ -0,0 +1,55 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.server; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * $webService.description.asString + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/server">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class ServerService extends BaseService { + + public ServerService(WsConnector wsConnector) { + super(wsConnector, "api/server"); + } + + /** + * Version of SonarQube in plain text + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/server/version">Further information about this action online (including a response example)</a> + * @since 2.10 + */ + public String version() { + return call( + new GetRequest(path("version")) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/server/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/server/package-info.java new file mode 100644 index 00000000000..8e64aaefb0f --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/server/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.server; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/settings/EncryptRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/settings/EncryptRequest.java new file mode 100644 index 00000000000..6777e93df8f --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/settings/EncryptRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.settings; + +import javax.annotation.Generated; + +/** + * Encrypt a setting value.<br>Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/settings/encrypt">Further information about this action online (including a response example)</a> + * @since 6.1 + */ +@Generated("sonar-ws-generator") +public class EncryptRequest { + + private String value; + + /** + * Setting value to encrypt + * + * This is a mandatory parameter. + * Example value: "my value" + */ + public EncryptRequest setValue(String value) { + this.value = value; + return this; + } + + public String getValue() { + return value; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/settings/ListDefinitionsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/settings/ListDefinitionsRequest.java new file mode 100644 index 00000000000..3b7215008be --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/settings/ListDefinitionsRequest.java @@ -0,0 +1,66 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.settings; + +import javax.annotation.Generated; + +/** + * List settings definitions.<br>Requires 'Browse' permission when a component is specified<br/> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/settings/list_definitions">Further information about this action online (including a response example)</a> + * @since 6.3 + */ +@Generated("sonar-ws-generator") +public class ListDefinitionsRequest { + + private String branch; + private String component; + + /** + * Branch key. Only available on following settings : sonar.leak.period + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public ListDefinitionsRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * Component key + * + * Example value: "my_project" + */ + public ListDefinitionsRequest setComponent(String component) { + this.component = component; + return this; + } + + public String getComponent() { + return component; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/settings/ResetRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/settings/ResetRequest.java new file mode 100644 index 00000000000..24c14703acb --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/settings/ResetRequest.java @@ -0,0 +1,83 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.settings; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Remove a setting value.<br>Requires one of the following permissions: <ul><li>'Administer System'</li><li>'Administer' rights on the specified component</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/settings/reset">Further information about this action online (including a response example)</a> + * @since 6.1 + */ +@Generated("sonar-ws-generator") +public class ResetRequest { + + private String branch; + private String component; + private List<String> keys; + + /** + * Branch key + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public ResetRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * Component key + * + * Example value: "my_project" + */ + public ResetRequest setComponent(String component) { + this.component = component; + return this; + } + + public String getComponent() { + return component; + } + + /** + * Comma-separated list of keys + * + * This is a mandatory parameter. + * Example value: "sonar.links.scm,sonar.debt.hoursInDay" + */ + public ResetRequest setKeys(List<String> keys) { + this.keys = keys; + return this; + } + + public List<String> getKeys() { + return keys; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/settings/SetRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/settings/SetRequest.java new file mode 100644 index 00000000000..f230b401b07 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/settings/SetRequest.java @@ -0,0 +1,128 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.settings; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Update a setting value.<br>Either 'value' or 'values' must be provided.<br> Requires one of the following permissions: <ul><li>'Administer System'</li><li>'Administer' rights on the specified component</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/settings/set">Further information about this action online (including a response example)</a> + * @since 6.1 + */ +@Generated("sonar-ws-generator") +public class SetRequest { + + private String branch; + private String component; + private List<String> fieldValues; + private String key; + private String value; + private List<String> values; + + /** + * Branch key. Only available on following settings : sonar.leak.period + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public SetRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * Component key + * + * Example value: "my_project" + */ + public SetRequest setComponent(String component) { + this.component = component; + return this; + } + + public String getComponent() { + return component; + } + + /** + * Setting field values. To set several values, the parameter must be called once for each value. + * + * Example value: "fieldValues={\"firstField\":\"first value\", \"secondField\":\"second value\", \"thirdField\":\"third value\"}" + */ + public SetRequest setFieldValues(List<String> fieldValues) { + this.fieldValues = fieldValues; + return this; + } + + public List<String> getFieldValues() { + return fieldValues; + } + + /** + * Setting key + * + * This is a mandatory parameter. + * Example value: "sonar.links.scm" + */ + public SetRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Setting value. To reset a value, please use the reset web service. + * + * Example value: "git@github.com:SonarSource/sonarqube.git" + */ + public SetRequest setValue(String value) { + this.value = value; + return this; + } + + public String getValue() { + return value; + } + + /** + * Setting multi value. To set several values, the parameter must be called once for each value. + * + * Example value: "values=firstValue&values=secondValue&values=thirdValue" + */ + public SetRequest setValues(List<String> values) { + this.values = values; + return this; + } + + public List<String> getValues() { + return values; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/settings/SettingsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/settings/SettingsService.java new file mode 100644 index 00000000000..6be18837145 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/settings/SettingsService.java @@ -0,0 +1,160 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.settings; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.Settings.CheckSecretKeyWsResponse; +import org.sonarqube.ws.Settings.EncryptWsResponse; +import org.sonarqube.ws.Settings.GenerateSecretKeyWsResponse; +import org.sonarqube.ws.Settings.ListDefinitionsWsResponse; +import org.sonarqube.ws.Settings.ValuesWsResponse; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Manage settings. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/settings">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class SettingsService extends BaseService { + + public SettingsService(WsConnector wsConnector) { + super(wsConnector, "api/settings"); + } + + /** + * Check if a secret key is available.<br>Requires the 'Administer System' permission. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/settings/check_secret_key">Further information about this action online (including a response example)</a> + * @since 6.1 + */ + public CheckSecretKeyWsResponse checkSecretKey() { + return call( + new GetRequest(path("check_secret_key")), + CheckSecretKeyWsResponse.parser()); + } + + /** + * Encrypt a setting value.<br>Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/settings/encrypt">Further information about this action online (including a response example)</a> + * @since 6.1 + */ + public EncryptWsResponse encrypt(EncryptRequest request) { + return call( + new GetRequest(path("encrypt")) + .setParam("value", request.getValue()), + EncryptWsResponse.parser()); + } + + /** + * Generate a secret key.<br>Requires the 'Administer System' permission + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/settings/generate_secret_key">Further information about this action online (including a response example)</a> + * @since 6.1 + */ + public GenerateSecretKeyWsResponse generateSecretKey() { + return call( + new GetRequest(path("generate_secret_key")), + GenerateSecretKeyWsResponse.parser()); + } + + /** + * List settings definitions.<br>Requires 'Browse' permission when a component is specified<br/> + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/settings/list_definitions">Further information about this action online (including a response example)</a> + * @since 6.3 + */ + public ListDefinitionsWsResponse listDefinitions(ListDefinitionsRequest request) { + return call( + new GetRequest(path("list_definitions")) + .setParam("branch", request.getBranch()) + .setParam("component", request.getComponent()), + ListDefinitionsWsResponse.parser()); + } + + /** + * Remove a setting value.<br>Requires one of the following permissions: <ul><li>'Administer System'</li><li>'Administer' rights on the specified component</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/settings/reset">Further information about this action online (including a response example)</a> + * @since 6.1 + */ + public void reset(ResetRequest request) { + call( + new PostRequest(path("reset")) + .setParam("branch", request.getBranch()) + .setParam("component", request.getComponent()) + .setParam("keys", request.getKeys() == null ? null : request.getKeys().stream().collect(Collectors.joining(","))) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Update a setting value.<br>Either 'value' or 'values' must be provided.<br> Requires one of the following permissions: <ul><li>'Administer System'</li><li>'Administer' rights on the specified component</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/settings/set">Further information about this action online (including a response example)</a> + * @since 6.1 + */ + public void set(SetRequest request) { + call( + new PostRequest(path("set")) + .setParam("branch", request.getBranch()) + .setParam("component", request.getComponent()) + .setParam("fieldValues", request.getFieldValues() == null ? null : request.getFieldValues().stream().collect(Collectors.joining(","))) + .setParam("key", request.getKey()) + .setParam("value", request.getValue()) + .setParam("values", request.getValues() == null ? null : request.getValues().stream().collect(Collectors.joining(","))) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * List settings values.<br>If no value has been set for a setting, then the default value is returned.<br>Requires 'Browse' permission when a component is specified<br/> + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/settings/values">Further information about this action online (including a response example)</a> + * @since 6.3 + */ + public ValuesWsResponse values(ValuesRequest request) { + return call( + new GetRequest(path("values")) + .setParam("branch", request.getBranch()) + .setParam("component", request.getComponent()) + .setParam("keys", request.getKeys() == null ? null : request.getKeys().stream().collect(Collectors.joining(","))), + ValuesWsResponse.parser()); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/settings/ValuesRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/settings/ValuesRequest.java new file mode 100644 index 00000000000..3ec6fa952a5 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/settings/ValuesRequest.java @@ -0,0 +1,82 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.settings; + +import java.util.List; +import javax.annotation.Generated; + +/** + * List settings values.<br>If no value has been set for a setting, then the default value is returned.<br>Requires 'Browse' permission when a component is specified<br/> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/settings/values">Further information about this action online (including a response example)</a> + * @since 6.3 + */ +@Generated("sonar-ws-generator") +public class ValuesRequest { + + private String branch; + private String component; + private List<String> keys; + + /** + * Branch key + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public ValuesRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * Component key + * + * Example value: "my_project" + */ + public ValuesRequest setComponent(String component) { + this.component = component; + return this; + } + + public String getComponent() { + return component; + } + + /** + * List of setting keys + * + * Example value: "sonar.test.inclusions,sonar.dbcleaner.cleanDirectory" + */ + public ValuesRequest setKeys(List<String> keys) { + this.keys = keys; + return this; + } + + public List<String> getKeys() { + return keys; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/settings/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/settings/package-info.java new file mode 100644 index 00000000000..09aad91956c --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/settings/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.settings; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/HashRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/HashRequest.java new file mode 100644 index 00000000000..4055ddb3b6d --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/HashRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.sources; + +import javax.annotation.Generated; + +/** + * Show line line hashes for a given file. Require See Source Code permission on file's project<br/> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/sources/hash">Further information about this action online (including a response example)</a> + * @since 5.0 + */ +@Generated("sonar-ws-generator") +public class HashRequest { + + private String key; + + /** + * File key + * + * This is a mandatory parameter. + * Example value: "my_project:/src/foo/Bar.php" + */ + public HashRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/IndexRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/IndexRequest.java new file mode 100644 index 00000000000..9c19e1ce9cc --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/IndexRequest.java @@ -0,0 +1,79 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.sources; + +import javax.annotation.Generated; + +/** + * Get source code as line number / text pairs. Require See Source Code permission on file + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/sources/index">Further information about this action online (including a response example)</a> + * @since 5.0 + */ +@Generated("sonar-ws-generator") +public class IndexRequest { + + private String from; + private String resource; + private String to; + + /** + * First line + * + */ + public IndexRequest setFrom(String from) { + this.from = from; + return this; + } + + public String getFrom() { + return from; + } + + /** + * File key + * + * This is a mandatory parameter. + * Example value: "my_project:/src/foo/Bar.php" + */ + public IndexRequest setResource(String resource) { + this.resource = resource; + return this; + } + + public String getResource() { + return resource; + } + + /** + * Last line (excluded). If not specified, all lines are returned until end of file + * + */ + public IndexRequest setTo(String to) { + this.to = to; + return this; + } + + public String getTo() { + return to; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/LinesRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/LinesRequest.java new file mode 100644 index 00000000000..e18c68e274c --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/LinesRequest.java @@ -0,0 +1,111 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.sources; + +import javax.annotation.Generated; + +/** + * Show source code with line oriented info. Require See Source Code permission on file's project<br/>Each element of the result array is an object which contains:<ol><li>Line number</li><li>Content of the line</li><li>Author of the line (from SCM information)</li><li>Revision of the line (from SCM information)</li><li>Last commit date of the line (from SCM information)</li><li>Line hits from coverage</li><li>Number of conditions to cover in tests</li><li>Number of conditions covered by tests</li></ol> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/sources/lines">Further information about this action online (including a response example)</a> + * @since 5.0 + */ +@Generated("sonar-ws-generator") +public class LinesRequest { + + private String branch; + private String from; + private String key; + private String to; + private String uuid; + + /** + * Branch key + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public LinesRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * First line to return. Starts from 1 + * + * Example value: "10" + */ + public LinesRequest setFrom(String from) { + this.from = from; + return this; + } + + public String getFrom() { + return from; + } + + /** + * File key. Mandatory if param 'uuid' is not set. Available since 5.2 + * + * Example value: "my_project:/src/foo/Bar.php" + */ + public LinesRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Optional last line to return (inclusive). It must be greater than or equal to parameter 'from'. If unset, then all the lines greater than or equal to 'from' are returned. + * + * Example value: "20" + */ + public LinesRequest setTo(String to) { + this.to = to; + return this; + } + + public String getTo() { + return to; + } + + /** + * File uuid. Mandatory if param 'key' is not set + * + * Example value: "f333aab4-7e3a-4d70-87e1-f4c491f05e5c" + */ + public LinesRequest setUuid(String uuid) { + this.uuid = uuid; + return this; + } + + public String getUuid() { + return uuid; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/RawRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/RawRequest.java new file mode 100644 index 00000000000..384cc2d1412 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/RawRequest.java @@ -0,0 +1,67 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.sources; + +import javax.annotation.Generated; + +/** + * Get source code as raw text. Require 'See Source Code' permission on file + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/sources/raw">Further information about this action online (including a response example)</a> + * @since 5.0 + */ +@Generated("sonar-ws-generator") +public class RawRequest { + + private String branch; + private String key; + + /** + * Branch key + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public RawRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * File key + * + * This is a mandatory parameter. + * Example value: "my_project:src/foo/Bar.php" + */ + public RawRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/ScmRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/ScmRequest.java new file mode 100644 index 00000000000..58bc1ddeb68 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/ScmRequest.java @@ -0,0 +1,102 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.sources; + +import javax.annotation.Generated; + +/** + * Get SCM information of source files. Require See Source Code permission on file's project<br/>Each element of the result array is composed of:<ol><li>Line number</li><li>Author of the commit</li><li>Datetime of the commit (before 5.2 it was only the Date)</li><li>Revision of the commit (added in 5.2)</li></ol> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/sources/scm">Further information about this action online (including a response example)</a> + * @since 4.4 + */ +@Generated("sonar-ws-generator") +public class ScmRequest { + + private String commitsByLine; + private String from; + private String key; + private String to; + + /** + * Group lines by SCM commit if value is false, else display commits for each line, even if two consecutive lines relate to the same commit. + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public ScmRequest setCommitsByLine(String commitsByLine) { + this.commitsByLine = commitsByLine; + return this; + } + + public String getCommitsByLine() { + return commitsByLine; + } + + /** + * First line to return. Starts at 1 + * + * Example value: "10" + */ + public ScmRequest setFrom(String from) { + this.from = from; + return this; + } + + public String getFrom() { + return from; + } + + /** + * File key + * + * This is a mandatory parameter. + * Example value: "my_project:/src/foo/Bar.php" + */ + public ScmRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Last line to return (inclusive) + * + * Example value: "20" + */ + public ScmRequest setTo(String to) { + this.to = to; + return this; + } + + public String getTo() { + return to; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/ShowRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/ShowRequest.java new file mode 100644 index 00000000000..d8f3950134d --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/ShowRequest.java @@ -0,0 +1,81 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.sources; + +import javax.annotation.Generated; + +/** + * Get source code. Require See Source Code permission on file's project<br/>Each element of the result array is composed of:<ol><li>Line number</li><li>Content of the line</li></ol> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/sources/show">Further information about this action online (including a response example)</a> + * @since 4.4 + */ +@Generated("sonar-ws-generator") +public class ShowRequest { + + private String from; + private String key; + private String to; + + /** + * First line to return. Starts at 1 + * + * Example value: "10" + */ + public ShowRequest setFrom(String from) { + this.from = from; + return this; + } + + public String getFrom() { + return from; + } + + /** + * File key + * + * This is a mandatory parameter. + * Example value: "my_project:/src/foo/Bar.php" + */ + public ShowRequest setKey(String key) { + this.key = key; + return this; + } + + public String getKey() { + return key; + } + + /** + * Last line to return (inclusive) + * + * Example value: "20" + */ + public ShowRequest setTo(String to) { + this.to = to; + return this; + } + + public String getTo() { + return to; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/SourcesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/SourcesService.java new file mode 100644 index 00000000000..d7545c9d9ee --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/SourcesService.java @@ -0,0 +1,146 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.sources; + +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Get details on source files. See also api/tests. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/sources">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class SourcesService extends BaseService { + + public SourcesService(WsConnector wsConnector) { + super(wsConnector, "api/sources"); + } + + /** + * Show line line hashes for a given file. Require See Source Code permission on file's project<br/> + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/sources/hash">Further information about this action online (including a response example)</a> + * @since 5.0 + */ + public String hash(HashRequest request) { + return call( + new GetRequest(path("hash")) + .setParam("key", request.getKey()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get source code as line number / text pairs. Require See Source Code permission on file + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/sources/index">Further information about this action online (including a response example)</a> + * @since 5.0 + */ + public String index(IndexRequest request) { + return call( + new GetRequest(path("index")) + .setParam("from", request.getFrom()) + .setParam("resource", request.getResource()) + .setParam("to", request.getTo()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Show source code with line oriented info. Require See Source Code permission on file's project<br/>Each element of the result array is an object which contains:<ol><li>Line number</li><li>Content of the line</li><li>Author of the line (from SCM information)</li><li>Revision of the line (from SCM information)</li><li>Last commit date of the line (from SCM information)</li><li>Line hits from coverage</li><li>Number of conditions to cover in tests</li><li>Number of conditions covered by tests</li></ol> + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/sources/lines">Further information about this action online (including a response example)</a> + * @since 5.0 + */ + public String lines(LinesRequest request) { + return call( + new GetRequest(path("lines")) + .setParam("branch", request.getBranch()) + .setParam("from", request.getFrom()) + .setParam("key", request.getKey()) + .setParam("to", request.getTo()) + .setParam("uuid", request.getUuid()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get source code as raw text. Require 'See Source Code' permission on file + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/sources/raw">Further information about this action online (including a response example)</a> + * @since 5.0 + */ + public String raw(RawRequest request) { + return call( + new GetRequest(path("raw")) + .setParam("branch", request.getBranch()) + .setParam("key", request.getKey()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get SCM information of source files. Require See Source Code permission on file's project<br/>Each element of the result array is composed of:<ol><li>Line number</li><li>Author of the commit</li><li>Datetime of the commit (before 5.2 it was only the Date)</li><li>Revision of the commit (added in 5.2)</li></ol> + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/sources/scm">Further information about this action online (including a response example)</a> + * @since 4.4 + */ + public String scm(ScmRequest request) { + return call( + new GetRequest(path("scm")) + .setParam("commits_by_line", request.getCommitsByLine()) + .setParam("from", request.getFrom()) + .setParam("key", request.getKey()) + .setParam("to", request.getTo()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get source code. Require See Source Code permission on file's project<br/>Each element of the result array is composed of:<ol><li>Line number</li><li>Content of the line</li></ol> + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/sources/show">Further information about this action online (including a response example)</a> + * @since 4.4 + */ + public String show(ShowRequest request) { + return call( + new GetRequest(path("show")) + .setParam("from", request.getFrom()) + .setParam("key", request.getKey()) + .setParam("to", request.getTo()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/package-info.java new file mode 100644 index 00000000000..06a8b91a35a --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.sources; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/system/ChangeLogLevelRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/system/ChangeLogLevelRequest.java new file mode 100644 index 00000000000..0f7e71b9573 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/system/ChangeLogLevelRequest.java @@ -0,0 +1,56 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.system; + +import javax.annotation.Generated; + +/** + * Temporarily changes level of logs. New level is not persistent and is lost when restarting server. Requires system administration permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/system/change_log_level">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class ChangeLogLevelRequest { + + private String level; + + /** + * The new level. Be cautious: DEBUG, and even more TRACE, may have performance impacts. + * + * This is a mandatory parameter. + * Possible values: + * <ul> + * <li>"TRACE"</li> + * <li>"DEBUG"</li> + * <li>"INFO"</li> + * </ul> + */ + public ChangeLogLevelRequest setLevel(String level) { + this.level = level; + return this; + } + + public String getLevel() { + return level; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/system/LogsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/system/LogsRequest.java new file mode 100644 index 00000000000..42544c1b783 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/system/LogsRequest.java @@ -0,0 +1,56 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.system; + +import javax.annotation.Generated; + +/** + * Get system logs in plain-text format. Requires system administration permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/system/logs">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class LogsRequest { + + private String process; + + /** + * Process to get logs from + * + * Possible values: + * <ul> + * <li>"app"</li> + * <li>"ce"</li> + * <li>"es"</li> + * <li>"web"</li> + * </ul> + */ + public LogsRequest setProcess(String process) { + this.process = process; + return this; + } + + public String getProcess() { + return process; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/system/SystemService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/system/SystemService.java new file mode 100644 index 00000000000..6c970de9ba2 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/system/SystemService.java @@ -0,0 +1,191 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.system; + +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.System.HealthResponse; +import org.sonarqube.ws.System.StatusResponse; + +/** + * Get system details, and perform some management actions, such as restarting, and initiating a database migration (as part of a system upgrade). + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/system">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class SystemService extends BaseService { + + public SystemService(WsConnector wsConnector) { + super(wsConnector, "api/system"); + } + + /** + * Temporarily changes level of logs. New level is not persistent and is lost when restarting server. Requires system administration permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/system/change_log_level">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void changeLogLevel(ChangeLogLevelRequest request) { + call( + new PostRequest(path("change_log_level")) + .setParam("level", request.getLevel()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Display the database migration status of SonarQube.<br/>State values are:<ul><li>NO_MIGRATION: DB is up to date with current version of SonarQube.</li><li>NOT_SUPPORTED: Migration is not supported on embedded databases.</li><li>MIGRATION_RUNNING: DB migration is under go.</li><li>MIGRATION_SUCCEEDED: DB migration has run and has been successful.</li><li>MIGRATION_FAILED: DB migration has run and failed. SonarQube must be restarted in order to retry a DB migration (optionally after DB has been restored from backup).</li><li>MIGRATION_REQUIRED: DB migration is required.</li></ul> + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/system/db_migration_status">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public String dbMigrationStatus() { + return call( + new GetRequest(path("db_migration_status")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Provide health status of SonarQube.<p>Require 'Administer System' permission or authentication with passcode</p><p> <ul> <li>GREEN: SonarQube is fully operational</li> <li>YELLOW: SonarQube is usable, but it needs attention in order to be fully operational</li> <li>RED: SonarQube is not operational</li> </ul></p> + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/system/health">Further information about this action online (including a response example)</a> + * @since 6.6 + */ + public HealthResponse health() { + return call( + new GetRequest(path("health")), + HealthResponse.parser()); + } + + /** + * Get detailed information about system configuration.<br/>Requires 'Administer' permissions.<br/>Since 5.5, this web service becomes internal in order to more easily update result. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/system/info">Further information about this action online (including a response example)</a> + * @since 5.1 + */ + public String info() { + return call( + new GetRequest(path("info")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get system logs in plain-text format. Requires system administration permission. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/system/logs">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public String logs(LogsRequest request) { + return call( + new GetRequest(path("logs")) + .setParam("process", request.getProcess()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Migrate the database to match the current version of SonarQube.<br/>Sending a POST request to this URL starts the DB migration. It is strongly advised to <strong>make a database backup</strong> before invoking this WS.<br/>State values are:<ul><li>NO_MIGRATION: DB is up to date with current version of SonarQube.</li><li>NOT_SUPPORTED: Migration is not supported on embedded databases.</li><li>MIGRATION_RUNNING: DB migration is under go.</li><li>MIGRATION_SUCCEEDED: DB migration has run and has been successful.</li><li>MIGRATION_FAILED: DB migration has run and failed. SonarQube must be restarted in order to retry a DB migration (optionally after DB has been restored from backup).</li><li>MIGRATION_REQUIRED: DB migration is required.</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/system/migrate_db">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public String migrateDb() { + return call( + new PostRequest(path("migrate_db")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Answers "pong" as plain-text + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/system/ping">Further information about this action online (including a response example)</a> + * @since 6.3 + */ + public String ping() { + return call( + new GetRequest(path("ping")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Restart server. Require 'Administer System' permission. Perform a full restart of the Web, Search and Compute Engine Servers processes. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/system/restart">Further information about this action online (including a response example)</a> + * @since 4.3 + */ + public void restart() { + call( + new PostRequest(path("restart")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Get state information about SonarQube.<p>status: the running status <ul> <li>STARTING: SonarQube Web Server is up and serving some Web Services (eg. api/system/status) but initialization is still ongoing</li> <li>UP: SonarQube instance is up and running</li> <li>DOWN: SonarQube instance is up but not running because migration has failed (refer to WS /api/system/migrate_db for details) or some other reason (check logs).</li> <li>RESTARTING: SonarQube instance is still up but a restart has been requested (refer to WS /api/system/restart for details).</li> <li>DB_MIGRATION_NEEDED: database migration is required. DB migration can be started using WS /api/system/migrate_db.</li> <li>DB_MIGRATION_RUNNING: DB migration is running (refer to WS /api/system/migrate_db for details)</li> </ul></p> + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/system/status">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public StatusResponse status() { + return call( + new GetRequest(path("status")), + StatusResponse.parser()); + } + + /** + * Lists available upgrades for the SonarQube instance (if any) and for each one, lists incompatible plugins and plugins requiring upgrade.<br/>Plugin information is retrieved from Update Center. Date and time at which Update Center was last refreshed is provided in the response. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/system/upgrades">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public String upgrades() { + return call( + new GetRequest(path("upgrades")) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/system/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/system/package-info.java new file mode 100644 index 00000000000..86b11d9949b --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/system/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.system; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/tests/CoveredFilesRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/tests/CoveredFilesRequest.java new file mode 100644 index 00000000000..19602644ddd --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/tests/CoveredFilesRequest.java @@ -0,0 +1,81 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.tests; + +import javax.annotation.Generated; + +/** + * Get the list of source files covered by a test. Require Browse permission on test file's project + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/tests/covered_files">Further information about this action online (including a response example)</a> + * @since 4.4 + */ +@Generated("sonar-ws-generator") +public class CoveredFilesRequest { + + private String p; + private String ps; + private String testId; + + /** + * 1-based page number + * + * Example value: "42" + */ + public CoveredFilesRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0. + * + * Example value: "20" + */ + public CoveredFilesRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Test ID + * + * This is a mandatory parameter. + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public CoveredFilesRequest setTestId(String testId) { + this.testId = testId; + return this; + } + + public String getTestId() { + return testId; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/tests/ListRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/tests/ListRequest.java new file mode 100644 index 00000000000..80ec000656c --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/tests/ListRequest.java @@ -0,0 +1,171 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.tests; + +import javax.annotation.Generated; + +/** + * Get the list of tests either in a test file or that test a given line of source code.<br /> Requires 'Browse' permission on the file's project.<br /> One (and only one) of the following combination of parameters must be provided: <ul><li>testId - get a specific test</li><li>testFileId - get the tests in a test file</li><li>testFileKey - get the tests in a test file</li><li>sourceFileId and sourceFileLineNumber - get the tests that cover a specific line of code</li><li>sourceFileKey and sourceFileLineNumber - get the tests that cover a specific line of code</li></ul> + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/tests/list">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class ListRequest { + + private String branch; + private String p; + private String ps; + private String sourceFileId; + private String sourceFileKey; + private String sourceFileLineNumber; + private String testFileId; + private String testFileKey; + private String testId; + + /** + * Branch key + * + * This is part of the internal API. + * Example value: "feature/my_branch" + */ + public ListRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public ListRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public ListRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * ID of source file. Must be provided with the source file line number. + * + * Example value: "AU-TpxcA-iU5OvuD2FL0" + */ + public ListRequest setSourceFileId(String sourceFileId) { + this.sourceFileId = sourceFileId; + return this; + } + + public String getSourceFileId() { + return sourceFileId; + } + + /** + * Key of source file. Must be provided with the source file line number. + * + * Example value: "my_project:/src/foo/Bar.php" + */ + public ListRequest setSourceFileKey(String sourceFileKey) { + this.sourceFileKey = sourceFileKey; + return this; + } + + public String getSourceFileKey() { + return sourceFileKey; + } + + /** + * Source file line number. Must be provided with the source file ID or key. + * + * Example value: "10" + */ + public ListRequest setSourceFileLineNumber(String sourceFileLineNumber) { + this.sourceFileLineNumber = sourceFileLineNumber; + return this; + } + + public String getSourceFileLineNumber() { + return sourceFileLineNumber; + } + + /** + * ID of test file + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public ListRequest setTestFileId(String testFileId) { + this.testFileId = testFileId; + return this; + } + + public String getTestFileId() { + return testFileId; + } + + /** + * Key of test file + * + * Example value: "MY_PROJECT:src/test/java/foo/BarTest.java" + */ + public ListRequest setTestFileKey(String testFileKey) { + this.testFileKey = testFileKey; + return this; + } + + public String getTestFileKey() { + return testFileKey; + } + + /** + * ID of test + * + * Example value: "AU-TpxcA-iU5OvuD2FLz" + */ + public ListRequest setTestId(String testId) { + this.testId = testId; + return this; + } + + public String getTestId() { + return testId; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/tests/TestsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/tests/TestsService.java new file mode 100644 index 00000000000..adcbf796e9c --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/tests/TestsService.java @@ -0,0 +1,83 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.tests; + +import javax.annotation.Generated; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.WsConnector; +import org.sonarqube.ws.Tests.CoveredFilesResponse; +import org.sonarqube.ws.Tests.ListResponse; + +/** + * Get details on test files. See also api/sources. Deprecated since 5.6. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/tests">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class TestsService extends BaseService { + + public TestsService(WsConnector wsConnector) { + super(wsConnector, "api/tests"); + } + + /** + * Get the list of source files covered by a test. Require Browse permission on test file's project + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/tests/covered_files">Further information about this action online (including a response example)</a> + * @since 4.4 + * @deprecated since 5.6 + */ + @Deprecated + public CoveredFilesResponse coveredFiles(CoveredFilesRequest request) { + return call( + new GetRequest(path("covered_files")) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("testId", request.getTestId()), + CoveredFilesResponse.parser()); + } + + /** + * Get the list of tests either in a test file or that test a given line of source code.<br /> Requires 'Browse' permission on the file's project.<br /> One (and only one) of the following combination of parameters must be provided: <ul><li>testId - get a specific test</li><li>testFileId - get the tests in a test file</li><li>testFileKey - get the tests in a test file</li><li>sourceFileId and sourceFileLineNumber - get the tests that cover a specific line of code</li><li>sourceFileKey and sourceFileLineNumber - get the tests that cover a specific line of code</li></ul> + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/tests/list">Further information about this action online (including a response example)</a> + * @since 5.2 + * @deprecated since 5.6 + */ + @Deprecated + public ListResponse list(ListRequest request) { + return call( + new GetRequest(path("list")) + .setParam("branch", request.getBranch()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("sourceFileId", request.getSourceFileId()) + .setParam("sourceFileKey", request.getSourceFileKey()) + .setParam("sourceFileLineNumber", request.getSourceFileLineNumber()) + .setParam("testFileId", request.getTestFileId()) + .setParam("testFileKey", request.getTestFileKey()) + .setParam("testId", request.getTestId()), + ListResponse.parser()); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/tests/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/tests/package-info.java new file mode 100644 index 00000000000..3884257898d --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/tests/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.tests; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/timemachine/TimemachineService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/timemachine/TimemachineService.java new file mode 100644 index 00000000000..28f2dcae33b --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/timemachine/TimemachineService.java @@ -0,0 +1,57 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.timemachine; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Removed since 6.3, please use api/measures/search_history instead + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/timemachine">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class TimemachineService extends BaseService { + + public TimemachineService(WsConnector wsConnector) { + super(wsConnector, "api/timemachine"); + } + + /** + * The web service is removed and you're invited to use api/measures/search_history instead + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/timemachine/index">Further information about this action online (including a response example)</a> + * @since 2.10 + * @deprecated since 6.3 + */ + @Deprecated + public String index() { + return call( + new GetRequest(path("index")) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/timemachine/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/timemachine/package-info.java new file mode 100644 index 00000000000..81ff8ac0a3b --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/timemachine/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.timemachine; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/updatecenter/InstalledPluginsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/updatecenter/InstalledPluginsRequest.java new file mode 100644 index 00000000000..c0659f4ee60 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/updatecenter/InstalledPluginsRequest.java @@ -0,0 +1,53 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.updatecenter; + +import javax.annotation.Generated; + +/** + * Get the list of all the plugins installed on the SonarQube instance + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/updatecenter/installed_plugins">Further information about this action online (including a response example)</a> + * @since 2.10 + */ +@Generated("sonar-ws-generator") +public class InstalledPluginsRequest { + + private String format; + + /** + * Only json response format is available + * + * Possible values: + * <ul> + * <li>"json"</li> + * </ul> + */ + public InstalledPluginsRequest setFormat(String format) { + this.format = format; + return this; + } + + public String getFormat() { + return format; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/updatecenter/UpdatecenterService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/updatecenter/UpdatecenterService.java new file mode 100644 index 00000000000..3bccacf942f --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/updatecenter/UpdatecenterService.java @@ -0,0 +1,73 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.updatecenter; + +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Get list of installed plugins + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/updatecenter">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class UpdatecenterService extends BaseService { + + public UpdatecenterService(WsConnector wsConnector) { + super(wsConnector, "api/updatecenter"); + } + + /** + * Get the list of all the plugins installed on the SonarQube instance + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/updatecenter/installed_plugins">Further information about this action online (including a response example)</a> + * @since 2.10 + * @deprecated since 6.3 + */ + @Deprecated + public String installedPlugins(InstalledPluginsRequest request) { + return call( + new GetRequest(path("installed_plugins")) + .setParam("format", request.getFormat()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Upload a plugin.<br /> Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/updatecenter/upload">Further information about this action online (including a response example)</a> + * @since 6.0 + */ + public void upload(UploadRequest request) { + call( + new PostRequest(path("upload")) + .setParam("file", request.getFile()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/updatecenter/UploadRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/updatecenter/UploadRequest.java new file mode 100644 index 00000000000..ee4238bc24f --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/updatecenter/UploadRequest.java @@ -0,0 +1,50 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.updatecenter; + +import javax.annotation.Generated; + +/** + * Upload a plugin.<br /> Requires 'Administer System' permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/updatecenter/upload">Further information about this action online (including a response example)</a> + * @since 6.0 + */ +@Generated("sonar-ws-generator") +public class UploadRequest { + + private String file; + + /** + * The jar file of the plugin to install + * + * This is a mandatory parameter. + */ + public UploadRequest setFile(String file) { + this.file = file; + return this; + } + + public String getFile() { + return file; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/updatecenter/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/updatecenter/package-info.java new file mode 100644 index 00000000000..71095e82a09 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/updatecenter/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.updatecenter; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/AddUserRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/AddUserRequest.java new file mode 100644 index 00000000000..6fb42a27830 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/AddUserRequest.java @@ -0,0 +1,96 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.usergroups; + +import javax.annotation.Generated; + +/** + * Add a user to a group.<br />'id' or 'name' must be provided.<br />Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/user_groups/add_user">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class AddUserRequest { + + private String id; + private String login; + private String name; + private String organization; + + /** + * Group id + * + * Example value: "42" + */ + public AddUserRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } + + /** + * User login + * + * Example value: "g.hopper" + */ + public AddUserRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * Group name + * + * Example value: "sonar-administrators" + */ + public AddUserRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * Key of organization + * + * This is part of the internal API. + * Example value: "my-org" + */ + public AddUserRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/CreateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/CreateRequest.java new file mode 100644 index 00000000000..92190cf7b13 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/CreateRequest.java @@ -0,0 +1,82 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.usergroups; + +import javax.annotation.Generated; + +/** + * Create a group.<br>Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/user_groups/create">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class CreateRequest { + + private String description; + private String name; + private String organization; + + /** + * Description for the new group. A group description cannot be larger than 200 characters. + * + * Example value: "Default group for new users" + */ + public CreateRequest setDescription(String description) { + this.description = description; + return this; + } + + public String getDescription() { + return description; + } + + /** + * Name for the new group. A group name cannot be larger than 255 characters and must be unique. The value 'anyone' (whatever the case) is reserved and cannot be used. + * + * This is a mandatory parameter. + * Example value: "sonar-users" + */ + public CreateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * Key of organization. If unset then default organization is used. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public CreateRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/DeleteRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/DeleteRequest.java new file mode 100644 index 00000000000..a5a67ba3500 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/DeleteRequest.java @@ -0,0 +1,81 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.usergroups; + +import javax.annotation.Generated; + +/** + * Delete a group. The default groups cannot be deleted.<br/>'id' or 'name' must be provided.<br />Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/user_groups/delete">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class DeleteRequest { + + private String id; + private String name; + private String organization; + + /** + * Group id + * + * Example value: "42" + */ + public DeleteRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } + + /** + * Group name + * + * Example value: "sonar-administrators" + */ + public DeleteRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * Key of organization + * + * This is part of the internal API. + * Example value: "my-org" + */ + public DeleteRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/RemoveUserRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/RemoveUserRequest.java new file mode 100644 index 00000000000..46e710598fe --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/RemoveUserRequest.java @@ -0,0 +1,96 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.usergroups; + +import javax.annotation.Generated; + +/** + * Remove a user from a group.<br />'id' or 'name' must be provided.<br>Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/user_groups/remove_user">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class RemoveUserRequest { + + private String id; + private String login; + private String name; + private String organization; + + /** + * Group id + * + * Example value: "42" + */ + public RemoveUserRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } + + /** + * User login + * + * Example value: "g.hopper" + */ + public RemoveUserRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * Group name + * + * Example value: "sonar-administrators" + */ + public RemoveUserRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * Key of organization + * + * This is part of the internal API. + * Example value: "my-org" + */ + public RemoveUserRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/SearchRequest.java new file mode 100644 index 00000000000..92844e21d1b --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/SearchRequest.java @@ -0,0 +1,117 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.usergroups; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Search for user groups.<br>Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/user_groups/search">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class SearchRequest { + + private List<String> f; + private String organization; + private String p; + private String ps; + private String q; + + /** + * Comma-separated list of the fields to be returned in response. All the fields are returned by default. + * + * Possible values: + * <ul> + * <li>"name"</li> + * <li>"description"</li> + * <li>"membersCount"</li> + * </ul> + */ + public SearchRequest setF(List<String> f) { + this.f = f; + return this; + } + + public List<String> getF() { + return f; + } + + /** + * Key of organization. If not set then groups are searched in default organization. + * + * This is part of the internal API. + * Example value: "my-org" + */ + public SearchRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public SearchRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to names that contain the supplied string. + * + * Example value: "sonar-users" + */ + public SearchRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/UpdateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/UpdateRequest.java new file mode 100644 index 00000000000..c07e0dffd76 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/UpdateRequest.java @@ -0,0 +1,81 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.usergroups; + +import javax.annotation.Generated; + +/** + * Update a group.<br>Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/user_groups/update">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class UpdateRequest { + + private String description; + private String id; + private String name; + + /** + * New optional description for the group. A group description cannot be larger than 200 characters. If value is not defined, then description is not changed. + * + * Example value: "Default group for new users" + */ + public UpdateRequest setDescription(String description) { + this.description = description; + return this; + } + + public String getDescription() { + return description; + } + + /** + * Identifier of the group. + * + * This is a mandatory parameter. + * Example value: "42" + */ + public UpdateRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } + + /** + * New optional name for the group. A group name cannot be larger than 255 characters and must be unique. Value 'anyone' (whatever the case) is reserved and cannot be used. If value is empty or not defined, then name is not changed. + * + * Example value: "my-group" + */ + public UpdateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/UserGroupsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/UserGroupsService.java new file mode 100644 index 00000000000..2401737e0f1 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/UserGroupsService.java @@ -0,0 +1,174 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.usergroups; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.UserGroups.CreateWsResponse; +import org.sonarqube.ws.UserGroups.SearchWsResponse; +import org.sonarqube.ws.UserGroups.UpdateWsResponse; + +/** + * Manage user groups. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/user_groups">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class UserGroupsService extends BaseService { + + public UserGroupsService(WsConnector wsConnector) { + super(wsConnector, "api/user_groups"); + } + + /** + * Add a user to a group.<br />'id' or 'name' must be provided.<br />Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/user_groups/add_user">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void addUser(AddUserRequest request) { + call( + new PostRequest(path("add_user")) + .setParam("id", request.getId()) + .setParam("login", request.getLogin()) + .setParam("name", request.getName()) + .setParam("organization", request.getOrganization()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Create a group.<br>Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/user_groups/create">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public CreateWsResponse create(CreateRequest request) { + return call( + new PostRequest(path("create")) + .setParam("description", request.getDescription()) + .setParam("name", request.getName()) + .setParam("organization", request.getOrganization()), + CreateWsResponse.parser()); + } + + /** + * Delete a group. The default groups cannot be deleted.<br/>'id' or 'name' must be provided.<br />Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/user_groups/delete">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void delete(DeleteRequest request) { + call( + new PostRequest(path("delete")) + .setParam("id", request.getId()) + .setParam("name", request.getName()) + .setParam("organization", request.getOrganization()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Remove a user from a group.<br />'id' or 'name' must be provided.<br>Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/user_groups/remove_user">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void removeUser(RemoveUserRequest request) { + call( + new PostRequest(path("remove_user")) + .setParam("id", request.getId()) + .setParam("login", request.getLogin()) + .setParam("name", request.getName()) + .setParam("organization", request.getOrganization()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Search for user groups.<br>Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/user_groups/search">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public SearchWsResponse search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("f", request.getF() == null ? null : request.getF().stream().collect(Collectors.joining(","))) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()), + SearchWsResponse.parser()); + } + + /** + * Update a group.<br>Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/user_groups/update">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void update(UpdateRequest request) { + call( + new PostRequest(path("update")) + .setParam("description", request.getDescription()) + .setParam("id", request.getId()) + .setParam("name", request.getName()), + UpdateWsResponse.parser()); + } + + /** + * Search for users with membership information with respect to a group.<br>Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/user_groups/users">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public String users(UsersRequest request) { + return call( + new GetRequest(path("users")) + .setParam("id", request.getId()) + .setParam("name", request.getName()) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setParam("selected", request.getSelected()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/UsersRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/UsersRequest.java new file mode 100644 index 00000000000..940e1899ac3 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/UsersRequest.java @@ -0,0 +1,146 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.usergroups; + +import javax.annotation.Generated; + +/** + * Search for users with membership information with respect to a group.<br>Requires the following permission: 'Administer System'. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/user_groups/users">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class UsersRequest { + + private String id; + private String name; + private String organization; + private String p; + private String ps; + private String q; + private String selected; + + /** + * Group id + * + * Example value: "42" + */ + public UsersRequest setId(String id) { + this.id = id; + return this; + } + + public String getId() { + return id; + } + + /** + * Group name + * + * Example value: "sonar-administrators" + */ + public UsersRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * Key of organization + * + * This is part of the internal API. + * Example value: "my-org" + */ + public UsersRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public UsersRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0. + * + * Example value: "20" + */ + public UsersRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to names or logins that contain the supplied string. + * + * Example value: "freddy" + */ + public UsersRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Depending on the value, show only selected items (selected=selected), deselected items (selected=deselected), or all items with their selection status (selected=all). + * + * Possible values: + * <ul> + * <li>"all"</li> + * <li>"deselected"</li> + * <li>"selected"</li> + * </ul> + */ + public UsersRequest 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/usergroups/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/package-info.java new file mode 100644 index 00000000000..fd91b8c99ac --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.usergroups; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/userproperties/UserPropertiesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/userproperties/UserPropertiesService.java new file mode 100644 index 00000000000..e8685b5b00c --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/userproperties/UserPropertiesService.java @@ -0,0 +1,57 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.userproperties; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Removed since 6.3, please use api/favorites and api/notifications instead + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/user_properties">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class UserPropertiesService extends BaseService { + + public UserPropertiesService(WsConnector wsConnector) { + super(wsConnector, "api/user_properties"); + } + + /** + * This web service is removed + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/user_properties/index">Further information about this action online (including a response example)</a> + * @since 2.6 + * @deprecated since 6.3 + */ + @Deprecated + public String index() { + return call( + new GetRequest(path("index")) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/userproperties/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/userproperties/package-info.java new file mode 100644 index 00000000000..2e6ccc12bce --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/userproperties/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.userproperties; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/users/ChangePasswordRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/ChangePasswordRequest.java new file mode 100644 index 00000000000..42d42e08d89 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/ChangePasswordRequest.java @@ -0,0 +1,82 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.users; + +import javax.annotation.Generated; + +/** + * Update a user's password. Authenticated users can change their own password, provided that the account is not linked to an external authentication system. Administer System permission is required to change another user's password. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/change_password">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class ChangePasswordRequest { + + private String login; + private String password; + private String previousPassword; + + /** + * User login + * + * This is a mandatory parameter. + * Example value: "myuser" + */ + public ChangePasswordRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * New password + * + * This is a mandatory parameter. + * Example value: "mypassword" + */ + public ChangePasswordRequest setPassword(String password) { + this.password = password; + return this; + } + + public String getPassword() { + return password; + } + + /** + * Previous password. Required when changing one's own password. + * + * Example value: "oldpassword" + */ + public ChangePasswordRequest setPreviousPassword(String previousPassword) { + this.previousPassword = previousPassword; + return this; + } + + public String getPreviousPassword() { + return previousPassword; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/users/CreateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/CreateRequest.java new file mode 100644 index 00000000000..39517cb7f51 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/CreateRequest.java @@ -0,0 +1,150 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.users; + +import javax.annotation.Generated; + +/** + * Create a user.<br/>If a deactivated user account exists with the given login, it will be reactivated.<br/>Requires Administer System permission + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/create">Further information about this action online (including a response example)</a> + * @since 3.7 + */ +@Generated("sonar-ws-generator") +public class CreateRequest { + + private String email; + private String local; + private String login; + private String name; + private String password; + private String scmAccount; + private String scmAccounts; + + /** + * User email + * + * Example value: "myname@email.com" + */ + public CreateRequest setEmail(String email) { + this.email = email; + return this; + } + + public String getEmail() { + return email; + } + + /** + * Specify if the user should be authenticated from SonarQube server or from an external authentication system. Password should not be set when local is set to false. + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public CreateRequest setLocal(String local) { + this.local = local; + return this; + } + + public String getLocal() { + return local; + } + + /** + * User login + * + * This is a mandatory parameter. + * Example value: "myuser" + */ + public CreateRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * User name + * + * This is a mandatory parameter. + * Example value: "My Name" + */ + public CreateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * User password. Only mandatory when creating local user, otherwise it should not be set + * + * Example value: "mypassword" + */ + public CreateRequest setPassword(String password) { + this.password = password; + return this; + } + + public String getPassword() { + return password; + } + + /** + * SCM accounts. To set several values, the parameter must be called once for each value. + * + * Example value: "scmAccount=firstValue&scmAccount=secondValue&scmAccount=thirdValue" + */ + public CreateRequest setScmAccount(String scmAccount) { + this.scmAccount = scmAccount; + return this; + } + + public String getScmAccount() { + return scmAccount; + } + + /** + * This parameter is deprecated, please use 'scmAccount' instead + * + * Example value: "myscmaccount1,myscmaccount2" + * @deprecated since 6.1 + */ + @Deprecated + public CreateRequest setScmAccounts(String scmAccounts) { + this.scmAccounts = scmAccounts; + return this; + } + + public String getScmAccounts() { + return scmAccounts; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/users/DeactivateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/DeactivateRequest.java new file mode 100644 index 00000000000..5e83fd9dd67 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/DeactivateRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.users; + +import javax.annotation.Generated; + +/** + * Deactivate a user. Requires Administer System permission + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/deactivate">Further information about this action online (including a response example)</a> + * @since 3.7 + */ +@Generated("sonar-ws-generator") +public class DeactivateRequest { + + private String login; + + /** + * User login + * + * This is a mandatory parameter. + * Example value: "myuser" + */ + public DeactivateRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/users/GroupsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/GroupsRequest.java new file mode 100644 index 00000000000..7fbb7f99a1f --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/GroupsRequest.java @@ -0,0 +1,132 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.users; + +import javax.annotation.Generated; + +/** + * Lists the groups a user belongs to. <br/>Requires Administer System permission. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/groups">Further information about this action online (including a response example)</a> + * @since 5.2 + */ +@Generated("sonar-ws-generator") +public class GroupsRequest { + + private String login; + private String organization; + private String p; + private String ps; + private String q; + private String selected; + + /** + * A user login + * + * This is a mandatory parameter. + * Example value: "admin" + */ + public GroupsRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * Organization key + * + * This is part of the internal API. + * Example value: "my-org" + */ + public GroupsRequest setOrganization(String organization) { + this.organization = organization; + return this; + } + + public String getOrganization() { + return organization; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public GroupsRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0. + * + * Example value: "20" + */ + public GroupsRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Limit search to group names that contain the supplied string. + * + * Example value: "users" + */ + public GroupsRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } + + /** + * Depending on the value, show only selected items (selected=selected), deselected items (selected=deselected), or all items with their selection status (selected=all). + * + * Possible values: + * <ul> + * <li>"all"</li> + * <li>"deselected"</li> + * <li>"selected"</li> + * </ul> + */ + public GroupsRequest 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/users/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/SearchRequest.java new file mode 100644 index 00000000000..f7095f9c962 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/SearchRequest.java @@ -0,0 +1,108 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.users; + +import java.util.List; +import javax.annotation.Generated; + +/** + * Get a list of active users. <br/>Administer System permission is required to show the 'groups' field.<br/>When accessed anonymously, only logins and names are returned. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/search">Further information about this action online (including a response example)</a> + * @since 3.6 + */ +@Generated("sonar-ws-generator") +public class SearchRequest { + + private List<String> f; + private String p; + private String ps; + private String q; + + /** + * Comma-separated list of the fields to be returned in response. All the fields are returned by default. + * + * Possible values: + * <ul> + * <li>"name"</li> + * <li>"email"</li> + * <li>"avatart"</li> + * <li>"scmAccounts"</li> + * <li>"groups"</li> + * <li>"active"</li> + * <li>"local"</li> + * <li>"externalIdentity"</li> + * <li>"externalProvider"</li> + * </ul> + * @deprecated since 5.4 + */ + @Deprecated + public SearchRequest setF(List<String> f) { + this.f = f; + return this; + } + + public List<String> getF() { + return f; + } + + /** + * 1-based page number + * + * Example value: "42" + */ + public SearchRequest setP(String p) { + this.p = p; + return this; + } + + public String getP() { + return p; + } + + /** + * Page size. Must be greater than 0 and less than 500 + * + * Example value: "20" + */ + public SearchRequest setPs(String ps) { + this.ps = ps; + return this; + } + + public String getPs() { + return ps; + } + + /** + * Filter on login or name. + * + */ + public SearchRequest setQ(String q) { + this.q = q; + return this; + } + + public String getQ() { + return q; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/users/UpdateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/UpdateRequest.java new file mode 100644 index 00000000000..6c720f186d6 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/UpdateRequest.java @@ -0,0 +1,113 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.users; + +import javax.annotation.Generated; + +/** + * Update a user. If a deactivated user account exists with the given login, it will be reactivated. Requires Administer System permission + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/update">Further information about this action online (including a response example)</a> + * @since 3.7 + */ +@Generated("sonar-ws-generator") +public class UpdateRequest { + + private String email; + private String login; + private String name; + private String scmAccount; + private String scmAccounts; + + /** + * User email + * + * Example value: "myname@email.com" + */ + public UpdateRequest setEmail(String email) { + this.email = email; + return this; + } + + public String getEmail() { + return email; + } + + /** + * User login + * + * This is a mandatory parameter. + * Example value: "myuser" + */ + public UpdateRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * User name + * + * Example value: "My Name" + */ + public UpdateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } + + /** + * SCM accounts. To set several values, the parameter must be called once for each value. + * + * Example value: "scmAccount=firstValue&scmAccount=secondValue&scmAccount=thirdValue" + */ + public UpdateRequest setScmAccount(String scmAccount) { + this.scmAccount = scmAccount; + return this; + } + + public String getScmAccount() { + return scmAccount; + } + + /** + * This parameter is deprecated, please use 'scmAccount' instead + * + * Example value: "myscmaccount1,myscmaccount2" + * @deprecated since 6.1 + */ + @Deprecated + public UpdateRequest setScmAccounts(String scmAccounts) { + this.scmAccounts = scmAccounts; + return this; + } + + public String getScmAccounts() { + return scmAccounts; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/users/UsersService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/UsersService.java new file mode 100644 index 00000000000..5170936a7e1 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/UsersService.java @@ -0,0 +1,201 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.users; + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.Users.CreateWsResponse; +import org.sonarqube.ws.Users.CurrentWsResponse; +import org.sonarqube.ws.Users.GroupsWsResponse; +import org.sonarqube.ws.Users.IdentityProvidersWsResponse; +import org.sonarqube.ws.Users.SearchWsResponse; + +/** + * Manage users. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/users">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class UsersService extends BaseService { + + public UsersService(WsConnector wsConnector) { + super(wsConnector, "api/users"); + } + + /** + * Update a user's password. Authenticated users can change their own password, provided that the account is not linked to an external authentication system. Administer System permission is required to change another user's password. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/change_password">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public void changePassword(ChangePasswordRequest request) { + call( + new PostRequest(path("change_password")) + .setParam("login", request.getLogin()) + .setParam("password", request.getPassword()) + .setParam("previousPassword", request.getPreviousPassword()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Create a user.<br/>If a deactivated user account exists with the given login, it will be reactivated.<br/>Requires Administer System permission + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/create">Further information about this action online (including a response example)</a> + * @since 3.7 + */ + public void create(CreateRequest request) { + call( + new PostRequest(path("create")) + .setParam("email", request.getEmail()) + .setParam("local", request.getLocal()) + .setParam("login", request.getLogin()) + .setParam("name", request.getName()) + .setParam("password", request.getPassword()) + .setParam("scmAccount", request.getScmAccount()) + .setParam("scmAccounts", request.getScmAccounts()), + CreateWsResponse.parser()); + } + + /** + * Get the details of the current authenticated user. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/current">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public CurrentWsResponse current() { + return call( + new GetRequest(path("current")), + CurrentWsResponse.parser()); + } + + /** + * Deactivate a user. Requires Administer System permission + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/deactivate">Further information about this action online (including a response example)</a> + * @since 3.7 + */ + public String deactivate(DeactivateRequest request) { + return call( + new PostRequest(path("deactivate")) + .setParam("login", request.getLogin()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Lists the groups a user belongs to. <br/>Requires Administer System permission. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/groups">Further information about this action online (including a response example)</a> + * @since 5.2 + */ + public GroupsWsResponse groups(GroupsRequest request) { + return call( + new GetRequest(path("groups")) + .setParam("login", request.getLogin()) + .setParam("organization", request.getOrganization()) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()) + .setParam("selected", request.getSelected()), + GroupsWsResponse.parser()); + } + + /** + * List the external identity providers + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/identity_providers">Further information about this action online (including a response example)</a> + * @since 5.5 + */ + public IdentityProvidersWsResponse identityProviders() { + return call( + new GetRequest(path("identity_providers")), + IdentityProvidersWsResponse.parser()); + } + + /** + * Get a list of active users. <br/>Administer System permission is required to show the 'groups' field.<br/>When accessed anonymously, only logins and names are returned. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/search">Further information about this action online (including a response example)</a> + * @since 3.6 + */ + public SearchWsResponse search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("f", request.getF() == null ? null : request.getF().stream().collect(Collectors.joining(","))) + .setParam("p", request.getP()) + .setParam("ps", request.getPs()) + .setParam("q", request.getQ()), + SearchWsResponse.parser()); + } + + /** + * Stores that the user has skipped the onboarding tutorial and does not want to see it after future logins.<br/>Requires authentication. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/skip_onboarding_tutorial">Further information about this action online (including a response example)</a> + * @since 6.5 + */ + public void skipOnboardingTutorial() { + call( + new PostRequest(path("skip_onboarding_tutorial")) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Update a user. If a deactivated user account exists with the given login, it will be reactivated. Requires Administer System permission + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/update">Further information about this action online (including a response example)</a> + * @since 3.7 + */ + public String update(UpdateRequest request) { + return call( + new PostRequest(path("update")) + .setParam("email", request.getEmail()) + .setParam("login", request.getLogin()) + .setParam("name", request.getName()) + .setParam("scmAccount", request.getScmAccount()) + .setParam("scmAccounts", request.getScmAccounts()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/users/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/package-info.java new file mode 100644 index 00000000000..8076ca836b0 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.users; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/GenerateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/GenerateRequest.java new file mode 100644 index 00000000000..14b713942dd --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/GenerateRequest.java @@ -0,0 +1,66 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.usertokens; + +import javax.annotation.Generated; + +/** + * Generate a user access token. <br />Please keep your tokens secret. They enable to authenticate and analyze projects.<br />If the login is set, it requires administration permissions. Otherwise, a token is generated for the authenticated user. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/user_tokens/generate">Further information about this action online (including a response example)</a> + * @since 5.3 + */ +@Generated("sonar-ws-generator") +public class GenerateRequest { + + private String login; + private String name; + + /** + * User login. If not set, the token is generated for the authenticated user. + * + * Example value: "g.hopper" + */ + public GenerateRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * Token name + * + * This is a mandatory parameter. + * Example value: "Project scan on Travis" + */ + public GenerateRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/RevokeRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/RevokeRequest.java new file mode 100644 index 00000000000..90700dc20fa --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/RevokeRequest.java @@ -0,0 +1,66 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.usertokens; + +import javax.annotation.Generated; + +/** + * Revoke a user access token. <br/>If the login is set, it requires administration permissions. Otherwise, a token is generated for the authenticated user. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/user_tokens/revoke">Further information about this action online (including a response example)</a> + * @since 5.3 + */ +@Generated("sonar-ws-generator") +public class RevokeRequest { + + private String login; + private String name; + + /** + * User login + * + * Example value: "g.hopper" + */ + public RevokeRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } + + /** + * Token name + * + * This is a mandatory parameter. + * Example value: "Project scan on Travis" + */ + public RevokeRequest setName(String name) { + this.name = name; + return this; + } + + public String getName() { + return name; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/SearchRequest.java new file mode 100644 index 00000000000..0cae81bc664 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/SearchRequest.java @@ -0,0 +1,50 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.usertokens; + +import javax.annotation.Generated; + +/** + * List the access tokens of a user.<br>The login must exist and active.<br>If the login is set, it requires administration permissions. Otherwise, a token is generated for the authenticated user. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/user_tokens/search">Further information about this action online (including a response example)</a> + * @since 5.3 + */ +@Generated("sonar-ws-generator") +public class SearchRequest { + + private String login; + + /** + * User login + * + * Example value: "g.hopper" + */ + public SearchRequest setLogin(String login) { + this.login = login; + return this; + } + + public String getLogin() { + return login; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/UserTokensService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/UserTokensService.java new file mode 100644 index 00000000000..30e6e7ea690 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/UserTokensService.java @@ -0,0 +1,89 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.usertokens; + +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +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.UserTokens.GenerateWsResponse; +import org.sonarqube.ws.UserTokens.SearchWsResponse; + +/** + * List, create, and delete a user's access tokens. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/user_tokens">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class UserTokensService extends BaseService { + + public UserTokensService(WsConnector wsConnector) { + super(wsConnector, "api/user_tokens"); + } + + /** + * Generate a user access token. <br />Please keep your tokens secret. They enable to authenticate and analyze projects.<br />If the login is set, it requires administration permissions. Otherwise, a token is generated for the authenticated user. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/user_tokens/generate">Further information about this action online (including a response example)</a> + * @since 5.3 + */ + public GenerateWsResponse generate(GenerateRequest request) { + return call( + new PostRequest(path("generate")) + .setParam("login", request.getLogin()) + .setParam("name", request.getName()), + GenerateWsResponse.parser()); + } + + /** + * Revoke a user access token. <br/>If the login is set, it requires administration permissions. Otherwise, a token is generated for the authenticated user. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/user_tokens/revoke">Further information about this action online (including a response example)</a> + * @since 5.3 + */ + public void revoke(RevokeRequest request) { + call( + new PostRequest(path("revoke")) + .setParam("login", request.getLogin()) + .setParam("name", request.getName()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * List the access tokens of a user.<br>The login must exist and active.<br>If the login is set, it requires administration permissions. Otherwise, a token is generated for the authenticated user. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/user_tokens/search">Further information about this action online (including a response example)</a> + * @since 5.3 + */ + public SearchWsResponse search(SearchRequest request) { + return call( + new GetRequest(path("search")) + .setParam("login", request.getLogin()), + SearchWsResponse.parser()); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/package-info.java new file mode 100644 index 00000000000..cca27eb2dec --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.usertokens; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/DeliveriesRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/DeliveriesRequest.java new file mode 100644 index 00000000000..d47604c0657 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/DeliveriesRequest.java @@ -0,0 +1,65 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.webhooks; + +import javax.annotation.Generated; + +/** + * Get the recent deliveries for a specified project or Compute Engine task.<br/>Require 'Administer' permission on the related project.<br/>Note that additional information are returned by api/webhooks/delivery. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/webhooks/deliveries">Further information about this action online (including a response example)</a> + * @since 6.2 + */ +@Generated("sonar-ws-generator") +public class DeliveriesRequest { + + private String ceTaskId; + private String componentKey; + + /** + * Id of the Compute Engine task + * + * Example value: "AU-Tpxb--iU5OvuD2FLy" + */ + public DeliveriesRequest setCeTaskId(String ceTaskId) { + this.ceTaskId = ceTaskId; + return this; + } + + public String getCeTaskId() { + return ceTaskId; + } + + /** + * Key of the project + * + * Example value: "my-project" + */ + public DeliveriesRequest setComponentKey(String componentKey) { + this.componentKey = componentKey; + return this; + } + + public String getComponentKey() { + return componentKey; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/DeliveryRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/DeliveryRequest.java new file mode 100644 index 00000000000..32af1fef83a --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/DeliveryRequest.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.webhooks; + +import javax.annotation.Generated; + +/** + * Get a webhook delivery by its id.<br/>Require 'Administer System' permission.<br/>Note that additional information are returned by api/webhooks/delivery. + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/webhooks/delivery">Further information about this action online (including a response example)</a> + * @since 6.2 + */ +@Generated("sonar-ws-generator") +public class DeliveryRequest { + + private String deliveryId; + + /** + * Id of delivery + * + * This is a mandatory parameter. + * Example value: "AU-TpxcA-iU5OvuD2FL3" + */ + public DeliveryRequest setDeliveryId(String deliveryId) { + this.deliveryId = deliveryId; + return this; + } + + public String getDeliveryId() { + return deliveryId; + } +} 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 new file mode 100644 index 00000000000..36112100f59 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/WebhooksService.java @@ -0,0 +1,70 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.webhooks; + +import javax.annotation.Generated; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.WsConnector; +import org.sonarqube.ws.Webhooks.DeliveriesWsResponse; +import org.sonarqube.ws.Webhooks.DeliveryWsResponse; + +/** + * Webhooks allow to notify external services when a project analysis is done + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/webhooks">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class WebhooksService extends BaseService { + + public WebhooksService(WsConnector wsConnector) { + super(wsConnector, "api/webhooks"); + } + + /** + * Get the recent deliveries for a specified project or Compute Engine task.<br/>Require 'Administer' permission on the related project.<br/>Note that additional information are returned by api/webhooks/delivery. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/webhooks/deliveries">Further information about this action online (including a response example)</a> + * @since 6.2 + */ + public DeliveriesWsResponse deliveries(DeliveriesRequest request) { + return call( + new GetRequest(path("deliveries")) + .setParam("ceTaskId", request.getCeTaskId()) + .setParam("componentKey", request.getComponentKey()), + DeliveriesWsResponse.parser()); + } + + /** + * Get a webhook delivery by its id.<br/>Require 'Administer System' permission.<br/>Note that additional information are returned by api/webhooks/delivery. + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/webhooks/delivery">Further information about this action online (including a response example)</a> + * @since 6.2 + */ + public DeliveryWsResponse delivery(DeliveryRequest request) { + return call( + new GetRequest(path("delivery")) + .setParam("deliveryId", request.getDeliveryId()), + DeliveryWsResponse.parser()); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/package-info.java new file mode 100644 index 00000000000..adb8d2d7fe8 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.webhooks; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/webservices/ListRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/webservices/ListRequest.java new file mode 100644 index 00000000000..4505ab69093 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/webservices/ListRequest.java @@ -0,0 +1,56 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.webservices; + +import javax.annotation.Generated; + +/** + * List web services + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/webservices/list">Further information about this action online (including a response example)</a> + * @since 4.2 + */ +@Generated("sonar-ws-generator") +public class ListRequest { + + private String includeInternals; + + /** + * Include web services that are implemented for internal use only. Their forward-compatibility is not assured + * + * Possible values: + * <ul> + * <li>"true"</li> + * <li>"false"</li> + * <li>"yes"</li> + * <li>"no"</li> + * </ul> + */ + public ListRequest setIncludeInternals(String includeInternals) { + this.includeInternals = includeInternals; + return this; + } + + public String getIncludeInternals() { + return includeInternals; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/webservices/ResponseExampleRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/webservices/ResponseExampleRequest.java new file mode 100644 index 00000000000..79657974c31 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/webservices/ResponseExampleRequest.java @@ -0,0 +1,67 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.webservices; + +import javax.annotation.Generated; + +/** + * Display web service response example + * + * This is part of the internal API. + * This is a POST request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/webservices/response_example">Further information about this action online (including a response example)</a> + * @since 4.4 + */ +@Generated("sonar-ws-generator") +public class ResponseExampleRequest { + + private String action; + private String controller; + + /** + * Action of the web service + * + * This is a mandatory parameter. + * Example value: "search" + */ + public ResponseExampleRequest setAction(String action) { + this.action = action; + return this; + } + + public String getAction() { + return action; + } + + /** + * Controller of the web service + * + * This is a mandatory parameter. + * Example value: "api/issues" + */ + public ResponseExampleRequest setController(String controller) { + this.controller = controller; + return this; + } + + public String getController() { + return controller; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/webservices/WebservicesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/webservices/WebservicesService.java new file mode 100644 index 00000000000..14912772103 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/webservices/WebservicesService.java @@ -0,0 +1,71 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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.webservices; + +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * Get information on the web api supported on this instance. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/webservices">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class WebservicesService extends BaseService { + + public WebservicesService(WsConnector wsConnector) { + super(wsConnector, "api/webservices"); + } + + /** + * List web services + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/webservices/list">Further information about this action online (including a response example)</a> + * @since 4.2 + */ + public String list(ListRequest request) { + return call( + new GetRequest(path("list")) + .setParam("include_internals", request.getIncludeInternals()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * Display web service response example + * + * This is part of the internal API. + * This is a GET request. + * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/webservices/response_example">Further information about this action online (including a response example)</a> + * @since 4.4 + */ + public String responseExample(ResponseExampleRequest request) { + return call( + new GetRequest(path("response_example")) + .setParam("action", request.getAction()) + .setParam("controller", request.getController()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/webservices/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/webservices/package-info.java new file mode 100644 index 00000000000..d8ec8cbb9d7 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/webservices/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 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. + */ +@ParametersAreNonnullByDefault +package org.sonarqube.ws.client.webservices; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws/src/main/protobuf/ws-batch.proto b/sonar-ws/src/main/protobuf/ws-batch.proto new file mode 100644 index 00000000000..11a696da9e8 --- /dev/null +++ b/sonar-ws/src/main/protobuf/ws-batch.proto @@ -0,0 +1,47 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.batch; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Batch"; + +option optimize_for = SPEED; + +// WS batch/project +message WsProjectResponse { + optional int64 timestamp = 1; + map<string, Settings> settingsByModule = 2; + map<string, FileDataByPath> fileDataByModuleAndPath = 3; + optional int64 lastAnalysisDate = 4; + + message Settings { + map<string,string> settings = 1; + } + + message FileDataByPath { + map<string, FileData> FileDataByPath = 1; + } + + message FileData { + optional string hash = 1; + optional string revision = 2; + } +} diff --git a/sonar-ws/src/main/protobuf/ws-ce.proto b/sonar-ws/src/main/protobuf/ws-ce.proto new file mode 100644 index 00000000000..dc18f7cb87e --- /dev/null +++ b/sonar-ws/src/main/protobuf/ws-ce.proto @@ -0,0 +1,103 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.ce; + +import "ws-commons.proto"; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Ce"; +option optimize_for = SPEED; + +// POST api/ce/submit +message SubmitResponse { + optional string taskId = 1; + optional string projectId = 2; +} + +// GET api/ce/task +message TaskResponse { + optional Task task = 1; +} + +// GET api/ce/activity +message ActivityResponse { + // paging has been deprecated in 5.5 + optional sonarqube.ws.commons.Paging unusedPaging = 1; + repeated Task tasks = 2; +} + +// GET api/ce/activity_status +message ActivityStatusWsResponse { + optional int32 pending = 1; + optional int32 failing = 2; + optional int32 inProgress = 3; +} + +// GET api/ce/component +message ComponentResponse { + repeated Task queue = 1; + optional Task current = 2; +} + +// GET api/ce/task_types +message TaskTypesWsResponse { + repeated string taskTypes = 1; +} + +// GET api/ce/worker_count +message WorkerCountResponse { + optional int32 value = 1; + optional bool canSetWorkerCount = 2; +} + +message Task { + optional string id = 1; + optional string type = 2; + optional string componentId = 3; + optional string componentKey = 4; + optional string componentName = 5; + optional string componentQualifier = 6; + optional string analysisId = 7; + optional TaskStatus status = 8; + optional string submittedAt = 9; + optional string submitterLogin = 10; + optional string startedAt = 11; + optional string executedAt = 12; + optional bool isLastExecuted = 13; + optional int64 executionTimeMs = 14; + optional bool logs = 15; + optional string errorMessage = 16; + optional string errorStacktrace = 17; + optional string scannerContext = 18; + optional bool hasScannerContext = 19; + optional string organization = 20; + optional string branch = 21; + optional sonarqube.ws.commons.BranchType branchType = 22; + optional string errorType = 23; +} + +enum TaskStatus { + PENDING = 0; + IN_PROGRESS = 1; + SUCCESS = 2; + FAILED = 3; + CANCELED = 4; +} diff --git a/sonar-ws/src/main/protobuf/ws-commons.proto b/sonar-ws/src/main/protobuf/ws-commons.proto new file mode 100644 index 00000000000..a9b566583e3 --- /dev/null +++ b/sonar-ws/src/main/protobuf/ws-commons.proto @@ -0,0 +1,124 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.commons; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Common"; +option optimize_for = SPEED; + +message Paging { + optional int32 pageIndex = 1; + optional int32 pageSize = 2; + optional int32 total = 3; +} + +message Facet { + // kind of key + optional string property = 1; + repeated FacetValue values = 2; +} + +message Facets { + repeated Facet facets = 1; +} + +message FacetValue { + optional string val = 1; + optional int64 count = 2; +} + +enum Severity { + INFO = 0; + MINOR = 1; + MAJOR = 2; + CRITICAL = 3; + BLOCKER = 4; +} + +message Rule { + optional string key = 1; + optional string name = 2; + optional string lang = 3; + optional RuleStatus status = 4; + optional string langName = 5; +} + +message Rules { + repeated Rule rules = 1; +} + +enum RuleStatus { + BETA = 0; + DEPRECATED = 1; + READY = 2; + REMOVED = 3; +} + +// Lines start at 1 and line offsets start at 0 +message TextRange { + // Start line. Should never be absent + optional int32 startLine = 1; + + // End line (inclusive). Absent means it is same as start line + optional int32 endLine = 2; + + // If absent it means range starts at the first offset of start line + optional int32 startOffset = 3; + + // If absent it means range ends at the last offset of end line + optional int32 endOffset = 4; +} + +message Metric { + optional string key = 1; + optional string name = 2; + optional string description = 3; + optional string domain = 4; + optional string type = 5; + optional bool higherValuesAreBetter = 6; + optional bool qualitative = 7; + optional bool hidden = 8; + optional bool custom = 9; + optional int32 decimalScale = 10; + optional string bestValue = 11; + optional string worstValue = 12; +} + +enum RuleType { + // Zero is required in order to not get MAINTAINABILITY as default value + // See http://androiddevblog.com/protocol-buffers-pitfall-adding-enum-values/ + UNKNOWN = 0; + + // same name as in Java enum IssueType, + // same index values as in database (see column ISSUES.ISSUE_TYPE) + CODE_SMELL = 1; + BUG = 2; + VULNERABILITY = 3; +} + +enum BranchType { + // Zero is required in order to not get LONG as default value + // See http://androiddevblog.com/protocol-buffers-pitfall-adding-enum-values/ + UNKNOWN_BRANCH_TYPE = 0; + + LONG = 1; + SHORT = 2; +} diff --git a/sonar-ws/src/main/protobuf/ws-components.proto b/sonar-ws/src/main/protobuf/ws-components.proto new file mode 100644 index 00000000000..73059133649 --- /dev/null +++ b/sonar-ws/src/main/protobuf/ws-components.proto @@ -0,0 +1,130 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.component; + +import "ws-commons.proto"; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Components"; +option optimize_for = SPEED; + +// WS api/components/search +message SearchWsResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated Component components = 2; +} + +// WS api/components/tree +message TreeWsResponse { + optional sonarqube.ws.commons.Paging paging = 1; + optional Component baseComponent = 3; + repeated Component components = 4; +} + +// WS api/components/show +message ShowWsResponse { + optional sonarqube.ws.commons.Paging paging = 1; + optional Component component = 2; + repeated Component ancestors = 3; +} + +// WS api/components/suggestions +message SuggestionsWsResponse { + repeated Category results = 1; + optional string warning = 2; + repeated Organization organizations = 3; + repeated Project projects = 4; + + message Category { + optional string q = 1; + repeated Suggestion items = 2; + optional int64 more = 3; + } + + message Suggestion { + optional string key = 1; + optional string name = 2; + optional string match = 3; + optional string organization = 4; + optional string project = 5; + optional bool isRecentlyBrowsed = 6; + optional bool isFavorite = 7; + } + + message Organization { + optional string key = 1; + optional string name = 2; + } + + message Project { + optional string key = 1; + optional string name = 2; + } +} + +// WS api/components/search_projects +message SearchProjectsWsResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated Component components = 2; + optional sonarqube.ws.commons.Facets facets = 3; +} + +// WS api/components/provisioned +message ProvisionedWsResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated Component projects = 2; + + message Component { + optional string uuid = 1; + optional string key = 2; + optional string name = 3; + optional string creationDate = 4; + optional string visibility = 5; + } +} + +message Component { + optional string organization = 12; + optional string id = 1; + optional string key = 2; + optional string refId = 3; + optional string refKey = 4; + optional string projectId = 5; + optional string name = 6; + optional string description = 7; + optional string qualifier = 8; + optional string path = 9; + optional string language = 10; + optional bool isFavorite = 11; + optional string analysisDate = 13; + optional Tags tags = 14; + optional string visibility = 15; + optional string leakPeriodDate = 16; + // Root project key + optional string project = 17; + optional string branch = 18; + optional string version = 19; + + message Tags { + repeated string tags = 1; + } +} + diff --git a/sonar-ws/src/main/protobuf/ws-duplications.proto b/sonar-ws/src/main/protobuf/ws-duplications.proto new file mode 100644 index 00000000000..6eeb5f29a32 --- /dev/null +++ b/sonar-ws/src/main/protobuf/ws-duplications.proto @@ -0,0 +1,55 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto3"; + +package sonarqube.ws.duplication; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Duplications"; +option optimize_for = SPEED; + +// WS api/duplications/show +message ShowResponse { + repeated Duplication duplications = 1; + map<string,File> files = 2; + +} + +message Duplication { + repeated Block blocks = 1; +} + +message Block { + int32 from = 1; + int32 size = 2; + string _ref = 3; +} + +message File { + string key = 1; + string name = 2; + string uuid = 3; + string project = 4; + string projectUuid = 5; + string projectName = 6; + string subProject = 7; + string subProjectUuid = 8; + string subProjectName = 9; + string branch = 10; +} diff --git a/sonar-ws/src/main/protobuf/ws-editions.proto b/sonar-ws/src/main/protobuf/ws-editions.proto new file mode 100644 index 00000000000..87531bb7331 --- /dev/null +++ b/sonar-ws/src/main/protobuf/ws-editions.proto @@ -0,0 +1,60 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.editions; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Editions"; +option optimize_for = SPEED; + +// GET api/editions/status +// POST api/editions/apply_license +message StatusResponse { + optional string currentEditionKey = 1; + optional InstallationStatus installationStatus = 2; + optional string nextEditionKey = 3; + optional string installError = 4; +} + +enum InstallationStatus { + NONE = 0; + AUTOMATIC_IN_PROGRESS = 1; + AUTOMATIC_READY = 2; + MANUAL_IN_PROGRESS = 3; + UNINSTALL_IN_PROGRESS = 4; +} + +// POST api/editions/preview +message PreviewResponse { + optional string nextEditionKey = 1; + optional PreviewStatus previewStatus = 2; +} + +enum PreviewStatus { + NO_INSTALL = 0; + AUTOMATIC_INSTALL = 1; + MANUAL_INSTALL = 2; +} + +// POST api/editions/form_data +message FormDataResponse { + optional string serverId = 1; + optional int64 ncloc = 2; +} diff --git a/sonar-ws/src/main/protobuf/ws-favorites.proto b/sonar-ws/src/main/protobuf/ws-favorites.proto new file mode 100644 index 00000000000..7cdb6eceb94 --- /dev/null +++ b/sonar-ws/src/main/protobuf/ws-favorites.proto @@ -0,0 +1,40 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.favorite; + +import "ws-commons.proto"; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Favorites"; +option optimize_for = SPEED; + +// WS api/favorites/search +message SearchResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated Favorite favorites = 2; +} + +message Favorite { + optional string organization = 4; + optional string key = 1; + optional string name = 2; + optional string qualifier = 3; +} diff --git a/sonar-ws/src/main/protobuf/ws-issues.proto b/sonar-ws/src/main/protobuf/ws-issues.proto new file mode 100644 index 00000000000..a1309679f58 --- /dev/null +++ b/sonar-ws/src/main/protobuf/ws-issues.proto @@ -0,0 +1,232 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.issues; + +import "ws-commons.proto"; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Issues"; +option optimize_for = SPEED; + +// Response of GET api/issues/search +message SearchWsResponse { + optional int64 total = 1; + optional int64 p = 2; + optional int32 ps = 3; + optional sonarqube.ws.commons.Paging paging = 4; + + // Total amount of effort, only when the facet "total" is enabled + optional int64 effortTotal = 13; + // Deprecated since 5.5, replaced by effortTotal + optional int64 debtTotal = 5; + + repeated Issue issues = 6; + repeated Component components = 7; + optional sonarqube.ws.commons.Rules rules = 8; + optional Users users = 9; + + // Deprecated since 5.5, action plan has been removed + optional ActionPlans unusedActionPlans = 10; + optional Languages languages = 11; + optional sonarqube.ws.commons.Facets facets = 12; +} + +// Response of most of POST/issues/{operation}, for instance assign, add_comment and set_severity +message Operation { + optional Issue issue = 1; + repeated Component components = 2; + repeated sonarqube.ws.commons.Rule rules = 3; + repeated Users.User users = 4; + // Deprecated since 5.5, action plan has been removed + repeated ActionPlan unusedActionPlans = 5; +} + +message Issue { + optional string key = 1; + optional string rule = 2; + optional sonarqube.ws.commons.Severity severity = 3; + optional string component = 4; + optional int64 unusedComponentId = 5; + optional string project = 6; + optional string subProject = 7; + optional int32 line = 8; + optional string hash = 31; + optional sonarqube.ws.commons.TextRange textRange = 9; + repeated Flow flows = 10; + optional string resolution = 11; + optional string status = 12; + optional string message = 13; + + optional string effort = 28; + // Deprecated since 5.5, replaced by effort + optional string debt = 14; + + optional string assignee = 15; + + // Unused since 5.5, manual issues feature has been removed + optional string unusedReporter = 16; + + // SCM login of the committer who introduced the issue + optional string author = 17; + + // Deprecated since 5.5, action plan has been removed + optional string actionPlan = 18; + + repeated string tags = 19; + + // the transitions allowed for the requesting user. + optional Transitions transitions = 20; + + // the actions allowed for the requesting user. + optional Actions actions = 21; + + optional Comments comments = 22; + optional string creationDate = 23; + optional string updateDate = 24; + optional string fUpdateAge = 25; + optional string closeDate = 26; + + optional sonarqube.ws.commons.RuleType type = 27; + + optional string organization = 29; + optional string branch = 30; +} + +message Transitions { + repeated string transitions = 1; +} + +message Actions { + repeated string actions = 1; +} + +message Flow { + repeated Location locations = 1; +} + +message Location { + optional string unusedComponentId = 1; + // Only when component is a file. Can be empty for a file if this is an issue global to the file. + optional sonarqube.ws.commons.TextRange textRange = 2; + optional string msg = 3; +} + +message Comment { + optional string key = 1; + optional string login = 2; + // TODO drop, it's already in field "users" + optional string email = 3; + // TODO drop, it's already in field "users" + optional string userName = 4; + optional string htmlText = 5; + // TODO rename markdownText ? + optional string markdown = 6; + optional bool updatable = 7; + optional string createdAt = 8; +} + +message Comments { + repeated Comment comments = 1; +} + +// Deprecated since 5.5 +message ActionPlan { + optional string key = 1; + optional string name = 2; + + // TODO define enum + optional string status = 3; + optional string deadLine = 4; + // TODO to be renamed, is it id or key ? + optional string project = 5; +} + +// Deprecated since 5.5 +message ActionPlans { + repeated ActionPlan actionPlans = 1; +} + +message Language { + optional string key = 1; + optional string name = 2; +} + +message Languages { + repeated Language languages = 1; +} + +message Component { + optional string organization = 11; + optional int64 deprecatedId = 1; + optional string key = 2; + optional string uuid = 3; + optional bool enabled = 4; + optional string qualifier = 5; + optional string name = 6; + optional string longName = 7; + optional string path = 8; + optional int64 unusedProjectId = 9; + optional int64 unusedSubProjectId = 10; + optional string branch = 12; +} + +// Response of GET api/issues/changelog +message ChangelogWsResponse { + repeated Changelog changelog = 1; + + message Changelog { + optional string user = 1; + optional string userName = 2; + // Email is no more returned since 6.3 + optional string deprecatedEmail = 3; + optional string creationDate = 4; + repeated Diff diffs = 5; + optional string avatar = 6; + + message Diff { + optional string key = 1; + optional string newValue = 2; + optional string oldValue = 3; + } + } +} + +// Response of POST api/issues/bulk_change +message BulkChangeWsResponse { + optional int64 total = 1; + optional int64 success = 2; + optional int64 ignored = 3; + optional int64 failures = 4; +} + +message Users { + repeated User users = 1; + + message User { + optional string login = 1; + optional string name = 2; + optional string avatar = 3; + optional bool active = 4; + } +} + + + diff --git a/sonar-ws/src/main/protobuf/ws-measures.proto b/sonar-ws/src/main/protobuf/ws-measures.proto new file mode 100644 index 00000000000..36cd4ab6174 --- /dev/null +++ b/sonar-ws/src/main/protobuf/ws-measures.proto @@ -0,0 +1,110 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.measures; + +import "ws-commons.proto"; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Measures"; +option optimize_for = SPEED; + +// WS api/measures/component_tree +message ComponentTreeWsResponse { + optional sonarqube.ws.commons.Paging paging = 1; + optional Component baseComponent = 2; + repeated Component components = 3; + optional Metrics metrics = 4; + optional Periods periods = 5; +} + +// WS api/measures/component +message ComponentWsResponse { + optional Component component = 1; + optional Metrics metrics = 2; + optional Periods periods = 3; +} + +// WS api/measures/search +message SearchWsResponse { + repeated Measure measures = 1; +} + +// WS api/measures/search_history +message SearchHistoryResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated HistoryMeasure measures = 2; + + message HistoryMeasure { + optional string metric = 1; + repeated HistoryValue history = 2; + } + + message HistoryValue { + optional string date = 1; + optional string value = 2; + } +} + +message Component { + optional string id = 1; + optional string key = 2; + optional string refId = 3; + optional string refKey = 4; + optional string projectId = 5; + optional string name = 6; + optional string description = 7; + optional string qualifier = 8; + optional string path = 9; + optional string language = 10; + repeated Measure measures = 11; + optional string branch = 12; +} + +message Period { + optional int32 index = 1; + optional string mode = 2; + optional string date = 3; + optional string parameter = 4; +} + +message Periods { + repeated Period periods = 1; +} + +message Metrics { + repeated sonarqube.ws.commons.Metric metrics = 1; +} + +message Measure { + optional string metric = 1; + optional string value = 2; + optional PeriodsValue periods = 3; + optional string component = 4; +} + +message PeriodsValue { + repeated PeriodValue periodsValue = 1; +} + +message PeriodValue { + optional int32 index = 1; + optional string value = 2; +} diff --git a/sonar-ws/src/main/protobuf/ws-notifications.proto b/sonar-ws/src/main/protobuf/ws-notifications.proto new file mode 100644 index 00000000000..ac0cb034748 --- /dev/null +++ b/sonar-ws/src/main/protobuf/ws-notifications.proto @@ -0,0 +1,41 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.notification; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Notifications"; +option optimize_for = SPEED; + +// WS api/notifications/list +message ListResponse { + repeated Notification notifications = 1; + repeated string channels = 2; + repeated string globalTypes = 3; + repeated string perProjectTypes = 4; +} + +message Notification { + optional string channel = 1; + optional string type = 2; + optional string organization = 5; + optional string project = 3; + optional string projectName = 4; +} diff --git a/sonar-ws/src/main/protobuf/ws-organizations.proto b/sonar-ws/src/main/protobuf/ws-organizations.proto new file mode 100644 index 00000000000..172bf31d85c --- /dev/null +++ b/sonar-ws/src/main/protobuf/ws-organizations.proto @@ -0,0 +1,71 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.organizations; + +import "ws-commons.proto"; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Organizations"; +option optimize_for = SPEED; + +// WS api/organizations/create +message CreateWsResponse { + optional Organization organization = 1; +} + +// WS api/organizations/update +message UpdateWsResponse { + optional Organization organization = 1; +} + +// WS api/organizations/search +message SearchWsResponse { + repeated Organization organizations = 1; + optional sonarqube.ws.commons.Paging paging = 2; +} + +// WS api/organizations/search_members +message SearchMembersWsResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated User users = 2; +} + +// WS api/organizations/add_member +message AddMemberWsResponse { + optional User user = 1; +} + +message Organization { + optional string key = 1; + optional string name = 2; + optional string description = 3; + optional string url = 4; + optional string avatar = 5; + optional bool guarded = 6; + optional bool isAdmin = 7; +} + +message User { + optional string login = 1; + optional string name = 2; + optional string avatar = 3; + optional int32 groupCount = 4; +} diff --git a/sonar-ws/src/main/protobuf/ws-permissions.proto b/sonar-ws/src/main/protobuf/ws-permissions.proto new file mode 100644 index 00000000000..53acf4d8ec4 --- /dev/null +++ b/sonar-ws/src/main/protobuf/ws-permissions.proto @@ -0,0 +1,138 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.permissions; + +import "ws-commons.proto"; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Permissions"; +option optimize_for = SPEED; + +// WS api/permissions/template_users for internal use only +message OldUsersWsResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated OldUser users = 2; +} + +// WS api/permissions/users for internal use only +message UsersWsResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated User users = 2; +} + +// WS api/permissions/groups for internal use only +message WsGroupsResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated Group groups = 2; +} + +// WS api/permissions/template_groups for internal use only +message WsTemplateGroupsResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated OldGroup groups = 2; +} + +message WsSearchGlobalPermissionsResponse { + repeated Permission permissions = 1; +} + +message SearchProjectPermissionsWsResponse { + message Project { + optional string id = 1; + optional string key = 2; + optional string qualifier = 3; + optional string name = 4; + repeated Permission permissions = 5; + } + + optional sonarqube.ws.commons.Paging paging = 1; + repeated Project projects = 2; + repeated Permission permissions = 3; +} + +message CreateTemplateWsResponse { + optional PermissionTemplate permissionTemplate = 1; +} + +message UpdateTemplateWsResponse { + optional PermissionTemplate permissionTemplate = 1; +} + +message SearchTemplatesWsResponse { + message TemplateIdQualifier { + optional string templateId = 1; + optional string qualifier = 2; + } + + repeated PermissionTemplate permissionTemplates = 1; + repeated TemplateIdQualifier defaultTemplates = 2; + repeated Permission permissions = 3; +} + +message Permission { + optional string key = 1; + optional string name = 2; + optional string description = 3; + optional int32 usersCount = 4; + optional int32 groupsCount = 5; + optional bool withProjectCreator = 6; +} + +message PermissionTemplate { + optional string id = 1; + optional string name = 2; + optional string description = 3; + optional string projectKeyPattern = 4; + // ex: 2015-08-25T16:18:48+0200 + optional string createdAt = 5; + // ex: 2015-08-25T16:18:48+0200 + optional string updatedAt = 6; + repeated Permission permissions = 7; +} + +message OldUser { + optional string login = 1; + optional string name = 2; + optional string email = 3; + optional bool selected = 4; +} + +message User { + optional string login = 1; + optional string name = 2; + optional string email = 3; + repeated string permissions = 4; + optional string avatar = 5; +} + +message OldGroup { + optional string id = 1; + optional string name = 2; + optional string description = 3; + optional bool selected = 4; +} + +message Group { + optional string id = 1; + optional string name = 2; + optional string description = 3; + repeated string permissions = 4; +} diff --git a/sonar-ws/src/main/protobuf/ws-project_tags.proto b/sonar-ws/src/main/protobuf/ws-project_tags.proto new file mode 100644 index 00000000000..86f1901a806 --- /dev/null +++ b/sonar-ws/src/main/protobuf/ws-project_tags.proto @@ -0,0 +1,30 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto3"; + +package sonarqube.ws.projects; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "ProjectTags"; +option optimize_for = SPEED; + +// Response for api/project_tags/search +message SearchResponse { + repeated string tags = 1; +} diff --git a/sonar-ws/src/main/protobuf/ws-projectanalyses.proto b/sonar-ws/src/main/protobuf/ws-projectanalyses.proto new file mode 100644 index 00000000000..3b4ea562bb9 --- /dev/null +++ b/sonar-ws/src/main/protobuf/ws-projectanalyses.proto @@ -0,0 +1,57 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.projectanalysis; + +import "ws-commons.proto"; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "ProjectAnalyses"; +option optimize_for = SPEED; + +// WS api/project_analyses/create_event +message CreateEventResponse { + optional Event event = 1; +} + +// WS api/project_analyses/update_event +message UpdateEventResponse { + optional Event event = 1; +} + +// WS api/project_analyses/search +message SearchResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated Analysis analyses = 2; +} + +message Event { + optional string key = 1; + optional string analysis = 2; + optional string category = 3; + optional string name = 4; + optional string description = 5; +} + +message Analysis { + optional string key = 1; + optional string date = 2; + repeated Event events = 3; +} diff --git a/sonar-ws/src/main/protobuf/ws-projectbranches.proto b/sonar-ws/src/main/protobuf/ws-projectbranches.proto new file mode 100644 index 00000000000..55d8e4032ce --- /dev/null +++ b/sonar-ws/src/main/protobuf/ws-projectbranches.proto @@ -0,0 +1,60 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.projectbranch; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "ProjectBranches"; +option optimize_for = SPEED; + +import "ws-commons.proto"; + +// WS api/project_branches/list +message ListWsResponse { + repeated Branch branches = 1; +} + +// WS api/project_branches/show +message ShowWsResponse { + optional Branch branch = 1; +} + +message Branch { + optional string name = 1; + optional bool isMain = 2; + optional sonarqube.ws.commons.BranchType type = 3; + // Merge branch is only present for short living branch + optional string mergeBranch = 4; + optional Status status = 5; + optional bool isOrphan = 6; + optional string analysisDate = 7; + + message Status { + // Quality gate status is only present for long living branch + optional string qualityGateStatus = 1; + // Merge bugs, vulnerabilities and codeSmell are only present for short living branch + optional int64 bugs = 2; + optional int64 vulnerabilities = 3; + optional int64 codeSmells = 4; + } + +} + + diff --git a/sonar-ws/src/main/protobuf/ws-projectlink.proto b/sonar-ws/src/main/protobuf/ws-projectlink.proto new file mode 100644 index 00000000000..613f6b633cc --- /dev/null +++ b/sonar-ws/src/main/protobuf/ws-projectlink.proto @@ -0,0 +1,23 @@ +syntax = "proto2"; + +package sonarqube.ws.projectlink; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "ProjectLinks"; +option optimize_for = SPEED; + +// WS api/project_links/list +message SearchWsResponse { + repeated Link links = 1; +} + +message CreateWsResponse { + optional Link link = 1; +} + +message Link { + optional string id = 1; + optional string name = 2; + optional string type = 3; + optional string url = 4; +}
\ No newline at end of file diff --git a/sonar-ws/src/main/protobuf/ws-projects.proto b/sonar-ws/src/main/protobuf/ws-projects.proto new file mode 100644 index 00000000000..2f5372f1305 --- /dev/null +++ b/sonar-ws/src/main/protobuf/ws-projects.proto @@ -0,0 +1,86 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.projects; + +import "ws-commons.proto"; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Projects"; +option optimize_for = SPEED; + +message SearchMyProjectsWsResponse { + message Project { + optional string id = 1; + optional string key = 2; + optional string name = 4; + optional string description = 5; + optional string lastAnalysisDate = 6; + optional string qualityGate = 7; + repeated Link links = 8; + } + + message Link { + optional string name = 1; + optional string type = 2; + optional string href = 3; + } + + optional sonarqube.ws.commons.Paging paging = 1; + repeated Project projects = 2; +} + +message CreateWsResponse { + optional Project project = 1; + + message Project { + optional string key = 1; + optional string name = 2; + optional string qualifier = 3; + optional string visibility = 4; + } +} + +// WS api/projects/search +message SearchWsResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated Component components = 2; + + message Component { + optional string organization = 1; + optional string id = 2; + optional string key = 3; + optional string name = 4; + optional string qualifier = 5; + optional string visibility = 6; + optional string lastAnalysisDate = 7; + } +} + +// WS api/projects/prepare_bulk_update_key +message BulkUpdateKeyWsResponse { + repeated Key keys = 1; + + message Key { + optional string key = 1; + optional string newKey = 2; + optional bool duplicate = 3; + } +} diff --git a/sonar-ws/src/main/protobuf/ws-qualitygates.proto b/sonar-ws/src/main/protobuf/ws-qualitygates.proto new file mode 100644 index 00000000000..7a40a0bf2ce --- /dev/null +++ b/sonar-ws/src/main/protobuf/ws-qualitygates.proto @@ -0,0 +1,122 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.qualitygate; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Qualitygates"; +option optimize_for = SPEED; + +// GET api/qualitygates/project_status +message ProjectStatusResponse { + optional ProjectStatus projectStatus = 1; + + message ProjectStatus { + optional Status status = 1; + repeated Condition conditions = 2; + repeated Period periods = 3; + optional bool ignoredConditions = 4; + } + + message Condition { + optional Status status = 1; + optional string metricKey = 2; + optional Comparator comparator = 3; + optional int32 periodIndex = 4; + optional string warningThreshold = 5; + optional string errorThreshold = 6; + optional string actualValue = 7; + } + + message Period { + optional int32 index = 1; + optional string mode = 2; + optional string date = 3; + optional string parameter = 4; + } + + enum Status { + OK = 1; + WARN = 2; + ERROR = 3; + NONE = 4; + } + + enum Comparator { + GT = 1; + LT = 2; + EQ = 3; + NE = 4; + } +} + +// GET api/qualitygates/get_by_project +message GetByProjectResponse { + optional QualityGate qualityGate = 1; +} + +message QualityGate { + optional string id = 1; + optional string name = 2; + optional bool default = 3; +} + +// GET api/qualitygates/app +message AppResponse { + optional bool edit = 1; + repeated Metric metrics = 3; + + message Metric { + optional string key = 1; + optional string name = 2; + optional string type = 3; + optional string domain = 4; + optional bool hidden = 5; + } +} + +// POST api/qualitygates/create +message CreateResponse { + optional int64 id = 1; + optional string name = 2; +} + +// POST api/qualitygates/create_condition +message CreateConditionResponse { + optional int64 id = 1; + optional string metric = 2; + optional string op = 3; + optional string warning = 4; + optional string error = 5; + optional int32 period = 6; +} + +// POST api/qualitygates/update_condition +message UpdateConditionResponse { + optional int64 id = 1; + optional string metric = 2; + optional string op = 3; + optional string warning = 4; + optional string error = 5; + optional int32 period = 6; +} + + + diff --git a/sonar-ws/src/main/protobuf/ws-qualityprofiles.proto b/sonar-ws/src/main/protobuf/ws-qualityprofiles.proto new file mode 100644 index 00000000000..e4d9df36abc --- /dev/null +++ b/sonar-ws/src/main/protobuf/ws-qualityprofiles.proto @@ -0,0 +1,169 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.qualityprofiles; + +import "ws-commons.proto"; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Qualityprofiles"; +option optimize_for = SPEED; + +// WS api/qualityprofiles/search +message SearchWsResponse { + repeated QualityProfile profiles = 1; + optional Actions actions = 2; + + message QualityProfile { + optional string key = 1; + optional string name = 2; + optional string language = 3; + optional string languageName = 4; + optional bool isInherited = 5; + optional string parentKey = 6; + optional string parentName = 7; + optional bool isDefault = 8; + optional int64 activeRuleCount = 9; + optional int64 activeDeprecatedRuleCount = 12; + optional int64 projectCount = 10; + optional string rulesUpdatedAt = 11; + optional string lastUsed = 13; + optional string userUpdatedAt = 14; + optional string organization = 15; + optional bool isBuiltIn = 16; + optional Actions actions = 17; + + message Actions { + optional bool edit = 1; + optional bool setAsDefault = 2; + optional bool copy = 3; + } + } + + message Actions { + optional bool create = 1; + } +} + +// WS api/qualityprofiles/create +message CreateWsResponse { + optional QualityProfile profile = 1; + + message QualityProfile { + optional string key = 1; + optional string name = 2; + optional string language = 3; + optional string languageName = 4; + optional bool isInherited = 5; + optional bool isDefault = 6; + optional Infos infos = 7; + optional Warnings warnings = 8; + optional string organization = 9; + + message Infos { + repeated string infos = 1; + } + + message Warnings { + repeated string warnings = 1; + } + } +} + +// WS api/qualityprofiles/inheritance +message InheritanceWsResponse { + optional QualityProfile profile = 1; + repeated QualityProfile ancestors = 2; + repeated QualityProfile children = 3; + + message QualityProfile { + optional string key = 1; + optional string name = 2; + optional string parent = 3; + optional int64 activeRuleCount = 4; + optional int64 overridingRuleCount = 5; + optional bool isBuiltIn = 6; + } +} + +// WS api/qualityprofiles/copy +message CopyWsResponse { + optional string key = 1; + optional string name = 2; + optional string language = 3; + optional string languageName = 4; + optional bool isDefault = 5; + optional bool isInherited = 6; + optional string parentKey = 7; +} + +// WS api/qualityprofiles/show +message ShowResponse { + optional QualityProfile profile = 1; + optional CompareToSonarWay compareToSonarWay = 2; + + message QualityProfile { + optional string key = 1; + optional string name = 2; + optional string language = 3; + optional string languageName = 4; + optional bool isInherited = 5; + optional bool isDefault = 6; + optional int64 activeRuleCount = 7; + optional int64 activeDeprecatedRuleCount = 8; + optional int64 projectCount = 9; + optional string rulesUpdatedAt = 10; + optional string lastUsed = 11; + optional string userUpdatedAt = 12; + optional string organization = 13; + optional bool isBuiltIn = 14; + } + + message CompareToSonarWay { + optional string profile = 1; + optional string profileName = 2; + optional int64 missingRuleCount = 3; + } +} + +// WS api/qualityprofiles/search_users +message SearchUsersResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated User users = 2; + + message User { + optional string login = 1; + optional string name = 2; + optional string avatar = 3; + optional bool selected = 4; + } +} + +// WS api/qualityprofiles/search_groups +message SearchGroupsResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated Group groups = 2; + + message Group { + optional string name = 1; + optional string description = 2; + optional bool selected = 3; + } +} diff --git a/sonar-ws/src/main/protobuf/ws-root.proto b/sonar-ws/src/main/protobuf/ws-root.proto new file mode 100644 index 00000000000..fd55b926a4d --- /dev/null +++ b/sonar-ws/src/main/protobuf/ws-root.proto @@ -0,0 +1,36 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.root; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Roots"; +option optimize_for = SPEED; + +// WS api/root/search +message SearchResponse { + repeated RootContent roots = 1; +} + +message RootContent { + optional string login = 1; + optional string name = 2; + optional string email = 3; +} diff --git a/sonar-ws/src/main/protobuf/ws-rules.proto b/sonar-ws/src/main/protobuf/ws-rules.proto new file mode 100644 index 00000000000..d3dfe2cd826 --- /dev/null +++ b/sonar-ws/src/main/protobuf/ws-rules.proto @@ -0,0 +1,177 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.rules; + +import "ws-commons.proto"; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Rules"; +option optimize_for = SPEED; + +// WS api/rules/list for internal use only +message ListResponse { + + message Rule { + optional string repository = 1; + optional string key = 2; + optional string internal_key = 3; + optional string name = 4; + } + + repeated Rule rules = 1; +} + +// WS api/rules/search +message SearchResponse { + optional int64 total = 1; + optional int32 p = 2; + optional int64 ps = 3; + repeated Rule rules = 4; + optional Actives actives = 5; + optional QProfiles qProfiles = 6; + optional sonarqube.ws.commons.Facets facets = 7; +} + +//WS api/rules/show +message ShowResponse { + optional Rule rule = 1; + repeated Active actives = 3; +} + +//WS api/rules/create +message CreateResponse { + optional Rule rule = 1; +} + +//WS api/rules/update +message UpdateResponse { + optional Rule rule = 1; +} + +message Rule { + optional string key = 1; + optional string repo = 2; + optional string name = 3; + optional string createdAt = 4; + optional string htmlDesc = 5; + optional string htmlNote = 6; + optional string mdDesc = 7; + optional string mdNote = 8; + optional string noteLogin = 9; + optional string severity = 10; + optional sonarqube.ws.commons.RuleStatus status = 11; + optional string internalKey = 12; + optional bool isTemplate = 13; + optional string templateKey = 14; + optional Tags tags = 15; + optional SysTags sysTags = 16; + optional string lang = 19; + optional string langName = 20; + optional Params params = 21; + // characteristic fields, unsupported since 5.5 + optional string unusedDefaultDebtChar = 23; + optional string unusedDefaultDebtSubChar = 24; + optional string unusedDebtChar = 25; + optional string unusedDebtSubChar = 26; + optional string unusedDebtCharName = 27; + optional string unusedDebtSubCharName = 28; + + // Deprecated since 5.5, replaced by defaultRemFnType + optional string defaultDebtRemFnType = 29; + // Deprecated since 5.5, replaced by defaultRemFnGapMultiplier + optional string defaultDebtRemFnCoeff = 30; + // Deprecated since 5.5, replaced by defaultRemFnBaseEffort + optional string defaultDebtRemFnOffset = 31; + // Deprecated since 5.5, replaced by gapDescription + optional string effortToFixDescription = 32; + // Deprecated since 5.5, replaced by remFnOverloaded + optional bool debtOverloaded = 33; + // Deprecated since 5.5, replaced by remFnType + optional string debtRemFnType = 34; + // Deprecated since 5.5, replaced by remFnGapMultiplier + optional string debtRemFnCoeff = 35; + // Deprecated since 5.5, replaced by remFnBaseEffort + optional string debtRemFnOffset = 36; + + optional string defaultRemFnType = 38; + optional string defaultRemFnGapMultiplier = 39; + optional string defaultRemFnBaseEffort = 40; + optional string remFnType = 41; + optional string remFnGapMultiplier = 42; + optional string remFnBaseEffort = 43; + optional bool remFnOverloaded = 45; + optional string gapDescription = 44; + + optional sonarqube.ws.commons.RuleType type = 37; + + message Params { + repeated Param params = 1; + } + + message Param { + optional string key = 1; + optional string htmlDesc = 2; + optional string defaultValue = 3; + optional string type = 4; + } +} + +message SysTags { + repeated string sysTags = 1; +} + +message Tags { + repeated string tags = 1; +} + +message Actives { + map<string, ActiveList> actives = 1; +} + +message ActiveList { + repeated Active activeList = 1; +} + +message Active { + optional string qProfile = 1; + optional string inherit = 2; + optional string severity = 3; + // Unused since 5.6, it has been removed because it was never used and costly to compute + optional string unusedParent = 4; + repeated Param params = 5; + optional string createdAt = 6; + + message Param { + optional string key = 1; + optional string value = 2; + } +} + +message QProfiles { + map<string,QProfile> qProfiles = 1; +} + +message QProfile { + optional string name = 1; + optional string lang = 2; + optional string langName = 3; + optional string parent = 4; +} diff --git a/sonar-ws/src/main/protobuf/ws-settings.proto b/sonar-ws/src/main/protobuf/ws-settings.proto new file mode 100644 index 00000000000..db185b54446 --- /dev/null +++ b/sonar-ws/src/main/protobuf/ws-settings.proto @@ -0,0 +1,119 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto3"; + +package sonarqube.ws.settings; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Settings"; +option optimize_for = SPEED; + +// Response of GET api/settings/list_definitions +message ListDefinitionsWsResponse { + repeated Definition definitions = 1; +} + +// Response of GET api/settings/encrypt +message EncryptWsResponse { + string encryptedValue = 1; +} + +// Response of GET api/settings/generate_secret_key +message GenerateSecretKeyWsResponse { + string secretKey = 1; +} + +// Response of GET api/settings/check_secret_key +message CheckSecretKeyWsResponse { + bool secretKeyAvailable = 1; +} + +message Definition { + string key = 1; + oneof nameOneOf {string name = 2;} + string description = 3; + Type type = 4; + oneof categoryOneOf {string category = 5;} + oneof subCategoryOneOf {string subCategory = 6;} + oneof defaultValueOneOf {string defaultValue = 7;} + bool multiValues = 8; + repeated string options = 9; + repeated Field fields = 10; + oneof deprecatedKeyOneOf {string deprecatedKey = 11;} +} + +message Field { + string key = 1; + string name = 2; + string description = 3; + Type type = 4; + repeated string options = 5; +} + +enum Type { + STRING = 0; + TEXT = 1; + PASSWORD = 2; + BOOLEAN = 3; + INTEGER = 4; + FLOAT = 5; + LONG = 6; + REGULAR_EXPRESSION = 7; + METRIC = 8; + USER_LOGIN = 9; + METRIC_LEVEL = 10; + SINGLE_SELECT_LIST = 11; + PROPERTY_SET = 12; + LICENSE = 13; +} + +// Response of GET api/settings/values +message ValuesWsResponse { + repeated Setting settings = 1; +} + +message Setting { + string key = 1; + oneof valueOneOf { + string value = 2; + Values values = 3; + FieldValues fieldValues = 4; + } + bool inherited = 5; + oneof parentValueOneOf { + string parentValue = 6; + Values parentValues = 7; + FieldValues parentFieldValues = 8; + } +} + +message Values { + repeated string values = 1; +} + +message FieldValues { + repeated Value fieldValues = 1; + + message Value { + map<string, string> value = 1; + } +} + + + diff --git a/sonar-ws/src/main/protobuf/ws-system.proto b/sonar-ws/src/main/protobuf/ws-system.proto new file mode 100644 index 00000000000..5ec419745d4 --- /dev/null +++ b/sonar-ws/src/main/protobuf/ws-system.proto @@ -0,0 +1,77 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.system; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "System"; +option optimize_for = SPEED; + +// GET api/system/health +message HealthResponse { + optional Health health = 1; + repeated Cause causes = 2; + optional Nodes nodes = 3; +} + +message Nodes { + repeated Node nodes = 1; +} + +// GET api/system/status +message StatusResponse { + optional string id = 1; + optional string version = 2; + optional Status status = 3; +} + +message Cause { + optional string message = 1; +} + +enum Health { + GREEN = 0; + YELLOW = 1; + RED = 2; +} + +enum Status { + STARTING = 0; + UP = 1; + DOWN = 2; + RESTARTING = 3; + DB_MIGRATION_NEEDED = 4; + DB_MIGRATION_RUNNING = 5; +} + +message Node { + optional string name = 1; + optional NodeType type = 2; + optional string host = 3; + optional int32 port = 4; + optional string startedAt = 5; + optional Health health = 6; + repeated Cause causes = 7; +} + +enum NodeType { + APPLICATION = 0; + SEARCH = 1; +} diff --git a/sonar-ws/src/main/protobuf/ws-tests.proto b/sonar-ws/src/main/protobuf/ws-tests.proto new file mode 100644 index 00000000000..74865970ca6 --- /dev/null +++ b/sonar-ws/src/main/protobuf/ws-tests.proto @@ -0,0 +1,68 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.tests; + +import "ws-commons.proto"; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Tests"; +option optimize_for = SPEED; + +// WS api/tests/list +message ListResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated Test tests = 2; +} + +// WS api/tests/covered_files +message CoveredFilesResponse { + repeated CoveredFile files = 1; + + message CoveredFile { + optional string id = 1; + optional string key = 2; + optional string longName = 3; + optional int32 coveredLines = 4; + optional string branch = 5; + } +} + + +message Test { + optional string id = 1; + optional string name = 2; + optional string fileId = 3; + optional string fileKey = 4; + optional string fileName = 5; + optional TestStatus status = 6; + optional int64 durationInMs = 7; + optional int32 coveredLines = 8; + optional string message = 9; + optional string stacktrace = 10; + optional string fileBranch = 11; +} + +enum TestStatus { + OK = 1; + FAILURE = 2; + ERROR = 3; + SKIPPED = 4; +} diff --git a/sonar-ws/src/main/protobuf/ws-user_groups.proto b/sonar-ws/src/main/protobuf/ws-user_groups.proto new file mode 100644 index 00000000000..07918617d9b --- /dev/null +++ b/sonar-ws/src/main/protobuf/ws-user_groups.proto @@ -0,0 +1,52 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.usergroup; + +import "ws-commons.proto"; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "UserGroups"; +option optimize_for = SPEED; + +// WS api/user_groups/create +message CreateWsResponse { + optional Group group = 1; +} + +// WS api/user_groups/update +message UpdateWsResponse { + optional Group group = 1; +} + +// WS api/user_groups/search +message SearchWsResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated Group groups = 2; +} + +message Group { + optional int64 id = 1; + optional string organization = 2; + optional string name = 3; + optional string description = 4; + optional int32 membersCount = 5; + optional bool default = 6; +} diff --git a/sonar-ws/src/main/protobuf/ws-user_tokens.proto b/sonar-ws/src/main/protobuf/ws-user_tokens.proto new file mode 100644 index 00000000000..e51cd80174c --- /dev/null +++ b/sonar-ws/src/main/protobuf/ws-user_tokens.proto @@ -0,0 +1,43 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.usertoken; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "UserTokens"; +option optimize_for = SPEED; + +// WS api/user_tokens/generate +message GenerateWsResponse { + optional string login = 1; + optional string name = 2; + optional string token = 3; +} + +// WS api/user_tokens/search +message SearchWsResponse { + optional string login = 1; + repeated UserToken userTokens = 2; + + message UserToken { + optional string name = 1; + optional string createdAt = 2; + } +} diff --git a/sonar-ws/src/main/protobuf/ws-users.proto b/sonar-ws/src/main/protobuf/ws-users.proto new file mode 100644 index 00000000000..474b2a870bf --- /dev/null +++ b/sonar-ws/src/main/protobuf/ws-users.proto @@ -0,0 +1,116 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.users; + +import "ws-commons.proto"; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Users"; +option optimize_for = SPEED; + +// WS api/users/search +message SearchWsResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated User users = 2; + + message User { + optional string login = 1; + optional string name = 2; + optional bool active = 3; + optional string email = 4; + optional ScmAccounts scmAccounts = 5; + optional Groups groups = 6; + optional int32 tokensCount = 7; + optional bool local = 8; + optional string externalIdentity = 9; + optional string externalProvider = 10; + optional string avatar = 11; + } + + message Groups { + repeated string groups = 1; + } + + message ScmAccounts { + repeated string scmAccounts = 1; + } +} + +// WS api/users/identity_providers +message IdentityProvidersWsResponse { + repeated IdentityProvider identityProviders = 1; +} + +message IdentityProvider { + optional string key = 1; + optional string name = 2; + optional string iconPath = 3; + optional string backgroundColor = 4; +} + +message CreateWsResponse { + optional User user = 1; + + message User { + optional string login = 1; + optional string name = 2; + optional string email = 3; + repeated string scmAccounts = 4; + optional bool active = 5; + optional bool local = 6; + } +} + +// WS api/users/groups +message GroupsWsResponse { + optional sonarqube.ws.commons.Paging paging = 1; + repeated Group groups = 2; + + message Group { + optional int64 id = 1; + optional string name = 2; + optional string description = 3; + optional bool selected = 4; + optional bool default = 5; + } +} + +// WS api/users/current +message CurrentWsResponse { + optional bool isLoggedIn = 1; + optional string login = 2; + optional string name = 3; + optional string email = 4; + optional bool local = 5; + optional string externalIdentity = 6; + optional string externalProvider = 7; + repeated string scmAccounts = 8; + repeated string groups = 9; + optional Permissions permissions = 10; + optional bool showOnboardingTutorial = 11; + optional string avatar = 12; + + message Permissions { + repeated string global = 1; + } +} + + diff --git a/sonar-ws/src/main/protobuf/ws-webhooks.proto b/sonar-ws/src/main/protobuf/ws-webhooks.proto new file mode 100644 index 00000000000..a7ef3a9ab2b --- /dev/null +++ b/sonar-ws/src/main/protobuf/ws-webhooks.proto @@ -0,0 +1,49 @@ +// SonarQube, open source software quality management tool. +// Copyright (C) 2008-2016 SonarSource +// mailto:contact AT sonarsource DOT com +// +// SonarQube 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. +// +// SonarQube 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. + +syntax = "proto2"; + +package sonarqube.ws.webhooks; + +option java_package = "org.sonarqube.ws"; +option java_outer_classname = "Webhooks"; +option optimize_for = SPEED; + +// WS api/webhooks/deliveries +message DeliveriesWsResponse { + repeated Delivery deliveries = 1; +} + +// WS api/webhooks/delivery +message DeliveryWsResponse { + optional Delivery delivery = 1; +} + +message Delivery { + optional string id = 1; + optional string componentKey = 2; + optional string ceTaskId = 3; + optional string name = 4; + optional string url = 5; + optional string at = 6; + optional bool success = 7; + optional int32 httpStatus = 8; + optional int32 durationMs = 9; + optional string payload = 10; + optional string errorStacktrace = 11; +} |