<module>sonar-markdown</module>
<module>sonar-plugin-api</module>
<module>server</module>
+ <module>sonar-ws-generated</module>
<module>sonar-ws</module>
<module>sonar-testing-harness</module>
<module>plugins/sonar-xoo-plugin</module>
<artifactId>sonar-scanner-protocol</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>sonar-ws-generated</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>sonar-ws</artifactId>
import java.util.stream.Collectors;
import javax.annotation.Nullable;
import org.sonarqube.ws.Organizations;
-import org.sonarqube.ws.WsUserGroups;
-import org.sonarqube.ws.WsUsers;
-import org.sonarqube.ws.WsUsers.GroupsWsResponse.Group;
+import org.sonarqube.ws.UserGroups;
+import org.sonarqube.ws.Users;
+import org.sonarqube.ws.Users.GroupsWsResponse.Group;
import org.sonarqube.ws.client.user.GroupsRequest;
import org.sonarqube.ws.client.usergroup.AddUserWsRequest;
import org.sonarqube.ws.client.usergroup.CreateWsRequest;
}
@SafeVarargs
- public final WsUserGroups.Group generate(@Nullable Organizations.Organization organization, Consumer<CreateWsRequest.Builder>... populators) {
+ public final UserGroups.Group generate(@Nullable Organizations.Organization organization, Consumer<CreateWsRequest.Builder>... populators) {
int id = ID_GENERATOR.getAndIncrement();
CreateWsRequest.Builder request = CreateWsRequest.builder()
.setName("Group" + id)
.setOrganization(organization != null ? organization.getKey() : null)
.setLogin(userLogin)
.build();
- WsUsers.GroupsWsResponse response = session.users().service().groups(request);
+ Users.GroupsWsResponse response = session.users().service().groups(request);
return response.getGroupsList();
}
import javax.annotation.Nullable;
import org.assertj.core.api.Assertions;
import org.sonarqube.ws.Organizations;
-import org.sonarqube.ws.WsUsers;
+import org.sonarqube.ws.Users;
import org.sonarqube.ws.client.HttpException;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.organization.CreateWsRequest;
import org.sonarqube.ws.client.user.GroupsRequest;
import static java.util.Arrays.stream;
-import static org.assertj.core.api.Assertions.assertThat;
public class OrganizationTester {
return service().create(request.build()).getOrganization();
}
- public OrganizationTester addMember(Organizations.Organization organization, WsUsers.CreateWsResponse.User user) {
+ public OrganizationTester addMember(Organizations.Organization organization, Users.CreateWsResponse.User user) {
service().addMember(organization.getKey(), user.getLogin());
return this;
}
return this;
}
- public OrganizationTester assertThatMemberOf(Organizations.Organization organization, WsUsers.CreateWsResponse.User user) {
+ public OrganizationTester assertThatMemberOf(Organizations.Organization organization, Users.CreateWsResponse.User user) {
return assertThatMemberOf(organization, user.getLogin());
}
return this;
}
- public OrganizationTester assertThatNotMemberOf(Organizations.Organization organization, WsUsers.CreateWsResponse.User user) {
+ public OrganizationTester assertThatNotMemberOf(Organizations.Organization organization, Users.CreateWsResponse.User user) {
return assertThatNotMemberOf(organization, user.getLogin());
}
}
private void verifyMembersGroupMembership(String userLogin, @Nullable Organizations.Organization organization, boolean isMember) {
- List<WsUsers.GroupsWsResponse.Group> groups = session.wsClient().users().groups(GroupsRequest.builder()
+ List<Users.GroupsWsResponse.Group> groups = session.wsClient().users().groups(GroupsRequest.builder()
.setLogin(userLogin)
.setOrganization(organization != null ? organization.getKey() : null)
.setQuery("Members")
import java.util.function.Consumer;
import javax.annotation.Nullable;
import org.sonarqube.ws.Organizations;
-import org.sonarqube.ws.WsProjects;
+import org.sonarqube.ws.Projects;
import org.sonarqube.ws.client.project.CreateRequest;
import org.sonarqube.ws.client.project.DeleteRequest;
import org.sonarqube.ws.client.project.ProjectsService;
}
@SafeVarargs
- public final WsProjects.CreateWsResponse.Project generate(@Nullable Organizations.Organization organization, Consumer<CreateRequest.Builder>... populators) {
+ public final Projects.CreateWsResponse.Project provision(Consumer<CreateRequest.Builder>... populators) {
+ return provision(null, populators);
+ }
+
+ @SafeVarargs
+ public final Projects.CreateWsResponse.Project provision(@Nullable Organizations.Organization organization, Consumer<CreateRequest.Builder>... populators) {
int id = ID_GENERATOR.getAndIncrement();
CreateRequest.Builder request = CreateRequest.builder()
.setKey("key" + id)
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
-import org.sonarqube.ws.WsProjects.CreateWsResponse.Project;
-import org.sonarqube.ws.WsQualityGates.CreateWsResponse;
+import org.sonarqube.ws.Projects.CreateWsResponse.Project;
+import org.sonarqube.ws.Qualitygates.CreateWsResponse;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.PostRequest;
-import org.sonarqube.ws.client.qualitygate.QualityGatesService;
-import org.sonarqube.ws.client.qualitygate.SelectWsRequest;
+import org.sonarqube.ws.client.qualitygates.CreateRequest;
+import org.sonarqube.ws.client.qualitygates.QualitygatesService;
+import org.sonarqube.ws.client.qualitygates.SelectRequest;
public class QGateTester {
private static final AtomicInteger ID_GENERATOR = new AtomicInteger();
this.session = session;
}
- public QualityGatesService service() {
+ public QualitygatesService service() {
return session.wsClient().qualityGates();
}
public CreateWsResponse generate() {
int id = ID_GENERATOR.getAndIncrement();
- return session.wsClient().qualityGates().create("QualityGate" + id);
+ return session.wsClient().qualityGates().create(new CreateRequest().setName("QualityGate" + id));
}
public void associateProject(CreateWsResponse qualityGate, Project project){
- service().associateProject(new SelectWsRequest().setGateId(qualityGate.getId()).setProjectKey(project.getKey()));
+ service().select(new SelectRequest().setGateId(String.valueOf(qualityGate.getId())).setProjectKey(project.getKey()));
}
public static class ListResponse {
import org.assertj.core.api.Assertions;
import org.sonarqube.ws.Common;
import org.sonarqube.ws.Organizations.Organization;
-import org.sonarqube.ws.QualityProfiles.CreateWsResponse.QualityProfile;
+import org.sonarqube.ws.Qualityprofiles.CreateWsResponse.QualityProfile;
import org.sonarqube.ws.Rules;
-import org.sonarqube.ws.WsProjects.CreateWsResponse.Project;
+import org.sonarqube.ws.Projects.CreateWsResponse.Project;
import org.sonarqube.ws.client.HttpException;
import org.sonarqube.ws.client.qualityprofile.ActivateRuleWsRequest;
import org.sonarqube.ws.client.qualityprofile.AddProjectRequest;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Consumer;
import org.sonarqube.ws.Organizations;
-import org.sonarqube.ws.WsUsers;
-import org.sonarqube.ws.WsUsers.CreateWsResponse.User;
+import org.sonarqube.ws.Users;
+import org.sonarqube.ws.Users.CreateWsResponse.User;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.user.CreateRequest;
import org.sonarqube.ws.client.user.SearchRequest;
return session.wsClient().users();
}
- public Optional<WsUsers.SearchWsResponse.User> getByLogin(String login) {
- List<WsUsers.SearchWsResponse.User> users = session.wsClient().users().search(SearchRequest.builder().setQuery(login).build()).getUsersList();
+ public Optional<Users.SearchWsResponse.User> getByLogin(String login) {
+ List<Users.SearchWsResponse.User> users = session.wsClient().users().search(SearchRequest.builder().setQuery(login).build()).getUsersList();
if (users.size() == 1) {
return Optional.of(users.get(0));
}
import org.sonar.api.server.ws.WebService;
import org.sonar.scanner.protocol.input.FileData;
import org.sonar.scanner.protocol.input.ProjectRepositories;
-import org.sonarqube.ws.WsBatch.WsProjectResponse;
-import org.sonarqube.ws.WsBatch.WsProjectResponse.FileData.Builder;
+import org.sonarqube.ws.Batch.WsProjectResponse;
+import org.sonarqube.ws.Batch.WsProjectResponse.FileData.Builder;
import static org.sonar.core.util.Protobuf.setNullable;
import static org.sonar.server.ws.KeyExamples.KEY_BRANCH_EXAMPLE_001;
import org.sonar.server.user.UserSession;
import org.sonar.server.ws.WsUtils;
import org.sonarqube.ws.Common;
-import org.sonarqube.ws.WsBranches;
+import org.sonarqube.ws.ProjectBranches;
import static com.google.common.base.Preconditions.checkArgument;
import static java.util.Collections.singletonList;
.selectLastAnalysesByRootComponentUuids(dbSession, branches.stream().map(BranchDto::getUuid).collect(Collectors.toList()))
.stream().collect(uniqueIndex(SnapshotDto::getComponentUuid, s -> formatDateTime(s.getCreatedAt())));
- WsBranches.ListWsResponse.Builder protobufResponse = WsBranches.ListWsResponse.newBuilder();
+ ProjectBranches.ListWsResponse.Builder protobufResponse = ProjectBranches.ListWsResponse.newBuilder();
branches.stream()
.forEach(b -> addBranch(protobufResponse, b, mergeBranchesByUuid, qualityGateMeasuresByComponentUuids.get(b.getUuid()), branchStatisticsByBranchUuid.get(b.getUuid()),
analysisDateByBranchUuid.get(b.getUuid())));
}
}
- private static void addBranch(WsBranches.ListWsResponse.Builder response, BranchDto branch, Map<String, BranchDto> mergeBranchesByUuid, @Nullable MeasureDto qualityGateMeasure,
- BranchStatistics branchStatistics, @Nullable String analysisDate) {
- WsBranches.Branch.Builder builder = toBranchBuilder(branch, Optional.ofNullable(mergeBranchesByUuid.get(branch.getMergeBranchUuid())));
+ private static void addBranch(ProjectBranches.ListWsResponse.Builder response, BranchDto branch, Map<String, BranchDto> mergeBranchesByUuid,
+ @Nullable MeasureDto qualityGateMeasure, BranchStatistics branchStatistics, @Nullable String analysisDate) {
+ ProjectBranches.Branch.Builder builder = toBranchBuilder(branch, Optional.ofNullable(mergeBranchesByUuid.get(branch.getMergeBranchUuid())));
setBranchStatus(builder, branch, qualityGateMeasure, branchStatistics);
if (analysisDate != null) {
builder.setAnalysisDate(analysisDate);
response.addBranches(builder);
}
- private static WsBranches.Branch.Builder toBranchBuilder(BranchDto branch, Optional<BranchDto> mergeBranch) {
- WsBranches.Branch.Builder builder = WsBranches.Branch.newBuilder();
+ private static ProjectBranches.Branch.Builder toBranchBuilder(BranchDto branch, Optional<BranchDto> mergeBranch) {
+ ProjectBranches.Branch.Builder builder = ProjectBranches.Branch.newBuilder();
String branchKey = branch.getKey();
setNullable(branchKey, builder::setName);
builder.setIsMain(branch.isMain());
return builder;
}
- private static void setBranchStatus(WsBranches.Branch.Builder builder, BranchDto branch, @Nullable MeasureDto qualityGateMeasure, @Nullable BranchStatistics branchStatistics) {
- WsBranches.Branch.Status.Builder statusBuilder = WsBranches.Branch.Status.newBuilder();
+ private static void setBranchStatus(ProjectBranches.Branch.Builder builder, BranchDto branch, @Nullable MeasureDto qualityGateMeasure,
+ @Nullable BranchStatistics branchStatistics) {
+ ProjectBranches.Branch.Status.Builder statusBuilder = ProjectBranches.Branch.Status.newBuilder();
if (branch.getBranchType() == LONG && qualityGateMeasure != null) {
statusBuilder.setQualityGateStatus(qualityGateMeasure.getData());
}
import org.sonar.db.component.ComponentDto;
import org.sonar.db.component.ComponentQuery;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.WsCe;
-import org.sonarqube.ws.WsCe.ActivityResponse;
-import org.sonarqube.ws.client.ce.ActivityWsRequest;
+import org.sonarqube.ws.Ce;
+import org.sonarqube.ws.Ce.ActivityResponse;
+import org.sonarqube.ws.client.ce.ActivityRequest;
+import static java.lang.Boolean.parseBoolean;
+import static java.lang.Integer.parseInt;
import static java.lang.String.format;
import static java.util.Collections.singletonList;
import static org.apache.commons.lang.StringUtils.defaultString;
writeProtobuf(activityResponse, wsRequest, wsResponse);
}
- private ActivityResponse doHandle(ActivityWsRequest request) {
+ private ActivityResponse doHandle(ActivityRequest request) {
try (DbSession dbSession = dbClient.openSession(false)) {
ComponentDto component = loadComponent(dbSession, request);
checkPermission(component);
// if a task searched by uuid is found all other parameters are ignored
- Optional<WsCe.Task> taskSearchedById = searchTaskByUuid(dbSession, request);
+ Optional<Ce.Task> taskSearchedById = searchTaskByUuid(dbSession, request);
if (taskSearchedById.isPresent()) {
return buildResponse(
singletonList(taskSearchedById.get()),
Collections.emptyList(),
- request.getPageSize());
+ parseInt(request.getPs()));
}
CeTaskQuery query = buildQuery(dbSession, request, component);
- List<WsCe.Task> queuedTasks = loadQueuedTasks(dbSession, request, query);
- List<WsCe.Task> pastTasks = loadPastTasks(dbSession, request, query);
+ List<Ce.Task> queuedTasks = loadQueuedTasks(dbSession, request, query);
+ List<Ce.Task> pastTasks = loadPastTasks(dbSession, request, query);
return buildResponse(
queuedTasks,
pastTasks,
- request.getPageSize());
+ parseInt(request.getPs()));
}
}
@CheckForNull
- private ComponentDto loadComponent(DbSession dbSession, ActivityWsRequest request) {
+ private ComponentDto loadComponent(DbSession dbSession, ActivityRequest request) {
String componentId = request.getComponentId();
if (componentId == null) {
return null;
}
}
- private Optional<WsCe.Task> searchTaskByUuid(DbSession dbSession, ActivityWsRequest request) {
- String textQuery = request.getQuery();
+ private Optional<Ce.Task> searchTaskByUuid(DbSession dbSession, ActivityRequest request) {
+ String textQuery = request.getQ();
if (textQuery == null) {
return Optional.absent();
}
return activity.map(ceActivityDto -> Optional.of(formatter.formatActivity(dbSession, ceActivityDto, null))).orElseGet(Optional::absent);
}
- private CeTaskQuery buildQuery(DbSession dbSession, ActivityWsRequest request, @Nullable ComponentDto component) {
+ private CeTaskQuery buildQuery(DbSession dbSession, ActivityRequest request, @Nullable ComponentDto component) {
CeTaskQuery query = new CeTaskQuery();
query.setType(request.getType());
- query.setOnlyCurrents(request.getOnlyCurrents());
+ query.setOnlyCurrents(parseBoolean(request.getOnlyCurrents()));
Date minSubmittedAt = parseStartingDateOrDateTime(request.getMinSubmittedAt());
query.setMinSubmittedAt(minSubmittedAt == null ? null : minSubmittedAt.getTime());
Date maxExecutedAt = parseEndingDateOrDateTime(request.getMaxExecutedAt());
query.setStatuses(request.getStatus());
}
- String componentQuery = request.getQuery();
+ String componentQuery = request.getQ();
if (component != null) {
query.setComponentUuid(component.uuid());
} else if (componentQuery != null) {
return dbClient.componentDao().selectByQuery(dbSession, componentDtoQuery, 0, CeTaskQuery.MAX_COMPONENT_UUIDS);
}
- private List<WsCe.Task> loadQueuedTasks(DbSession dbSession, ActivityWsRequest request, CeTaskQuery query) {
- List<CeQueueDto> dtos = dbClient.ceQueueDao().selectByQueryInDescOrder(dbSession, query, request.getPageSize());
+ private List<Ce.Task> loadQueuedTasks(DbSession dbSession, ActivityRequest request, CeTaskQuery query) {
+ List<CeQueueDto> dtos = dbClient.ceQueueDao().selectByQueryInDescOrder(dbSession, query, parseInt(request.getPs()));
return formatter.formatQueue(dbSession, dtos);
}
- private List<WsCe.Task> loadPastTasks(DbSession dbSession, ActivityWsRequest request, CeTaskQuery query) {
- List<CeActivityDto> dtos = dbClient.ceActivityDao().selectByQuery(dbSession, query, forPage(1).andSize(request.getPageSize()));
+ private List<Ce.Task> loadPastTasks(DbSession dbSession, ActivityRequest request, CeTaskQuery query) {
+ List<CeActivityDto> dtos = dbClient.ceActivityDao().selectByQuery(dbSession, query, forPage(1).andSize(parseInt(request.getPs())));
return formatter.formatActivity(dbSession, dtos);
}
- private static ActivityResponse buildResponse(Iterable<WsCe.Task> queuedTasks, Iterable<WsCe.Task> pastTasks, int pageSize) {
- WsCe.ActivityResponse.Builder wsResponseBuilder = WsCe.ActivityResponse.newBuilder();
+ private static ActivityResponse buildResponse(Iterable<Ce.Task> queuedTasks, Iterable<Ce.Task> pastTasks, int pageSize) {
+ Ce.ActivityResponse.Builder wsResponseBuilder = Ce.ActivityResponse.newBuilder();
int nbInsertedTasks = 0;
- for (WsCe.Task queuedTask : queuedTasks) {
+ for (Ce.Task queuedTask : queuedTasks) {
if (nbInsertedTasks < pageSize) {
wsResponseBuilder.addTasks(queuedTask);
nbInsertedTasks++;
}
}
- for (WsCe.Task pastTask : pastTasks) {
+ for (Ce.Task pastTask : pastTasks) {
if (nbInsertedTasks < pageSize) {
wsResponseBuilder.addTasks(pastTask);
nbInsertedTasks++;
return wsResponseBuilder.build();
}
- private static ActivityWsRequest toSearchWsRequest(Request request) {
- ActivityWsRequest activityWsRequest = new ActivityWsRequest()
+ private static ActivityRequest toSearchWsRequest(Request request) {
+ ActivityRequest activityWsRequest = new ActivityRequest()
.setComponentId(request.param(PARAM_COMPONENT_ID))
- .setQuery(defaultString(request.param(Param.TEXT_QUERY), request.param(PARAM_COMPONENT_QUERY)))
+ .setQ(defaultString(request.param(Param.TEXT_QUERY), request.param(PARAM_COMPONENT_QUERY)))
.setStatus(request.paramAsStrings(PARAM_STATUS))
.setType(request.param(PARAM_TYPE))
.setMinSubmittedAt(request.param(PARAM_MIN_SUBMITTED_AT))
.setMaxExecutedAt(request.param(PARAM_MAX_EXECUTED_AT))
- .setOnlyCurrents(request.paramAsBoolean(PARAM_ONLY_CURRENTS))
- .setPageSize(request.mandatoryParamAsInt(Param.PAGE_SIZE));
+ .setOnlyCurrents(String.valueOf(request.paramAsBoolean(PARAM_ONLY_CURRENTS)))
+ .setPs(String.valueOf(request.mandatoryParamAsInt(Param.PAGE_SIZE)));
- checkRequest(activityWsRequest.getComponentId() == null || activityWsRequest.getQuery() == null, "%s and %s must not be set at the same time",
+ checkRequest(activityWsRequest.getComponentId() == null || activityWsRequest.getQ() == null, "%s and %s must not be set at the same time",
PARAM_COMPONENT_ID, PARAM_COMPONENT_QUERY);
return activityWsRequest;
}
import org.sonar.server.component.ComponentFinder;
import org.sonar.server.user.UserSession;
import org.sonar.server.ws.KeyExamples;
-import org.sonarqube.ws.WsCe.ActivityStatusWsResponse;
-import org.sonarqube.ws.client.ce.ActivityStatusWsRequest;
+import org.sonarqube.ws.Ce.ActivityStatusWsResponse;
+import org.sonarqube.ws.client.ce.ActivityStatusRequest;
import static org.sonar.server.component.ComponentFinder.ParamNames.COMPONENT_ID_AND_KEY;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
writeProtobuf(activityStatusResponse, request, response);
}
- private ActivityStatusWsResponse doHandle(ActivityStatusWsRequest request) {
+ private ActivityStatusWsResponse doHandle(ActivityStatusRequest request) {
try (DbSession dbSession = dbClient.openSession(false)) {
Optional<ComponentDto> component = searchComponent(dbSession, request);
String componentUuid = component.isPresent() ? component.get().uuid() : null;
}
}
- private Optional<ComponentDto> searchComponent(DbSession dbSession, ActivityStatusWsRequest request) {
+ private Optional<ComponentDto> searchComponent(DbSession dbSession, ActivityStatusRequest request) {
ComponentDto component = null;
if (hasComponentInRequest(request)) {
component = componentFinder.getByUuidOrKey(dbSession, request.getComponentId(), request.getComponentKey(), COMPONENT_ID_AND_KEY);
}
}
- private static boolean hasComponentInRequest(ActivityStatusWsRequest request) {
+ private static boolean hasComponentInRequest(ActivityStatusRequest request) {
return request.getComponentId() != null || request.getComponentKey() != null;
}
- private static ActivityStatusWsRequest toWsRequest(Request request) {
- return ActivityStatusWsRequest.newBuilder()
+ private static ActivityStatusRequest toWsRequest(Request request) {
+ return new ActivityStatusRequest()
.setComponentId(request.param(PARAM_COMPONENT_ID))
- .setComponentKey(request.param(DEPRECATED_PARAM_COMPONENT_KEY))
- .build();
+ .setComponentKey(request.param(DEPRECATED_PARAM_COMPONENT_KEY));
}
}
import org.sonar.server.component.ComponentFinder;
import org.sonar.server.user.UserSession;
import org.sonar.server.ws.KeyExamples;
-import org.sonarqube.ws.WsCe.ProjectResponse;
+import org.sonarqube.ws.Ce.ProjectResponse;
import static org.sonar.db.Pagination.forPage;
import static org.sonar.server.component.ComponentFinder.ParamNames.COMPONENT_ID_AND_COMPONENT;
import org.sonar.server.computation.queue.ReportSubmitter;
import org.sonar.server.organization.DefaultOrganizationProvider;
import org.sonar.server.ws.WsUtils;
-import org.sonarqube.ws.WsCe;
+import org.sonarqube.ws.Ce;
import static org.sonar.core.component.ComponentKeys.MAX_COMPONENT_KEY_LENGTH;
import static org.sonar.db.component.ComponentValidator.MAX_COMPONENT_NAME_LENGTH;
try (InputStream report = new BufferedInputStream(wsRequest.mandatoryParamAsPart(PARAM_REPORT_DATA).getInputStream())) {
CeTask task = reportSubmitter.submit(organizationKey, projectKey, projectBranch, projectName, characteristics, report);
- WsCe.SubmitResponse submitResponse = WsCe.SubmitResponse.newBuilder()
+ Ce.SubmitResponse submitResponse = Ce.SubmitResponse.newBuilder()
.setTaskId(task.getUuid())
.setProjectId(task.getComponentUuid())
.build();
import org.sonar.db.permission.OrganizationPermission;
import org.sonar.server.user.UserSession;
import org.sonar.server.ws.WsUtils;
-import org.sonarqube.ws.WsCe;
+import org.sonarqube.ws.Ce;
import static org.sonar.core.permission.GlobalPermissions.SCAN_EXECUTION;
import static org.sonar.server.user.AbstractUserSession.insufficientPrivilegesException;
public void handle(Request wsRequest, Response wsResponse) throws Exception {
String taskUuid = wsRequest.mandatoryParam(PARAM_TASK_UUID);
try (DbSession dbSession = dbClient.openSession(false)) {
- WsCe.TaskResponse.Builder wsTaskResponse = WsCe.TaskResponse.newBuilder();
+ Ce.TaskResponse.Builder wsTaskResponse = Ce.TaskResponse.newBuilder();
Optional<CeQueueDto> queueDto = dbClient.ceQueueDao().selectByUuid(dbSession, taskUuid);
if (queueDto.isPresent()) {
com.google.common.base.Optional<ComponentDto> component = loadComponent(dbSession, queueDto.get().getComponentUuid());
import org.sonar.db.ce.CeTaskCharacteristicDto;
import org.sonar.db.component.ComponentDto;
import org.sonar.db.organization.OrganizationDto;
+import org.sonarqube.ws.Ce;
import org.sonarqube.ws.Common;
-import org.sonarqube.ws.WsCe;
import static com.google.common.base.Preconditions.checkState;
import static java.lang.String.format;
this.system2 = system2;
}
- public List<WsCe.Task> formatQueue(DbSession dbSession, List<CeQueueDto> dtos) {
+ public List<Ce.Task> formatQueue(DbSession dbSession, List<CeQueueDto> dtos) {
DtoCache cache = DtoCache.forQueueDtos(dbClient, dbSession, dtos);
return dtos.stream().map(input -> formatQueue(input, cache)).collect(MoreCollectors.toList(dtos.size()));
}
- public WsCe.Task formatQueue(DbSession dbSession, CeQueueDto queue) {
+ public Ce.Task formatQueue(DbSession dbSession, CeQueueDto queue) {
return formatQueue(queue, DtoCache.forQueueDtos(dbClient, dbSession, singletonList(queue)));
}
- private WsCe.Task formatQueue(CeQueueDto dto, DtoCache componentDtoCache) {
- WsCe.Task.Builder builder = WsCe.Task.newBuilder();
+ private Ce.Task formatQueue(CeQueueDto dto, DtoCache componentDtoCache) {
+ Ce.Task.Builder builder = Ce.Task.newBuilder();
String organizationKey = componentDtoCache.getOrganizationKey(dto.getComponentUuid());
// FIXME organization field should be set from the CeQueueDto rather than from the ComponentDto
setNullable(organizationKey, builder::setOrganization);
setComponent(builder, dto.getComponentUuid(), componentDtoCache);
}
builder.setId(dto.getUuid());
- builder.setStatus(WsCe.TaskStatus.valueOf(dto.getStatus().name()));
+ builder.setStatus(Ce.TaskStatus.valueOf(dto.getStatus().name()));
builder.setType(dto.getTaskType());
builder.setLogs(false);
setNullable(dto.getSubmitterLogin(), builder::setSubmitterLogin);
return builder.build();
}
- public WsCe.Task formatActivity(DbSession dbSession, CeActivityDto dto, @Nullable String scannerContext) {
+ public Ce.Task formatActivity(DbSession dbSession, CeActivityDto dto, @Nullable String scannerContext) {
return formatActivity(dto, DtoCache.forActivityDtos(dbClient, dbSession, singletonList(dto)), scannerContext);
}
- public List<WsCe.Task> formatActivity(DbSession dbSession, List<CeActivityDto> dtos) {
+ public List<Ce.Task> formatActivity(DbSession dbSession, List<CeActivityDto> dtos) {
DtoCache cache = DtoCache.forActivityDtos(dbClient, dbSession, dtos);
return dtos.stream()
.map(input -> formatActivity(input, cache, null))
.collect(MoreCollectors.toList(dtos.size()));
}
- private static WsCe.Task formatActivity(CeActivityDto dto, DtoCache componentDtoCache, @Nullable String scannerContext) {
- WsCe.Task.Builder builder = WsCe.Task.newBuilder();
+ private static Ce.Task formatActivity(CeActivityDto dto, DtoCache componentDtoCache, @Nullable String scannerContext) {
+ Ce.Task.Builder builder = Ce.Task.newBuilder();
String organizationKey = componentDtoCache.getOrganizationKey(dto.getComponentUuid());
// FIXME organization field should be set from the CeActivityDto rather than from the ComponentDto
setNullable(organizationKey, builder::setOrganization);
builder.setId(dto.getUuid());
- builder.setStatus(WsCe.TaskStatus.valueOf(dto.getStatus().name()));
+ builder.setStatus(Ce.TaskStatus.valueOf(dto.getStatus().name()));
builder.setType(dto.getTaskType());
builder.setLogs(false);
setNullable(dto.getComponentUuid(), uuid -> setComponent(builder, uuid, componentDtoCache).setComponentId(uuid));
return builder.build();
}
- private static WsCe.Task.Builder setComponent(WsCe.Task.Builder builder, @Nullable String componentUuid, DtoCache componentDtoCache) {
+ private static Ce.Task.Builder setComponent(Ce.Task.Builder builder, @Nullable String componentUuid, DtoCache componentDtoCache) {
ComponentDto componentDto = componentDtoCache.getComponent(componentUuid);
if (componentDto == null) {
return builder;
return builder;
}
- private static WsCe.Task.Builder setBranch(WsCe.Task.Builder builder, String taskUuid, DtoCache componentDtoCache) {
+ private static Ce.Task.Builder setBranch(Ce.Task.Builder builder, String taskUuid, DtoCache componentDtoCache) {
componentDtoCache.getBranchName(taskUuid).ifPresent(
b -> {
builder.setBranch(b);
import org.sonar.api.server.ws.Response;
import org.sonar.api.server.ws.WebService;
import org.sonar.ce.taskprocessor.CeTaskProcessor;
-import org.sonarqube.ws.WsCe;
+import org.sonarqube.ws.Ce;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
@Override
public void handle(Request request, Response response) throws Exception {
- WsCe.TaskTypesWsResponse taskTypesWsResponse = WsCe.TaskTypesWsResponse.newBuilder()
+ Ce.TaskTypesWsResponse taskTypesWsResponse = Ce.TaskTypesWsResponse.newBuilder()
.addAllTaskTypes(taskTypes)
.build();
import org.sonar.api.server.ws.WebService;
import org.sonar.ce.configuration.WorkerCountProvider;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.WsCe.WorkerCountResponse;
+import org.sonarqube.ws.Ce.WorkerCountResponse;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
import static org.sonarqube.ws.client.ce.CeWsParameters.ACTION_WORKER_COUNT;
import org.sonar.db.component.SnapshotDto;
import org.sonar.db.organization.OrganizationDto;
import org.sonar.server.project.Visibility;
-import org.sonarqube.ws.WsComponents;
+import org.sonarqube.ws.Components;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Strings.emptyToNull;
// prevent instantiation
}
- static WsComponents.Component.Builder componentDtoToWsComponent(ComponentDto dto, OrganizationDto organizationDto, Optional<SnapshotDto> lastAnalysis) {
+ static Components.Component.Builder componentDtoToWsComponent(ComponentDto dto, OrganizationDto organizationDto, Optional<SnapshotDto> lastAnalysis) {
checkArgument(
Objects.equals(dto.getOrganizationUuid(), organizationDto.getUuid()),
"OrganizationUuid (%s) of ComponentDto to convert to Ws Component is not the same as the one (%s) of the specified OrganizationDto",
return componentDtoToWsComponent(dto, organizationDto.getKey(), lastAnalysis);
}
- private static WsComponents.Component.Builder componentDtoToWsComponent(ComponentDto dto, String organizationDtoKey, Optional<SnapshotDto> lastAnalysis) {
- WsComponents.Component.Builder wsComponent = WsComponents.Component.newBuilder()
+ private static Components.Component.Builder componentDtoToWsComponent(ComponentDto dto, String organizationDtoKey, Optional<SnapshotDto> lastAnalysis) {
+ Components.Component.Builder wsComponent = Components.Component.newBuilder()
.setOrganization(organizationDtoKey)
.setId(dto.uuid())
.setKey(dto.getKey())
return wsComponent;
}
- private static void setTags(ComponentDto dto, WsComponents.Component.Builder wsComponent) {
+ private static void setTags(ComponentDto dto, Components.Component.Builder wsComponent) {
if (Qualifiers.PROJECT.equals(dto.qualifier())) {
wsComponent.getTagsBuilder().addAllTags(dto.getTags());
}
import org.sonar.server.es.SearchOptions;
import org.sonar.server.organization.DefaultOrganizationProvider;
import org.sonar.server.ws.WsUtils;
-import org.sonarqube.ws.WsComponents;
-import org.sonarqube.ws.WsComponents.SearchWsResponse;
+import org.sonarqube.ws.Components;
+import org.sonarqube.ws.Components.SearchWsResponse;
import org.sonarqube.ws.client.component.SearchWsRequest;
import static com.google.common.base.Preconditions.checkArgument;
return responseBuilder.build();
}
- private static WsComponents.Component dtoToComponent(OrganizationDto organization, ComponentDto dto, String projectKey) {
+ private static Components.Component dtoToComponent(OrganizationDto organization, ComponentDto dto, String projectKey) {
checkArgument(
organization.getUuid().equals(dto.getOrganizationUuid()),
"No Organization found for uuid '%s'",
dto.getOrganizationUuid());
- WsComponents.Component.Builder builder = WsComponents.Component.newBuilder()
+ Components.Component.Builder builder = Components.Component.newBuilder()
.setOrganization(organization.getKey())
.setId(dto.uuid())
.setKey(dto.getDbKey())
import org.sonar.server.project.Visibility;
import org.sonar.server.user.UserSession;
import org.sonarqube.ws.Common;
-import org.sonarqube.ws.WsComponents.Component;
-import org.sonarqube.ws.WsComponents.SearchProjectsWsResponse;
+import org.sonarqube.ws.Components.Component;
+import org.sonarqube.ws.Components.SearchProjectsWsResponse;
import org.sonarqube.ws.client.component.SearchProjectsRequest;
import static com.google.common.base.MoreObjects.firstNonNull;
import org.sonar.db.organization.OrganizationDto;
import org.sonar.server.component.ComponentFinder;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.WsComponents.ShowWsResponse;
+import org.sonarqube.ws.Components.ShowWsResponse;
import org.sonarqube.ws.client.component.ShowWsRequest;
import static com.google.common.base.Preconditions.checkArgument;
import org.sonar.server.es.DefaultIndexSettings;
import org.sonar.server.favorite.FavoriteFinder;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.WsComponents.SuggestionsWsResponse;
-import org.sonarqube.ws.WsComponents.SuggestionsWsResponse.Category;
-import org.sonarqube.ws.WsComponents.SuggestionsWsResponse.Project;
-import org.sonarqube.ws.WsComponents.SuggestionsWsResponse.Suggestion;
+import org.sonarqube.ws.Components.SuggestionsWsResponse;
+import org.sonarqube.ws.Components.SuggestionsWsResponse.Category;
+import org.sonarqube.ws.Components.SuggestionsWsResponse.Project;
+import org.sonarqube.ws.Components.SuggestionsWsResponse.Suggestion;
import static com.google.common.base.Preconditions.checkState;
import static java.util.Arrays.stream;
import static org.sonar.server.component.index.SuggestionQuery.DEFAULT_LIMIT;
import static org.sonar.server.es.DefaultIndexSettings.MINIMUM_NGRAM_LENGTH;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
-import static org.sonarqube.ws.WsComponents.SuggestionsWsResponse.Organization;
-import static org.sonarqube.ws.WsComponents.SuggestionsWsResponse.newBuilder;
+import static org.sonarqube.ws.Components.SuggestionsWsResponse.Organization;
+import static org.sonarqube.ws.Components.SuggestionsWsResponse.newBuilder;
import static org.sonarqube.ws.client.component.ComponentsWsParameters.ACTION_SUGGESTIONS;
public class SuggestionsAction implements ComponentsWsAction {
import org.sonar.db.organization.OrganizationDto;
import org.sonar.server.component.ComponentFinder;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.WsComponents;
-import org.sonarqube.ws.WsComponents.TreeWsResponse;
+import org.sonarqube.ws.Components;
+import org.sonarqube.ws.Components.TreeWsResponse;
import org.sonarqube.ws.client.component.TreeWsRequest;
import static com.google.common.base.Preconditions.checkArgument;
return response.build();
}
- private static WsComponents.Component.Builder toWsComponent(ComponentDto component, OrganizationDto organizationDto,
- Map<String, ComponentDto> referenceComponentsByUuid) {
- WsComponents.Component.Builder wsComponent = componentDtoToWsComponent(component, organizationDto, Optional.empty());
+ private static Components.Component.Builder toWsComponent(ComponentDto component, OrganizationDto organizationDto,
+ Map<String, ComponentDto> referenceComponentsByUuid) {
+ Components.Component.Builder wsComponent = componentDtoToWsComponent(component, organizationDto, Optional.empty());
ComponentDto referenceComponent = referenceComponentsByUuid.get(component.getCopyResourceUuid());
if (referenceComponent != null) {
import org.sonar.db.DbSession;
import org.sonar.db.component.ComponentDao;
import org.sonar.db.component.ComponentDto;
-import org.sonarqube.ws.WsDuplications;
-import org.sonarqube.ws.WsDuplications.Block;
-import org.sonarqube.ws.WsDuplications.ShowResponse;
+import org.sonarqube.ws.Duplications;
+import org.sonarqube.ws.Duplications.Block;
+import org.sonarqube.ws.Duplications.ShowResponse;
import static com.google.common.collect.Maps.newHashMap;
import static org.sonar.core.util.Protobuf.setNullable;
return response.build();
}
- private static WsDuplications.Duplication.Builder toWsDuplication(DuplicationsParser.Block block, Map<String, String> refByComponentKey) {
- WsDuplications.Duplication.Builder wsDuplication = WsDuplications.Duplication.newBuilder();
+ private static Duplications.Duplication.Builder toWsDuplication(DuplicationsParser.Block block, Map<String, String> refByComponentKey) {
+ Duplications.Duplication.Builder wsDuplication = Duplications.Duplication.newBuilder();
block.getDuplications().stream()
.map(d -> toWsBlock(refByComponentKey, d))
.forEach(wsDuplication::addBlocks);
return block;
}
- private static WsDuplications.File toWsFile(ComponentDto file, @Nullable ComponentDto project, @Nullable ComponentDto subProject, @Nullable String branch) {
- WsDuplications.File.Builder wsFile = WsDuplications.File.newBuilder();
+ private static Duplications.File toWsFile(ComponentDto file, @Nullable ComponentDto project, @Nullable ComponentDto subProject, @Nullable String branch) {
+ Duplications.File.Builder wsFile = Duplications.File.newBuilder();
wsFile.setKey(file.getKey());
wsFile.setUuid(file.uuid());
wsFile.setName(file.longName());
private void writeFiles(DbSession session, ShowResponse.Builder response, Map<String, String> refByComponentKey, @Nullable String branch) {
Map<String, ComponentDto> projectsByUuid = newHashMap();
Map<String, ComponentDto> parentModulesByUuid = newHashMap();
- Map<String, WsDuplications.File> filesByRef = response.getMutableFiles();
+ Map<String, Duplications.File> filesByRef = response.getMutableFiles();
for (Map.Entry<String, String> entry : refByComponentKey.entrySet()) {
String componentKey = entry.getKey();
import org.sonar.server.plugins.edition.EditionInstaller;
import org.sonar.server.user.UserSession;
import org.sonar.server.ws.WsUtils;
-import org.sonarqube.ws.WsEditions;
+import org.sonarqube.ws.Editions;
import static com.google.common.base.Preconditions.checkState;
}
}
- private WsEditions.StatusResponse buildResponse() {
- WsEditions.StatusResponse.Builder builder = WsEditions.StatusResponse.newBuilder()
+ private Editions.StatusResponse buildResponse() {
+ Editions.StatusResponse.Builder builder = Editions.StatusResponse.newBuilder()
.setNextEditionKey(editionManagementState.getPendingEditionKey().orElse(""))
.setCurrentEditionKey(editionManagementState.getCurrentEditionKey().orElse(""))
- .setInstallationStatus(WsEditions.InstallationStatus.valueOf(editionManagementState.getPendingInstallationStatus().name()));
+ .setInstallationStatus(Editions.InstallationStatus.valueOf(editionManagementState.getPendingInstallationStatus().name()));
editionManagementState.getInstallErrorMessage().ifPresent(builder::setInstallError);
return builder.build();
}
import org.sonar.server.measure.index.ProjectMeasuresIndex;
import org.sonar.server.user.UserSession;
import org.sonar.server.ws.WsUtils;
-import org.sonarqube.ws.WsEditions.FormDataResponse;
+import org.sonarqube.ws.Editions.FormDataResponse;
public class FormDataAction implements EditionsWsAction {
private final UserSession userSession;
import org.sonar.server.plugins.edition.EditionInstaller;
import org.sonar.server.user.UserSession;
import org.sonar.server.ws.WsUtils;
-import org.sonarqube.ws.WsEditions;
+import org.sonarqube.ws.Editions;
import static java.util.Optional.ofNullable;
-import static org.sonarqube.ws.WsEditions.PreviewStatus.AUTOMATIC_INSTALL;
-import static org.sonarqube.ws.WsEditions.PreviewStatus.MANUAL_INSTALL;
-import static org.sonarqube.ws.WsEditions.PreviewStatus.NO_INSTALL;
+import static org.sonarqube.ws.Editions.PreviewStatus.AUTOMATIC_INSTALL;
+import static org.sonarqube.ws.Editions.PreviewStatus.MANUAL_INSTALL;
+import static org.sonarqube.ws.Editions.PreviewStatus.NO_INSTALL;
public class PreviewAction implements EditionsWsAction {
private static final String PARAM_LICENSE = "license";
WsUtils.writeProtobuf(buildResponse(nextState), request, response);
}
- private static WsEditions.PreviewResponse buildResponse(NextState nextState) {
- return WsEditions.PreviewResponse.newBuilder()
+ private static Editions.PreviewResponse buildResponse(NextState nextState) {
+ return Editions.PreviewResponse.newBuilder()
.setNextEditionKey(nextState.getPendingEditionKey().orElse(""))
.setPreviewStatus(nextState.getPreviewStatus())
.build();
private static final class NextState {
private final String pendingEditionKey;
- private final WsEditions.PreviewStatus previewStatus;
+ private final Editions.PreviewStatus previewStatus;
- private NextState(@Nullable String pendingEditionKey, WsEditions.PreviewStatus previewStatus) {
+ private NextState(@Nullable String pendingEditionKey, Editions.PreviewStatus previewStatus) {
this.pendingEditionKey = pendingEditionKey;
this.previewStatus = previewStatus;
}
return ofNullable(pendingEditionKey);
}
- WsEditions.PreviewStatus getPreviewStatus() {
+ Editions.PreviewStatus getPreviewStatus() {
return previewStatus;
}
}
import org.sonar.server.edition.EditionManagementState;
import org.sonar.server.user.UserSession;
import org.sonar.server.ws.WsUtils;
-import org.sonarqube.ws.WsEditions;
+import org.sonarqube.ws.Editions;
public class StatusAction implements EditionsWsAction {
private final UserSession userSession;
.checkLoggedIn()
.checkIsSystemAdministrator();
- WsEditions.StatusResponse.Builder responseBuilder = WsEditions.StatusResponse.newBuilder()
+ Editions.StatusResponse.Builder responseBuilder = Editions.StatusResponse.newBuilder()
.setCurrentEditionKey(editionManagementState.getCurrentEditionKey().orElse(""))
.setNextEditionKey(editionManagementState.getPendingEditionKey().orElse(""))
- .setInstallationStatus(WsEditions.InstallationStatus.valueOf(editionManagementState.getPendingInstallationStatus().name()));
+ .setInstallationStatus(Editions.InstallationStatus.valueOf(editionManagementState.getPendingInstallationStatus().name()));
editionManagementState.getInstallErrorMessage().ifPresent(responseBuilder::setInstallError);
WsUtils.writeProtobuf(responseBuilder.build(), request, response);
import org.sonar.server.exceptions.NotFoundException;
import org.sonar.server.measure.ws.MetricDtoWithBestValue.MetricDtoToMetricDtoWithBestValueFunction;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.WsMeasures;
-import org.sonarqube.ws.WsMeasures.ComponentWsResponse;
+import org.sonarqube.ws.Measures;
+import org.sonarqube.ws.Measures.ComponentWsResponse;
import org.sonarqube.ws.client.measure.ComponentWsRequest;
import static com.google.common.base.Preconditions.checkArgument;
checkPermissions(component);
SnapshotDto analysis = dbClient.snapshotDao().selectLastAnalysisByRootComponentUuid(dbSession, component.projectUuid()).orElse(null);
List<MetricDto> metrics = searchMetrics(dbSession, request);
- List<WsMeasures.Period> periods = snapshotToWsPeriods(analysis);
+ List<Measures.Period> periods = snapshotToWsPeriods(analysis);
List<MeasureDto> measures = searchMeasures(dbSession, component, analysis, metrics, developerId);
return buildResponse(request, component, refComponent, measures, metrics, periods);
}
private static ComponentWsResponse buildResponse(ComponentWsRequest request, ComponentDto component, Optional<ComponentDto> refComponent, List<MeasureDto> measures,
- List<MetricDto> metrics, List<WsMeasures.Period> periods) {
+ List<MetricDto> metrics, List<Measures.Period> periods) {
ComponentWsResponse.Builder response = ComponentWsResponse.newBuilder();
Map<Integer, MetricDto> metricsById = Maps.uniqueIndex(metrics, MetricDto::getId);
Map<MetricDto, MeasureDto> measuresByMetric = new HashMap<>();
import org.sonar.db.component.ComponentDto;
import org.sonar.db.measure.MeasureDto;
import org.sonar.db.metric.MetricDto;
-import org.sonarqube.ws.WsMeasures;
-import org.sonarqube.ws.WsMeasures.Component;
+import org.sonarqube.ws.Measures;
+import org.sonarqube.ws.Measures.Component;
class ComponentDtoToWsComponent {
private ComponentDtoToWsComponent() {
wsComponent.setRefKey(referenceComponent.getDbKey());
}
- WsMeasures.Measure.Builder measureBuilder = WsMeasures.Measure.newBuilder();
+ Measures.Measure.Builder measureBuilder = Measures.Measure.newBuilder();
for (Map.Entry<MetricDto, MeasureDto> entry : measuresByMetric.entrySet()) {
MeasureDtoToWsMeasure.updateMeasureBuilder(measureBuilder, entry.getKey(), entry.getValue());
wsComponent.addMeasures(measureBuilder);
import org.sonar.db.component.ComponentDto;
import org.sonar.db.component.ComponentTreeQuery.Strategy;
import org.sonar.db.metric.MetricDto;
-import org.sonarqube.ws.WsMeasures;
-import org.sonarqube.ws.WsMeasures.ComponentTreeWsResponse;
+import org.sonarqube.ws.Measures;
+import org.sonarqube.ws.Measures.ComponentTreeWsResponse;
import org.sonarqube.ws.client.measure.ComponentTreeWsRequest;
import static com.google.common.base.Preconditions.checkArgument;
}
if (areMetricsInResponse(request)) {
- WsMeasures.Metrics.Builder metricsBuilder = response.getMetricsBuilder();
+ Measures.Metrics.Builder metricsBuilder = response.getMetricsBuilder();
for (MetricDto metricDto : data.getMetrics()) {
metricsBuilder.addMetrics(metricDtoToWsMetric(metricDto));
}
return componentTreeWsRequest;
}
- private static WsMeasures.Component.Builder toWsComponent(ComponentDto component, Map<MetricDto, ComponentTreeData.Measure> measures,
- Map<String, ComponentDto> referenceComponentsByUuid) {
- WsMeasures.Component.Builder wsComponent = componentDtoToWsComponent(component);
+ private static Measures.Component.Builder toWsComponent(ComponentDto component, Map<MetricDto, ComponentTreeData.Measure> measures,
+ Map<String, ComponentDto> referenceComponentsByUuid) {
+ Measures.Component.Builder wsComponent = componentDtoToWsComponent(component);
ComponentDto referenceComponent = referenceComponentsByUuid.get(component.getCopyResourceUuid());
if (referenceComponent != null) {
wsComponent.setRefId(referenceComponent.uuid());
wsComponent.setRefKey(referenceComponent.getDbKey());
}
- WsMeasures.Measure.Builder measureBuilder = WsMeasures.Measure.newBuilder();
+ Measures.Measure.Builder measureBuilder = Measures.Measure.newBuilder();
for (Map.Entry<MetricDto, ComponentTreeData.Measure> entry : measures.entrySet()) {
ComponentTreeData.Measure measure = entry.getValue();
updateMeasureBuilder(measureBuilder, entry.getKey(), measure.getValue(), measure.getData(), measure.getVariation());
import org.sonar.db.component.ComponentDto;
import org.sonar.db.measure.MeasureDto;
import org.sonar.db.metric.MetricDto;
-import org.sonarqube.ws.WsMeasures;
+import org.sonarqube.ws.Measures;
import static java.lang.Double.NaN;
import static java.lang.Double.isNaN;
private final int componentCount;
private final Map<String, ComponentDto> referenceComponentsByUuid;
private final List<MetricDto> metrics;
- private final List<WsMeasures.Period> periods;
+ private final List<Measures.Period> periods;
private final Table<String, MetricDto, Measure> measuresByComponentUuidAndMetric;
private ComponentTreeData(Builder builder) {
}
@CheckForNull
- List<WsMeasures.Period> getPeriods() {
+ List<Measures.Period> getPeriods() {
return periods;
}
private Map<String, ComponentDto> referenceComponentsByUuid;
private int componentCount;
private List<MetricDto> metrics;
- private List<WsMeasures.Period> periods;
+ private List<Measures.Period> periods;
private Table<String, MetricDto, Measure> measuresByComponentUuidAndMetric;
private Builder() {
return this;
}
- public Builder setPeriods(List<WsMeasures.Period> periods) {
+ public Builder setPeriods(List<Measures.Period> periods) {
this.periods = periods;
return this;
}
import javax.annotation.Nullable;
import org.sonar.db.measure.MeasureDto;
import org.sonar.db.metric.MetricDto;
-import org.sonarqube.ws.WsMeasures;
-import org.sonarqube.ws.WsMeasures.Measure;
+import org.sonarqube.ws.Measures;
+import org.sonarqube.ws.Measures.Measure;
import static org.sonar.server.measure.ws.MeasureValueFormatter.formatMeasureValue;
import static org.sonar.server.measure.ws.MeasureValueFormatter.formatNumericalValue;
measureBuilder.setValue(formatMeasureValue(doubleValue, stringValue, metric));
}
- WsMeasures.PeriodValue.Builder periodBuilder = WsMeasures.PeriodValue.newBuilder();
+ Measures.PeriodValue.Builder periodBuilder = Measures.PeriodValue.newBuilder();
if (Double.isNaN(variation)) {
return;
}
import org.sonar.db.measure.MeasureDto;
import org.sonar.db.metric.MetricDto;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.WsMeasures.Measure;
-import org.sonarqube.ws.WsMeasures.SearchWsResponse;
+import org.sonarqube.ws.Measures.Measure;
+import org.sonarqube.ws.Measures.SearchWsResponse;
import org.sonarqube.ws.client.measure.SearchRequest;
import static com.google.common.base.Preconditions.checkArgument;
import org.sonar.server.component.ComponentFinder;
import org.sonar.server.user.UserSession;
import org.sonar.server.ws.KeyExamples;
-import org.sonarqube.ws.WsMeasures.SearchHistoryResponse;
+import org.sonarqube.ws.Measures.SearchHistoryResponse;
import org.sonarqube.ws.client.measure.SearchHistoryRequest;
import static java.lang.String.format;
import org.sonar.db.component.SnapshotDto;
import org.sonar.db.measure.MeasureDto;
import org.sonar.db.metric.MetricDto;
-import org.sonarqube.ws.WsMeasures.SearchHistoryResponse;
-import org.sonarqube.ws.WsMeasures.SearchHistoryResponse.HistoryMeasure;
-import org.sonarqube.ws.WsMeasures.SearchHistoryResponse.HistoryValue;
+import org.sonarqube.ws.Measures.SearchHistoryResponse;
+import org.sonarqube.ws.Measures.SearchHistoryResponse.HistoryMeasure;
+import org.sonarqube.ws.Measures.SearchHistoryResponse.HistoryValue;
import static org.sonar.api.utils.DateUtils.formatDateTime;
import static org.sonar.server.measure.ws.MeasureValueFormatter.formatMeasureValue;
import java.util.List;
import javax.annotation.Nullable;
import org.sonar.db.component.SnapshotDto;
-import org.sonarqube.ws.WsMeasures;
+import org.sonarqube.ws.Measures;
import static java.util.Collections.emptyList;
import static org.sonar.api.utils.DateUtils.formatDateTime;
// prevent instantiation
}
- static List<WsMeasures.Period> snapshotToWsPeriods(@Nullable SnapshotDto snapshot) {
+ static List<Measures.Period> snapshotToWsPeriods(@Nullable SnapshotDto snapshot) {
if (snapshot == null) {
return emptyList();
}
- List<WsMeasures.Period> periods = new ArrayList<>();
+ List<Measures.Period> periods = new ArrayList<>();
if (snapshot.getPeriodDate() != null) {
periods.add(snapshotDtoToWsPeriod(snapshot));
}
return periods;
}
- private static WsMeasures.Period snapshotDtoToWsPeriod(SnapshotDto snapshot) {
- WsMeasures.Period.Builder period = WsMeasures.Period.newBuilder();
+ private static Measures.Period snapshotDtoToWsPeriod(SnapshotDto snapshot) {
+ Measures.Period.Builder period = Measures.Period.newBuilder();
period.setIndex(1);
String periodMode = snapshot.getPeriodMode();
if (periodMode != null) {
import org.sonar.db.user.GroupDto;
import org.sonar.server.permission.ProjectId;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.WsPermissions.Group;
-import org.sonarqube.ws.WsPermissions.WsGroupsResponse;
+import org.sonarqube.ws.Permissions.Group;
+import org.sonarqube.ws.Permissions.WsGroupsResponse;
import static java.util.Collections.emptyList;
import static org.sonar.core.util.Protobuf.setNullable;
import org.sonar.db.permission.OrganizationPermission;
import org.sonar.db.permission.PermissionQuery;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.WsPermissions.Permission;
-import org.sonarqube.ws.WsPermissions.WsSearchGlobalPermissionsResponse;
+import org.sonarqube.ws.Permissions.Permission;
+import org.sonarqube.ws.Permissions.WsSearchGlobalPermissionsResponse;
import static org.sonar.server.permission.PermissionPrivilegeChecker.checkGlobalAdmin;
import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createOrganizationParameter;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
-import static org.sonarqube.ws.WsPermissions.Permission.newBuilder;
+import static org.sonarqube.ws.Permissions.Permission.newBuilder;
import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_ORGANIZATION;
public class SearchGlobalPermissionsAction implements PermissionsWsAction {
import org.sonar.server.permission.ProjectId;
import org.sonar.server.user.UserSession;
import org.sonarqube.ws.Common;
-import org.sonarqube.ws.WsPermissions.Permission;
-import org.sonarqube.ws.WsPermissions.SearchProjectPermissionsWsResponse;
-import org.sonarqube.ws.WsPermissions.SearchProjectPermissionsWsResponse.Project;
+import org.sonarqube.ws.Permissions.Permission;
+import org.sonarqube.ws.Permissions.SearchProjectPermissionsWsResponse;
+import org.sonarqube.ws.Permissions.SearchProjectPermissionsWsResponse.Project;
import org.sonarqube.ws.client.permission.SearchProjectPermissionsWsRequest;
import static org.sonar.server.permission.ws.PermissionRequestValidator.validateQualifier;
import org.sonar.server.issue.ws.AvatarResolver;
import org.sonar.server.permission.ProjectId;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.WsPermissions;
-import org.sonarqube.ws.WsPermissions.UsersWsResponse;
+import org.sonarqube.ws.Permissions;
+import org.sonarqube.ws.Permissions.UsersWsResponse;
import static com.google.common.base.Strings.emptyToNull;
import static java.util.Collections.emptyList;
UsersWsResponse.Builder response = UsersWsResponse.newBuilder();
users.forEach(user -> {
- WsPermissions.User.Builder userResponse = response.addUsersBuilder()
+ Permissions.User.Builder userResponse = response.addUsersBuilder()
.setLogin(user.getLogin())
.addAllPermissions(permissionsByUserId.get(user.getId()));
setNullable(user.getEmail(), userResponse::setEmail);
import org.sonar.server.permission.ws.PermissionWsSupport;
import org.sonar.server.permission.ws.PermissionsWsAction;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.WsPermissions.CreateTemplateWsResponse;
-import org.sonarqube.ws.WsPermissions.PermissionTemplate;
+import org.sonarqube.ws.Permissions.CreateTemplateWsResponse;
+import org.sonarqube.ws.Permissions.PermissionTemplate;
import org.sonarqube.ws.client.permission.CreateTemplateWsRequest;
import static java.lang.String.format;
import javax.annotation.Nonnull;
import org.sonar.api.utils.DateUtils;
import org.sonar.db.permission.template.PermissionTemplateDto;
-import org.sonarqube.ws.WsPermissions.PermissionTemplate;
+import org.sonarqube.ws.Permissions.PermissionTemplate;
import static org.sonar.core.util.Protobuf.setNullable;
import org.sonar.server.permission.ws.PermissionWsSupport;
import org.sonar.server.permission.ws.PermissionsWsAction;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.WsPermissions;
-import org.sonarqube.ws.WsPermissions.Permission;
-import org.sonarqube.ws.WsPermissions.PermissionTemplate;
-import org.sonarqube.ws.WsPermissions.SearchTemplatesWsResponse;
-import org.sonarqube.ws.WsPermissions.SearchTemplatesWsResponse.TemplateIdQualifier;
+import org.sonarqube.ws.Permissions;
+import org.sonarqube.ws.Permissions.Permission;
+import org.sonarqube.ws.Permissions.PermissionTemplate;
+import org.sonarqube.ws.Permissions.SearchTemplatesWsResponse;
+import org.sonarqube.ws.Permissions.SearchTemplatesWsResponse.TemplateIdQualifier;
import org.sonarqube.ws.client.permission.SearchTemplatesWsRequest;
import static org.sonar.api.utils.DateUtils.formatDateTime;
.setTemplateId(viewDefaultTemplate)));
}
- private static void buildTemplatesResponse(WsPermissions.SearchTemplatesWsResponse.Builder response, SearchTemplatesData data) {
+ private static void buildTemplatesResponse(Permissions.SearchTemplatesWsResponse.Builder response, SearchTemplatesData data) {
Permission.Builder permissionResponse = Permission.newBuilder();
PermissionTemplate.Builder templateBuilder = PermissionTemplate.newBuilder();
}
}
- private WsPermissions.SearchTemplatesWsResponse buildResponse(SearchTemplatesData data) {
+ private Permissions.SearchTemplatesWsResponse buildResponse(SearchTemplatesData data) {
SearchTemplatesWsResponse.Builder response = SearchTemplatesWsResponse.newBuilder();
buildTemplatesResponse(response, data);
import org.sonar.server.permission.ws.PermissionWsSupport;
import org.sonar.server.permission.ws.PermissionsWsAction;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.WsPermissions;
+import org.sonarqube.ws.Permissions;
import static org.sonar.api.server.ws.WebService.Param.PAGE;
import static org.sonar.api.server.ws.WebService.Param.PAGE_SIZE;
Paging paging = Paging.forPageIndex(wsRequest.mandatoryParamAsInt(PAGE)).withPageSize(wsRequest.mandatoryParamAsInt(PAGE_SIZE)).andTotal(total);
List<GroupDto> groups = findGroups(dbSession, query, template);
List<PermissionTemplateGroupDto> groupPermissions = findGroupPermissions(dbSession, groups, template);
- WsPermissions.WsGroupsResponse groupsResponse = buildResponse(groups, groupPermissions, paging);
+ Permissions.WsGroupsResponse groupsResponse = buildResponse(groups, groupPermissions, paging);
writeProtobuf(groupsResponse, wsRequest, wsResponse);
}
}
return permissionQuery.build();
}
- private static WsPermissions.WsGroupsResponse buildResponse(List<GroupDto> groups, List<PermissionTemplateGroupDto> groupPermissions, Paging paging) {
+ private static Permissions.WsGroupsResponse buildResponse(List<GroupDto> groups, List<PermissionTemplateGroupDto> groupPermissions, Paging paging) {
Multimap<Integer, String> permissionsByGroupId = TreeMultimap.create();
groupPermissions.forEach(groupPermission -> permissionsByGroupId.put(groupPermission.getGroupId(), groupPermission.getPermission()));
- WsPermissions.WsGroupsResponse.Builder response = WsPermissions.WsGroupsResponse.newBuilder();
+ Permissions.WsGroupsResponse.Builder response = Permissions.WsGroupsResponse.newBuilder();
groups.forEach(group -> {
- WsPermissions.Group.Builder wsGroup = response.addGroupsBuilder()
+ Permissions.Group.Builder wsGroup = response.addGroupsBuilder()
.setName(group.getName());
if (group.getId() != 0) {
wsGroup.setId(String.valueOf(group.getId()));
import org.sonar.server.permission.ws.PermissionWsSupport;
import org.sonar.server.permission.ws.PermissionsWsAction;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.WsPermissions;
-import org.sonarqube.ws.WsPermissions.UsersWsResponse;
+import org.sonarqube.ws.Permissions;
+import org.sonarqube.ws.Permissions.UsersWsResponse;
import static com.google.common.base.Strings.emptyToNull;
import static org.sonar.api.server.ws.WebService.Param.PAGE;
List<UserDto> users = findUsers(dbSession, query, template);
List<PermissionTemplateUserDto> permissionTemplateUsers = dbClient.permissionTemplateDao().selectUserPermissionsByTemplateIdAndUserLogins(dbSession, template.getId(),
users.stream().map(UserDto::getLogin).collect(Collectors.toList()));
- WsPermissions.UsersWsResponse templateUsersResponse = buildResponse(users, permissionTemplateUsers, paging);
+ Permissions.UsersWsResponse templateUsersResponse = buildResponse(users, permissionTemplateUsers, paging);
writeProtobuf(templateUsersResponse, wsRequest, wsResponse);
}
}
return query.build();
}
- private WsPermissions.UsersWsResponse buildResponse(List<UserDto> users, List<PermissionTemplateUserDto> permissionTemplateUsers, Paging paging) {
+ private Permissions.UsersWsResponse buildResponse(List<UserDto> users, List<PermissionTemplateUserDto> permissionTemplateUsers, Paging paging) {
Multimap<Integer, String> permissionsByUserId = TreeMultimap.create();
permissionTemplateUsers.forEach(userPermission -> permissionsByUserId.put(userPermission.getUserId(), userPermission.getPermission()));
UsersWsResponse.Builder responseBuilder = UsersWsResponse.newBuilder();
users.forEach(user -> {
- WsPermissions.User.Builder userResponse = responseBuilder.addUsersBuilder()
+ Permissions.User.Builder userResponse = responseBuilder.addUsersBuilder()
.setLogin(user.getLogin())
.addAllPermissions(permissionsByUserId.get(user.getId()));
setNullable(user.getEmail(), userResponse::setEmail);
import org.sonar.server.permission.ws.PermissionWsSupport;
import org.sonar.server.permission.ws.PermissionsWsAction;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.WsPermissions.PermissionTemplate;
-import org.sonarqube.ws.WsPermissions.UpdateTemplateWsResponse;
+import org.sonarqube.ws.Permissions.PermissionTemplate;
+import org.sonarqube.ws.Permissions.UpdateTemplateWsResponse;
import org.sonarqube.ws.client.permission.UpdateTemplateWsRequest;
import static com.google.common.base.MoreObjects.firstNonNull;
import org.sonar.server.health.ClusterHealth;
import org.sonar.server.health.Health;
import org.sonar.server.health.HealthChecker;
-import org.sonarqube.ws.WsSystem;
+import org.sonarqube.ws.System;
import static org.sonar.api.utils.DateUtils.formatDateTime;
.setHandler(handler);
}
- WsSystem.HealthResponse checkNodeHealth() {
+ System.HealthResponse checkNodeHealth() {
Health check = healthChecker.checkNode();
- WsSystem.HealthResponse.Builder responseBuilder = WsSystem.HealthResponse.newBuilder()
- .setHealth(WsSystem.Health.valueOf(check.getStatus().name()));
- WsSystem.Cause.Builder causeBuilder = WsSystem.Cause.newBuilder();
+ System.HealthResponse.Builder responseBuilder = System.HealthResponse.newBuilder()
+ .setHealth(System.Health.valueOf(check.getStatus().name()));
+ System.Cause.Builder causeBuilder = System.Cause.newBuilder();
check.getCauses().forEach(str -> responseBuilder.addCauses(causeBuilder.clear().setMessage(str).build()));
return responseBuilder.build();
}
- WsSystem.HealthResponse checkClusterHealth() {
+ System.HealthResponse checkClusterHealth() {
ClusterHealth check = healthChecker.checkCluster();
return toResponse(check);
}
- private static WsSystem.HealthResponse toResponse(ClusterHealth check) {
- WsSystem.HealthResponse.Builder responseBuilder = WsSystem.HealthResponse.newBuilder();
- WsSystem.Node.Builder nodeBuilder = WsSystem.Node.newBuilder();
- WsSystem.Cause.Builder causeBuilder = WsSystem.Cause.newBuilder();
+ private static System.HealthResponse toResponse(ClusterHealth check) {
+ System.HealthResponse.Builder responseBuilder = System.HealthResponse.newBuilder();
+ System.Node.Builder nodeBuilder = System.Node.newBuilder();
+ System.Cause.Builder causeBuilder = System.Cause.newBuilder();
Health health = check.getHealth();
- responseBuilder.setHealth(WsSystem.Health.valueOf(health.getStatus().name()));
+ responseBuilder.setHealth(System.Health.valueOf(health.getStatus().name()));
health.getCauses().forEach(str -> responseBuilder.addCauses(toCause(str, causeBuilder)));
- WsSystem.Nodes.Builder nodesBuilder = WsSystem.Nodes.newBuilder();
+ System.Nodes.Builder nodesBuilder = System.Nodes.newBuilder();
check.getNodes().stream()
.sorted(NODE_HEALTH_COMPARATOR)
.map(node -> toNode(node, nodeBuilder, causeBuilder))
return responseBuilder.build();
}
- private static WsSystem.Node toNode(NodeHealth nodeHealth, WsSystem.Node.Builder nodeBuilder, WsSystem.Cause.Builder causeBuilder) {
+ private static System.Node toNode(NodeHealth nodeHealth, System.Node.Builder nodeBuilder, System.Cause.Builder causeBuilder) {
nodeBuilder.clear();
- nodeBuilder.setHealth(WsSystem.Health.valueOf(nodeHealth.getStatus().name()));
+ nodeBuilder.setHealth(System.Health.valueOf(nodeHealth.getStatus().name()));
nodeHealth.getCauses().forEach(str -> nodeBuilder.addCauses(toCause(str, causeBuilder)));
NodeDetails details = nodeHealth.getDetails();
nodeBuilder
- .setType(WsSystem.NodeType.valueOf(details.getType().name()))
+ .setType(System.NodeType.valueOf(details.getType().name()))
.setName(details.getName())
.setHost(details.getHost())
.setPort(details.getPort())
return nodeBuilder.build();
}
- private static WsSystem.Cause toCause(String str, WsSystem.Cause.Builder causeBuilder) {
+ private static System.Cause toCause(String str, System.Cause.Builder causeBuilder) {
return causeBuilder.clear().setMessage(str).build();
}
}
import org.sonar.server.platform.Platform;
import org.sonar.server.platform.db.migration.DatabaseMigrationState;
import org.sonar.server.ws.WsUtils;
-import org.sonarqube.ws.WsSystem;
+import org.sonarqube.ws.System;
/**
* Implementation of the {@code status} action for the System WebService.
@Override
public void handle(Request request, Response response) throws Exception {
- WsSystem.StatusResponse.Builder protobuf = WsSystem.StatusResponse.newBuilder();
+ System.StatusResponse.Builder protobuf = System.StatusResponse.newBuilder();
Protobuf.setNullable(server.getId(), protobuf::setId);
Protobuf.setNullable(server.getVersion(), protobuf::setVersion);
protobuf.setStatus(computeStatus());
WsUtils.writeProtobuf(protobuf.build(), request, response);
}
- private WsSystem.Status computeStatus() {
+ private System.Status computeStatus() {
Platform.Status platformStatus = platform.status();
switch (platformStatus) {
case BOOTING:
// can not happen since there can not even exist an instance of the current class
// unless the Platform's status is UP/SAFEMODE/STARTING
- return WsSystem.Status.DOWN;
+ return System.Status.DOWN;
case UP:
- return restartFlagHolder.isRestarting() ? WsSystem.Status.RESTARTING : WsSystem.Status.UP;
+ return restartFlagHolder.isRestarting() ? System.Status.RESTARTING : System.Status.UP;
case STARTING:
return computeStatusInStarting();
case SAFEMODE:
}
}
- private WsSystem.Status computeStatusInStarting() {
+ private System.Status computeStatusInStarting() {
DatabaseMigrationState.Status databaseMigrationStatus = migrationState.getStatus();
switch (databaseMigrationStatus) {
case NONE:
- return WsSystem.Status.STARTING;
+ return System.Status.STARTING;
case RUNNING:
- return WsSystem.Status.DB_MIGRATION_RUNNING;
+ return System.Status.DB_MIGRATION_RUNNING;
case FAILED:
- return WsSystem.Status.DOWN;
+ return System.Status.DOWN;
case SUCCEEDED:
// DB migration can be finished while we haven't yet finished SQ's initialization
- return WsSystem.Status.STARTING;
+ return System.Status.STARTING;
default:
throw new IllegalArgumentException("Unsupported DatabaseMigration.Status " + databaseMigrationStatus);
}
}
- private WsSystem.Status computeStatusInSafemode() {
+ private System.Status computeStatusInSafemode() {
DatabaseMigrationState.Status databaseMigrationStatus = migrationState.getStatus();
switch (databaseMigrationStatus) {
case NONE:
- return WsSystem.Status.DB_MIGRATION_NEEDED;
+ return System.Status.DB_MIGRATION_NEEDED;
case RUNNING:
- return WsSystem.Status.DB_MIGRATION_RUNNING;
+ return System.Status.DB_MIGRATION_RUNNING;
case FAILED:
- return WsSystem.Status.DOWN;
+ return System.Status.DOWN;
case SUCCEEDED:
- return WsSystem.Status.STARTING;
+ return System.Status.STARTING;
default:
throw new IllegalArgumentException("Unsupported DatabaseMigration.Status " + databaseMigrationStatus);
}
import org.sonar.server.component.ComponentFinder.ParamNames;
import org.sonar.server.component.ComponentService;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.WsProjects.BulkUpdateKeyWsResponse;
+import org.sonarqube.ws.Projects.BulkUpdateKeyWsResponse;
import org.sonarqube.ws.client.project.BulkUpdateKeyWsRequest;
import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01;
import org.sonar.server.component.ComponentUpdater;
import org.sonar.server.project.Visibility;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.WsProjects.CreateWsResponse;
+import org.sonarqube.ws.Projects.CreateWsResponse;
import org.sonarqube.ws.client.project.CreateRequest;
import static org.sonar.api.resources.Qualifiers.PROJECT;
import org.sonar.db.organization.OrganizationDto;
import org.sonar.server.user.UserSession;
import org.sonarqube.ws.Common.Paging;
-import org.sonarqube.ws.WsComponents.ProvisionedWsResponse;
-import org.sonarqube.ws.WsComponents.ProvisionedWsResponse.Component;
+import org.sonarqube.ws.Components.ProvisionedWsResponse;
+import org.sonarqube.ws.Components.ProvisionedWsResponse.Component;
import static com.google.common.collect.Sets.newHashSet;
import static java.util.Optional.ofNullable;
import org.sonar.db.permission.OrganizationPermission;
import org.sonar.server.project.Visibility;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.WsProjects.SearchWsResponse;
+import org.sonarqube.ws.Projects.SearchWsResponse;
import org.sonarqube.ws.client.project.SearchWsRequest;
import static com.google.common.base.Preconditions.checkArgument;
import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_002;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
-import static org.sonarqube.ws.WsProjects.SearchWsResponse.Component;
-import static org.sonarqube.ws.WsProjects.SearchWsResponse.newBuilder;
+import static org.sonarqube.ws.Projects.SearchWsResponse.Component;
+import static org.sonarqube.ws.Projects.SearchWsResponse.newBuilder;
import static org.sonarqube.ws.client.project.ProjectsWsParameters.ACTION_SEARCH;
import static org.sonarqube.ws.client.project.ProjectsWsParameters.MAX_PAGE_SIZE;
import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_ANALYZED_BEFORE;
import org.sonar.db.component.ComponentDto;
import org.sonar.db.component.ComponentLinkDto;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.WsProjects.SearchMyProjectsWsResponse;
-import org.sonarqube.ws.WsProjects.SearchMyProjectsWsResponse.Link;
-import org.sonarqube.ws.WsProjects.SearchMyProjectsWsResponse.Project;
+import org.sonarqube.ws.Projects.SearchMyProjectsWsResponse;
+import org.sonarqube.ws.Projects.SearchMyProjectsWsResponse.Link;
+import org.sonarqube.ws.Projects.SearchMyProjectsWsResponse.Project;
import org.sonarqube.ws.client.project.SearchMyProjectsRequest;
import static com.google.common.base.Strings.emptyToNull;
import org.sonar.db.component.ComponentLinkDto;
import org.sonar.server.component.ComponentFinder;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.WsProjectLinks;
-import org.sonarqube.ws.WsProjectLinks.CreateWsResponse;
+import org.sonarqube.ws.ProjectLinks;
+import org.sonarqube.ws.ProjectLinks.CreateWsResponse;
import org.sonarqube.ws.client.projectlinks.CreateWsRequest;
import static org.sonar.core.util.Slug.slugify;
}
private static CreateWsResponse buildResponse(ComponentLinkDto link) {
- return CreateWsResponse.newBuilder().setLink(WsProjectLinks.Link.newBuilder()
+ return CreateWsResponse.newBuilder().setLink(ProjectLinks.Link.newBuilder()
.setId(String.valueOf(link.getId()))
.setName(link.getName())
.setType(link.getType())
import org.sonar.db.component.ComponentLinkDto;
import org.sonar.server.component.ComponentFinder;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.WsProjectLinks.Link;
-import org.sonarqube.ws.WsProjectLinks.SearchWsResponse;
+import org.sonarqube.ws.ProjectLinks.Link;
+import org.sonarqube.ws.ProjectLinks.SearchWsResponse;
import org.sonarqube.ws.client.projectlinks.SearchWsRequest;
import static org.sonar.core.util.Protobuf.setNullable;
import org.sonar.api.server.ws.Response;
import org.sonar.api.server.ws.WebService;
import org.sonar.server.measure.index.ProjectMeasuresIndex;
-import org.sonarqube.ws.WsProjectTags;
+import org.sonarqube.ws.ProjectTags;
import static org.sonar.api.server.ws.WebService.Param.PAGE_SIZE;
import static org.sonar.api.server.ws.WebService.Param.TEXT_QUERY;
@Override
public void handle(Request request, Response response) throws Exception {
- WsProjectTags.SearchResponse wsResponse = doHandle(request);
+ ProjectTags.SearchResponse wsResponse = doHandle(request);
writeProtobuf(wsResponse, request, response);
}
- private WsProjectTags.SearchResponse doHandle(Request request) {
+ private ProjectTags.SearchResponse doHandle(Request request) {
List<String> tags = index.searchTags(request.param(TEXT_QUERY), request.mandatoryParamAsInt(PAGE_SIZE));
- return WsProjectTags.SearchResponse.newBuilder().addAllTags(tags).build();
+ return ProjectTags.SearchResponse.newBuilder().addAllTags(tags).build();
}
}
import org.sonar.server.organization.DefaultOrganizationProvider;
import org.sonar.db.permission.OrganizationPermission;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.WsQualityGates.AppWsResponse.Metric;
+import org.sonarqube.ws.Qualitygates.AppWsResponse.Metric;
import static org.sonar.api.measures.CoreMetrics.ALERT_STATUS_KEY;
import static org.sonar.api.measures.Metric.ValueType.RATING;
import static org.sonar.server.qualitygate.ValidRatingMetrics.isCoreRatingMetric;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
-import static org.sonarqube.ws.WsQualityGates.AppWsResponse;
+import static org.sonarqube.ws.Qualitygates.AppWsResponse;
public class AppAction implements QualityGatesWsAction {
import org.sonar.server.organization.DefaultOrganizationProvider;
import org.sonar.server.qualitygate.QualityGateUpdater;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.WsQualityGates.CreateWsResponse;
+import org.sonarqube.ws.Qualitygates.CreateWsResponse;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.ACTION_CREATE;
import org.sonar.server.organization.DefaultOrganizationProvider;
import org.sonar.server.qualitygate.QualityGateConditionsUpdater;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.WsQualityGates.CreateConditionWsResponse;
-import org.sonarqube.ws.client.qualitygate.CreateConditionRequest;
+import org.sonarqube.ws.Qualitygates.CreateConditionWsResponse;
import static org.sonar.core.util.Protobuf.setNullable;
import static org.sonar.server.qualitygate.ws.QualityGatesWs.addConditionParams;
public void handle(Request request, Response response) {
userSession.checkPermission(OrganizationPermission.ADMINISTER_QUALITY_GATES, defaultOrganizationProvider.get().getUuid());
+ int gateId = request.mandatoryParamAsInt(PARAM_GATE_ID);
+ String metric = request.mandatoryParam(PARAM_METRIC);
+ String operator = request.mandatoryParam(PARAM_OPERATOR);
+ String warning = request.param(PARAM_WARNING);
+ String error = request.param(PARAM_ERROR);
+ Integer period = request.paramAsInt(PARAM_PERIOD);
+
try (DbSession dbSession = dbClient.openSession(false)) {
- writeProtobuf(doHandle(toWsRequest(request), dbSession), request, response);
+ QualityGateConditionDto condition = qualityGateConditionsUpdater.createCondition(dbSession, gateId, metric, operator, warning, error, period);
+
+ CreateConditionWsResponse.Builder createConditionWsResponse = CreateConditionWsResponse.newBuilder()
+ .setId(condition.getId())
+ .setMetric(condition.getMetricKey())
+ .setOp(condition.getOperator());
+ setNullable(condition.getWarningThreshold(), createConditionWsResponse::setWarning);
+ setNullable(condition.getErrorThreshold(), createConditionWsResponse::setError);
+ setNullable(condition.getPeriod(), createConditionWsResponse::setPeriod);
+ writeProtobuf(createConditionWsResponse.build(), request, response);
dbSession.commit();
}
}
- private CreateConditionWsResponse doHandle(CreateConditionRequest request, DbSession dbSession) {
- QualityGateConditionDto condition = qualityGateConditionsUpdater.createCondition(dbSession,
- request.getQualityGateId(),
- request.getMetricKey(),
- request.getOperator(),
- request.getWarning(),
- request.getError(),
- request.getPeriod());
-
- CreateConditionWsResponse.Builder response = CreateConditionWsResponse.newBuilder()
- .setId(condition.getId())
- .setMetric(condition.getMetricKey())
- .setOp(condition.getOperator());
- setNullable(condition.getWarningThreshold(), response::setWarning);
- setNullable(condition.getErrorThreshold(), response::setError);
- setNullable(condition.getPeriod(), response::setPeriod);
- return response.build();
- }
-
- private static CreateConditionRequest toWsRequest(Request request) {
- return CreateConditionRequest.builder()
- .setQualityGateId(request.mandatoryParamAsInt(PARAM_GATE_ID))
- .setMetricKey(request.mandatoryParam(PARAM_METRIC))
- .setOperator(request.mandatoryParam(PARAM_OPERATOR))
- .setWarning(request.param(PARAM_WARNING))
- .setError(request.param(PARAM_ERROR))
- .setPeriod(request.paramAsInt(PARAM_PERIOD))
- .build();
- }
-
}
import org.sonar.server.qualitygate.QualityGateFinder;
import org.sonar.server.qualitygate.QualityGateFinder.QualityGateData;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.WsQualityGates.GetByProjectWsResponse;
+import org.sonarqube.ws.Qualitygates.GetByProjectWsResponse;
import static org.sonar.server.user.AbstractUserSession.insufficientPrivilegesException;
import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
import org.sonar.server.exceptions.BadRequestException;
import org.sonar.server.user.UserSession;
import org.sonar.server.ws.KeyExamples;
-import org.sonarqube.ws.WsQualityGates.ProjectStatusWsResponse;
-import org.sonarqube.ws.client.qualitygate.ProjectStatusWsRequest;
+import org.sonarqube.ws.Qualitygates.ProjectStatusWsResponse;
import static com.google.common.base.Strings.isNullOrEmpty;
import static java.util.Collections.singletonList;
@Override
public void handle(Request request, Response response) throws Exception {
- ProjectStatusWsResponse projectStatusWsResponse = doHandle(toProjectStatusWsRequest(request));
+ String analysisId = request.param(PARAM_ANALYSIS_ID);
+ String projectId = request.param(PARAM_PROJECT_ID);
+ String projectKey = request.param(PARAM_PROJECT_KEY);
+ checkRequest(
+ !isNullOrEmpty(analysisId)
+ ^ !isNullOrEmpty(projectId)
+ ^ !isNullOrEmpty(projectKey),
+ MSG_ONE_PARAMETER_ONLY);
+ ProjectStatusWsResponse projectStatusWsResponse = doHandle(analysisId, projectId, projectKey);
writeProtobuf(projectStatusWsResponse, request, response);
}
- private ProjectStatusWsResponse doHandle(ProjectStatusWsRequest request) {
+ private ProjectStatusWsResponse doHandle(String analysisId, String projectId, String projectKey) {
try (DbSession dbSession = dbClient.openSession(false)) {
- ProjectAndSnapshot projectAndSnapshot = getProjectAndSnapshot(dbSession, request);
+ ProjectAndSnapshot projectAndSnapshot = getProjectAndSnapshot(dbSession, analysisId, projectId, projectKey);
checkPermission(projectAndSnapshot.project);
Optional<String> measureData = getQualityGateDetailsMeasureData(dbSession, projectAndSnapshot.project);
}
}
- private ProjectAndSnapshot getProjectAndSnapshot(DbSession dbSession, ProjectStatusWsRequest request) {
- String analysisUuid = request.getAnalysisId();
- if (!isNullOrEmpty(request.getAnalysisId())) {
- return getSnapshotThenProject(dbSession, analysisUuid);
- } else if (!isNullOrEmpty(request.getProjectId()) ^ !isNullOrEmpty(request.getProjectKey())) {
- return getProjectThenSnapshot(dbSession, request);
+ private ProjectAndSnapshot getProjectAndSnapshot(DbSession dbSession, String analysisId, String projectId, String projectKey) {
+ if (!isNullOrEmpty(analysisId)) {
+ return getSnapshotThenProject(dbSession, analysisId);
+ } else if (!isNullOrEmpty(projectId) ^ !isNullOrEmpty(projectKey)) {
+ return getProjectThenSnapshot(dbSession, projectId, projectKey);
}
throw BadRequestException.create(MSG_ONE_PARAMETER_ONLY);
}
- private ProjectAndSnapshot getProjectThenSnapshot(DbSession dbSession, ProjectStatusWsRequest request) {
- ComponentDto projectDto = componentFinder.getByUuidOrKey(dbSession, request.getProjectId(), request.getProjectKey(), ParamNames.PROJECT_ID_AND_KEY);
+ private ProjectAndSnapshot getProjectThenSnapshot(DbSession dbSession, String projectId, String projectKey) {
+ ComponentDto projectDto = componentFinder.getByUuidOrKey(dbSession, projectId, projectKey, ParamNames.PROJECT_ID_AND_KEY);
java.util.Optional<SnapshotDto> snapshot = dbClient.snapshotDao().selectLastAnalysisByRootComponentUuid(dbSession, projectDto.projectUuid());
return new ProjectAndSnapshot(projectDto, snapshot.orElse(null));
}
: Optional.fromNullable(measures.get(0).getData());
}
- private static ProjectStatusWsRequest toProjectStatusWsRequest(Request request) {
- ProjectStatusWsRequest projectStatusWsRequest = new ProjectStatusWsRequest()
- .setAnalysisId(request.param(PARAM_ANALYSIS_ID))
- .setProjectId(request.param(PARAM_PROJECT_ID))
- .setProjectKey(request.param(PARAM_PROJECT_KEY));
- checkRequest(
- !isNullOrEmpty(projectStatusWsRequest.getAnalysisId())
- ^ !isNullOrEmpty(projectStatusWsRequest.getProjectId())
- ^ !isNullOrEmpty(projectStatusWsRequest.getProjectKey()),
- MSG_ONE_PARAMETER_ONLY);
- return projectStatusWsRequest;
- }
-
private void checkPermission(ComponentDto project) {
if (!userSession.hasComponentPermission(UserRole.ADMIN, project) &&
!userSession.hasComponentPermission(UserRole.USER, project)) {
import java.util.stream.StreamSupport;
import javax.annotation.Nullable;
import org.sonar.db.component.SnapshotDto;
-import org.sonarqube.ws.WsQualityGates.ProjectStatusWsResponse;
+import org.sonarqube.ws.Qualitygates.ProjectStatusWsResponse;
import static com.google.common.base.Strings.isNullOrEmpty;
import static org.sonar.api.utils.DateUtils.formatDateTime;
import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
import org.sonar.db.component.ComponentDto;
+import org.sonar.db.permission.OrganizationPermission;
import org.sonar.db.property.PropertyDto;
import org.sonar.server.component.ComponentFinder;
import org.sonar.server.component.ComponentFinder.ParamNames;
-import org.sonar.db.permission.OrganizationPermission;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.client.qualitygate.SelectWsRequest;
import static org.sonar.server.qualitygate.QualityGates.SONAR_QUALITYGATE_PROPERTY;
import static org.sonar.server.user.AbstractUserSession.insufficientPrivilegesException;
@Override
public void handle(Request request, Response response) {
- doHandle(toSelectWsRequest(request));
- response.noContent();
- }
+ long gateId = request.mandatoryParamAsLong(PARAM_GATE_ID);
+ String projectId = request.param(PARAM_PROJECT_ID);
+ String projectKey = request.param(PARAM_PROJECT_KEY);
- private void doHandle(SelectWsRequest request) {
try (DbSession dbSession = dbClient.openSession(false)) {
- checkQualityGate(dbSession, request.getGateId());
- ComponentDto project = getProject(dbSession, request.getProjectId(), request.getProjectKey());
+ checkQualityGate(dbSession, gateId);
+ ComponentDto project = getProject(dbSession, projectId, projectKey);
dbClient.propertiesDao().saveProperty(dbSession, new PropertyDto()
.setKey(SONAR_QUALITYGATE_PROPERTY)
.setResourceId(project.getId())
- .setValue(String.valueOf(request.getGateId())));
+ .setValue(String.valueOf(gateId)));
dbSession.commit();
}
- }
-
- private static SelectWsRequest toSelectWsRequest(Request request) {
- return new SelectWsRequest()
- .setGateId(request.mandatoryParamAsLong(PARAM_GATE_ID))
- .setProjectId(request.param(PARAM_PROJECT_ID))
- .setProjectKey(request.param(PARAM_PROJECT_KEY));
+ response.noContent();
}
private ComponentDto getProject(DbSession dbSession, @Nullable String projectId, @Nullable String projectKey) {
import org.sonar.server.organization.DefaultOrganizationProvider;
import org.sonar.server.qualitygate.QualityGateConditionsUpdater;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.WsQualityGates.UpdateConditionWsResponse;
-import org.sonarqube.ws.client.qualitygate.UpdateConditionRequest;
+import org.sonarqube.ws.Qualitygates.UpdateConditionWsResponse;
import static org.sonar.core.util.Protobuf.setNullable;
import static org.sonar.db.permission.OrganizationPermission.ADMINISTER_QUALITY_GATES;
public void handle(Request request, Response response) {
userSession.checkPermission(ADMINISTER_QUALITY_GATES, defaultOrganizationProvider.get().getUuid());
+ int id = request.mandatoryParamAsInt(PARAM_ID);
+ String metric = request.mandatoryParam(PARAM_METRIC);
+ String operator = request.mandatoryParam(PARAM_OPERATOR);
+ String warning = request.param(PARAM_WARNING);
+ String error = request.param(PARAM_ERROR);
+ Integer period = request.paramAsInt(PARAM_PERIOD);
+
try (DbSession dbSession = dbClient.openSession(false)) {
- writeProtobuf(doHandle(toWsRequest(request), dbSession), request, response);
+ QualityGateConditionDto condition = qualityGateConditionsUpdater.updateCondition(dbSession, id, metric, operator, warning, error, period);
+ UpdateConditionWsResponse.Builder updateConditionWsResponse = UpdateConditionWsResponse.newBuilder()
+ .setId(condition.getId())
+ .setMetric(condition.getMetricKey())
+ .setOp(condition.getOperator());
+ setNullable(condition.getWarningThreshold(), updateConditionWsResponse::setWarning);
+ setNullable(condition.getErrorThreshold(), updateConditionWsResponse::setError);
+ setNullable(condition.getPeriod(), updateConditionWsResponse::setPeriod);
+ writeProtobuf(updateConditionWsResponse.build(), request, response);
dbSession.commit();
}
}
-
- private UpdateConditionWsResponse doHandle(UpdateConditionRequest request, DbSession dbSession) {
- QualityGateConditionDto condition = qualityGateConditionsUpdater.updateCondition(dbSession, request.getConditionId(), request.getMetricKey(), request.getOperator(),
- request.getWarning(), request.getError(), request.getPeriod());
- UpdateConditionWsResponse.Builder response = UpdateConditionWsResponse.newBuilder()
- .setId(condition.getId())
- .setMetric(condition.getMetricKey())
- .setOp(condition.getOperator());
- setNullable(condition.getWarningThreshold(), response::setWarning);
- setNullable(condition.getErrorThreshold(), response::setError);
- setNullable(condition.getPeriod(), response::setPeriod);
- return response.build();
- }
-
- private static UpdateConditionRequest toWsRequest(Request request) {
- return UpdateConditionRequest.builder()
- .setConditionId(request.mandatoryParamAsInt(PARAM_ID))
- .setMetricKey(request.mandatoryParam(PARAM_METRIC))
- .setOperator(request.mandatoryParam(PARAM_OPERATOR))
- .setWarning(request.param(PARAM_WARNING))
- .setError(request.param(PARAM_ERROR))
- .setPeriod(request.paramAsInt(PARAM_PERIOD))
- .build();
- }
-
}
import org.sonar.db.qualityprofile.QProfileDto;
import org.sonar.server.qualityprofile.QProfileCopier;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.QualityProfiles.CopyWsResponse;
+import org.sonarqube.ws.Qualityprofiles.CopyWsResponse;
import static org.sonar.core.util.Protobuf.setNullable;
import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01;
import org.sonar.server.qualityprofile.QProfileResult;
import org.sonar.server.qualityprofile.index.ActiveRuleIndexer;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.QualityProfiles.CreateWsResponse;
+import org.sonarqube.ws.Qualityprofiles.CreateWsResponse;
import org.sonarqube.ws.client.qualityprofile.CreateRequest;
import static org.sonar.db.permission.OrganizationPermission.ADMINISTER_QUALITY_PROFILES;
import org.sonar.db.qualityprofile.ActiveRuleCountQuery;
import org.sonar.db.qualityprofile.ActiveRuleDao;
import org.sonar.db.qualityprofile.QProfileDto;
-import org.sonarqube.ws.QualityProfiles.InheritanceWsResponse;
-import org.sonarqube.ws.QualityProfiles.InheritanceWsResponse.QualityProfile;
+import org.sonarqube.ws.Qualityprofiles.InheritanceWsResponse;
+import org.sonarqube.ws.Qualityprofiles.InheritanceWsResponse.QualityProfile;
import static org.sonar.core.util.Protobuf.setNullable;
import static org.sonar.db.qualityprofile.ActiveRuleDto.OVERRIDES;
import org.sonar.server.exceptions.NotFoundException;
import org.sonar.server.user.UserSession;
import org.sonar.server.util.LanguageParamUtils;
-import org.sonarqube.ws.QualityProfiles.SearchWsResponse;
-import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile;
+import org.sonarqube.ws.Qualityprofiles.SearchWsResponse;
+import org.sonarqube.ws.Qualityprofiles.SearchWsResponse.QualityProfile;
import org.sonarqube.ws.client.qualityprofile.SearchWsRequest;
import static com.google.common.base.Preconditions.checkState;
import org.sonar.db.qualityprofile.SearchGroupsQuery;
import org.sonar.db.user.GroupDto;
import org.sonarqube.ws.Common;
-import org.sonarqube.ws.QualityProfiles;
+import org.sonarqube.ws.Qualityprofiles;
import org.sonarqube.ws.client.qualityprofile.SearchUsersRequest;
import static org.sonar.api.server.ws.WebService.Param.PAGE;
.stream()
.collect(MoreCollectors.uniqueIndex(GroupDto::getId));
writeProtobuf(
- QualityProfiles.SearchGroupsResponse.newBuilder()
+ Qualityprofiles.SearchGroupsResponse.newBuilder()
.addAllGroups(groupMemberships.stream()
.map(groupsMembership -> toGroup(groupsById.get(groupsMembership.getGroupId()), groupsMembership.isSelected()))
.collect(toList()))
.build();
}
- private static QualityProfiles.SearchGroupsResponse.Group toGroup(GroupDto group, boolean isSelected) {
- QualityProfiles.SearchGroupsResponse.Group.Builder builder = QualityProfiles.SearchGroupsResponse.Group.newBuilder()
+ private static Qualityprofiles.SearchGroupsResponse.Group toGroup(GroupDto group, boolean isSelected) {
+ Qualityprofiles.SearchGroupsResponse.Group.Builder builder = Qualityprofiles.SearchGroupsResponse.Group.newBuilder()
.setName(group.getName())
.setSelected(isSelected);
setNullable(group.getDescription(), builder::setDescription);
import org.sonar.db.user.UserDto;
import org.sonar.server.issue.ws.AvatarResolver;
import org.sonarqube.ws.Common;
-import org.sonarqube.ws.QualityProfiles.SearchUsersResponse;
+import org.sonarqube.ws.Qualityprofiles.SearchUsersResponse;
import org.sonarqube.ws.client.qualityprofile.SearchUsersRequest;
import static com.google.common.base.Strings.emptyToNull;
import org.sonar.server.es.SearchOptions;
import org.sonar.server.rule.index.RuleIndex;
import org.sonar.server.rule.index.RuleQuery;
-import org.sonarqube.ws.QualityProfiles;
-import org.sonarqube.ws.QualityProfiles.ShowResponse;
-import org.sonarqube.ws.QualityProfiles.ShowResponse.CompareToSonarWay;
-import org.sonarqube.ws.QualityProfiles.ShowResponse.QualityProfile;
+import org.sonarqube.ws.Qualityprofiles;
+import org.sonarqube.ws.Qualityprofiles.ShowResponse;
+import org.sonarqube.ws.Qualityprofiles.ShowResponse.CompareToSonarWay;
+import org.sonarqube.ws.Qualityprofiles.ShowResponse.QualityProfile;
import static java.util.Collections.singletonList;
import static org.sonar.api.rule.RuleStatus.DEPRECATED;
private static ShowResponse buildResponse(QProfileDto profile, boolean isDefault, Language language, long activeRules, long deprecatedActiveRules, long projects,
@Nullable CompareToSonarWay compareToSonarWay) {
- ShowResponse.Builder showResponseBuilder = QualityProfiles.ShowResponse.newBuilder();
+ ShowResponse.Builder showResponseBuilder = Qualityprofiles.ShowResponse.newBuilder();
QualityProfile.Builder profileBuilder = QualityProfile.newBuilder()
.setKey(profile.getKee())
.setName(profile.getName())
import org.sonar.db.DbSession;
import org.sonar.db.user.UserDto;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.WsRoot;
+import org.sonarqube.ws.Root;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
}
private static void writeResponse(Request request, Response response, List<UserDto> dtos) {
- WsRoot.SearchWsResponse.Builder responseBuilder = WsRoot.SearchWsResponse.newBuilder();
- WsRoot.Root.Builder rootBuilder = WsRoot.Root.newBuilder();
+ Root.SearchWsResponse.Builder responseBuilder = Root.SearchWsResponse.newBuilder();
+ Root.RootContent.Builder rootBuilder = Root.RootContent.newBuilder();
dtos.forEach(dto -> responseBuilder.addRoots(toRoot(rootBuilder, dto)));
writeProtobuf(responseBuilder.build(), request, response);
}
- private static WsRoot.Root toRoot(WsRoot.Root.Builder builder, UserDto dto) {
+ private static Root.RootContent toRoot(Root.RootContent.Builder builder, UserDto dto) {
builder.clear();
builder.setLogin(dto.getLogin());
if (dto.getName() != null) {
import org.sonar.server.test.index.TestDoc;
import org.sonar.server.test.index.TestIndex;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.WsTests;
+import org.sonarqube.ws.Tests;
import static org.sonar.core.util.Protobuf.setNullable;
import static org.sonar.server.ws.WsUtils.checkFoundWithOptional;
List<CoveredFileDoc> coveredFiles = index.coveredFiles(testId);
Map<String, ComponentDto> componentsByUuid = buildComponentsByUuid(coveredFiles);
- WsTests.CoveredFilesResponse.Builder responseBuilder = WsTests.CoveredFilesResponse.newBuilder();
+ Tests.CoveredFilesResponse.Builder responseBuilder = Tests.CoveredFilesResponse.newBuilder();
if (!coveredFiles.isEmpty()) {
for (CoveredFileDoc doc : coveredFiles) {
- WsTests.CoveredFilesResponse.CoveredFile.Builder fileBuilder = WsTests.CoveredFilesResponse.CoveredFile.newBuilder();
+ Tests.CoveredFilesResponse.CoveredFile.Builder fileBuilder = Tests.CoveredFilesResponse.CoveredFile.newBuilder();
fileBuilder.setId(doc.fileUuid());
fileBuilder.setCoveredLines(doc.coveredLines().size());
ComponentDto component = componentsByUuid.get(doc.fileUuid());
import org.sonar.server.ws.KeyExamples;
import org.sonar.server.ws.WsUtils;
import org.sonarqube.ws.Common;
-import org.sonarqube.ws.WsTests;
+import org.sonarqube.ws.Tests;
import static org.sonar.api.server.ws.WebService.Param.PAGE;
import static org.sonar.api.server.ws.WebService.Param.PAGE_SIZE;
componentsByTestFileUuid = buildComponentsByTestFileUuid(dbSession, tests.getDocs());
}
- WsTests.ListResponse.Builder responseBuilder = WsTests.ListResponse.newBuilder();
+ Tests.ListResponse.Builder responseBuilder = Tests.ListResponse.newBuilder();
responseBuilder.setPaging(Common.Paging.newBuilder()
.setPageIndex(searchOptions.getPage())
.setPageSize(searchOptions.getLimit())
.build());
for (TestDoc testDoc : tests.getDocs()) {
- WsTests.Test.Builder testBuilder = WsTests.Test.newBuilder();
+ Tests.Test.Builder testBuilder = Tests.Test.newBuilder();
testBuilder.setId(testDoc.testUuid());
testBuilder.setName(StringUtils.defaultString(testDoc.name()));
testBuilder.setFileId(testDoc.fileUuid());
testBuilder.setFileName(component.longName());
setNullable(component.getBranch(), testBuilder::setFileBranch);
}
- testBuilder.setStatus(WsTests.TestStatus.valueOf(testDoc.status()));
+ testBuilder.setStatus(Tests.TestStatus.valueOf(testDoc.status()));
if (testDoc.durationInMs() != null) {
testBuilder.setDurationInMs(testDoc.durationInMs());
}
import org.sonar.server.user.NewUser;
import org.sonar.server.user.UserSession;
import org.sonar.server.user.UserUpdater;
-import org.sonarqube.ws.WsUsers.CreateWsResponse;
+import org.sonarqube.ws.Users.CreateWsResponse;
import org.sonarqube.ws.client.user.CreateRequest;
import static com.google.common.base.Strings.emptyToNull;
import org.sonar.server.issue.ws.AvatarResolver;
import org.sonar.server.organization.DefaultOrganizationProvider;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.WsUsers.CurrentWsResponse;
+import org.sonarqube.ws.Users.CurrentWsResponse;
import static com.google.common.base.Preconditions.checkState;
import static com.google.common.base.Strings.emptyToNull;
import static java.util.Collections.singletonList;
import static org.sonar.core.util.Protobuf.setNullable;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
-import static org.sonarqube.ws.WsUsers.CurrentWsResponse.Permissions;
-import static org.sonarqube.ws.WsUsers.CurrentWsResponse.newBuilder;
+import static org.sonarqube.ws.Users.CurrentWsResponse.Permissions;
+import static org.sonarqube.ws.Users.CurrentWsResponse.newBuilder;
import static org.sonarqube.ws.client.user.UsersWsParameters.ACTION_CURRENT;
public class CurrentAction implements UsersWsAction {
import org.sonar.server.organization.DefaultOrganizationProvider;
import org.sonar.server.user.UserSession;
import org.sonar.server.usergroups.DefaultGroupFinder;
-import org.sonarqube.ws.WsUsers.GroupsWsResponse;
-import org.sonarqube.ws.WsUsers.GroupsWsResponse.Group;
+import org.sonarqube.ws.Users.GroupsWsResponse;
+import org.sonarqube.ws.Users.GroupsWsResponse.Group;
import org.sonarqube.ws.client.user.GroupsRequest;
import static com.google.common.base.Preconditions.checkArgument;
import org.sonar.api.server.ws.Response;
import org.sonar.api.server.ws.WebService;
import org.sonar.server.authentication.IdentityProviderRepository;
-import org.sonarqube.ws.WsUsers;
-import org.sonarqube.ws.WsUsers.IdentityProvidersWsResponse;
+import org.sonarqube.ws.Users;
+import org.sonarqube.ws.Users.IdentityProvidersWsResponse;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
return response.build();
}
- private enum IdentityProviderToWsResponse implements Function<IdentityProvider, WsUsers.IdentityProvider> {
+ private enum IdentityProviderToWsResponse implements Function<IdentityProvider, Users.IdentityProvider> {
INSTANCE;
@Override
- public WsUsers.IdentityProvider apply(@Nonnull IdentityProvider input) {
- WsUsers.IdentityProvider.Builder builder = WsUsers.IdentityProvider.newBuilder()
+ public Users.IdentityProvider apply(@Nonnull IdentityProvider input) {
+ Users.IdentityProvider.Builder builder = Users.IdentityProvider.newBuilder()
.setKey(input.getKey())
.setName(input.getName());
Display display = input.getDisplay();
import org.sonar.server.user.index.UserDoc;
import org.sonar.server.user.index.UserIndex;
import org.sonar.server.user.index.UserQuery;
-import org.sonarqube.ws.WsUsers;
-import org.sonarqube.ws.WsUsers.SearchWsResponse;
+import org.sonarqube.ws.Users;
+import org.sonarqube.ws.Users.SearchWsResponse;
import org.sonarqube.ws.client.user.SearchRequest;
import static com.google.common.base.MoreObjects.firstNonNull;
import static org.sonar.server.user.ws.UserJsonWriter.FIELD_SCM_ACCOUNTS;
import static org.sonar.server.user.ws.UserJsonWriter.FIELD_TOKENS_COUNT;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
-import static org.sonarqube.ws.WsUsers.SearchWsResponse.Groups;
-import static org.sonarqube.ws.WsUsers.SearchWsResponse.ScmAccounts;
-import static org.sonarqube.ws.WsUsers.SearchWsResponse.User;
-import static org.sonarqube.ws.WsUsers.SearchWsResponse.newBuilder;
+import static org.sonarqube.ws.Users.SearchWsResponse.Groups;
+import static org.sonarqube.ws.Users.SearchWsResponse.ScmAccounts;
+import static org.sonarqube.ws.Users.SearchWsResponse.User;
+import static org.sonarqube.ws.Users.SearchWsResponse.newBuilder;
public class SearchAction implements UsersWsAction {
@Override
public void handle(Request request, Response response) throws Exception {
- WsUsers.SearchWsResponse wsResponse = doHandle(toSearchRequest(request));
+ Users.SearchWsResponse wsResponse = doHandle(toSearchRequest(request));
writeProtobuf(wsResponse, request, response);
}
- private WsUsers.SearchWsResponse doHandle(SearchRequest request) {
+ private Users.SearchWsResponse doHandle(SearchRequest request) {
SearchOptions options = new SearchOptions().setPage(request.getPage(), request.getPageSize());
List<String> fields = request.getPossibleFields();
SearchResult<UserDoc> result = userIndex.search(UserQuery.builder().setTextQuery(request.getQuery()).build(), options);
import org.sonar.db.organization.OrganizationDto;
import org.sonar.db.user.GroupDto;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.WsUserGroups;
+import org.sonarqube.ws.UserGroups;
import static java.lang.String.format;
import static org.sonar.api.user.UserGroupValidation.GROUP_NAME_MAX_LENGTH;
}
private void writeResponse(Request request, Response response, OrganizationDto organization, GroupDto group) {
- WsUserGroups.CreateWsResponse.Builder respBuilder = WsUserGroups.CreateWsResponse.newBuilder();
+ UserGroups.CreateWsResponse.Builder respBuilder = UserGroups.CreateWsResponse.newBuilder();
// 'default' is always false as it's not possible to create a default group
respBuilder.setGroup(toProtobuf(organization, group, 0, false));
writeProtobuf(respBuilder.build(), request, response);
import org.sonar.server.exceptions.NotFoundException;
import org.sonar.server.organization.DefaultOrganizationProvider;
import org.sonar.server.usergroups.DefaultGroupFinder;
-import org.sonarqube.ws.WsUserGroups;
+import org.sonarqube.ws.UserGroups;
import static com.google.common.base.Preconditions.checkArgument;
import static org.sonar.core.util.Protobuf.setNullable;
checkArgument(!defaultGroup.getId().equals(groupDto.getId()), "Default group '%s' cannot be used to perform this action", groupDto.getName());
}
- static WsUserGroups.Group.Builder toProtobuf(OrganizationDto organization, GroupDto group, int membersCount, boolean isDefault) {
- WsUserGroups.Group.Builder wsGroup = WsUserGroups.Group.newBuilder()
+ static UserGroups.Group.Builder toProtobuf(OrganizationDto organization, GroupDto group, int membersCount, boolean isDefault) {
+ UserGroups.Group.Builder wsGroup = UserGroups.Group.newBuilder()
.setId(group.getId())
.setOrganization(organization.getKey())
.setName(group.getName())
import static org.sonar.server.es.SearchOptions.MAX_LIMIT;
import static org.sonar.server.usergroups.ws.GroupWsSupport.PARAM_ORGANIZATION_KEY;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
-import static org.sonarqube.ws.WsUserGroups.Group;
-import static org.sonarqube.ws.WsUserGroups.SearchWsResponse;
+import static org.sonarqube.ws.UserGroups.Group;
+import static org.sonarqube.ws.UserGroups.SearchWsResponse;
public class SearchAction implements UserGroupsWsAction {
import org.sonar.db.user.GroupDto;
import org.sonar.db.user.UserMembershipQuery;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.WsUserGroups;
+import org.sonarqube.ws.UserGroups;
import static java.lang.String.format;
import static org.sonar.api.user.UserGroupValidation.GROUP_NAME_MAX_LENGTH;
.build();
int membersCount = dbClient.groupMembershipDao().countMembers(dbSession, query);
- WsUserGroups.UpdateWsResponse.Builder respBuilder = WsUserGroups.UpdateWsResponse.newBuilder();
+ UserGroups.UpdateWsResponse.Builder respBuilder = UserGroups.UpdateWsResponse.newBuilder();
// 'default' is always false as it's not possible to update a default group
respBuilder.setGroup(toProtobuf(organization, group, membersCount, false));
writeProtobuf(respBuilder.build(), request, response);
import org.sonar.server.exceptions.ServerException;
import org.sonar.server.user.UserSession;
import org.sonar.server.usertoken.TokenGenerator;
-import org.sonarqube.ws.WsUserTokens;
-import org.sonarqube.ws.WsUserTokens.GenerateWsResponse;
+import org.sonarqube.ws.UserTokens;
+import org.sonarqube.ws.UserTokens.GenerateWsResponse;
import org.sonarqube.ws.client.usertoken.GenerateWsRequest;
import static java.net.HttpURLConnection.HTTP_INTERNAL_ERROR;
@Override
public void handle(Request request, Response response) throws Exception {
- WsUserTokens.GenerateWsResponse generateWsResponse = doHandle(toCreateWsRequest(request));
+ UserTokens.GenerateWsResponse generateWsResponse = doHandle(toCreateWsRequest(request));
writeProtobuf(generateWsResponse, request, response);
}
- private WsUserTokens.GenerateWsResponse doHandle(GenerateWsRequest request) {
+ private UserTokens.GenerateWsResponse doHandle(GenerateWsRequest request) {
try (DbSession dbSession = dbClient.openSession(false)) {
checkWsRequest(dbSession, request);
TokenPermissionsValidator.validate(userSession, request.getLogin());
}
private static GenerateWsResponse buildResponse(UserTokenDto userTokenDto, String token) {
- return WsUserTokens.GenerateWsResponse.newBuilder()
+ return UserTokens.GenerateWsResponse.newBuilder()
.setLogin(userTokenDto.getLogin())
.setName(userTokenDto.getName())
.setToken(token)
import org.sonar.db.DbSession;
import org.sonar.db.user.UserTokenDto;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.WsUserTokens.SearchWsResponse;
+import org.sonarqube.ws.UserTokens.SearchWsResponse;
import org.sonarqube.ws.client.usertoken.SearchWsRequest;
import static org.sonar.api.utils.DateUtils.formatDateTime;
import org.sonar.scanner.protocol.input.ProjectRepositories;
import org.sonar.server.ws.TestResponse;
import org.sonar.server.ws.WsActionTester;
-import org.sonarqube.ws.WsBatch.WsProjectResponse;
+import org.sonarqube.ws.Batch.WsProjectResponse;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Matchers.any;
import org.sonar.server.ws.WsActionTester;
import org.sonarqube.ws.Common;
import org.sonarqube.ws.MediaTypes;
-import org.sonarqube.ws.WsBranches;
-import org.sonarqube.ws.WsBranches.Branch;
-import org.sonarqube.ws.WsBranches.ListWsResponse;
+import org.sonarqube.ws.ProjectBranches;
+import org.sonarqube.ws.ProjectBranches.Branch;
+import org.sonarqube.ws.ProjectBranches.ListWsResponse;
import static java.lang.String.format;
import static java.util.Collections.emptySet;
import static org.sonar.api.utils.DateUtils.dateToLong;
import static org.sonar.api.utils.DateUtils.parseDateTime;
import static org.sonar.test.JsonAssert.assertJson;
-import static org.sonarqube.ws.WsBranches.Branch.Status;
+import static org.sonarqube.ws.ProjectBranches.Branch.Status;
public class ListActionTest {
ComponentDto shortLivingBranch = db.components().insertProjectBranch(project,
b -> b.setKey("short").setBranchType(BranchType.SHORT).setMergeBranchUuid(project.uuid()));
- WsBranches.ShowWsResponse response = ws.newRequest()
+ ProjectBranches.ShowWsResponse response = ws.newRequest()
.setParam("project", shortLivingBranch.getKey())
- .executeProtobuf(WsBranches.ShowWsResponse.class);
+ .executeProtobuf(ProjectBranches.ShowWsResponse.class);
assertThat(response.getBranch())
.extracting(Branch::getName, Branch::getType, Branch::getMergeBranch)
.setParam("project", project.getKey())
.executeProtobuf(ListWsResponse.class);
- assertThat(response.getBranchesList().stream().map(WsBranches.Branch::getStatus))
+ assertThat(response.getBranchesList().stream().map(ProjectBranches.Branch::getStatus))
.extracting(Status::hasBugs, Status::getBugs, Status::hasVulnerabilities, Status::getVulnerabilities, Status::hasCodeSmells, Status::getCodeSmells)
.containsExactlyInAnyOrder(
tuple(false, 0L, false, 0L, false, 0L),
.setParam("project", project.getKey())
.executeProtobuf(ListWsResponse.class);
- assertThat(response.getBranchesList().stream().filter(b -> b.getType().equals(Common.BranchType.SHORT)).map(WsBranches.Branch::getStatus))
+ assertThat(response.getBranchesList().stream().filter(b -> b.getType().equals(Common.BranchType.SHORT)).map(ProjectBranches.Branch::getStatus))
.extracting(Status::getBugs, Status::getVulnerabilities, Status::getCodeSmells)
.containsExactlyInAnyOrder(tuple(0L, 0L, 0L));
}
.executeProtobuf(ListWsResponse.class);
assertThat(response.getBranchesList())
- .extracting(WsBranches.Branch::getType, WsBranches.Branch::hasAnalysisDate, b -> "".equals(b.getAnalysisDate()) ? null : dateToLong(parseDateTime(b.getAnalysisDate())))
+ .extracting(ProjectBranches.Branch::getType, ProjectBranches.Branch::hasAnalysisDate, b -> "".equals(b.getAnalysisDate()) ? null : dateToLong(parseDateTime(b.getAnalysisDate())))
.containsExactlyInAnyOrder(
tuple(Common.BranchType.LONG, false, null),
tuple(Common.BranchType.SHORT, false, null),
import org.sonar.server.ws.TestResponse;
import org.sonar.server.ws.WsActionTester;
import org.sonar.test.JsonAssert;
+import org.sonarqube.ws.Ce;
import org.sonarqube.ws.Common;
import org.sonarqube.ws.MediaTypes;
-import org.sonarqube.ws.WsCe;
-import org.sonarqube.ws.WsCe.ActivityResponse;
-import org.sonarqube.ws.WsCe.Task;
+import org.sonarqube.ws.Ce;
+import org.sonarqube.ws.Ce.ActivityResponse;
+import org.sonarqube.ws.Ce.Task;
import static java.util.Arrays.asList;
import static org.assertj.core.api.Assertions.assertThat;
Task task = activityResponse.getTasks(0);
assertThat(task.getOrganization()).isEqualTo(org2.getKey());
assertThat(task.getId()).isEqualTo("T2");
- assertThat(task.getStatus()).isEqualTo(WsCe.TaskStatus.FAILED);
+ assertThat(task.getStatus()).isEqualTo(Ce.TaskStatus.FAILED);
assertThat(task.getComponentId()).isEqualTo(project2.uuid());
assertThat(task.hasAnalysisId()).isFalse();
assertThat(task.getExecutionTimeMs()).isEqualTo(500L);
task = activityResponse.getTasks(1);
assertThat(task.getId()).isEqualTo("T1");
- assertThat(task.getStatus()).isEqualTo(WsCe.TaskStatus.SUCCESS);
+ assertThat(task.getStatus()).isEqualTo(Ce.TaskStatus.SUCCESS);
assertThat(task.getComponentId()).isEqualTo(project1.uuid());
assertThat(task.getLogs()).isFalse();
assertThat(task.getOrganization()).isEqualTo(org1.getKey());
assertThat(activityResponse.getTasksCount()).isEqualTo(1);
assertThat(activityResponse.getTasks(0).getId()).isEqualTo("T1");
- assertThat(activityResponse.getTasks(0).getStatus()).isEqualTo(WsCe.TaskStatus.SUCCESS);
+ assertThat(activityResponse.getTasks(0).getStatus()).isEqualTo(Ce.TaskStatus.SUCCESS);
assertThat(activityResponse.getTasks(0).getComponentId()).isEqualTo(project1.uuid());
}
ActivityResponse response = ws.newRequest().executeProtobuf(ActivityResponse.class);
assertThat(response.getTasksList())
- .extracting(Task::getId, WsCe.Task::getBranch, WsCe.Task::getBranchType, WsCe.Task::getStatus, WsCe.Task::getComponentKey)
+ .extracting(Task::getId, Ce.Task::getBranch, Ce.Task::getBranchType, Ce.Task::getStatus, Ce.Task::getComponentKey)
.containsExactlyInAnyOrder(
- tuple("T1", longLivingBranch.getBranch(), Common.BranchType.LONG, WsCe.TaskStatus.SUCCESS, longLivingBranch.getKey()));
+ tuple("T1", longLivingBranch.getBranch(), Common.BranchType.LONG, Ce.TaskStatus.SUCCESS, longLivingBranch.getKey()));
}
@Test
.executeProtobuf(ActivityResponse.class);
assertThat(response.getTasksList())
- .extracting(Task::getId, WsCe.Task::getBranch, WsCe.Task::getBranchType, WsCe.Task::getStatus)
+ .extracting(Task::getId, Ce.Task::getBranch, Ce.Task::getBranchType, Ce.Task::getStatus)
.containsExactlyInAnyOrder(
- tuple("T1", branch, Common.BranchType.LONG, WsCe.TaskStatus.IN_PROGRESS),
- tuple("T2", branch, Common.BranchType.LONG, WsCe.TaskStatus.PENDING));
+ tuple("T1", branch, Common.BranchType.LONG, Ce.TaskStatus.IN_PROGRESS),
+ tuple("T2", branch, Common.BranchType.LONG, Ce.TaskStatus.PENDING));
}
@Test
import org.sonar.server.tester.UserSessionRule;
import org.sonar.server.ws.TestRequest;
import org.sonar.server.ws.WsActionTester;
-import org.sonarqube.ws.WsCe;
+import org.sonarqube.ws.Ce;
+import org.sonarqube.ws.Ce;
import static org.assertj.core.api.Assertions.assertThat;
import static org.sonar.db.ce.CeQueueTesting.newCeQueueDto;
insertActivity(CeActivityDto.Status.FAILED, projectUuid);
insertActivity(CeActivityDto.Status.FAILED, anotherProjectUuid);
- WsCe.ActivityStatusWsResponse result = call(projectUuid);
+ Ce.ActivityStatusWsResponse result = call(projectUuid);
assertThat(result.getPending()).isEqualTo(2);
assertThat(result.getFailing()).isEqualTo(1);
@Test
public void empty_status() {
- WsCe.ActivityStatusWsResponse result = call();
+ Ce.ActivityStatusWsResponse result = call();
assertThat(result.getPending()).isEqualTo(0);
assertThat(result.getFailing()).isEqualTo(0);
db.commit();
}
- private WsCe.ActivityStatusWsResponse call() {
+ private Ce.ActivityStatusWsResponse call() {
return callByComponentUuidOrComponentKey(null, null);
}
- private WsCe.ActivityStatusWsResponse call(String componentUuid) {
+ private Ce.ActivityStatusWsResponse call(String componentUuid) {
return callByComponentUuidOrComponentKey(componentUuid, null);
}
- private WsCe.ActivityStatusWsResponse callByComponentKey(String componentKey) {
+ private Ce.ActivityStatusWsResponse callByComponentKey(String componentKey) {
return callByComponentUuidOrComponentKey(null, componentKey);
}
- private WsCe.ActivityStatusWsResponse callByComponentUuidOrComponentKey(@Nullable String componentUuid, @Nullable String componentKey) {
+ private Ce.ActivityStatusWsResponse callByComponentUuidOrComponentKey(@Nullable String componentUuid, @Nullable String componentKey) {
TestRequest request = ws.newRequest();
if (componentUuid != null) {
request.setParam(PARAM_COMPONENT_ID, componentUuid);
if (componentKey != null) {
request.setParam(DEPRECATED_PARAM_COMPONENT_KEY, componentKey);
}
- return request.executeProtobuf(WsCe.ActivityStatusWsResponse.class);
+ return request.executeProtobuf(Ce.ActivityStatusWsResponse.class);
}
}
import org.sonar.server.exceptions.NotFoundException;
import org.sonar.server.tester.UserSessionRule;
import org.sonar.server.ws.WsActionTester;
+import org.sonarqube.ws.Ce;
import org.sonarqube.ws.Common;
import org.sonarqube.ws.MediaTypes;
-import org.sonarqube.ws.WsCe;
+import org.sonarqube.ws.Ce;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Java6Assertions.tuple;
ComponentDto project = db.components().insertPrivateProject();
userSession.addProjectPermission(UserRole.USER, project);
- WsCe.ProjectResponse response = ws.newRequest()
+ Ce.ProjectResponse response = ws.newRequest()
.setParam(PARAM_COMPONENT, project.getKey())
- .executeProtobuf(WsCe.ProjectResponse.class);
+ .executeProtobuf(Ce.ProjectResponse.class);
assertThat(response.getQueueCount()).isEqualTo(0);
assertThat(response.hasCurrent()).isFalse();
insertQueue("T4", project1, IN_PROGRESS);
insertQueue("T5", project1, PENDING);
- WsCe.ProjectResponse response = ws.newRequest()
+ Ce.ProjectResponse response = ws.newRequest()
.setParam(PARAM_COMPONENT, project1.getKey())
- .executeProtobuf(WsCe.ProjectResponse.class);
+ .executeProtobuf(Ce.ProjectResponse.class);
assertThat(response.getQueueCount()).isEqualTo(2);
assertThat(response.getQueue(0).getId()).isEqualTo("T4");
assertThat(response.getQueue(1).getId()).isEqualTo("T5");
assertThat(response.getCurrent().getId()).isEqualTo("T3");
assertThat(response.getCurrent().hasAnalysisId()).isFalse();
assertThat(response.getQueueList())
- .extracting(WsCe.Task::getOrganization)
+ .extracting(Ce.Task::getOrganization)
.containsOnly(organization.getKey());
assertThat(response.getCurrent().getOrganization()).isEqualTo(organization.getKey());
}
SnapshotDto analysis = db.components().insertSnapshot(project);
insertActivity("T1", project, CeActivityDto.Status.SUCCESS, analysis);
- WsCe.ProjectResponse response = ws.newRequest()
+ Ce.ProjectResponse response = ws.newRequest()
.setParam(PARAM_COMPONENT, project.getDbKey())
- .executeProtobuf(WsCe.ProjectResponse.class);
+ .executeProtobuf(Ce.ProjectResponse.class);
assertThat(response.hasCurrent()).isTrue();
assertThat(response.getCurrent().getId()).isEqualTo("T1");
assertThat(response.getCurrent().getAnalysisId()).isEqualTo(analysis.getUuid());
SnapshotDto analysis = db.components().insertSnapshot(project);
insertActivity("T1", project, CeActivityDto.Status.SUCCESS, analysis);
- WsCe.ProjectResponse response = ws.newRequest()
+ Ce.ProjectResponse response = ws.newRequest()
.setParam(PARAM_COMPONENT_ID, project.uuid())
- .executeProtobuf(WsCe.ProjectResponse.class);
+ .executeProtobuf(Ce.ProjectResponse.class);
assertThat(response.hasCurrent()).isTrue();
assertThat(response.getCurrent().getId()).isEqualTo("T1");
assertThat(response.getCurrent().getAnalysisId()).isEqualTo(analysis.getUuid());
insertActivity("T4", project, CeActivityDto.Status.CANCELED);
insertActivity("T5", project, CeActivityDto.Status.CANCELED);
- WsCe.ProjectResponse response = ws.newRequest()
+ Ce.ProjectResponse response = ws.newRequest()
.setParam(PARAM_COMPONENT, project.getKey())
- .executeProtobuf(WsCe.ProjectResponse.class);
+ .executeProtobuf(Ce.ProjectResponse.class);
assertThat(response.getQueueCount()).isEqualTo(0);
// T3 is the latest task executed on PROJECT_1 ignoring Canceled ones
assertThat(response.hasCurrent()).isTrue();
insertCharacteristic(activity, BRANCH_KEY, longLivingBranch.getBranch());
insertCharacteristic(activity, BRANCH_TYPE_KEY, LONG.name());
- WsCe.ProjectResponse response = ws.newRequest()
+ Ce.ProjectResponse response = ws.newRequest()
.setParam(PARAM_COMPONENT, project.getKey())
- .executeProtobuf(WsCe.ProjectResponse.class);
+ .executeProtobuf(Ce.ProjectResponse.class);
assertThat(response.getCurrent())
- .extracting(WsCe.Task::getId, WsCe.Task::getBranch, WsCe.Task::getBranchType, WsCe.Task::getStatus, WsCe.Task::getComponentKey)
+ .extracting(Ce.Task::getId, Ce.Task::getBranch, Ce.Task::getBranchType, Ce.Task::getStatus, Ce.Task::getComponentKey)
.containsOnly(
- "T1", longLivingBranch.getBranch(), Common.BranchType.LONG, WsCe.TaskStatus.SUCCESS, project.getKey());
+ "T1", longLivingBranch.getBranch(), Common.BranchType.LONG, Ce.TaskStatus.SUCCESS, project.getKey());
}
@Test
insertCharacteristic(queue2, BRANCH_KEY, longLivingBranch.getBranch());
insertCharacteristic(queue2, BRANCH_TYPE_KEY, LONG.name());
- WsCe.ProjectResponse response = ws.newRequest()
+ Ce.ProjectResponse response = ws.newRequest()
.setParam(PARAM_COMPONENT, longLivingBranch.getKey())
- .executeProtobuf(WsCe.ProjectResponse.class);
+ .executeProtobuf(Ce.ProjectResponse.class);
assertThat(response.getQueueList())
- .extracting(WsCe.Task::getId, WsCe.Task::getBranch, WsCe.Task::getBranchType, WsCe.Task::getStatus, WsCe.Task::getComponentKey)
+ .extracting(Ce.Task::getId, Ce.Task::getBranch, Ce.Task::getBranchType, Ce.Task::getStatus, Ce.Task::getComponentKey)
.containsOnly(
- tuple("T1", longLivingBranch.getBranch(), Common.BranchType.LONG, WsCe.TaskStatus.IN_PROGRESS, project.getKey()),
- tuple("T2", longLivingBranch.getBranch(), Common.BranchType.LONG, WsCe.TaskStatus.PENDING, project.getKey()));
+ tuple("T1", longLivingBranch.getBranch(), Common.BranchType.LONG, Ce.TaskStatus.IN_PROGRESS, project.getKey()),
+ tuple("T2", longLivingBranch.getBranch(), Common.BranchType.LONG, Ce.TaskStatus.PENDING, project.getKey()));
}
@Test
insertCharacteristic(shortLivingBranchQueue, BRANCH_KEY, shortLivingBranch.getBranch());
insertCharacteristic(shortLivingBranchQueue, BRANCH_TYPE_KEY, SHORT.name());
- WsCe.ProjectResponse response = ws.newRequest()
+ Ce.ProjectResponse response = ws.newRequest()
.setParam(PARAM_COMPONENT, longLivingBranch.getKey())
- .executeProtobuf(WsCe.ProjectResponse.class);
+ .executeProtobuf(Ce.ProjectResponse.class);
assertThat(response.getQueueList())
- .extracting(WsCe.Task::getId, WsCe.Task::getComponentKey, WsCe.Task::getBranch, WsCe.Task::getBranchType)
+ .extracting(Ce.Task::getId, Ce.Task::getComponentKey, Ce.Task::getBranch, Ce.Task::getBranchType)
.containsOnly(
tuple("Main", project.getKey(), "", Common.BranchType.UNKNOWN_BRANCH_TYPE),
tuple("Long", longLivingBranch.getKey(), longLivingBranch.getBranch(), Common.BranchType.LONG),
SnapshotDto analysis = db.components().insertSnapshot(project);
insertActivity("T1", project, CeActivityDto.Status.SUCCESS, analysis);
- WsCe.ProjectResponse response = ws.newRequest()
+ Ce.ProjectResponse response = ws.newRequest()
.setParam("componentKey", project.getKey())
- .executeProtobuf(WsCe.ProjectResponse.class);
+ .executeProtobuf(Ce.ProjectResponse.class);
assertThat(response.hasCurrent()).isTrue();
assertThat(response.getCurrent().getId()).isEqualTo("T1");
assertThat(response.getCurrent().getAnalysisId()).isEqualTo(analysis.getUuid());
import org.sonar.server.ws.TestResponse;
import org.sonar.server.ws.WsActionTester;
import org.sonar.test.JsonAssert;
+import org.sonarqube.ws.Ce;
import org.sonarqube.ws.MediaTypes;
-import org.sonarqube.ws.WsCe;
+import org.sonarqube.ws.Ce;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.entry;
when(reportSubmitter.submit(eq(organizationKey), eq("my_project"), Matchers.isNull(String.class), eq("My Project"),
anyMapOf(String.class, String.class), any(InputStream.class))).thenReturn(A_CE_TASK);
- WsCe.SubmitResponse submitResponse = tester.newRequest()
+ Ce.SubmitResponse submitResponse = tester.newRequest()
.setParam("projectKey", "my_project")
.setParam("projectName", "My Project")
.setPart("report", new ByteArrayInputStream("{binary}".getBytes()), "foo.bar")
.setMethod("POST")
- .executeProtobuf(WsCe.SubmitResponse.class);
+ .executeProtobuf(Ce.SubmitResponse.class);
verify(reportSubmitter).submit(eq(organizationKey), eq("my_project"), Matchers.isNull(String.class), eq("My Project"),
anyMapOf(String.class, String.class), any(InputStream.class));
anyMapOf(String.class, String.class), any(InputStream.class))).thenReturn(A_CE_TASK);
String[] characteristics = {"branch=branch1", "key=value1=value2"};
- WsCe.SubmitResponse submitResponse = tester.newRequest()
+ Ce.SubmitResponse submitResponse = tester.newRequest()
.setParam("projectKey", "my_project")
.setParam("projectName", "My Project")
.setMultiParam("characteristic", Arrays.asList(characteristics))
.setPart("report", new ByteArrayInputStream("{binary}".getBytes()), "foo.bar")
.setMethod("POST")
- .executeProtobuf(WsCe.SubmitResponse.class);
+ .executeProtobuf(Ce.SubmitResponse.class);
assertThat(submitResponse.getTaskId()).isEqualTo("TASK_1");
verify(reportSubmitter).submit(eq(organizationKey), eq("my_project"), Matchers.isNull(String.class), eq("My Project"),
import org.sonar.server.exceptions.NotFoundException;
import org.sonar.server.tester.UserSessionRule;
import org.sonar.server.ws.WsActionTester;
+import org.sonarqube.ws.Ce;
import org.sonarqube.ws.Common;
-import org.sonarqube.ws.WsCe;
+import org.sonarqube.ws.Ce;
import static java.util.Collections.singleton;
import static org.assertj.core.api.Assertions.assertThat;
queueDto.setSubmitterLogin("john");
persist(queueDto);
- WsCe.TaskResponse taskResponse = ws.newRequest()
+ Ce.TaskResponse taskResponse = ws.newRequest()
.setParam("id", SOME_TASK_UUID)
- .executeProtobuf(WsCe.TaskResponse.class);
+ .executeProtobuf(Ce.TaskResponse.class);
assertThat(taskResponse.getTask().getOrganization()).isEqualTo(organizationDto.getKey());
assertThat(taskResponse.getTask().getId()).isEqualTo(SOME_TASK_UUID);
- assertThat(taskResponse.getTask().getStatus()).isEqualTo(WsCe.TaskStatus.PENDING);
+ assertThat(taskResponse.getTask().getStatus()).isEqualTo(Ce.TaskStatus.PENDING);
assertThat(taskResponse.getTask().getSubmitterLogin()).isEqualTo("john");
assertThat(taskResponse.getTask().getComponentId()).isEqualTo(project.uuid());
assertThat(taskResponse.getTask().getComponentKey()).isEqualTo(project.getDbKey());
CeActivityDto activityDto = createActivityDto(SOME_TASK_UUID);
persist(activityDto);
- WsCe.TaskResponse taskResponse = ws.newRequest()
+ Ce.TaskResponse taskResponse = ws.newRequest()
.setParam("id", SOME_TASK_UUID)
- .executeProtobuf(WsCe.TaskResponse.class);
- WsCe.Task task = taskResponse.getTask();
+ .executeProtobuf(Ce.TaskResponse.class);
+ Ce.Task task = taskResponse.getTask();
assertThat(task.getOrganization()).isEqualTo(organizationDto.getKey());
assertThat(task.getId()).isEqualTo(SOME_TASK_UUID);
- assertThat(task.getStatus()).isEqualTo(WsCe.TaskStatus.FAILED);
+ assertThat(task.getStatus()).isEqualTo(Ce.TaskStatus.FAILED);
assertThat(task.getComponentId()).isEqualTo(project.uuid());
assertThat(task.getComponentKey()).isEqualTo(project.getDbKey());
assertThat(task.getComponentName()).isEqualTo(project.name());
insertCharacteristic(activity, BRANCH_KEY, longLivingBranch.getBranch());
insertCharacteristic(activity, BRANCH_TYPE_KEY, LONG.name());
- WsCe.TaskResponse taskResponse = ws.newRequest()
+ Ce.TaskResponse taskResponse = ws.newRequest()
.setParam("id", SOME_TASK_UUID)
- .executeProtobuf(WsCe.TaskResponse.class);
+ .executeProtobuf(Ce.TaskResponse.class);
assertThat(taskResponse.getTask())
- .extracting(WsCe.Task::getId, WsCe.Task::getBranch, WsCe.Task::getBranchType, WsCe.Task::getComponentKey)
+ .extracting(Ce.Task::getId, Ce.Task::getBranch, Ce.Task::getBranchType, Ce.Task::getComponentKey)
.containsExactlyInAnyOrder(SOME_TASK_UUID, longLivingBranch.getBranch(), Common.BranchType.LONG, longLivingBranch.getKey());
}
insertCharacteristic(queueDto, BRANCH_KEY, branch);
insertCharacteristic(queueDto, BRANCH_TYPE_KEY, LONG.name());
- WsCe.TaskResponse taskResponse = ws.newRequest()
+ Ce.TaskResponse taskResponse = ws.newRequest()
.setParam("id", SOME_TASK_UUID)
- .executeProtobuf(WsCe.TaskResponse.class);
+ .executeProtobuf(Ce.TaskResponse.class);
assertThat(taskResponse.getTask())
- .extracting(WsCe.Task::getId, WsCe.Task::getBranch, WsCe.Task::getBranchType, WsCe.Task::hasComponentKey)
+ .extracting(Ce.Task::getId, Ce.Task::getBranch, Ce.Task::getBranchType, Ce.Task::hasComponentKey)
.containsExactlyInAnyOrder(SOME_TASK_UUID, branch, Common.BranchType.LONG, false);
}
.setErrorStacktrace("error stack");
persist(activityDto);
- WsCe.TaskResponse taskResponse = ws.newRequest()
+ Ce.TaskResponse taskResponse = ws.newRequest()
.setParam("id", SOME_TASK_UUID)
.setParam("additionalFields", "stacktrace")
- .executeProtobuf(WsCe.TaskResponse.class);
- WsCe.Task task = taskResponse.getTask();
+ .executeProtobuf(Ce.TaskResponse.class);
+ Ce.Task task = taskResponse.getTask();
assertThat(task.getId()).isEqualTo(SOME_TASK_UUID);
assertThat(task.getErrorMessage()).isEqualTo(activityDto.getErrorMessage());
assertThat(task.hasErrorStacktrace()).isTrue();
.setErrorStacktrace("error stack");
persist(activityDto);
- WsCe.TaskResponse taskResponse = ws.newRequest()
+ Ce.TaskResponse taskResponse = ws.newRequest()
.setParam("id", SOME_TASK_UUID)
- .executeProtobuf(WsCe.TaskResponse.class);
- WsCe.Task task = taskResponse.getTask();
+ .executeProtobuf(Ce.TaskResponse.class);
+ Ce.Task task = taskResponse.getTask();
assertThat(task.getId()).isEqualTo(SOME_TASK_UUID);
assertThat(task.getErrorMessage()).isEqualTo(activityDto.getErrorMessage());
assertThat(task.hasErrorStacktrace()).isFalse();
persist(createActivityDto(SOME_TASK_UUID));
persistScannerContext(SOME_TASK_UUID, scannerContext);
- WsCe.TaskResponse taskResponse = ws.newRequest()
+ Ce.TaskResponse taskResponse = ws.newRequest()
.setParam("id", SOME_TASK_UUID)
.setParam("additionalFields", "scannerContext")
- .executeProtobuf(WsCe.TaskResponse.class);
- WsCe.Task task = taskResponse.getTask();
+ .executeProtobuf(Ce.TaskResponse.class);
+ Ce.Task task = taskResponse.getTask();
assertThat(task.getId()).isEqualTo(SOME_TASK_UUID);
assertThat(task.getScannerContext()).isEqualTo(scannerContext);
}
persist(createActivityDto(SOME_TASK_UUID));
persistScannerContext(SOME_TASK_UUID, scannerContext);
- WsCe.TaskResponse taskResponse = ws.newRequest()
+ Ce.TaskResponse taskResponse = ws.newRequest()
.setParam("id", SOME_TASK_UUID)
.setParam("additionalFields", "stacktrace")
- .executeProtobuf(WsCe.TaskResponse.class);
- WsCe.Task task = taskResponse.getTask();
+ .executeProtobuf(Ce.TaskResponse.class);
+ Ce.Task task = taskResponse.getTask();
assertThat(task.getId()).isEqualTo(SOME_TASK_UUID);
assertThat(task.hasScannerContext()).isFalse();
}
.setErrorMessage("error msg");
persist(activityDto);
- WsCe.TaskResponse taskResponse = ws.newRequest()
+ Ce.TaskResponse taskResponse = ws.newRequest()
.setParam("id", SOME_TASK_UUID)
- .executeProtobuf(WsCe.TaskResponse.class);
- WsCe.Task task = taskResponse.getTask();
+ .executeProtobuf(Ce.TaskResponse.class);
+ Ce.Task task = taskResponse.getTask();
assertThat(task.getId()).isEqualTo(SOME_TASK_UUID);
assertThat(task.getErrorMessage()).isEqualTo(activityDto.getErrorMessage());
assertThat(task.hasErrorStacktrace()).isFalse();
}
private void call(String taskUuid) {
- WsCe.TaskResponse taskResponse = ws.newRequest()
+ Ce.TaskResponse taskResponse = ws.newRequest()
.setParam("id", taskUuid)
- .executeProtobuf(WsCe.TaskResponse.class);
- WsCe.Task task = taskResponse.getTask();
+ .executeProtobuf(Ce.TaskResponse.class);
+ Ce.Task task = taskResponse.getTask();
assertThat(task.getId()).isEqualTo(taskUuid);
}
import org.sonar.db.ce.CeQueueDto;
import org.sonar.db.ce.CeTaskTypes;
import org.sonar.db.organization.OrganizationDto;
-import org.sonarqube.ws.WsCe;
+import org.sonarqube.ws.Ce;
+import org.sonarqube.ws.Ce;
import static java.util.Arrays.asList;
import static org.assertj.core.api.Assertions.assertThat;
dto.setStatus(CeQueueDto.Status.PENDING);
dto.setCreatedAt(1_450_000_000_000L);
- WsCe.Task wsTask = underTest.formatQueue(db.getSession(), dto);
+ Ce.Task wsTask = underTest.formatQueue(db.getSession(), dto);
assertThat(wsTask.getType()).isEqualTo("TYPE");
assertThat(wsTask.getId()).isEqualTo("UUID");
- assertThat(wsTask.getStatus()).isEqualTo(WsCe.TaskStatus.PENDING);
+ assertThat(wsTask.getStatus()).isEqualTo(Ce.TaskStatus.PENDING);
assertThat(wsTask.getLogs()).isFalse();
assertThat(wsTask.getSubmittedAt()).isEqualTo(DateUtils.formatDateTime(new Date(1_450_000_000_000L)));
assertThat(wsTask.hasScannerContext()).isFalse();
dto.setComponentUuid(uuid);
dto.setSubmitterLogin("rob");
- WsCe.Task wsTask = underTest.formatQueue(db.getSession(), dto);
+ Ce.Task wsTask = underTest.formatQueue(db.getSession(), dto);
assertThat(wsTask.getType()).isEqualTo("TYPE");
assertThat(wsTask.getId()).isEqualTo("UUID");
assertThat(wsTask.getComponentKey()).isEqualTo("COMPONENT_KEY");
assertThat(wsTask.getComponentName()).isEqualTo("Component Name");
assertThat(wsTask.getComponentQualifier()).isEqualTo("TRK");
- assertThat(wsTask.getStatus()).isEqualTo(WsCe.TaskStatus.IN_PROGRESS);
+ assertThat(wsTask.getStatus()).isEqualTo(Ce.TaskStatus.IN_PROGRESS);
assertThat(wsTask.getLogs()).isFalse();
assertThat(wsTask.getSubmitterLogin()).isEqualTo("rob");
assertThat(wsTask.hasExecutionTimeMs()).isTrue();
dto.setCreatedAt(1_450_000_000_000L);
dto.setComponentUuid("DOES_NOT_EXIST");
- WsCe.Task wsTask = underTest.formatQueue(db.getSession(), dto);
+ Ce.Task wsTask = underTest.formatQueue(db.getSession(), dto);
assertThat(wsTask.getComponentId()).isEqualTo("DOES_NOT_EXIST");
assertThat(wsTask.hasComponentKey()).isFalse();
dto.setStartedAt(startedAt);
when(system2.now()).thenReturn(now);
- WsCe.Task wsTask = underTest.formatQueue(db.getSession(), dto);
+ Ce.Task wsTask = underTest.formatQueue(db.getSession(), dto);
assertThat(wsTask.getExecutionTimeMs()).isEqualTo(now - startedAt);
}
dto2.setStatus(CeQueueDto.Status.PENDING);
dto2.setCreatedAt(1_451_000_000_000L);
- Iterable<WsCe.Task> wsTasks = underTest.formatQueue(db.getSession(), asList(dto1, dto2));
+ Iterable<Ce.Task> wsTasks = underTest.formatQueue(db.getSession(), asList(dto1, dto2));
assertThat(wsTasks).extracting("id").containsExactly("UUID1", "UUID2");
}
public void formatActivity() {
CeActivityDto dto = newActivity("UUID", "COMPONENT_UUID", CeActivityDto.Status.FAILED);
- WsCe.Task wsTask = underTest.formatActivity(db.getSession(), dto, null);
+ Ce.Task wsTask = underTest.formatActivity(db.getSession(), dto, null);
assertThat(wsTask.getType()).isEqualTo(CeTaskTypes.REPORT);
assertThat(wsTask.getId()).isEqualTo("UUID");
- assertThat(wsTask.getStatus()).isEqualTo(WsCe.TaskStatus.FAILED);
+ assertThat(wsTask.getStatus()).isEqualTo(Ce.TaskStatus.FAILED);
assertThat(wsTask.getSubmittedAt()).isEqualTo(DateUtils.formatDateTime(new Date(1_450_000_000_000L)));
assertThat(wsTask.getExecutionTimeMs()).isEqualTo(500L);
assertThat(wsTask.getAnalysisId()).isEqualTo("U1");
CeActivityDto dto = newActivity("UUID", "COMPONENT_UUID", CeActivityDto.Status.FAILED);
String expected = "scanner context baby!";
- WsCe.Task wsTask = underTest.formatActivity(db.getSession(), dto, expected);
+ Ce.Task wsTask = underTest.formatActivity(db.getSession(), dto, expected);
assertThat(wsTask.hasScannerContext()).isTrue();
assertThat(wsTask.getScannerContext()).isEqualTo(expected);
CeActivityDto dto1 = newActivity("UUID1", "COMPONENT_UUID", CeActivityDto.Status.FAILED);
CeActivityDto dto2 = newActivity("UUID2", "COMPONENT_UUID", CeActivityDto.Status.SUCCESS);
- Iterable<WsCe.Task> wsTasks = underTest.formatActivity(db.getSession(), asList(dto1, dto2));
+ Iterable<Ce.Task> wsTasks = underTest.formatActivity(db.getSession(), asList(dto1, dto2));
assertThat(wsTasks).extracting("id").containsExactly("UUID1", "UUID2");
}
.setErrorStacktrace("error stacktrace")
.setErrorType("anErrorType");
- WsCe.Task task = underTest.formatActivity(db.getSession(), Collections.singletonList(dto)).iterator().next();
+ Ce.Task task = underTest.formatActivity(db.getSession(), Collections.singletonList(dto)).iterator().next();
assertThat(task.getErrorMessage()).isEqualTo(dto.getErrorMessage());
assertThat(task.getErrorStacktrace()).isEqualTo(dto.getErrorStacktrace());
CeActivityDto dto = newActivity("UUID", "COMPONENT_UUID", CeActivityDto.Status.FAILED)
.setErrorMessage("error msg");
- WsCe.Task task = underTest.formatActivity(db.getSession(), Collections.singletonList(dto)).iterator().next();
+ Ce.Task task = underTest.formatActivity(db.getSession(), Collections.singletonList(dto)).iterator().next();
assertThat(task.getErrorMessage()).isEqualTo(dto.getErrorMessage());
assertThat(task.hasErrorStacktrace()).isFalse();
CeActivityDto dto = newActivity("UUID", "COMPONENT_UUID", CeActivityDto.Status.FAILED)
.setErrorMessage("error msg");
- WsCe.Task task = underTest.formatActivity(db.getSession(), Collections.singletonList(dto)).iterator().next();
+ Ce.Task task = underTest.formatActivity(db.getSession(), Collections.singletonList(dto)).iterator().next();
assertThat(task.getErrorMessage()).isEqualTo(dto.getErrorMessage());
assertThat(task.hasErrorStacktrace()).isFalse();
import org.sonar.server.exceptions.ForbiddenException;
import org.sonar.server.tester.UserSessionRule;
import org.sonar.server.ws.WsActionTester;
-import org.sonarqube.ws.WsCe.WorkerCountResponse;
+import org.sonarqube.ws.Ce.WorkerCountResponse;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import org.sonar.server.ws.TestRequest;
import org.sonar.server.ws.WsActionTester;
import org.sonarqube.ws.MediaTypes;
-import org.sonarqube.ws.WsComponents.Component;
-import org.sonarqube.ws.WsComponents.SearchWsResponse;
+import org.sonarqube.ws.Components.Component;
+import org.sonarqube.ws.Components.SearchWsResponse;
import org.sonarqube.ws.client.component.SearchWsRequest;
import static java.util.Arrays.asList;
import org.sonar.server.ws.TestRequest;
import org.sonar.server.ws.WsActionTester;
import org.sonarqube.ws.Common;
-import org.sonarqube.ws.WsComponents.Component;
-import org.sonarqube.ws.WsComponents.SearchProjectsWsResponse;
+import org.sonarqube.ws.Components.Component;
+import org.sonarqube.ws.Components.SearchProjectsWsResponse;
import org.sonarqube.ws.client.component.SearchProjectsRequest;
import static java.util.Arrays.asList;
import org.sonar.api.web.UserRole;
import org.sonar.db.DbTester;
import org.sonar.db.component.ComponentDto;
-import org.sonar.db.component.SnapshotDto;
import org.sonar.db.organization.OrganizationDto;
import org.sonar.server.component.TestComponentFinder;
import org.sonar.server.exceptions.ForbiddenException;
import org.sonar.server.tester.UserSessionRule;
import org.sonar.server.ws.TestRequest;
import org.sonar.server.ws.WsActionTester;
-import org.sonarqube.ws.WsComponents.Component;
-import org.sonarqube.ws.WsComponents.ShowWsResponse;
+import org.sonarqube.ws.Components.Component;
+import org.sonarqube.ws.Components.ShowWsResponse;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.tuple;
import org.sonar.server.ws.TestResponse;
import org.sonar.server.ws.WsActionTester;
import org.sonarqube.ws.MediaTypes;
-import org.sonarqube.ws.WsComponents.SuggestionsWsResponse;
-import org.sonarqube.ws.WsComponents.SuggestionsWsResponse.Category;
-import org.sonarqube.ws.WsComponents.SuggestionsWsResponse.Organization;
-import org.sonarqube.ws.WsComponents.SuggestionsWsResponse.Project;
-import org.sonarqube.ws.WsComponents.SuggestionsWsResponse.Suggestion;
+import org.sonarqube.ws.Components.SuggestionsWsResponse;
+import org.sonarqube.ws.Components.SuggestionsWsResponse.Category;
+import org.sonarqube.ws.Components.SuggestionsWsResponse.Organization;
+import org.sonarqube.ws.Components.SuggestionsWsResponse.Project;
+import org.sonarqube.ws.Components.SuggestionsWsResponse.Suggestion;
import static java.util.Arrays.asList;
import static java.util.Collections.singletonList;
import org.sonar.server.tester.UserSessionRule;
import org.sonar.server.ws.WsActionTester;
import org.sonar.test.JsonAssert;
-import org.sonarqube.ws.WsComponents;
-import org.sonarqube.ws.WsComponents.TreeWsResponse;
+import org.sonarqube.ws.Components;
+import org.sonarqube.ws.Components.TreeWsResponse;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.assertj.core.api.Assertions.assertThat;
.setParam(PARAM_BRANCH, branchKey)
.executeProtobuf(TreeWsResponse.class);
- assertThat(response.getBaseComponent()).extracting(WsComponents.Component::getKey, WsComponents.Component::getBranch)
+ assertThat(response.getBaseComponent()).extracting(Components.Component::getKey, Components.Component::getBranch)
.containsExactlyInAnyOrder(module.getKey(), branchKey);
- assertThat(response.getComponentsList()).extracting(WsComponents.Component::getKey, WsComponents.Component::getBranch)
+ assertThat(response.getComponentsList()).extracting(Components.Component::getKey, Components.Component::getBranch)
.containsExactlyInAnyOrder(
tuple(directory.getKey(), branchKey),
tuple(file.getKey(), branchKey));
ws.newRequest()
.setParam(PARAM_COMPONENT, branch.getDbKey())
- .executeProtobuf(WsComponents.ShowWsResponse.class);
+ .executeProtobuf(Components.ShowWsResponse.class);
}
@Test
ws.newRequest()
.setParam(PARAM_COMPONENT_ID, branch.uuid())
- .executeProtobuf(WsComponents.ShowWsResponse.class);
+ .executeProtobuf(Components.ShowWsResponse.class);
}
@Test
import org.sonar.server.ws.WsActionTester;
import org.sonar.test.JsonAssert;
import org.sonarqube.ws.MediaTypes;
-import org.sonarqube.ws.WsEditions;
-import org.sonarqube.ws.WsEditions.StatusResponse;
+import org.sonarqube.ws.Editions;
+import org.sonarqube.ws.Editions.StatusResponse;
import static java.util.Collections.singleton;
import static org.assertj.core.api.Assertions.assertThat;
TestResponse response = request.execute();
- StatusResponse parsedResponse = WsEditions.StatusResponse.parseFrom(response.getInputStream());
+ StatusResponse parsedResponse = Editions.StatusResponse.parseFrom(response.getInputStream());
assertThat(parsedResponse.getInstallError()).isEqualTo(errorMessage);
}
private void assertResponse(TestResponse response, String expectedNextEditionKey, String expectedEditionKey,
PendingStatus expectedPendingStatus) throws IOException {
- StatusResponse parsedResponse = WsEditions.StatusResponse.parseFrom(response.getInputStream());
+ StatusResponse parsedResponse = Editions.StatusResponse.parseFrom(response.getInputStream());
assertThat(parsedResponse.getCurrentEditionKey()).isEqualTo(expectedEditionKey);
assertThat(parsedResponse.getNextEditionKey()).isEqualTo(expectedNextEditionKey);
- assertThat(parsedResponse.getInstallationStatus()).isEqualTo(WsEditions.InstallationStatus.valueOf(expectedPendingStatus.toString()));
+ assertThat(parsedResponse.getInstallationStatus()).isEqualTo(Editions.InstallationStatus.valueOf(expectedPendingStatus.toString()));
}
private void setPendingLicense(PendingStatus pendingStatus) {
import org.sonar.server.ws.WsActionTester;
import org.sonar.test.JsonAssert;
import org.sonarqube.ws.MediaTypes;
-import org.sonarqube.ws.WsEditions.FormDataResponse;
+import org.sonarqube.ws.Editions.FormDataResponse;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import org.sonar.server.ws.TestResponse;
import org.sonar.server.ws.WsActionTester;
import org.sonar.test.JsonAssert;
+import org.sonarqube.ws.Editions;
import org.sonarqube.ws.MediaTypes;
-import org.sonarqube.ws.WsEditions;
-import org.sonarqube.ws.WsEditions.PreviewResponse;
-import org.sonarqube.ws.WsEditions.PreviewStatus;
+import org.sonarqube.ws.Editions.PreviewResponse;
+import org.sonarqube.ws.Editions.PreviewStatus;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
}
private void assertResponse(TestResponse response, String expectedNextEditionKey, PreviewStatus expectedPreviewStatus) throws IOException {
- PreviewResponse parsedResponse = WsEditions.PreviewResponse.parseFrom(response.getInputStream());
+ PreviewResponse parsedResponse = Editions.PreviewResponse.parseFrom(response.getInputStream());
assertThat(parsedResponse.getPreviewStatus()).isEqualTo(expectedPreviewStatus);
assertThat(parsedResponse.getNextEditionKey()).isEqualTo(expectedNextEditionKey);
}
import org.sonar.server.tester.UserSessionRule;
import org.sonar.server.ws.WsActionTester;
import org.sonarqube.ws.Common;
-import org.sonarqube.ws.WsMeasures;
-import org.sonarqube.ws.WsMeasures.Component;
-import org.sonarqube.ws.WsMeasures.ComponentWsResponse;
+import org.sonarqube.ws.Measures;
+import org.sonarqube.ws.Measures.Component;
+import org.sonarqube.ws.Measures.ComponentWsResponse;
import static java.lang.Double.parseDouble;
import static java.lang.String.format;
assertThat(response.getComponent()).extracting(Component::getKey, Component::getBranch)
.containsExactlyInAnyOrder(file.getKey(), file.getBranch());
assertThat(response.getComponent().getMeasuresList())
- .extracting(WsMeasures.Measure::getMetric, m -> parseDouble(m.getValue()))
+ .extracting(Measures.Measure::getMetric, m -> parseDouble(m.getValue()))
.containsExactlyInAnyOrder(tuple(complexity.getKey(), measure.getValue()));
}
import org.sonar.server.tester.UserSessionRule;
import org.sonar.server.ws.WsActionTester;
import org.sonarqube.ws.Common;
-import org.sonarqube.ws.WsMeasures;
-import org.sonarqube.ws.WsMeasures.ComponentTreeWsResponse;
+import org.sonarqube.ws.Measures;
+import org.sonarqube.ws.Measures.ComponentTreeWsResponse;
import static java.lang.Double.parseDouble;
import static java.lang.String.format;
assertThat(response.getComponentsList().get(0).getMeasuresList()).extracting("metric").containsOnly("coverage");
// file measures
- List<WsMeasures.Measure> fileMeasures = response.getComponentsList().get(1).getMeasuresList();
+ List<Measures.Measure> fileMeasures = response.getComponentsList().get(1).getMeasuresList();
assertThat(fileMeasures).extracting("metric").containsOnly("ncloc", "coverage");
assertThat(fileMeasures).extracting("value").containsOnly("5", "15.5");
assertThat(response.getPeriods().getPeriodsList()).extracting("mode").containsOnly("last_version");
// directory measures
assertThat(response.getComponentsList().get(0).getMeasuresList()).extracting("metric").containsOnly("coverage");
// file measures
- List<WsMeasures.Measure> fileMeasures = response.getComponentsList().get(1).getMeasuresList();
+ List<Measures.Measure> fileMeasures = response.getComponentsList().get(1).getMeasuresList();
assertThat(fileMeasures).extracting("metric").containsOnly("ncloc", "coverage", "new_violations");
assertThat(fileMeasures).extracting("value").containsOnly("100", "15.5", "");
.setParam(PARAM_COMPONENT, file.getKey())
.setParam(PARAM_BRANCH, file.getBranch())
.setParam(PARAM_METRIC_KEYS, complexity.getKey())
- .executeProtobuf(WsMeasures.ComponentTreeWsResponse.class);
+ .executeProtobuf(Measures.ComponentTreeWsResponse.class);
- assertThat(response.getBaseComponent()).extracting(WsMeasures.Component::getKey, WsMeasures.Component::getBranch)
+ assertThat(response.getBaseComponent()).extracting(Measures.Component::getKey, Measures.Component::getBranch)
.containsExactlyInAnyOrder(file.getKey(), file.getBranch());
assertThat(response.getBaseComponent().getMeasuresList())
- .extracting(WsMeasures.Measure::getMetric, m -> parseDouble(m.getValue()))
+ .extracting(Measures.Measure::getMetric, m -> parseDouble(m.getValue()))
.containsExactlyInAnyOrder(tuple(complexity.getKey(), measure.getValue()));
}
.executeProtobuf(ComponentTreeWsResponse.class);
assertThat(response.getBaseComponent().getId()).isEqualTo(project.uuid());
- assertThat(response.getComponentsList()).extracting(WsMeasures.Component::getId)
+ assertThat(response.getComponentsList()).extracting(Measures.Component::getId)
.containsExactlyInAnyOrder(file.uuid());
}
.executeProtobuf(ComponentTreeWsResponse.class);
assertThat(result.getComponentsList())
- .extracting(WsMeasures.Component::getKey, WsMeasures.Component::getRefId, WsMeasures.Component::getRefKey)
+ .extracting(Measures.Component::getKey, Measures.Component::getRefId, Measures.Component::getRefKey)
.containsExactlyInAnyOrder(tuple(projectCopy.getKey(), project.uuid(), project.getKey()));
}
import org.sonar.server.tester.UserSessionRule;
import org.sonar.server.ws.TestRequest;
import org.sonar.server.ws.WsActionTester;
-import org.sonarqube.ws.WsMeasures;
-import org.sonarqube.ws.WsMeasures.Measure;
-import org.sonarqube.ws.WsMeasures.SearchWsResponse;
+import org.sonarqube.ws.Measures;
+import org.sonarqube.ws.Measures.Measure;
+import org.sonarqube.ws.Measures.SearchWsResponse;
import static com.google.common.collect.Lists.newArrayList;
import static java.util.Arrays.asList;
assertThat(measure.getMetric()).isEqualTo("coverage");
assertThat(measure.getValue()).isEqualTo("15.5");
assertThat(measure.getPeriods().getPeriodsValueList())
- .extracting(WsMeasures.PeriodValue::getIndex, WsMeasures.PeriodValue::getValue)
+ .extracting(Measures.PeriodValue::getIndex, Measures.PeriodValue::getValue)
.containsOnly(tuple(1, "10.0"));
}
import org.sonar.server.ws.TestRequest;
import org.sonar.server.ws.WsActionTester;
import org.sonarqube.ws.Common.Paging;
-import org.sonarqube.ws.WsMeasures.SearchHistoryResponse;
-import org.sonarqube.ws.WsMeasures.SearchHistoryResponse.HistoryMeasure;
-import org.sonarqube.ws.WsMeasures.SearchHistoryResponse.HistoryValue;
+import org.sonarqube.ws.Measures.SearchHistoryResponse;
+import org.sonarqube.ws.Measures.SearchHistoryResponse.HistoryMeasure;
+import org.sonarqube.ws.Measures.SearchHistoryResponse.HistoryValue;
import org.sonarqube.ws.client.measure.SearchHistoryRequest;
import static com.google.common.collect.Lists.newArrayList;
import org.sonar.server.exceptions.NotFoundException;
import org.sonar.server.exceptions.UnauthorizedException;
import org.sonar.server.i18n.I18nRule;
-import org.sonarqube.ws.WsPermissions;
+import org.sonarqube.ws.Permissions;
import static org.assertj.core.api.Assertions.assertThat;
import static org.sonar.core.permission.GlobalPermissions.PROVISIONING;
db.users().insertPermissionOnUser(org, user, ADMINISTER_QUALITY_GATES);
db.organizations().addMember(org, user);
- WsPermissions.WsSearchGlobalPermissionsResponse result = newRequest()
- .executeProtobuf(WsPermissions.WsSearchGlobalPermissionsResponse.class);
+ Permissions.WsSearchGlobalPermissionsResponse result = newRequest()
+ .executeProtobuf(Permissions.WsSearchGlobalPermissionsResponse.class);
assertThat(result.getPermissionsCount()).isEqualTo(GlobalPermissions.ALL.size());
- for (WsPermissions.Permission permission : result.getPermissionsList()) {
+ for (Permissions.Permission permission : result.getPermissionsList()) {
if (permission.getKey().equals(SCAN_EXECUTION)) {
assertThat(permission.getUsersCount()).isEqualTo(1);
} else {
public void supports_protobuf_response() throws Exception {
loginAsAdmin(db.getDefaultOrganization());
- WsPermissions.WsSearchGlobalPermissionsResponse result = newRequest()
- .executeProtobuf(WsPermissions.WsSearchGlobalPermissionsResponse.class);
+ Permissions.WsSearchGlobalPermissionsResponse result = newRequest()
+ .executeProtobuf(Permissions.WsSearchGlobalPermissionsResponse.class);
assertThat(result).isNotNull();
}
import org.sonar.server.exceptions.NotFoundException;
import org.sonar.server.exceptions.UnauthorizedException;
import org.sonar.server.i18n.I18nRule;
-import org.sonarqube.ws.WsPermissions;
+import org.sonarqube.ws.Permissions;
import static java.lang.String.format;
import static org.assertj.core.api.Assertions.assertThat;
db.components().insertComponent(newView(organizationDto, "view-uuid"));
db.components().insertComponent(newPrivateProjectDto(organizationDto, "project-uuid"));
- WsPermissions.SearchProjectPermissionsWsResponse result = newRequest()
+ Permissions.SearchProjectPermissionsWsResponse result = newRequest()
.setParam(PARAM_QUALIFIER, Qualifiers.PROJECT)
- .executeProtobuf(WsPermissions.SearchProjectPermissionsWsResponse.class);
+ .executeProtobuf(Permissions.SearchProjectPermissionsWsResponse.class);
assertThat(result.getProjectsList())
.extracting("id")
import org.sonar.server.permission.ws.BasePermissionWsTest;
import org.sonar.server.ws.TestRequest;
import org.sonar.server.ws.WsActionTester;
-import org.sonarqube.ws.WsPermissions;
+import org.sonarqube.ws.Permissions;
import static org.assertj.core.api.Assertions.assertThat;
import static org.sonar.api.server.ws.WebService.Param.TEXT_QUERY;
db.commit();
userSession.addPermission(ADMINISTER, org);
- WsPermissions.SearchTemplatesWsResponse result = newRequest(underTestWithoutViews)
+ Permissions.SearchTemplatesWsResponse result = newRequest(underTestWithoutViews)
.setParam("organization", org.getKey())
- .executeProtobuf(WsPermissions.SearchTemplatesWsResponse.class);
+ .executeProtobuf(Permissions.SearchTemplatesWsResponse.class);
assertThat(result.getPermissionTemplatesCount()).isEqualTo(2);
assertThat(result.getPermissionTemplatesList())
- .extracting(WsPermissions.PermissionTemplate::getId)
+ .extracting(Permissions.PermissionTemplate::getId)
.containsOnly(projectDefaultTemplate.getUuid(), templateInOrg.getUuid());
}
import org.sonar.server.exceptions.NotFoundException;
import org.sonar.server.exceptions.UnauthorizedException;
import org.sonar.server.permission.ws.BasePermissionWsTest;
-import org.sonarqube.ws.WsPermissions.WsGroupsResponse;
+import org.sonarqube.ws.Permissions.WsGroupsResponse;
import static org.assertj.core.api.Assertions.assertThat;
import static org.sonar.api.server.ws.WebService.Param.PAGE;
import org.sonar.server.issue.ws.AvatarResolverImpl;
import org.sonar.server.permission.ws.BasePermissionWsTest;
import org.sonar.server.ws.TestRequest;
-import org.sonarqube.ws.WsPermissions;
+import org.sonarqube.ws.Permissions;
import static org.assertj.core.api.Assertions.assertThat;
import static org.sonar.api.web.UserRole.ADMIN;
PermissionTemplateDto anotherTemplate = addTemplateToDefaultOrganization();
addUserToTemplate(newPermissionTemplateUser(USER, anotherTemplate, user1));
- WsPermissions.UsersWsResponse response = newRequest(null, null)
+ Permissions.UsersWsResponse response = newRequest(null, null)
.setParam(PARAM_TEMPLATE_NAME, template.getName())
- .executeProtobuf(WsPermissions.UsersWsResponse.class);
+ .executeProtobuf(Permissions.UsersWsResponse.class);
assertThat(response.getUsersList()).extracting("login").containsExactly("login-1", "login-2", "login-3");
assertThat(response.getUsers(0).getPermissionsList()).containsOnly("issueadmin", "user");
PermissionTemplateDto anotherTemplate = addTemplateToDefaultOrganization();
addUserToTemplate(newPermissionTemplateUser(USER, anotherTemplate, user1));
- WsPermissions.UsersWsResponse response = newRequest(null, null)
+ Permissions.UsersWsResponse response = newRequest(null, null)
.setParam(PARAM_TEMPLATE_NAME, template.getName())
.setParam(WebService.Param.TEXT_QUERY, "ame-1")
- .executeProtobuf(WsPermissions.UsersWsResponse.class);
+ .executeProtobuf(Permissions.UsersWsResponse.class);
assertThat(response.getUsersList()).extracting("login").containsOnly("login-1");
}
addUserToTemplate(newPermissionTemplateUser(USER, anotherTemplate, user1));
loginAsAdmin(db.getDefaultOrganization());
- WsPermissions.UsersWsResponse response = newRequest(USER, template.getUuid())
- .executeProtobuf(WsPermissions.UsersWsResponse.class);
+ Permissions.UsersWsResponse response = newRequest(USER, template.getUuid())
+ .executeProtobuf(Permissions.UsersWsResponse.class);
assertThat(response.getUsersList()).extracting("login").containsExactly("login-1", "login-2");
assertThat(response.getUsers(0).getPermissionsList()).containsOnly("issueadmin", "user");
assertThat(response.getUsers(1).getPermissionsList()).containsOnly("user");
addUserToTemplate(newPermissionTemplateUser(USER, anotherTemplate, user1));
loginAsAdmin(db.getDefaultOrganization());
- WsPermissions.UsersWsResponse response = newRequest(USER, null)
+ Permissions.UsersWsResponse response = newRequest(USER, null)
.setParam(PARAM_TEMPLATE_NAME, template.getName())
.setParam(WebService.Param.SELECTED, "all")
.setParam(WebService.Param.PAGE, "2")
.setParam(WebService.Param.PAGE_SIZE, "1")
- .executeProtobuf(WsPermissions.UsersWsResponse.class);
+ .executeProtobuf(Permissions.UsersWsResponse.class);
assertThat(response.getUsersList()).extracting("login").containsOnly("login-2");
}
addUserToTemplate(newPermissionTemplateUser(ISSUE_ADMIN, template, user3));
loginAsAdmin(db.getDefaultOrganization());
- WsPermissions.UsersWsResponse response = newRequest(null, null)
+ Permissions.UsersWsResponse response = newRequest(null, null)
.setParam(PARAM_TEMPLATE_NAME, template.getName())
- .executeProtobuf(WsPermissions.UsersWsResponse.class);
+ .executeProtobuf(Permissions.UsersWsResponse.class);
assertThat(response.getUsersList()).extracting("login").containsExactly("login-1", "login-2", "login-3");
}
addUserToTemplate(newPermissionTemplateUser(USER, anotherTemplate, user));
loginAsAdmin(db.getDefaultOrganization());
- WsPermissions.UsersWsResponse response = newRequest(null, null)
+ Permissions.UsersWsResponse response = newRequest(null, null)
.setParam(PARAM_TEMPLATE_NAME, template.getName())
- .executeProtobuf(WsPermissions.UsersWsResponse.class);
+ .executeProtobuf(Permissions.UsersWsResponse.class);
assertThat(response.getUsersList()).isEmpty();
}
import org.sonar.server.ws.TestRequest;
import org.sonar.server.ws.TestResponse;
import org.sonar.server.ws.WsActionTester;
-import org.sonarqube.ws.WsSystem;
+import org.sonarqube.ws.System;
import static java.util.Collections.emptySet;
import static java.util.Collections.singleton;
when(webServer.isStandalone()).thenReturn(true);
TestRequest request = underTest.newRequest();
- WsSystem.HealthResponse healthResponse = request.executeProtobuf(WsSystem.HealthResponse.class);
+ System.HealthResponse healthResponse = request.executeProtobuf(System.HealthResponse.class);
assertThat(healthResponse.getHealth().name()).isEqualTo(randomStatus.name());
assertThat(health.getCauses()).isEqualTo(health.getCauses());
}
when(webServer.isStandalone()).thenReturn(false);
when(healthChecker.checkCluster()).thenReturn(new ClusterHealth(healthBuilder.build(), emptySet()));
- WsSystem.HealthResponse clusterHealthResponse = underTest.newRequest().executeProtobuf(WsSystem.HealthResponse.class);
+ System.HealthResponse clusterHealthResponse = underTest.newRequest().executeProtobuf(System.HealthResponse.class);
assertThat(clusterHealthResponse.getHealth().name()).isEqualTo(randomStatus.name());
assertThat(clusterHealthResponse.getCausesList())
- .extracting(WsSystem.Cause::getMessage)
+ .extracting(System.Cause::getMessage)
.containsOnly(causes);
}
when(webServer.isStandalone()).thenReturn(false);
when(healthChecker.checkCluster()).thenReturn(new ClusterHealth(GREEN, singleton(nodeHealth)));
- WsSystem.HealthResponse response = underTest.newRequest().executeProtobuf(WsSystem.HealthResponse.class);
+ System.HealthResponse response = underTest.newRequest().executeProtobuf(System.HealthResponse.class);
assertThat(response.getNodes().getNodesList())
.hasSize(1);
- WsSystem.Node node = response.getNodes().getNodesList().iterator().next();
+ System.Node node = response.getNodes().getNodesList().iterator().next();
assertThat(node.getHealth().name()).isEqualTo(nodeHealth.getStatus().name());
assertThat(node.getCausesList())
- .extracting(WsSystem.Cause::getMessage)
+ .extracting(System.Cause::getMessage)
.containsOnly(nodeHealth.getCauses().stream().toArray(String[]::new));
assertThat(node.getName()).isEqualTo(nodeHealth.getDetails().getName());
assertThat(node.getHost()).isEqualTo(nodeHealth.getDetails().getHost());
when(webServer.isStandalone()).thenReturn(false);
when(healthChecker.checkCluster()).thenReturn(new ClusterHealth(GREEN, new HashSet<>(nodeHealths)));
- WsSystem.HealthResponse response = underTest.newRequest().executeProtobuf(WsSystem.HealthResponse.class);
+ System.HealthResponse response = underTest.newRequest().executeProtobuf(System.HealthResponse.class);
assertThat(response.getNodes().getNodesList())
- .extracting(WsSystem.Node::getStartedAt)
+ .extracting(System.Node::getStartedAt)
.containsExactly(expected);
}
import org.sonar.server.ws.TestRequest;
import org.sonar.server.ws.TestResponse;
import org.sonar.server.ws.WsActionTester;
-import org.sonarqube.ws.WsSystem;
+import org.sonarqube.ws.System;
import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric;
import static org.assertj.core.api.Assertions.assertThat;
when(healthChecker.checkNode()).thenReturn(health);
TestRequest request = underTest.newRequest();
- WsSystem.HealthResponse healthResponse = request.executeProtobuf(WsSystem.HealthResponse.class);
+ System.HealthResponse healthResponse = request.executeProtobuf(System.HealthResponse.class);
assertThat(healthResponse.getHealth().name()).isEqualTo(randomStatus.name());
assertThat(health.getCauses()).isEqualTo(health.getCauses());
}
Arrays.stream(causes).forEach(healthBuilder::addCause);
when(healthChecker.checkNode()).thenReturn(healthBuilder.build());
- WsSystem.HealthResponse clusterHealthResponse = underTest.newRequest().executeProtobuf(WsSystem.HealthResponse.class);
+ System.HealthResponse clusterHealthResponse = underTest.newRequest().executeProtobuf(System.HealthResponse.class);
assertThat(clusterHealthResponse.getHealth().name()).isEqualTo(randomStatus.name());
assertThat(clusterHealthResponse.getCausesList())
- .extracting(WsSystem.Cause::getMessage)
+ .extracting(System.Cause::getMessage)
.containsOnly(causes);
}
import org.sonar.server.tester.UserSessionRule;
import org.sonar.server.ws.TestRequest;
import org.sonar.server.ws.WsActionTester;
-import org.sonarqube.ws.WsProjects.BulkUpdateKeyWsResponse;
-import org.sonarqube.ws.WsProjects.BulkUpdateKeyWsResponse.Key;
+import org.sonarqube.ws.Projects.BulkUpdateKeyWsResponse;
+import org.sonarqube.ws.Projects.BulkUpdateKeyWsResponse.Key;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.tuple;
import org.sonar.server.tester.UserSessionRule;
import org.sonar.server.ws.TestRequest;
import org.sonar.server.ws.WsActionTester;
-import org.sonarqube.ws.WsProjects.CreateWsResponse;
-import org.sonarqube.ws.WsProjects.CreateWsResponse.Project;
+import org.sonarqube.ws.Projects.CreateWsResponse;
+import org.sonarqube.ws.Projects.CreateWsResponse.Project;
import org.sonarqube.ws.client.project.CreateRequest;
import static org.assertj.core.api.Assertions.assertThat;
import org.sonar.server.ws.TestRequest;
import org.sonar.server.ws.WsActionTester;
import org.sonarqube.ws.MediaTypes;
-import org.sonarqube.ws.WsProjects.SearchWsResponse;
-import org.sonarqube.ws.WsProjects.SearchWsResponse.Component;
+import org.sonarqube.ws.Projects.SearchWsResponse;
+import org.sonarqube.ws.Projects.SearchWsResponse.Component;
import org.sonarqube.ws.client.component.ComponentsWsParameters;
import org.sonarqube.ws.client.project.SearchWsRequest;
import org.sonar.server.exceptions.UnauthorizedException;
import org.sonar.server.tester.UserSessionRule;
import org.sonar.server.ws.WsActionTester;
-import org.sonarqube.ws.WsProjects.SearchMyProjectsWsResponse;
-import org.sonarqube.ws.WsProjects.SearchMyProjectsWsResponse.Project;
+import org.sonarqube.ws.Projects.SearchMyProjectsWsResponse;
+import org.sonarqube.ws.Projects.SearchMyProjectsWsResponse.Project;
import static org.assertj.core.api.Assertions.assertThat;
import static org.sonar.api.measures.CoreMetrics.ALERT_STATUS_KEY;
import org.sonar.server.tester.UserSessionRule;
import org.sonar.server.ws.TestRequest;
import org.sonar.server.ws.WsActionTester;
-import org.sonarqube.ws.WsProjectLinks;
+import org.sonarqube.ws.ProjectLinks;
import static java.lang.String.format;
import static org.assertj.core.api.Assertions.assertThat;
}
private void createAndTest(ComponentDto project, String name, String url, String type) throws IOException {
- WsProjectLinks.CreateWsResponse response = ws.newRequest()
+ ProjectLinks.CreateWsResponse response = ws.newRequest()
.setMethod("POST")
.setParam(PARAM_PROJECT_KEY, project.getDbKey())
.setParam(PARAM_NAME, name)
.setParam(PARAM_URL, url)
- .executeProtobuf(WsProjectLinks.CreateWsResponse.class);
+ .executeProtobuf(ProjectLinks.CreateWsResponse.class);
long newId = Long.valueOf(response.getLink().getId());
import org.sonar.server.tester.UserSessionRule;
import org.sonar.server.ws.TestRequest;
import org.sonar.server.ws.WsActionTester;
-import org.sonarqube.ws.WsProjectLinks.Link;
-import org.sonarqube.ws.WsProjectLinks.SearchWsResponse;
+import org.sonarqube.ws.ProjectLinks.Link;
+import org.sonarqube.ws.ProjectLinks.SearchWsResponse;
import static java.lang.String.format;
import static org.assertj.core.api.Assertions.assertThat;
import org.sonar.server.tester.UserSessionRule;
import org.sonar.server.ws.TestRequest;
import org.sonar.server.ws.WsActionTester;
-import org.sonarqube.ws.WsProjectTags.SearchResponse;
+import org.sonarqube.ws.ProjectTags.SearchResponse;
import static com.google.common.collect.Lists.newArrayList;
import static org.assertj.core.api.Assertions.assertThat;
import org.sonar.server.organization.TestDefaultOrganizationProvider;
import org.sonar.server.tester.UserSessionRule;
import org.sonar.server.ws.WsActionTester;
-import org.sonarqube.ws.WsQualityGates.AppWsResponse;
+import org.sonarqube.ws.Qualitygates.AppWsResponse;
import static org.assertj.core.api.Assertions.assertThat;
import static org.sonar.api.measures.Metric.ValueType.BOOL;
import org.sonar.server.qualitygate.QualityGateUpdater;
import org.sonar.server.tester.UserSessionRule;
import org.sonar.server.ws.WsActionTester;
-import org.sonarqube.ws.WsQualityGates.CreateWsResponse;
+import org.sonarqube.ws.Qualitygates.CreateWsResponse;
import static org.assertj.core.api.Assertions.assertThat;
import static org.sonar.db.permission.OrganizationPermission.ADMINISTER_QUALITY_GATES;
import org.sonar.server.tester.UserSessionRule;
import org.sonar.server.ws.TestRequest;
import org.sonar.server.ws.WsActionTester;
-import org.sonarqube.ws.MediaTypes;
-import org.sonarqube.ws.WsQualityGates.CreateConditionWsResponse;
+import org.sonarqube.ws.Qualitygates.CreateConditionWsResponse;
import static org.assertj.core.api.Assertions.assertThat;
import static org.sonar.db.metric.MetricTesting.newMetricDto;
import org.sonar.server.tester.UserSessionRule;
import org.sonar.server.ws.TestRequest;
import org.sonar.server.ws.WsActionTester;
-import org.sonarqube.ws.WsQualityGates;
-import org.sonarqube.ws.WsQualityGates.GetByProjectWsResponse;
+import org.sonarqube.ws.Qualitygates;
+import org.sonarqube.ws.Qualitygates.GetByProjectWsResponse;
import static java.lang.String.format;
import static org.assertj.core.api.Assertions.assertThat;
GetByProjectWsResponse result = callByKey(project.getKey());
- WsQualityGates.QualityGate qualityGate = result.getQualityGate();
+ Qualitygates.QualityGate qualityGate = result.getQualityGate();
assertThat(Long.valueOf(qualityGate.getId())).isEqualTo(dbQualityGate.getId());
assertThat(qualityGate.getName()).isEqualTo(dbQualityGate.getName());
assertThat(qualityGate.getDefault()).isTrue();
GetByProjectWsResponse result = callByKey(project.getKey());
- WsQualityGates.QualityGate qualityGate = result.getQualityGate();
+ Qualitygates.QualityGate qualityGate = result.getQualityGate();
assertThat(qualityGate.getName()).isEqualTo(dbQualityGate.getName());
assertThat(qualityGate.getDefault()).isFalse();
}
import org.sonar.server.exceptions.NotFoundException;
import org.sonar.server.tester.UserSessionRule;
import org.sonar.server.ws.WsActionTester;
-import org.sonarqube.ws.WsQualityGates.ProjectStatusWsResponse;
-import org.sonarqube.ws.WsQualityGates.ProjectStatusWsResponse.Status;
+import org.sonarqube.ws.Qualitygates.ProjectStatusWsResponse;
+import org.sonarqube.ws.Qualitygates.ProjectStatusWsResponse.Status;
import static java.lang.String.format;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.sonar.db.component.SnapshotDto;
-import org.sonarqube.ws.WsQualityGates.ProjectStatusWsResponse;
-import org.sonarqube.ws.WsQualityGates.ProjectStatusWsResponse.ProjectStatus;
+import org.sonarqube.ws.Qualitygates.ProjectStatusWsResponse;
+import org.sonarqube.ws.Qualitygates.ProjectStatusWsResponse.ProjectStatus;
import static org.assertj.core.api.Assertions.assertThat;
import static org.sonar.api.utils.DateUtils.formatDateTime;
import org.sonar.server.tester.UserSessionRule;
import org.sonar.server.ws.TestRequest;
import org.sonar.server.ws.WsActionTester;
-import org.sonarqube.ws.MediaTypes;
-import org.sonarqube.ws.WsQualityGates.CreateConditionWsResponse;
+import org.sonarqube.ws.Qualitygates.CreateConditionWsResponse;
import static org.assertj.core.api.Assertions.assertThat;
import static org.sonar.db.metric.MetricTesting.newMetricDto;
import org.sonar.server.ws.WsActionTester;
import org.sonar.test.JsonAssert;
import org.sonarqube.ws.MediaTypes;
-import org.sonarqube.ws.QualityProfiles.CreateWsResponse;
-import org.sonarqube.ws.QualityProfiles.CreateWsResponse.QualityProfile;
+import org.sonarqube.ws.Qualityprofiles.CreateWsResponse;
+import org.sonarqube.ws.Qualityprofiles.CreateWsResponse.QualityProfile;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import org.sonar.server.tester.UserSessionRule;
import org.sonar.server.util.TypeValidations;
import org.sonar.server.ws.WsActionTester;
-import org.sonarqube.ws.QualityProfiles.InheritanceWsResponse;
+import org.sonarqube.ws.Qualityprofiles.InheritanceWsResponse;
import static java.util.Arrays.asList;
import static org.assertj.core.api.Assertions.assertThat;
import org.sonar.server.ws.TestRequest;
import org.sonar.server.ws.WsActionTester;
import org.sonarqube.ws.MediaTypes;
-import org.sonarqube.ws.QualityProfiles.SearchWsResponse;
-import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile;
+import org.sonarqube.ws.Qualityprofiles.SearchWsResponse;
+import org.sonarqube.ws.Qualityprofiles.SearchWsResponse.QualityProfile;
import static java.lang.String.format;
import static java.util.stream.IntStream.range;
import org.sonar.server.organization.TestDefaultOrganizationProvider;
import org.sonar.server.tester.UserSessionRule;
import org.sonar.server.ws.WsActionTester;
-import org.sonarqube.ws.QualityProfiles.SearchGroupsResponse;
+import org.sonarqube.ws.Qualityprofiles.SearchGroupsResponse;
import static java.lang.String.format;
import static org.assertj.core.api.Assertions.assertThat;
import org.sonar.server.organization.TestDefaultOrganizationProvider;
import org.sonar.server.tester.UserSessionRule;
import org.sonar.server.ws.WsActionTester;
-import org.sonarqube.ws.QualityProfiles.SearchUsersResponse;
+import org.sonarqube.ws.Qualityprofiles.SearchUsersResponse;
import static java.lang.String.format;
import static org.assertj.core.api.Assertions.assertThat;
import org.sonar.server.ws.TestRequest;
import org.sonar.server.ws.WsActionTester;
import org.sonarqube.ws.MediaTypes;
-import org.sonarqube.ws.QualityProfiles;
-import org.sonarqube.ws.QualityProfiles.ShowResponse;
-import org.sonarqube.ws.QualityProfiles.ShowResponse.CompareToSonarWay;
-import org.sonarqube.ws.QualityProfiles.ShowResponse.QualityProfile;
+import org.sonarqube.ws.Qualityprofiles;
+import org.sonarqube.ws.Qualityprofiles.ShowResponse;
+import org.sonarqube.ws.Qualityprofiles.ShowResponse.CompareToSonarWay;
+import org.sonarqube.ws.Qualityprofiles.ShowResponse.QualityProfile;
import static java.util.stream.IntStream.range;
import static org.assertj.core.api.Assertions.assertThat;
public void profile_info() {
QProfileDto profile = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setLanguage(XOO1.getKey()));
- QualityProfiles.ShowResponse result = call(ws.newRequest().setParam(PARAM_KEY, profile.getKee()));
+ Qualityprofiles.ShowResponse result = call(ws.newRequest().setParam(PARAM_KEY, profile.getKee()));
assertThat(result.getProfile())
.extracting(QualityProfile::getKey, QualityProfile::getName, QualityProfile::getIsBuiltIn, QualityProfile::getLanguage, QualityProfile::getLanguageName,
QProfileDto profile = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setLanguage(XOO1.getKey()));
db.qualityProfiles().setAsDefault(profile);
- QualityProfiles.ShowResponse result = call(ws.newRequest().setParam(PARAM_KEY, profile.getKee()));
+ Qualityprofiles.ShowResponse result = call(ws.newRequest().setParam(PARAM_KEY, profile.getKee()));
assertThat(result.getProfile().getIsDefault()).isTrue();
}
.setLastUsed(time)
.setUserUpdatedAt(time));
- QualityProfiles.ShowResponse result = call(ws.newRequest().setParam(PARAM_KEY, profile.getKee()));
+ Qualityprofiles.ShowResponse result = call(ws.newRequest().setParam(PARAM_KEY, profile.getKee()));
assertThat(result.getProfile().getRulesUpdatedAt()).isEqualTo("2016-12-21T19:10:03+0100");
assertThat(parseDateTime(result.getProfile().getLastUsed()).getTime()).isEqualTo(time);
.mapToObj(i -> db.components().insertPrivateProject())
.forEach(project -> db.qualityProfiles().associateWithProject(project, profile));
- QualityProfiles.ShowResponse result = call(ws.newRequest().setParam(PARAM_KEY, profile.getKee()));
+ Qualityprofiles.ShowResponse result = call(ws.newRequest().setParam(PARAM_KEY, profile.getKee()));
assertThat(result.getProfile())
.extracting(QualityProfile::getActiveRuleCount, QualityProfile::getActiveDeprecatedRuleCount, QualityProfile::getProjectCount)
QProfileDto sonarWayProfile = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setIsBuiltIn(true).setName("Sonar way").setLanguage(XOO1.getKey()));
QProfileDto anotherBuiltInProfile = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setIsBuiltIn(true).setLanguage(XOO1.getKey()));
- QualityProfiles.ShowResponse result = call(ws.newRequest()
+ Qualityprofiles.ShowResponse result = call(ws.newRequest()
.setParam(PARAM_KEY, anotherBuiltInProfile.getKee())
.setParam(PARAM_COMPARE_TO_SONAR_WAY, "true"));
QProfileDto sonarWayProfile = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setIsBuiltIn(false).setName("Sonar way").setLanguage(XOO1.getKey()));
QProfileDto profile = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setLanguage(XOO1.getKey()));
- QualityProfiles.ShowResponse result = call(ws.newRequest()
+ Qualityprofiles.ShowResponse result = call(ws.newRequest()
.setParam(PARAM_KEY, profile.getKee())
.setParam(PARAM_COMPARE_TO_SONAR_WAY, "true"));
QProfileDto sonarWayProfile = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setIsBuiltIn(true).setName("Sonar way").setLanguage(XOO1.getKey()));
QProfileDto profile = db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p.setLanguage(XOO1.getKey()));
- QualityProfiles.ShowResponse result = call(ws.newRequest()
+ Qualityprofiles.ShowResponse result = call(ws.newRequest()
.setParam(PARAM_KEY, profile.getKee())
.setParam(PARAM_COMPARE_TO_SONAR_WAY, "false"));
private ShowResponse call(TestRequest request) {
TestRequest wsRequest = request.setMediaType(MediaTypes.PROTOBUF);
- return wsRequest.executeProtobuf(QualityProfiles.ShowResponse.class);
+ return wsRequest.executeProtobuf(Qualityprofiles.ShowResponse.class);
}
}
import org.sonar.server.ws.TestResponse;
import org.sonar.server.ws.WsActionTester;
import org.sonarqube.ws.MediaTypes;
-import org.sonarqube.ws.WsRoot;
+import org.sonarqube.ws.Root;
import static org.assertj.core.api.Assertions.assertThat;
import static org.sonar.test.JsonAssert.assertJson;
userDao.setRoot(dbSession, rootDto.getLogin(), true);
dbSession.commit();
- List<WsRoot.Root> roots = executeRequest();
+ List<Root.RootContent> roots = executeRequest();
assertThat(roots).hasSize(1);
- WsRoot.Root root = roots.iterator().next();
+ Root.RootContent root = roots.iterator().next();
assertThat(root.getLogin()).isEqualTo(rootDto.getLogin());
assertThat(root.hasName()).isFalse();
assertThat(root.hasEmail()).isFalse();
dbSession.commit();
assertThat(executeRequest())
- .extracting(WsRoot.Root::getName)
+ .extracting(Root.RootContent::getName)
.containsExactly("bbb", "ccc");
}
return userSessionRule.logIn().setRoot();
}
- private List<WsRoot.Root> executeRequest() {
+ private List<Root.RootContent> executeRequest() {
return wsTester.newRequest()
- .executeProtobuf(WsRoot.SearchWsResponse.class)
+ .executeProtobuf(Root.SearchWsResponse.class)
.getRootsList();
}
import org.sonar.server.tester.UserSessionRule;
import org.sonar.server.ws.TestRequest;
import org.sonar.server.ws.WsActionTester;
-import org.sonarqube.ws.WsTests;
-import org.sonarqube.ws.WsTests.ListResponse;
+import org.sonarqube.ws.Tests;
+import org.sonarqube.ws.Tests.ListResponse;
import static java.lang.String.format;
import static java.util.Arrays.asList;
ListResponse request = call(ws.newRequest().setParam(TEST_ID, test.getUuid()));
assertThat(request.getTestsList()).hasSize(1);
- WsTests.Test result = request.getTests(0);
+ Tests.Test result = request.getTests(0);
assertThat(result.getId()).isEqualTo(test.getUuid());
assertThat(result.getName()).isEqualTo(test.getName());
- assertThat(result.getStatus()).isEqualTo(WsTests.TestStatus.OK);
+ assertThat(result.getStatus()).isEqualTo(Tests.TestStatus.OK);
assertThat(result.getFileId()).isEqualTo(testFile.uuid());
assertThat(result.getFileKey()).isEqualTo(testFile.getDbKey());
assertThat(result.getFileName()).isEqualTo(testFile.path());
.setParam(TEST_ID, test1.getUuid()));
assertThat(request.getTestsList())
- .extracting(WsTests.Test::getId)
+ .extracting(Tests.Test::getId)
.containsOnly(test1.getUuid());
}
.setParam(TEST_FILE_ID, testFile.uuid()));
assertThat(request.getTestsList())
- .extracting(WsTests.Test::getId)
+ .extracting(Tests.Test::getId)
.containsOnly(test1.getUuid(), test2.getUuid());
}
.setParam(TEST_FILE_KEY, testFile.getDbKey()));
assertThat(request.getTestsList())
- .extracting(WsTests.Test::getId)
+ .extracting(Tests.Test::getId)
.containsOnly(test1.getUuid(), test2.getUuid());
}
.setParam("branch", testFile.getBranch()));
assertThat(request.getTestsList())
- .extracting(WsTests.Test::getId, WsTests.Test::getFileKey, WsTests.Test::getFileBranch)
+ .extracting(Tests.Test::getId, Tests.Test::getFileKey, Tests.Test::getFileBranch)
.containsOnly(
tuple(test1.getUuid(), testFile.getKey(), testFile.getBranch()),
tuple(test2.getUuid(), testFile.getKey(), testFile.getBranch()));
.setParam(SOURCE_FILE_ID, mainFile.uuid())
.setParam(SOURCE_FILE_LINE_NUMBER, "11"));
- assertThat(request.getTestsList()).extracting(WsTests.Test::getId).containsOnly(test1.getUuid(), test2.getUuid());
+ assertThat(request.getTestsList()).extracting(Tests.Test::getId).containsOnly(test1.getUuid(), test2.getUuid());
}
@Test
.setParam(SOURCE_FILE_LINE_NUMBER, "10"));
assertThat(request.getTestsList())
- .extracting(WsTests.Test::getId)
+ .extracting(Tests.Test::getId)
.containsOnly(test1.getUuid(), test3.getUuid());
}
.setParam("branch", testFile.getBranch()));
assertThat(request.getTestsList())
- .extracting(WsTests.Test::getId, WsTests.Test::getFileKey, WsTests.Test::getFileBranch)
+ .extracting(Tests.Test::getId, Tests.Test::getFileKey, Tests.Test::getFileBranch)
.containsOnly(
tuple(test1.getUuid(), testFile.getKey(), testFile.getBranch()),
tuple(test3.getUuid(), testFile.getKey(), testFile.getBranch()));
import org.sonar.server.usergroups.DefaultGroupFinder;
import org.sonar.server.ws.TestRequest;
import org.sonar.server.ws.WsActionTester;
-import org.sonarqube.ws.WsUsers.CreateWsResponse;
-import org.sonarqube.ws.WsUsers.CreateWsResponse.User;
+import org.sonarqube.ws.Users.CreateWsResponse;
+import org.sonarqube.ws.Users.CreateWsResponse.User;
import org.sonarqube.ws.client.user.CreateRequest;
import static java.util.Collections.singletonList;
import org.sonar.server.organization.TestDefaultOrganizationProvider;
import org.sonar.server.tester.UserSessionRule;
import org.sonar.server.ws.WsActionTester;
-import org.sonarqube.ws.WsUsers.CurrentWsResponse;
+import org.sonarqube.ws.Users.CurrentWsResponse;
import static com.google.common.collect.Lists.newArrayList;
import static org.assertj.core.api.Assertions.assertThat;
import org.sonar.server.ws.TestRequest;
import org.sonar.server.ws.WsActionTester;
import org.sonarqube.ws.MediaTypes;
-import org.sonarqube.ws.WsUsers.GroupsWsResponse;
+import org.sonarqube.ws.Users.GroupsWsResponse;
import static java.lang.String.format;
import static java.util.Collections.singletonList;
import static org.sonar.db.permission.OrganizationPermission.ADMINISTER;
import static org.sonar.db.user.GroupTesting.newGroupDto;
import static org.sonar.test.JsonAssert.assertJson;
-import static org.sonarqube.ws.WsUserGroups.Group;
-import static org.sonarqube.ws.WsUserGroups.SearchWsResponse;
+import static org.sonarqube.ws.UserGroups.Group;
+import static org.sonarqube.ws.UserGroups.SearchWsResponse;
public class SearchActionTest {
import org.sonar.server.ws.TestRequest;
import org.sonar.server.ws.WsActionTester;
import org.sonarqube.ws.MediaTypes;
-import org.sonarqube.ws.WsUserTokens.GenerateWsResponse;
+import org.sonarqube.ws.UserTokens.GenerateWsResponse;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Matchers.anyString;
import org.sonar.server.tester.UserSessionRule;
import org.sonar.server.ws.TestRequest;
import org.sonar.server.ws.WsActionTester;
-import org.sonarqube.ws.MediaTypes;
-import org.sonarqube.ws.WsUserTokens.SearchWsResponse;
+import org.sonarqube.ws.UserTokens.SearchWsResponse;
import static org.assertj.core.api.Assertions.assertThat;
import static org.sonar.db.user.UserTesting.newUserDto;
import org.sonar.server.exceptions.BadRequestException;
import org.sonarqube.ws.Issues;
import org.sonarqube.ws.MediaTypes;
-import org.sonarqube.ws.WsPermissions;
+import org.sonarqube.ws.Permissions;
import static org.assertj.core.api.Assertions.assertThat;
import static org.sonar.test.ExceptionCauseMatcher.hasType;
TestRequest request = new TestRequest();
request.setMediaType(MediaTypes.PROTOBUF);
- WsPermissions.Permission message = WsPermissions.Permission.newBuilder().setName("permission-name").build();
+ Permissions.Permission message = Permissions.Permission.newBuilder().setName("permission-name").build();
expectedException.expect(IllegalStateException.class);
expectedException.expectCause(hasType(NullPointerException.class));
import org.sonar.scanner.bootstrap.ScannerWsClient;
import org.sonar.scanner.protocol.output.ScannerReportWriter;
import org.sonar.scanner.scan.branch.BranchConfiguration;
+import org.sonarqube.ws.Ce;
import org.sonarqube.ws.MediaTypes;
-import org.sonarqube.ws.WsCe;
import org.sonarqube.ws.client.HttpException;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsResponse;
}
try (InputStream protobuf = response.contentStream()) {
- return WsCe.SubmitResponse.parser().parseFrom(protobuf).getTaskId();
+ return Ce.SubmitResponse.parser().parseFrom(protobuf).getTaskId();
} catch (Exception e) {
throw Throwables.propagate(e);
} finally {
import org.sonar.api.utils.MessageException;
import org.sonar.scanner.bootstrap.ScannerWsClient;
import org.sonar.scanner.util.ScannerUtils;
-import org.sonarqube.ws.WsBatch;
-import org.sonarqube.ws.WsBatch.WsProjectResponse;
-import org.sonarqube.ws.WsBatch.WsProjectResponse.FileDataByPath;
-import org.sonarqube.ws.WsBatch.WsProjectResponse.Settings;
+import org.sonarqube.ws.Batch;
+import org.sonarqube.ws.Batch.WsProjectResponse;
+import org.sonarqube.ws.Batch.WsProjectResponse.FileDataByPath;
+import org.sonarqube.ws.Batch.WsProjectResponse.Settings;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.HttpException;
import org.sonarqube.ws.client.WsResponse;
Map<String, FileDataByPath> fileDataByModuleAndPath = response.getFileDataByModuleAndPath();
for (Map.Entry<String, FileDataByPath> e1 : fileDataByModuleAndPath.entrySet()) {
- for (Map.Entry<String, WsBatch.WsProjectResponse.FileData> e2 : e1.getValue().getFileDataByPath().entrySet()) {
+ for (Map.Entry<String, Batch.WsProjectResponse.FileData> e2 : e1.getValue().getFileDataByPath().entrySet()) {
FileData fd = new FileData(e2.getValue().getHash(), e2.getValue().getRevision());
fileDataTable.put(e1.getKey(), e2.getKey(), fd);
}
import org.sonar.api.config.Configuration;
import org.sonar.api.utils.MessageException;
import org.sonar.scanner.bootstrap.ScannerWsClient;
-import org.sonarqube.ws.QualityProfiles.SearchWsResponse;
-import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile;
+import org.sonarqube.ws.Qualityprofiles.SearchWsResponse;
+import org.sonarqube.ws.Qualityprofiles.SearchWsResponse.QualityProfile;
import org.sonarqube.ws.client.GetRequest;
import static java.util.function.Function.identity;
import java.util.List;
import javax.annotation.Nullable;
-import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile;
+import org.sonarqube.ws.Qualityprofiles.SearchWsResponse.QualityProfile;
public interface QualityProfileLoader {
List<QualityProfile> load(String projectKey, @Nullable String profileName);
import org.sonar.api.utils.log.Profiler;
import org.sonar.scanner.analysis.AnalysisProperties;
import org.sonar.scanner.rule.ModuleQProfiles;
-import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile;
+import org.sonarqube.ws.Qualityprofiles.SearchWsResponse.QualityProfile;
public class QualityProfileProvider extends ProviderAdapter {
private static final Logger LOG = Loggers.get(QualityProfileProvider.class);
import org.sonar.api.utils.DateUtils;
-import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile;
+import org.sonarqube.ws.Qualityprofiles.SearchWsResponse.QualityProfile;
import org.sonar.api.batch.ScannerSide;
import javax.annotation.CheckForNull;
import org.sonar.scanner.scan.branch.BranchConfigurationLoader;
import org.sonar.scanner.scan.branch.BranchType;
import org.sonar.scanner.scan.branch.ProjectBranches;
-import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile;
+import org.sonarqube.ws.Qualityprofiles.SearchWsResponse.QualityProfile;
import org.sonarqube.ws.Rules.ListResponse.Rule;
/**
import org.sonar.scanner.bootstrap.GlobalAnalysisMode;
import org.sonar.scanner.bootstrap.ScannerWsClient;
import org.sonar.scanner.scan.branch.BranchConfiguration;
-import org.sonarqube.ws.WsCe;
+import org.sonarqube.ws.Ce;
import org.sonarqube.ws.client.HttpException;
import org.sonarqube.ws.client.WsRequest;
import org.sonarqube.ws.client.WsResponse;
PipedOutputStream out = new PipedOutputStream();
PipedInputStream in = new PipedInputStream(out);
- WsCe.SubmitResponse.newBuilder().build().writeTo(out);
+ Ce.SubmitResponse.newBuilder().build().writeTo(out);
out.close();
when(response.failIfNotSuccessful()).thenReturn(response);
PipedOutputStream out = new PipedOutputStream();
PipedInputStream in = new PipedInputStream(out);
- WsCe.SubmitResponse.newBuilder().build().writeTo(out);
+ Ce.SubmitResponse.newBuilder().build().writeTo(out);
out.close();
when(response.failIfNotSuccessful()).thenReturn(response);
import org.sonar.api.utils.MessageException;
import org.sonar.scanner.WsTestUtil;
import org.sonar.scanner.bootstrap.ScannerWsClient;
-import org.sonarqube.ws.WsBatch.WsProjectResponse;
+import org.sonarqube.ws.Batch.WsProjectResponse;
import org.sonarqube.ws.client.HttpException;
import org.sonarqube.ws.client.WsRequest;
import org.sonar.api.utils.MessageException;
import org.sonar.scanner.WsTestUtil;
import org.sonar.scanner.bootstrap.ScannerWsClient;
-import org.sonarqube.ws.QualityProfiles;
-import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile;
+import org.sonarqube.ws.Qualityprofiles;
+import org.sonarqube.ws.Qualityprofiles.SearchWsResponse.QualityProfile;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verifyNoMoreInteractions;
private static InputStream createStreamOfProfiles(String... names) throws IOException {
ByteArrayOutputStream os = new ByteArrayOutputStream();
- QualityProfiles.SearchWsResponse.Builder responseBuilder = QualityProfiles.SearchWsResponse.newBuilder();
+ Qualityprofiles.SearchWsResponse.Builder responseBuilder = Qualityprofiles.SearchWsResponse.newBuilder();
for (String n : names) {
QualityProfile qp = QualityProfile.newBuilder().setKey(n).setName(n).setLanguage("lang").build();
import org.sonar.api.utils.log.LoggerLevel;
import org.sonar.scanner.analysis.AnalysisProperties;
import org.sonar.scanner.rule.ModuleQProfiles;
-import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile;
+import org.sonarqube.ws.Qualityprofiles.SearchWsResponse.QualityProfile;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Matchers.anyString;
import org.sonar.api.batch.rule.ActiveRules;
import org.sonar.api.rule.RuleKey;
import org.sonar.api.utils.DateUtils;
-import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile;
+import org.sonarqube.ws.Qualityprofiles.SearchWsResponse.QualityProfile;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Matchers.eq;
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.sonarsource.sonarqube</groupId>
+ <artifactId>sonarqube</artifactId>
+ <version>7.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>sonar-ws-generated</artifactId>
+ <name>SonarQube :: Web Service :: Generated</name>
+ <description>Generated classes for Web Services</description>
+
+ <properties>
+ <sonar.exclusions>src/main/**/*</sonar.exclusions>
+ <sonar.test.exclusions>src/main/**/*</sonar.test.exclusions>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-java</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.findbugs</groupId>
+ <artifactId>jsr305</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.sonarsource.sonarqube</groupId>
+ <artifactId>sonar-plugin-api</artifactId>
+ <scope>provided</scope>
+ <optional>true</optional>
+ </dependency>
+
+ <!-- Tests -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>sonar-testing-harness</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.okhttp3</groupId>
+ <artifactId>mockwebserver</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this 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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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());
+ }
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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);
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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();
+
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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();
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+ }
+ }
+
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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);
+
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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();
+
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 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 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("https://github.com/SonarSource/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();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 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;
+
+/**
+ * Handle authentication.
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/authentication">Further information about this web service online</a>
+ */
+@Generated("https://github.com/SonarSource/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();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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.Batch.WsProjectResponse;
+import org.sonarqube.ws.MediaTypes;
+import org.sonarqube.ws.client.BaseService;
+import org.sonarqube.ws.client.GetRequest;
+import org.sonarqube.ws.client.WsConnector;
+
+/**
+ * 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("https://github.com/SonarSource/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());
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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-16T10:21:24+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-16T10:21:24+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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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.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("https://github.com/SonarSource/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 String component(ComponentRequest request) {
+ return call(
+ new GetRequest(path("component"))
+ .setParam("component", request.getComponent())
+ .setParam("componentId", request.getComponentId())
+ .setMediaType(MediaTypes.JSON)
+ ).content();
+ }
+
+ /**
+ * 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());
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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.PostRequest;
+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("https://github.com/SonarSource/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());
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 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.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("https://github.com/SonarSource/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());
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 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.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("https://github.com/SonarSource/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();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 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 emails
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/emails">Further information about this web service online</a>
+ */
+@Generated("https://github.com/SonarSource/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();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 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.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("https://github.com/SonarSource/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());
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 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 localization.
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/l10n">Further information about this web service online</a>
+ */
+@Generated("https://github.com/SonarSource/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();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 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 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("https://github.com/SonarSource/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();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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.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.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("https://github.com/SonarSource/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());
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 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 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("https://github.com/SonarSource/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();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 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.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("https://github.com/SonarSource/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();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonarqube.ws.client.orchestrator;
+
+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;
+
+/**
+ * Orchestrator web service
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/orchestrator">Further information about this web service online</a>
+ */
+@Generated("https://github.com/SonarSource/sonar-ws-generator")
+public class OrchestratorService extends BaseService {
+
+ public OrchestratorService(WsConnector wsConnector) {
+ super(wsConnector, "api/orchestrator");
+ }
+
+ /**
+ * Reset data
+ *
+ * This is part of the internal API.
+ * This is a POST request.
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/orchestrator/reset">Further information about this action online (including a response example)</a>
+ * @since Orchestrator 3.4
+ */
+ public void reset() {
+ call(
+ new PostRequest(path("reset"))
+ .setMediaType(MediaTypes.JSON)
+ ).content();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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.orchestrator;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/sonar-ws-generator")
+public class SearchRequest {
+
+ private List<String> organizations;
+ private String p;
+ private String ps;
+
+ /**
+ * 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.
+ *
+ * Example value: "20"
+ */
+ public SearchRequest setPs(String ps) {
+ this.ps = ps;
+ return this;
+ }
+
+ public String getPs() {
+ return ps;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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());
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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.ProjectAnalyses.CreateEventResponse;
+import org.sonarqube.ws.ProjectAnalyses.SearchResponse;
+import org.sonarqube.ws.ProjectAnalyses.UpdateEventResponse;
+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 project analyses.
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_analyses">Further information about this web service online</a>
+ */
+@Generated("https://github.com/SonarSource/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());
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 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.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("https://github.com/SonarSource/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();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 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.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("https://github.com/SonarSource/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());
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 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;
+
+/**
+ * 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("https://github.com/SonarSource/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();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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.AppWsResponse;
+import org.sonarqube.ws.Qualitygates.CreateConditionWsResponse;
+import org.sonarqube.ws.Qualitygates.CreateWsResponse;
+import org.sonarqube.ws.Qualitygates.GetByProjectWsResponse;
+import org.sonarqube.ws.Qualitygates.ProjectStatusWsResponse;
+import org.sonarqube.ws.Qualitygates.UpdateConditionWsResponse;
+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("https://github.com/SonarSource/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 AppWsResponse app() {
+ return call(
+ new GetRequest(path("app")),
+ AppWsResponse.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 CreateWsResponse create(CreateRequest request) {
+ return call(
+ new PostRequest(path("create"))
+ .setParam("name", request.getName()),
+ CreateWsResponse.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 CreateConditionWsResponse 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()),
+ CreateConditionWsResponse.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 GetByProjectWsResponse getByProject(GetByProjectRequest request) {
+ return call(
+ new GetRequest(path("get_by_project"))
+ .setParam("project", request.getProject()),
+ GetByProjectWsResponse.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 ProjectStatusWsResponse projectStatus(ProjectStatusRequest request) {
+ return call(
+ new GetRequest(path("project_status"))
+ .setParam("analysisId", request.getAnalysisId())
+ .setParam("projectId", request.getProjectId())
+ .setParam("projectKey", request.getProjectKey()),
+ ProjectStatusWsResponse.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()),
+ UpdateConditionWsResponse.parser());
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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());
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 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 root users
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/roots">Further information about this web service online</a>
+ */
+@Generated("https://github.com/SonarSource/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 String search() {
+ return call(
+ new GetRequest(path("search"))
+ .setMediaType(MediaTypes.JSON)
+ ).content();
+ }
+
+ /**
+ * 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();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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());
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/sonar-ws-generator")
+public class ResetRequest {
+
+ private String branch;
+ private String component;
+ private 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;
+ }
+
+ /**
+ * Setting keys
+ *
+ * This is a mandatory parameter.
+ * Example value: "sonar.links.scm,sonar.debt.hoursInDay"
+ */
+ public ResetRequest setKeys(String keys) {
+ this.keys = keys;
+ return this;
+ }
+
+ public String getKeys() {
+ return keys;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/sonar-ws-generator")
+public class SetRequest {
+
+ private String branch;
+ private String component;
+ private String fieldValues;
+ private String key;
+ private String value;
+ private 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(String fieldValues) {
+ this.fieldValues = fieldValues;
+ return this;
+ }
+
+ public 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(String values) {
+ this.values = values;
+ return this;
+ }
+
+ public String getValues() {
+ return values;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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.client.BaseService;
+import org.sonarqube.ws.client.GetRequest;
+import org.sonarqube.ws.client.PostRequest;
+import org.sonarqube.ws.client.WsConnector;
+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;
+
+/**
+ * Manage settings.
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/settings">Further information about this web service online</a>
+ */
+@Generated("https://github.com/SonarSource/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())
+ .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())
+ .setParam("key", request.getKey())
+ .setParam("value", request.getValue())
+ .setParam("values", request.getValues())
+ .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()),
+ ValuesWsResponse.parser());
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/sonar-ws-generator")
+public class ValuesRequest {
+
+ private String branch;
+ private String component;
+ private 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(String keys) {
+ this.keys = keys;
+ return this;
+ }
+
+ public String getKeys() {
+ return keys;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 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 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("https://github.com/SonarSource/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();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 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.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("https://github.com/SonarSource/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();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 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.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("https://github.com/SonarSource/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());
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 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 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("https://github.com/SonarSource/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();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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;
+
+/**
+ * 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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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("https://github.com/SonarSource/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();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 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.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("https://github.com/SonarSource/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());
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 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.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("https://github.com/SonarSource/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());
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 java.util.List;
+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("https://github.com/SonarSource/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;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 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 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("https://github.com/SonarSource/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();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
--- /dev/null
+// 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;
+ }
+}
--- /dev/null
+// 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 ProjectResponse {
+ 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+ }
+}
+
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+ }
+}
+
+
+
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
+
+message User {
+ optional string login = 1;
+ optional string name = 2;
+ optional string avatar = 3;
+ optional int32 groupCount = 4;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+ }
+
+}
+
+
--- /dev/null
+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
--- /dev/null
+// 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;
+ }
+}
--- /dev/null
+// 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 ProjectStatusWsResponse {
+ 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 GetByProjectWsResponse {
+ optional QualityGate qualityGate = 1;
+}
+
+message QualityGate {
+ optional string id = 1;
+ optional string name = 2;
+ optional bool default = 3;
+}
+
+// GET api/qualitygates/app
+message AppWsResponse {
+ 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 CreateWsResponse {
+ optional int64 id = 1;
+ optional string name = 2;
+}
+
+// POST api/qualitygates/create_condition
+message CreateConditionWsResponse {
+ 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 UpdateConditionWsResponse {
+ optional int64 id = 1;
+ optional string metric = 2;
+ optional string op = 3;
+ optional string warning = 4;
+ optional string error = 5;
+ optional int32 period = 6;
+}
+
+
+
--- /dev/null
+// 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;
+ }
+}
--- /dev/null
+// 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 = "Root";
+option optimize_for = SPEED;
+
+// WS api/root/search
+message SearchWsResponse {
+ repeated RootContent roots = 1;
+}
+
+message RootContent {
+ optional string login = 1;
+ optional string name = 2;
+ optional string email = 3;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+ }
+}
+
+
+
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+ }
+}
--- /dev/null
+// 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;
+ }
+}
+
+
--- /dev/null
+// 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;
+}
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.sonarsource.sonarqube</groupId>
+ <artifactId>sonar-ws-generated</artifactId>
+ </dependency>
<dependency>
<groupId>org.sonarsource.sonarqube</groupId>
<artifactId>sonar-plugin-api</artifactId>
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this 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;
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; 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());
- }
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; 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
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; 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);
- }
-}
import org.sonarqube.ws.client.permission.PermissionsService;
import org.sonarqube.ws.client.project.ProjectsService;
import org.sonarqube.ws.client.projectanalysis.ProjectAnalysisService;
-import org.sonarqube.ws.client.projectbranches.ProjectBranchesService;
+import org.sonarqube.ws.client.projectbranches.ProjectBranchesServiceOld;
import org.sonarqube.ws.client.projectlinks.ProjectLinksService;
-import org.sonarqube.ws.client.qualitygate.QualityGatesService;
+import org.sonarqube.ws.client.qualitygates.QualitygatesService;
import org.sonarqube.ws.client.qualityprofile.QualityProfilesService;
import org.sonarqube.ws.client.root.RootsService;
import org.sonarqube.ws.client.rule.RulesService;
import org.sonarqube.ws.client.setting.SettingsService;
-import org.sonarqube.ws.client.system.SystemService;
+import org.sonarqube.ws.client.system.SystemServiceOld;
import org.sonarqube.ws.client.user.UsersService;
import org.sonarqube.ws.client.usergroup.UserGroupsService;
import org.sonarqube.ws.client.usertoken.UserTokensService;
private final UsersService usersService;
private final UserGroupsService userGroupsService;
private final UserTokensService userTokensService;
- private final QualityGatesService qualityGatesService;
+ private final QualitygatesService qualityGatesService;
private final MeasuresService measuresService;
- private final SystemService systemService;
+ private final SystemServiceOld systemService;
private final CeService ceService;
private final RulesService rulesService;
private final ProjectsService projectsService;
private final RootsService rootsService;
private final WebhooksService webhooksService;
private final ProjectAnalysisService projectAnalysisService;
- private final ProjectBranchesService projectBranchesService;
+ private final ProjectBranchesServiceOld projectBranchesService;
DefaultWsClient(WsConnector wsConnector) {
this.wsConnector = wsConnector;
this.usersService = new UsersService(wsConnector);
this.userGroupsService = new UserGroupsService(wsConnector);
this.userTokensService = new UserTokensService(wsConnector);
- this.qualityGatesService = new QualityGatesService(wsConnector);
+ this.qualityGatesService = new QualitygatesService(wsConnector);
this.measuresService = new MeasuresService(wsConnector);
- this.systemService = new SystemService(wsConnector);
+ this.systemService = new SystemServiceOld(wsConnector);
this.ceService = new CeService(wsConnector);
this.rulesService = new RulesService(wsConnector);
this.projectsService = new ProjectsService(wsConnector);
this.rootsService = new RootsService(wsConnector);
this.webhooksService = new WebhooksService(wsConnector);
this.projectAnalysisService = new ProjectAnalysisService(wsConnector);
- this.projectBranchesService = new ProjectBranchesService(wsConnector);
+ this.projectBranchesService = new ProjectBranchesServiceOld(wsConnector);
}
@Override
}
@Override
- public QualityGatesService qualityGates() {
+ public QualitygatesService qualityGates() {
return qualityGatesService;
}
}
@Override
- public SystemService system() {
+ public SystemServiceOld system() {
return systemService;
}
}
@Override
- public ProjectBranchesService projectBranches() {
+ public ProjectBranchesServiceOld projectBranches() {
return projectBranchesService;
}
}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; 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;
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; 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();
-
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; 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;
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; 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();
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; 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;
- }
- }
-
-}
import org.sonarqube.ws.client.permission.PermissionsService;
import org.sonarqube.ws.client.project.ProjectsService;
import org.sonarqube.ws.client.projectanalysis.ProjectAnalysisService;
-import org.sonarqube.ws.client.projectbranches.ProjectBranchesService;
+import org.sonarqube.ws.client.projectbranches.ProjectBranchesServiceOld;
import org.sonarqube.ws.client.projectlinks.ProjectLinksService;
-import org.sonarqube.ws.client.qualitygate.QualityGatesService;
+import org.sonarqube.ws.client.qualitygates.QualitygatesService;
import org.sonarqube.ws.client.qualityprofile.QualityProfilesService;
import org.sonarqube.ws.client.root.RootsService;
import org.sonarqube.ws.client.rule.RulesService;
import org.sonarqube.ws.client.setting.SettingsService;
-import org.sonarqube.ws.client.system.SystemService;
+import org.sonarqube.ws.client.system.SystemServiceOld;
import org.sonarqube.ws.client.user.UsersService;
import org.sonarqube.ws.client.usergroup.UserGroupsService;
import org.sonarqube.ws.client.usertoken.UserTokensService;
UserTokensService userTokens();
- QualityGatesService qualityGates();
+ QualitygatesService qualityGates();
MeasuresService measures();
- SystemService system();
+ SystemServiceOld system();
CeService ce();
/**
* @since 6.6>
*/
- ProjectBranchesService projectBranches();
+ ProjectBranchesServiceOld projectBranches();
}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; 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);
-
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; 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
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; 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();
-
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; 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.CheckForNull;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.Immutable;
-
-@Immutable
-public class ActivityStatusWsRequest {
- private final String componentId;
- private final String componentKey;
-
- private ActivityStatusWsRequest(Builder builder) {
- this.componentId = builder.componentId;
- this.componentKey = builder.componentKey;
- }
-
- @CheckForNull
- public String getComponentId() {
- return componentId;
- }
-
- @CheckForNull
- public String getComponentKey() {
- return componentKey;
- }
-
- public static Builder newBuilder() {
- return new Builder();
- }
-
- public static class Builder {
- private String componentId;
- private String componentKey;
-
- private Builder() {
- // enforce newBuilder() use for instantiation
- }
-
- public Builder setComponentId(@Nullable String componentId) {
- this.componentId = componentId;
- return this;
- }
-
- public Builder setComponentKey(@Nullable String componentKey) {
- this.componentKey = componentKey;
- return this;
- }
-
- public ActivityStatusWsRequest build() {
- return new ActivityStatusWsRequest(this);
- }
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; 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.CheckForNull;
-import javax.annotation.Nullable;
-
-public class ActivityWsRequest {
- private String componentId;
- private String query;
- private List<String> status;
- private String type;
- private Boolean onlyCurrents;
- private String minSubmittedAt;
- private String maxExecutedAt;
- private Integer page;
- private Integer pageSize;
-
- @CheckForNull
- public String getComponentId() {
- return componentId;
- }
-
- public ActivityWsRequest setComponentId(@Nullable String componentId) {
- this.componentId = componentId;
- return this;
- }
-
- @CheckForNull
- public String getQuery() {
- return query;
- }
-
- public ActivityWsRequest setQuery(@Nullable String query) {
- this.query = query;
- return this;
- }
-
- @CheckForNull
- public List<String> getStatus() {
- return status;
- }
-
- public ActivityWsRequest setStatus(@Nullable List<String> status) {
- this.status = status;
- return this;
- }
-
- @CheckForNull
- public String getType() {
- return type;
- }
-
- public ActivityWsRequest setType(@Nullable String type) {
- this.type = type;
- return this;
- }
-
- @CheckForNull
- public Boolean getOnlyCurrents() {
- return onlyCurrents;
- }
-
- public ActivityWsRequest setOnlyCurrents(@Nullable Boolean onlyCurrents) {
- this.onlyCurrents = onlyCurrents;
- return this;
- }
-
- @CheckForNull
- public String getMinSubmittedAt() {
- return minSubmittedAt;
- }
-
- public ActivityWsRequest setMinSubmittedAt(@Nullable String minSubmittedAt) {
- this.minSubmittedAt = minSubmittedAt;
- return this;
- }
-
- @CheckForNull
- public String getMaxExecutedAt() {
- return maxExecutedAt;
- }
-
- public ActivityWsRequest setMaxExecutedAt(@Nullable String maxExecutedAt) {
- this.maxExecutedAt = maxExecutedAt;
- return this;
- }
-
- @CheckForNull
- public Integer getPage() {
- return page;
- }
-
- public ActivityWsRequest setPage(@Nullable Integer page) {
- this.page = page;
- return this;
- }
-
- @CheckForNull
- public Integer getPageSize() {
- return pageSize;
- }
-
- public ActivityWsRequest setPageSize(@Nullable Integer pageSize) {
- this.pageSize = pageSize;
- return this;
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; 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 org.sonarqube.ws.WsCe;
-import org.sonarqube.ws.WsCe.ActivityResponse;
-import org.sonarqube.ws.WsCe.ProjectResponse;
-import org.sonarqube.ws.WsCe.TaskTypesWsResponse;
-import org.sonarqube.ws.WsCe.WorkerCountResponse;
-import org.sonarqube.ws.client.BaseService;
-import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.WsConnector;
-
-import static org.sonarqube.ws.client.ce.CeWsParameters.ACTION_WORKER_COUNT;
-import static org.sonarqube.ws.client.ce.CeWsParameters.DEPRECATED_PARAM_COMPONENT_KEY;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_ID;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_MAX_EXECUTED_AT;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_MIN_SUBMITTED_AT;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_ONLY_CURRENTS;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_STATUS;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_TYPE;
-
-/**
- * Maps web service {@code api/ce} (Compute Engine).
- */
-public class CeService extends BaseService {
-
- public CeService(WsConnector wsConnector) {
- super(wsConnector, "api/ce");
- }
-
- public ActivityResponse activity(ActivityWsRequest request) {
- return call(
- new GetRequest(path("activity"))
- .setParam(PARAM_COMPONENT_ID, request.getComponentId())
- .setParam("q", request.getQuery())
- .setParam(PARAM_STATUS, inlineMultipleParamValue(request.getStatus()))
- .setParam(PARAM_TYPE, request.getType())
- .setParam(PARAM_MAX_EXECUTED_AT, request.getMaxExecutedAt())
- .setParam(PARAM_MIN_SUBMITTED_AT, request.getMinSubmittedAt())
- .setParam(PARAM_ONLY_CURRENTS, request.getOnlyCurrents())
- .setParam("p", request.getPage())
- .setParam("ps", request.getPageSize()),
- ActivityResponse.parser());
- }
-
- public TaskTypesWsResponse taskTypes() {
- return call(new GetRequest(path("task_types")), TaskTypesWsResponse.parser());
- }
-
- /**
- * Gets details of a Compute Engine task.
- *
- * @throws org.sonarqube.ws.client.HttpException if HTTP status code is not 2xx.
- * @since 5.5
- */
- public WsCe.TaskResponse task(String id) {
- return task(TaskWsRequest.newBuilder(id).build());
- }
-
- public WsCe.TaskResponse task(TaskWsRequest taskWsRequest) {
- GetRequest request = new GetRequest(path("task"))
- .setParam("id", taskWsRequest.getTaskUuid());
- if (!taskWsRequest.getAdditionalFields().isEmpty()) {
- request.setParam("additionalFields", inlineMultipleParamValue(taskWsRequest.getAdditionalFields()));
- }
- return call(request, WsCe.TaskResponse.parser());
- }
-
- public WsCe.ActivityStatusWsResponse activityStatus(ActivityStatusWsRequest request) {
- return call(
- new GetRequest(path("activity_status"))
- .setParam(PARAM_COMPONENT_ID, request.getComponentId())
- .setParam(DEPRECATED_PARAM_COMPONENT_KEY, request.getComponentKey()),
- WsCe.ActivityStatusWsResponse.parser());
- }
-
- public WorkerCountResponse workerCount() {
- return call(new GetRequest(path(ACTION_WORKER_COUNT)), WorkerCountResponse.parser());
- }
-
- public ProjectResponse component(String componentKey) {
- return call(
- new GetRequest(path("component"))
- .setParam(PARAM_COMPONENT, componentKey),
- ProjectResponse.parser());
- }
-
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; 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 com.google.common.collect.ImmutableList;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import javax.annotation.concurrent.Immutable;
-
-@Immutable
-public class TaskWsRequest {
- private final String taskUuid;
- private final List<String> additionalFields;
-
- private TaskWsRequest(Builder builder) {
- this.taskUuid = builder.taskUuid;
- this.additionalFields = createAdditionalFields(builder);
- }
- public static Builder newBuilder(String taskUuid) {
- return new Builder(taskUuid);
- }
-
- private static List<String> createAdditionalFields(Builder builder) {
- if (!builder.errorStacktrace && !builder.scannerContext) {
- return Collections.emptyList();
- }
- List<String> res = new ArrayList<>(2);
- if (builder.errorStacktrace) {
- res.add("stacktrace");
- }
- if (builder.scannerContext) {
- res.add("scannerContext");
- }
- return ImmutableList.copyOf(res);
- }
-
- public String getTaskUuid() {
- return taskUuid;
- }
-
- public List<String> getAdditionalFields() {
- return additionalFields;
- }
-
- public static final class Builder {
- private final String taskUuid;
- private boolean errorStacktrace = false;
- private boolean scannerContext = false;
-
- private Builder(String taskUuid) {
- this.taskUuid = taskUuid;
- }
-
- public Builder withErrorStacktrace() {
- this.errorStacktrace = true;
- return this;
- }
-
- public Builder withScannerContext() {
- this.scannerContext = true;
- return this;
- }
-
- public TaskWsRequest build() {
- return new TaskWsRequest(this);
- }
- }
-}
import com.google.common.base.Joiner;
import java.util.List;
import java.util.stream.Collectors;
-import org.sonarqube.ws.WsComponents.SearchProjectsWsResponse;
-import org.sonarqube.ws.WsComponents.SearchWsResponse;
-import org.sonarqube.ws.WsComponents.ShowWsResponse;
-import org.sonarqube.ws.WsComponents.TreeWsResponse;
+import org.sonarqube.ws.Components.SearchProjectsWsResponse;
+import org.sonarqube.ws.Components.SearchWsResponse;
+import org.sonarqube.ws.Components.ShowWsResponse;
+import org.sonarqube.ws.Components.TreeWsResponse;
import org.sonarqube.ws.client.BaseService;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.WsConnector;
package org.sonarqube.ws.client.measure;
import org.sonar.api.server.ws.WebService.Param;
-import org.sonarqube.ws.WsMeasures.ComponentTreeWsResponse;
-import org.sonarqube.ws.WsMeasures.ComponentWsResponse;
-import org.sonarqube.ws.WsMeasures.SearchHistoryResponse;
-import org.sonarqube.ws.WsMeasures.SearchWsResponse;
+import org.sonarqube.ws.Measures.ComponentTreeWsResponse;
+import org.sonarqube.ws.Measures.ComponentWsResponse;
+import org.sonarqube.ws.Measures.SearchHistoryResponse;
+import org.sonarqube.ws.Measures.SearchWsResponse;
import org.sonarqube.ws.client.BaseService;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.WsConnector;
*/
package org.sonarqube.ws.client.permission;
-import org.sonarqube.ws.WsPermissions;
-import org.sonarqube.ws.WsPermissions.CreateTemplateWsResponse;
-import org.sonarqube.ws.WsPermissions.SearchProjectPermissionsWsResponse;
-import org.sonarqube.ws.WsPermissions.SearchTemplatesWsResponse;
-import org.sonarqube.ws.WsPermissions.UpdateTemplateWsResponse;
-import org.sonarqube.ws.WsPermissions.UsersWsResponse;
-import org.sonarqube.ws.WsPermissions.WsSearchGlobalPermissionsResponse;
+import org.sonarqube.ws.Permissions;
+import org.sonarqube.ws.Permissions.CreateTemplateWsResponse;
+import org.sonarqube.ws.Permissions.SearchProjectPermissionsWsResponse;
+import org.sonarqube.ws.Permissions.SearchTemplatesWsResponse;
+import org.sonarqube.ws.Permissions.UpdateTemplateWsResponse;
+import org.sonarqube.ws.Permissions.UsersWsResponse;
+import org.sonarqube.ws.Permissions.WsSearchGlobalPermissionsResponse;
import org.sonarqube.ws.client.BaseService;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.PostRequest;
super(wsConnector, PermissionsWsParameters.CONTROLLER);
}
- public WsPermissions.WsGroupsResponse groups(GroupsWsRequest request) {
+ public Permissions.WsGroupsResponse groups(GroupsWsRequest request) {
GetRequest get = new GetRequest(path("groups"))
.setParam(PARAM_PERMISSION, request.getPermission())
.setParam(PARAM_PROJECT_ID, request.getProjectId())
.setParam("p", request.getPage())
.setParam("ps", request.getPageSize())
.setParam("q", request.getQuery());
- return call(get, WsPermissions.WsGroupsResponse.parser());
+ return call(get, Permissions.WsGroupsResponse.parser());
}
public void addGroup(AddGroupWsRequest request) {
package org.sonarqube.ws.client.project;
import com.google.common.base.Joiner;
-import org.sonarqube.ws.WsProjects.BulkUpdateKeyWsResponse;
-import org.sonarqube.ws.WsProjects.CreateWsResponse;
-import org.sonarqube.ws.WsProjects.SearchWsResponse;
+import org.sonarqube.ws.Projects.BulkUpdateKeyWsResponse;
+import org.sonarqube.ws.Projects.CreateWsResponse;
+import org.sonarqube.ws.Projects.SearchWsResponse;
import org.sonarqube.ws.client.BaseService;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.PostRequest;
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; 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 org.sonarqube.ws.WsBranches.ListWsResponse;
-import org.sonarqube.ws.WsBranches.ShowWsResponse;
-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 static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.ACTION_DELETE;
-import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.ACTION_LIST;
-import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.ACTION_RENAME;
-import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.ACTION_SHOW;
-import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.CONTROLLER;
-import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_BRANCH;
-import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_NAME;
-import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_PROJECT;
-
-public class ProjectBranchesService extends BaseService {
-
- public ProjectBranchesService(WsConnector wsConnector) {
- super(wsConnector, CONTROLLER);
- }
-
- public ListWsResponse list(String project) {
- GetRequest get = new GetRequest(path(ACTION_LIST))
- .setParam(PARAM_PROJECT, project);
- return call(get, ListWsResponse.parser());
- }
-
- public ShowWsResponse show(String project, String branch) {
- GetRequest get = new GetRequest(path(ACTION_SHOW))
- .setParam(PARAM_PROJECT, project)
- .setParam(PARAM_BRANCH, branch);
- return call(get, ShowWsResponse.parser());
- }
-
- public void delete(String project, String branch) {
- PostRequest post = new PostRequest(path(ACTION_DELETE))
- .setParam(PARAM_PROJECT, project)
- .setParam(PARAM_BRANCH, branch);
- call(post);
- }
-
- public void rename(String project, String name) {
- PostRequest post = new PostRequest(path(ACTION_RENAME))
- .setParam(PARAM_PROJECT, project)
- .setParam(PARAM_NAME, name);
- call(post);
- }
-
-}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 org.sonarqube.ws.ProjectBranches.ListWsResponse;
+import org.sonarqube.ws.ProjectBranches.ShowWsResponse;
+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 static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.ACTION_DELETE;
+import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.ACTION_LIST;
+import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.ACTION_RENAME;
+import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.ACTION_SHOW;
+import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.CONTROLLER;
+import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_BRANCH;
+import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_NAME;
+import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_PROJECT;
+
+public class ProjectBranchesServiceOld extends BaseService {
+
+ public ProjectBranchesServiceOld(WsConnector wsConnector) {
+ super(wsConnector, CONTROLLER);
+ }
+
+ public ListWsResponse list(String project) {
+ GetRequest get = new GetRequest(path(ACTION_LIST))
+ .setParam(PARAM_PROJECT, project);
+ return call(get, ListWsResponse.parser());
+ }
+
+ public ShowWsResponse show(String project, String branch) {
+ GetRequest get = new GetRequest(path(ACTION_SHOW))
+ .setParam(PARAM_PROJECT, project)
+ .setParam(PARAM_BRANCH, branch);
+ return call(get, ShowWsResponse.parser());
+ }
+
+ public void delete(String project, String branch) {
+ PostRequest post = new PostRequest(path(ACTION_DELETE))
+ .setParam(PARAM_PROJECT, project)
+ .setParam(PARAM_BRANCH, branch);
+ call(post);
+ }
+
+ public void rename(String project, String name) {
+ PostRequest post = new PostRequest(path(ACTION_RENAME))
+ .setParam(PARAM_PROJECT, project)
+ .setParam(PARAM_NAME, name);
+ call(post);
+ }
+
+}
package org.sonarqube.ws.client.projectbranches;
import javax.annotation.ParametersAreNonnullByDefault;
+
*/
package org.sonarqube.ws.client.projectlinks;
-import org.sonarqube.ws.WsProjectLinks.CreateWsResponse;
-import org.sonarqube.ws.WsProjectLinks.SearchWsResponse;
+import org.sonarqube.ws.ProjectLinks.CreateWsResponse;
+import org.sonarqube.ws.ProjectLinks.SearchWsResponse;
import org.sonarqube.ws.client.BaseService;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.PostRequest;
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonarqube.ws.client.qualitygate;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.Immutable;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Strings.isNullOrEmpty;
-
-@Immutable
-public class CreateConditionRequest {
-
- private final long qualityGateId;
- private final String metricKey;
- private final String operator;
- private final String warning;
- private final String error;
- private final Integer period;
-
- private CreateConditionRequest(Builder builder) {
- this.qualityGateId = builder.qualityGateId;
- this.metricKey = builder.metricKey;
- this.operator = builder.operator;
- this.warning = builder.warning;
- this.error = builder.error;
- this.period = builder.period;
- }
-
- public long getQualityGateId() {
- return qualityGateId;
- }
-
- public String getMetricKey() {
- return metricKey;
- }
-
- public String getOperator() {
- return operator;
- }
-
- @CheckForNull
- public String getWarning() {
- return warning;
- }
-
- @CheckForNull
- public String getError() {
- return error;
- }
-
- @CheckForNull
- public Integer getPeriod() {
- return period;
- }
-
- public static Builder builder() {
- return new Builder();
- }
-
- public static class Builder {
- private long qualityGateId;
- private String metricKey;
- private String operator;
- private String warning;
- private String error;
- private Integer period;
-
- private Builder() {
- // enforce factory method use
- }
-
- public Builder setQualityGateId(long qualityGateId) {
- this.qualityGateId = qualityGateId;
- return this;
- }
-
- public Builder setMetricKey(String metricKey) {
- this.metricKey = metricKey;
- return this;
- }
-
- public Builder setOperator(String operator) {
- this.operator = operator;
- return this;
- }
-
- public Builder setWarning(@Nullable String warning) {
- this.warning = warning;
- return this;
- }
-
- public Builder setError(@Nullable String error) {
- this.error = error;
- return this;
- }
-
- public Builder setPeriod(@Nullable Integer period) {
- this.period = period;
- return this;
- }
-
- public CreateConditionRequest build() {
- checkArgument(qualityGateId > 0, "Quality gate id is mandatory and must not be empty");
- checkArgument(!isNullOrEmpty(metricKey), "Metric key is mandatory and must not be empty");
- checkArgument(!isNullOrEmpty(operator), "Operator is mandatory and must not be empty");
- return new CreateConditionRequest(this);
- }
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonarqube.ws.client.qualitygate;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
-public class ProjectStatusWsRequest {
- private String analysisId;
- private String projectId;
- private String projectKey;
-
- @CheckForNull
- public String getAnalysisId() {
- return analysisId;
- }
-
- public ProjectStatusWsRequest setAnalysisId(@Nullable String analysisId) {
- this.analysisId = analysisId;
- return this;
- }
-
- @CheckForNull
- public String getProjectId() {
- return projectId;
- }
-
- public ProjectStatusWsRequest setProjectId(@Nullable String projectId) {
- this.projectId = projectId;
- return this;
- }
-
- @CheckForNull
- public String getProjectKey() {
- return projectKey;
- }
-
- public ProjectStatusWsRequest setProjectKey(@Nullable String projectKey) {
- this.projectKey = projectKey;
- return this;
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonarqube.ws.client.qualitygate;
-
-import org.sonarqube.ws.WsQualityGates.CreateConditionWsResponse;
-import org.sonarqube.ws.WsQualityGates.CreateWsResponse;
-import org.sonarqube.ws.WsQualityGates.ProjectStatusWsResponse;
-import org.sonarqube.ws.WsQualityGates.UpdateConditionWsResponse;
-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 static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.ACTION_CREATE;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.ACTION_CREATE_CONDITION;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.ACTION_PROJECT_STATUS;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.ACTION_SELECT;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.ACTION_UPDATE_CONDITION;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.CONTROLLER_QUALITY_GATES;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ANALYSIS_ID;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ERROR;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_GATE_ID;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ID;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_METRIC;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_NAME;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_OPERATOR;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PERIOD;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PROJECT_ID;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PROJECT_KEY;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_WARNING;
-
-public class QualityGatesService extends BaseService {
-
- public QualityGatesService(WsConnector wsConnector) {
- super(wsConnector, CONTROLLER_QUALITY_GATES);
- }
-
- public ProjectStatusWsResponse projectStatus(ProjectStatusWsRequest request) {
- return call(new GetRequest(path(ACTION_PROJECT_STATUS))
- .setParam(PARAM_ANALYSIS_ID, request.getAnalysisId())
- .setParam(PARAM_PROJECT_ID, request.getProjectId())
- .setParam(PARAM_PROJECT_KEY, request.getProjectKey()),
- ProjectStatusWsResponse.parser());
- }
-
- public void associateProject(SelectWsRequest request) {
- call(new PostRequest(path(ACTION_SELECT))
- .setParam(PARAM_GATE_ID, request.getGateId())
- .setParam(PARAM_PROJECT_ID, request.getProjectId())
- .setParam(PARAM_PROJECT_KEY, request.getProjectKey()));
- }
-
- public CreateWsResponse create(String name) {
- return call(new PostRequest(path(ACTION_CREATE))
- .setParam(PARAM_NAME, name),
- CreateWsResponse.parser());
- }
-
- public CreateConditionWsResponse createCondition(CreateConditionRequest request) {
- return call(new PostRequest(path(ACTION_CREATE_CONDITION))
- .setParam(PARAM_GATE_ID, request.getQualityGateId())
- .setParam(PARAM_METRIC, request.getMetricKey())
- .setParam(PARAM_OPERATOR, request.getOperator())
- .setParam(PARAM_WARNING, request.getWarning())
- .setParam(PARAM_ERROR, request.getError())
- .setParam(PARAM_PERIOD, request.getPeriod()),
- CreateConditionWsResponse.parser());
- }
-
- public UpdateConditionWsResponse updateCondition(UpdateConditionRequest request) {
- return call(new PostRequest(path(ACTION_UPDATE_CONDITION))
- .setParam(PARAM_ID, request.getConditionId())
- .setParam(PARAM_METRIC, request.getMetricKey())
- .setParam(PARAM_OPERATOR, request.getOperator())
- .setParam(PARAM_WARNING, request.getWarning())
- .setParam(PARAM_ERROR, request.getError())
- .setParam(PARAM_PERIOD, request.getPeriod()),
- UpdateConditionWsResponse.parser());
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonarqube.ws.client.qualitygate;
-
-import javax.annotation.CheckForNull;
-
-public class SelectWsRequest {
- private long gateId;
- private String projectId;
- private String projectKey;
-
- public long getGateId() {
- return gateId;
- }
-
- public SelectWsRequest setGateId(long gateId) {
- this.gateId = gateId;
- return this;
- }
-
- @CheckForNull
- public String getProjectId() {
- return projectId;
- }
-
- public SelectWsRequest setProjectId(String projectId) {
- this.projectId = projectId;
- return this;
- }
-
- @CheckForNull
- public String getProjectKey() {
- return projectKey;
- }
-
- public SelectWsRequest setProjectKey(String projectKey) {
- this.projectKey = projectKey;
- return this;
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonarqube.ws.client.qualitygate;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.Immutable;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Strings.isNullOrEmpty;
-
-@Immutable
-public class UpdateConditionRequest {
-
- private final long conditionId;
- private final String metricKey;
- private final String operator;
- private final String warning;
- private final String error;
- private final Integer period;
-
- private UpdateConditionRequest(Builder builder) {
- this.conditionId = builder.conditionId;
- this.metricKey = builder.metricKey;
- this.operator = builder.operator;
- this.warning = builder.warning;
- this.error = builder.error;
- this.period = builder.period;
- }
-
- public long getConditionId() {
- return conditionId;
- }
-
- public String getMetricKey() {
- return metricKey;
- }
-
- public String getOperator() {
- return operator;
- }
-
- @CheckForNull
- public String getWarning() {
- return warning;
- }
-
- @CheckForNull
- public String getError() {
- return error;
- }
-
- @CheckForNull
- public Integer getPeriod() {
- return period;
- }
- public static Builder builder() {
- return new Builder();
- }
-
- public static class Builder {
- private long conditionId;
- private String metricKey;
- private String operator;
- private String warning;
- private String error;
- private Integer period;
-
- private Builder() {
- // enforce factory method use
- }
-
- public Builder setConditionId(long conditionId) {
- this.conditionId = conditionId;
- return this;
- }
-
- public Builder setMetricKey(String metricKey) {
- this.metricKey = metricKey;
- return this;
- }
-
- public Builder setOperator(String operator) {
- this.operator = operator;
- return this;
- }
-
- public Builder setWarning(@Nullable String warning) {
- this.warning = warning;
- return this;
- }
-
- public Builder setError(@Nullable String error) {
- this.error = error;
- return this;
- }
-
- public Builder setPeriod(@Nullable Integer period) {
- this.period = period;
- return this;
- }
-
- public UpdateConditionRequest build() {
- checkArgument(conditionId > 0, "Condition id is mandatory and must not be empty");
- checkArgument(!isNullOrEmpty(metricKey), "Metric key is mandatory and must not be empty");
- checkArgument(!isNullOrEmpty(operator), "Operator is mandatory and must not be empty");
- return new UpdateConditionRequest(this);
- }
- }
-}
package org.sonarqube.ws.client.qualityprofile;
import org.sonarqube.ws.MediaTypes;
-import org.sonarqube.ws.QualityProfiles;
-import org.sonarqube.ws.QualityProfiles.CopyWsResponse;
-import org.sonarqube.ws.QualityProfiles.CreateWsResponse;
-import org.sonarqube.ws.QualityProfiles.SearchGroupsResponse;
-import org.sonarqube.ws.QualityProfiles.SearchUsersResponse;
-import org.sonarqube.ws.QualityProfiles.SearchWsResponse;
-import org.sonarqube.ws.QualityProfiles.ShowResponse;
+import org.sonarqube.ws.Qualityprofiles;
+import org.sonarqube.ws.Qualityprofiles.CopyWsResponse;
+import org.sonarqube.ws.Qualityprofiles.CreateWsResponse;
+import org.sonarqube.ws.Qualityprofiles.SearchGroupsResponse;
+import org.sonarqube.ws.Qualityprofiles.SearchUsersResponse;
+import org.sonarqube.ws.Qualityprofiles.SearchWsResponse;
+import org.sonarqube.ws.Qualityprofiles.ShowResponse;
import org.sonarqube.ws.client.BaseService;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.PostRequest;
SearchWsResponse.parser());
}
- public QualityProfiles.ShowResponse show(ShowRequest request) {
+ public Qualityprofiles.ShowResponse show(ShowRequest request) {
return call(
new GetRequest(path(ACTION_SHOW))
.setParam(PARAM_KEY, request.getKey())
*/
package org.sonarqube.ws.client.root;
-import org.sonarqube.ws.WsRoot;
+import org.sonarqube.ws.Root;
import org.sonarqube.ws.client.BaseService;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.PostRequest;
super(wsConnector, "api/roots");
}
- public WsRoot.SearchWsResponse search() {
- return call(new GetRequest(path("search")), WsRoot.SearchWsResponse.parser());
+ public Root.SearchWsResponse search() {
+ return call(new GetRequest(path("search")), Root.SearchWsResponse.parser());
}
public void setRoot(String login) {
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; 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 org.sonarqube.ws.WsSystem;
-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.client.WsResponse;
-
-public class SystemService extends BaseService {
- public SystemService(WsConnector wsConnector) {
- super(wsConnector, "api/system");
- }
-
- public WsSystem.HealthResponse health() {
- return call(new GetRequest(path("health")), WsSystem.HealthResponse.parser());
- }
-
- public void restart() {
- call(new PostRequest(path("restart")));
- }
-
- public WsSystem.StatusResponse status() {
- return call(new GetRequest(path("status")), WsSystem.StatusResponse.parser());
- }
-
- public void changeLogLevel(String level) {
- call(new PostRequest(path("change_log_level")).setParam("level", level));
- }
-
- public WsResponse info() {
- return call(new GetRequest(path("info")));
- }
-}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; 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 org.sonarqube.ws.System;
+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.client.WsResponse;
+
+public class SystemServiceOld extends BaseService {
+ public SystemServiceOld(WsConnector wsConnector) {
+ super(wsConnector, "api/system");
+ }
+
+ public System.HealthResponse health() {
+ return call(new GetRequest(path("health")), System.HealthResponse.parser());
+ }
+
+ public void restart() {
+ call(new PostRequest(path("restart")));
+ }
+
+ public System.StatusResponse status() {
+ return call(new GetRequest(path("status")), System.StatusResponse.parser());
+ }
+
+ public void changeLogLevel(String level) {
+ call(new PostRequest(path("change_log_level")).setParam("level", level));
+ }
+
+ public WsResponse info() {
+ return call(new GetRequest(path("info")));
+ }
+}
package org.sonarqube.ws.client.user;
import java.util.List;
-import org.sonarqube.ws.WsUsers.CreateWsResponse;
-import org.sonarqube.ws.WsUsers.CurrentWsResponse;
-import org.sonarqube.ws.WsUsers.GroupsWsResponse;
-import org.sonarqube.ws.WsUsers.SearchWsResponse;
+import org.sonarqube.ws.Users.CreateWsResponse;
+import org.sonarqube.ws.Users.CurrentWsResponse;
+import org.sonarqube.ws.Users.GroupsWsResponse;
+import org.sonarqube.ws.Users.SearchWsResponse;
import org.sonarqube.ws.client.BaseService;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.PostRequest;
import static org.sonar.api.server.ws.WebService.Param.PAGE;
import static org.sonar.api.server.ws.WebService.Param.PAGE_SIZE;
import static org.sonar.api.server.ws.WebService.Param.TEXT_QUERY;
-import static org.sonarqube.ws.WsUserGroups.CreateWsResponse;
-import static org.sonarqube.ws.WsUserGroups.SearchWsResponse;
-import static org.sonarqube.ws.WsUserGroups.UpdateWsResponse;
+import static org.sonarqube.ws.UserGroups.CreateWsResponse;
+import static org.sonarqube.ws.UserGroups.SearchWsResponse;
+import static org.sonarqube.ws.UserGroups.UpdateWsResponse;
public class UserGroupsService extends BaseService {
*/
package org.sonarqube.ws.client.usertoken;
-import org.sonarqube.ws.WsUserTokens.GenerateWsResponse;
-import org.sonarqube.ws.WsUserTokens.SearchWsResponse;
+import org.sonarqube.ws.UserTokens.GenerateWsResponse;
+import org.sonarqube.ws.UserTokens.SearchWsResponse;
import org.sonarqube.ws.client.BaseService;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.PostRequest;
+++ /dev/null
-// 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 = "WsBatch";
-
-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;
- }
-}
+++ /dev/null
-// 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 = "WsCe";
-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 ProjectResponse {
- 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;
-}
+++ /dev/null
-// 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;
-}
+++ /dev/null
-// 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 = "WsComponents";
-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;
- }
-}
-
+++ /dev/null
-// 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 = "WsDuplications";
-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;
-}
+++ /dev/null
-// 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 = "WsEditions";
-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;
-}
+++ /dev/null
-// 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;
-}
+++ /dev/null
-// 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;
- }
-}
-
-
-
+++ /dev/null
-// 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 = "WsMeasures";
-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;
-}
+++ /dev/null
-// 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;
-}
+++ /dev/null
-// 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;
-}
-
-message User {
- optional string login = 1;
- optional string name = 2;
- optional string avatar = 3;
- optional int32 groupCount = 4;
-}
+++ /dev/null
-// 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 = "WsPermissions";
-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;
-}
+++ /dev/null
-// 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 = "WsProjectTags";
-option optimize_for = SPEED;
-
-// Response for api/project_tags/search
-message SearchResponse {
- repeated string tags = 1;
-}
+++ /dev/null
-// 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;
-}
+++ /dev/null
-// 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 = "WsBranches";
-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;
- }
-
-}
-
-
+++ /dev/null
-syntax = "proto2";
-
-package sonarqube.ws.projectlink;
-
-option java_package = "org.sonarqube.ws";
-option java_outer_classname = "WsProjectLinks";
-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
+++ /dev/null
-// 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 = "WsProjects";
-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;
- }
-}
+++ /dev/null
-// 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 = "WsQualityGates";
-option optimize_for = SPEED;
-
-// GET api/qualitygates/project_status
-message ProjectStatusWsResponse {
- 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 GetByProjectWsResponse {
- optional QualityGate qualityGate = 1;
-}
-
-message QualityGate {
- optional string id = 1;
- optional string name = 2;
- optional bool default = 3;
-}
-
-// GET api/qualitygates/app
-message AppWsResponse {
- 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 CreateWsResponse {
- optional int64 id = 1;
- optional string name = 2;
-}
-
-// POST api/qualitygates/create_condition
-message CreateConditionWsResponse {
- 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 UpdateConditionWsResponse {
- optional int64 id = 1;
- optional string metric = 2;
- optional string op = 3;
- optional string warning = 4;
- optional string error = 5;
- optional int32 period = 6;
-}
-
-
-
+++ /dev/null
-// 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;
- }
-}
+++ /dev/null
-// 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 = "WsRoot";
-option optimize_for = SPEED;
-
-// WS api/root/search
-message SearchWsResponse {
- repeated Root roots = 1;
-}
-
-message Root {
- optional string login = 1;
- optional string name = 2;
- optional string email = 3;
-}
+++ /dev/null
-// 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;
-}
+++ /dev/null
-// 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;
- }
-}
-
-
-
+++ /dev/null
-// 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 = "WsSystem";
-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;
-}
+++ /dev/null
-// 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 = "WsTests";
-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;
-}
+++ /dev/null
-// 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 = "WsUserGroups";
-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;
-}
+++ /dev/null
-// 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 = "WsUserTokens";
-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;
- }
-}
+++ /dev/null
-// 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 = "WsUsers";
-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;
- }
-}
-
-
+++ /dev/null
-// 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;
-}
@Test
public void print() {
- WsPermissions.Permission.Builder message = WsPermissions.Permission.newBuilder()
+ Permissions.Permission.Builder message = Permissions.Permission.newBuilder()
.setName("permission-name")
.setKey("permission-key")
.setDescription("permission-description")
String result = MessageFormatter.print(message);
- assertThat(result).isEqualTo("org.sonarqube.ws.WsPermissions.Permission.Builder" +
+ assertThat(result).isEqualTo("org.sonarqube.ws.Permissions.Permission.Builder" +
"[key: \"permission-key\" name: \"permission-name\" description: \"permission-description\" usersCount: 1984 groupsCount: 42]");
}
}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; 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 com.google.common.collect.ImmutableList;
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonarqube.ws.WsCe;
-import org.sonarqube.ws.WsCe.ActivityResponse;
-import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.ServiceTester;
-import org.sonarqube.ws.client.WsConnector;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.data.MapEntry.entry;
-import static org.mockito.Mockito.mock;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_ID;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_MAX_EXECUTED_AT;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_MIN_SUBMITTED_AT;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_ONLY_CURRENTS;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_STATUS;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_TYPE;
-
-public class CeServiceTest {
- private static final String VALUE_COMPONENT_ID = "component-uuid";
- private static final String VALUE_QUERY = "component-query";
- private static final String VALUE_TASK_STATUS_1 = "task-status";
- private static final String VALUE_TASK_STATUS_2 = "task-status-2";
- private static final String VALUE_TASK_TYPE = "task-type";
- private static final int VALUE_PAGE = 1;
- private static final int VALUE_PAGE_SIZE = 10;
- private static final String VALUE_MAX_EXECUTED_AT = "2015-09-17T23:34:59+0200";
- private static final String VALUE_MIN_SUBMITTED_AT = "2015-09-17T23:34:59+0200";
- private static final boolean VALUE_ONLY_CURRENTS = true;
-
- @Rule
- public ServiceTester<CeService> serviceTester = new ServiceTester<>(new CeService(mock(WsConnector.class)));
-
- CeService underTest = serviceTester.getInstanceUnderTest();
-
- @Test
- public void activity() {
- ActivityWsRequest request = new ActivityWsRequest()
- .setComponentId(VALUE_COMPONENT_ID)
- .setQuery(VALUE_QUERY)
- .setStatus(ImmutableList.of(VALUE_TASK_STATUS_1, VALUE_TASK_STATUS_2))
- .setType(VALUE_TASK_TYPE)
- .setPage(VALUE_PAGE)
- .setPageSize(VALUE_PAGE_SIZE)
- .setMaxExecutedAt(VALUE_MAX_EXECUTED_AT)
- .setMinSubmittedAt(VALUE_MIN_SUBMITTED_AT)
- .setOnlyCurrents(VALUE_ONLY_CURRENTS)
- .setPage(1)
- .setPageSize(1);
-
- underTest.activity(request);
- GetRequest result = serviceTester.getGetRequest();
-
- assertThat(serviceTester.getGetParser()).isSameAs(ActivityResponse.parser());
- serviceTester.assertThat(result)
- .hasPath("activity")
- .hasParam(PARAM_COMPONENT_ID, VALUE_COMPONENT_ID)
- .hasParam("q", VALUE_QUERY)
- .hasParam(PARAM_STATUS, VALUE_TASK_STATUS_1 + "," + VALUE_TASK_STATUS_2)
- .hasParam(PARAM_TYPE, VALUE_TASK_TYPE)
- .hasParam(PARAM_MAX_EXECUTED_AT, VALUE_MAX_EXECUTED_AT)
- .hasParam(PARAM_MIN_SUBMITTED_AT, VALUE_MIN_SUBMITTED_AT)
- .hasParam(PARAM_ONLY_CURRENTS, VALUE_ONLY_CURRENTS)
- .hasParam("p", 1)
- .hasParam("ps", 1)
- .andNoOtherParam();
- }
-
- @Test
- public void task_types() {
- underTest.taskTypes();
-
- assertThat(serviceTester.getGetParser()).isSameAs(WsCe.TaskTypesWsResponse.parser());
- }
-
- @Test
- public void task_by_id_only() {
- underTest.task("task_id");
-
- assertThat(serviceTester.getGetRequest().getPath()).isEqualTo("api/ce/task");
- assertThat(serviceTester.getGetRequest().getParams()).containsOnly(entry("id", "task_id"));
- }
-
- @Test
- public void task_with_stacktrace_and_scanner_context() {
- underTest.task(TaskWsRequest.newBuilder("task_id")
- .withErrorStacktrace()
- .withScannerContext()
- .build());
-
- assertThat(serviceTester.getGetRequest().getPath()).isEqualTo("api/ce/task");
- assertThat(serviceTester.getGetRequest().getParams()).containsOnly(entry("id", "task_id"), entry("additionalFields", "stacktrace,scannerContext"));
- }
-
- @Test
- public void task_with_scanner_context_only() {
- underTest.task(TaskWsRequest.newBuilder("task_id")
- .withScannerContext()
- .build());
-
- assertThat(serviceTester.getGetRequest().getPath()).isEqualTo("api/ce/task");
- assertThat(serviceTester.getGetRequest().getParams()).containsOnly(entry("id", "task_id"), entry("additionalFields", "scannerContext"));
- }
-
- @Test
- public void task_with_stacktrace_only() {
- underTest.task(TaskWsRequest.newBuilder("task_id")
- .withErrorStacktrace()
- .build());
-
- assertThat(serviceTester.getGetRequest().getPath()).isEqualTo("api/ce/task");
- assertThat(serviceTester.getGetRequest().getParams()).containsOnly(entry("id", "task_id"), entry("additionalFields", "stacktrace"));
- }
-
- @Test
- public void worker_count() {
- underTest.workerCount();
-
- assertThat(serviceTester.getGetRequest().getPath()).isEqualTo("api/ce/worker_count");
- assertThat(serviceTester.getGetParser()).isSameAs(WsCe.WorkerCountResponse.parser());
- }
-
- @Test
- public void component() {
- underTest.component("my_component");
- GetRequest result = serviceTester.getGetRequest();
-
- assertThat(serviceTester.getGetParser()).isSameAs(WsCe.ProjectResponse.parser());
- serviceTester.assertThat(result)
- .hasPath("component")
- .hasParam(PARAM_COMPONENT, "my_component")
- .andNoOtherParam();
- }
-}
import org.junit.Rule;
import org.junit.Test;
-import org.sonarqube.ws.WsComponents;
+import org.sonarqube.ws.Components;
import org.sonarqube.ws.client.ServiceTester;
import org.sonarqube.ws.client.WsConnector;
.setAdditionalFields(singletonList("analysisDate"))
.build());
- assertThat(serviceTester.getGetParser()).isSameAs(WsComponents.SearchProjectsWsResponse.parser());
+ assertThat(serviceTester.getGetParser()).isSameAs(Components.SearchProjectsWsResponse.parser());
serviceTester.assertThat(serviceTester.getGetRequest())
.hasPath("search_projects")
.hasParam(PARAM_FILTER, "ncloc > 10")
.setPageSize(10)
.build());
- assertThat(serviceTester.getGetParser()).isSameAs(WsComponents.SearchProjectsWsResponse.parser());
+ assertThat(serviceTester.getGetParser()).isSameAs(Components.SearchProjectsWsResponse.parser());
serviceTester.assertThat(serviceTester.getGetRequest())
.hasPath("search_projects")
.hasParam(PARAM_FILTER, "ncloc > 10")
.setId(id)
.setBranch("my_branch"));
- assertThat(serviceTester.getGetParser()).isSameAs(WsComponents.ShowWsResponse.parser());
+ assertThat(serviceTester.getGetParser()).isSameAs(Components.ShowWsResponse.parser());
serviceTester.assertThat(serviceTester.getGetRequest())
.hasPath("show")
.hasParam("component", key)
.setPageSize(pageSize)
.setQuery(textQuery));
- assertThat(serviceTester.getGetParser()).isSameAs(WsComponents.SearchWsResponse.parser());
+ assertThat(serviceTester.getGetParser()).isSameAs(Components.SearchWsResponse.parser());
serviceTester.assertThat(serviceTester.getGetRequest())
.hasPath("search")
.hasParam("organization", organization)
.setQuery(query)
.setSort(asList("sort1", "sort2")));
- assertThat(serviceTester.getGetParser()).isSameAs(WsComponents.TreeWsResponse.parser());
+ assertThat(serviceTester.getGetParser()).isSameAs(Components.TreeWsResponse.parser());
serviceTester.assertThat(serviceTester.getGetRequest())
.hasPath("tree")
.hasParam("componentId", componentId)
import java.util.List;
import org.junit.Rule;
import org.junit.Test;
-import org.sonarqube.ws.WsMeasures;
-import org.sonarqube.ws.WsMeasures.ComponentTreeWsResponse;
-import org.sonarqube.ws.WsMeasures.ComponentWsResponse;
+import org.sonarqube.ws.Measures;
+import org.sonarqube.ws.Measures.ComponentTreeWsResponse;
+import org.sonarqube.ws.Measures.ComponentWsResponse;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.ServiceTester;
import org.sonarqube.ws.client.WsConnector;
underTest.searchHistory(request);
GetRequest getRequest = serviceTester.getGetRequest();
- assertThat(serviceTester.getGetParser()).isSameAs(WsMeasures.SearchHistoryResponse.parser());
+ assertThat(serviceTester.getGetParser()).isSameAs(Measures.SearchHistoryResponse.parser());
serviceTester.assertThat(getRequest)
.hasParam(PARAM_COMPONENT, VALUE_COMPONENT)
.hasParam(PARAM_BRANCH, "my_branch")
underTest.search(request);
GetRequest getRequest = serviceTester.getGetRequest();
- assertThat(serviceTester.getGetParser()).isSameAs(WsMeasures.SearchWsResponse.parser());
+ assertThat(serviceTester.getGetParser()).isSameAs(Measures.SearchWsResponse.parser());
serviceTester.assertThat(getRequest)
.hasParam(PARAM_PROJECT_KEYS, "P1,P2")
.hasParam(PARAM_METRIC_KEYS, "ncloc,complexity")
import java.util.Arrays;
import org.junit.Rule;
import org.junit.Test;
-import org.sonarqube.ws.WsPermissions;
+import org.sonarqube.ws.Permissions;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.ServiceTester;
.setPageSize(PAGE_SIZE_VALUE)
.setQuery(QUERY_VALUE));
- assertThat(serviceTester.getGetParser()).isSameAs(WsPermissions.WsGroupsResponse.parser());
+ assertThat(serviceTester.getGetParser()).isSameAs(Permissions.WsGroupsResponse.parser());
GetRequest getRequest = serviceTester.getGetRequest();
serviceTester.assertThat(getRequest)
.hasPath("groups")
.setProjectKeyPattern(PROJECT_KEY_PATTERN_VALUE)
);
- assertThat(serviceTester.getPostParser()).isSameAs(WsPermissions.CreateTemplateWsResponse.parser());
+ assertThat(serviceTester.getPostParser()).isSameAs(Permissions.CreateTemplateWsResponse.parser());
PostRequest postRequest = serviceTester.getPostRequest();
serviceTester.assertThat(postRequest)
.hasPath("create_template")
public void searchGlobalPermissions_does_GET_on_Ws_search_global_permissions() {
underTest.searchGlobalPermissions();
- assertThat(serviceTester.getGetParser()).isSameAs(WsPermissions.WsSearchGlobalPermissionsResponse.parser());
+ assertThat(serviceTester.getGetParser()).isSameAs(Permissions.WsSearchGlobalPermissionsResponse.parser());
GetRequest getRequest = serviceTester.getGetRequest();
serviceTester.assertThat(getRequest)
.hasPath("search_global_permissions")
.setQuery(QUERY_VALUE)
);
- assertThat(serviceTester.getGetParser()).isSameAs(WsPermissions.SearchProjectPermissionsWsResponse.parser());
+ assertThat(serviceTester.getGetParser()).isSameAs(Permissions.SearchProjectPermissionsWsResponse.parser());
GetRequest getRequest = serviceTester.getGetRequest();
serviceTester.assertThat(getRequest)
.hasPath("search_project_permissions")
.setQuery(QUERY_VALUE)
);
- assertThat(serviceTester.getGetParser()).isSameAs(WsPermissions.SearchTemplatesWsResponse.parser());
+ assertThat(serviceTester.getGetParser()).isSameAs(Permissions.SearchTemplatesWsResponse.parser());
GetRequest getRequest = serviceTester.getGetRequest();
serviceTester.assertThat(getRequest)
.hasPath("search_templates")
.setProjectKeyPattern(PROJECT_KEY_PATTERN_VALUE)
);
- assertThat(serviceTester.getPostParser()).isSameAs(WsPermissions.UpdateTemplateWsResponse.parser());
+ assertThat(serviceTester.getPostParser()).isSameAs(Permissions.UpdateTemplateWsResponse.parser());
PostRequest postRequest = serviceTester.getPostRequest();
serviceTester.assertThat(postRequest)
.hasPath("update_template")
.setPageSize(50)
);
- assertThat(serviceTester.getGetParser()).isSameAs(WsPermissions.UsersWsResponse.parser());
+ assertThat(serviceTester.getGetParser()).isSameAs(Permissions.UsersWsResponse.parser());
GetRequest getRequest = serviceTester.getGetRequest();
serviceTester.assertThat(getRequest)
import java.util.Arrays;
import org.junit.Rule;
import org.junit.Test;
-import org.sonarqube.ws.WsProjects;
+import org.sonarqube.ws.Projects;
import org.sonarqube.ws.client.ServiceTester;
import org.sonarqube.ws.client.WsConnector;
.setName("Project Name")
.build());
- assertThat(serviceTester.getPostParser()).isSameAs(WsProjects.CreateWsResponse.parser());
+ assertThat(serviceTester.getPostParser()).isSameAs(Projects.CreateWsResponse.parser());
assertThat(serviceTester.getPostRequest().getPath()).isEqualTo("api/projects/create");
assertThat(serviceTester.getPostRequest().getParams()).containsOnly(
entry("project", "project_key"),
.setName("Project Name")
.build());
- assertThat(serviceTester.getPostParser()).isSameAs(WsProjects.CreateWsResponse.parser());
+ assertThat(serviceTester.getPostParser()).isSameAs(Projects.CreateWsResponse.parser());
assertThat(serviceTester.getPostRequest().getPath()).isEqualTo("api/projects/create");
assertThat(serviceTester.getPostRequest().getParams()).containsOnly(
entry("organization", "org_key"),
import org.junit.Rule;
import org.junit.Test;
-import org.sonarqube.ws.WsBranches.ListWsResponse;
-import org.sonarqube.ws.WsBranches.ShowWsResponse;
+import org.sonarqube.ws.ProjectBranches.ListWsResponse;
+import org.sonarqube.ws.ProjectBranches.ShowWsResponse;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.ServiceTester;
public class ProjectBranchesServiceTest {
@Rule
- public ServiceTester<ProjectBranchesService> serviceTester = new ServiceTester<>(new ProjectBranchesService(mock(WsConnector.class)));
+ public ServiceTester<ProjectBranchesServiceOld> serviceTester = new ServiceTester<>(new ProjectBranchesServiceOld(mock(WsConnector.class)));
- private ProjectBranchesService underTest = serviceTester.getInstanceUnderTest();
+ private ProjectBranchesServiceOld underTest = serviceTester.getInstanceUnderTest();
@Test
public void list() {
import org.junit.Rule;
import org.junit.Test;
-import org.sonarqube.ws.WsProjectLinks.CreateWsResponse;
-import org.sonarqube.ws.WsProjectLinks.SearchWsResponse;
+import org.sonarqube.ws.ProjectLinks.CreateWsResponse;
+import org.sonarqube.ws.ProjectLinks.SearchWsResponse;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.ServiceTester;
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonarqube.ws.client.qualitygate;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class CreateConditionRequestTest {
-
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- CreateConditionRequest.Builder underTest = CreateConditionRequest.builder();
-
- @Test
- public void create_condition_request() {
- CreateConditionRequest result = underTest
- .setQualityGateId(10)
- .setMetricKey("metric")
- .setOperator("LT")
- .setWarning("warning")
- .setError("error")
- .setPeriod(1)
- .build();
-
- assertThat(result.getQualityGateId()).isEqualTo(10);
- assertThat(result.getMetricKey()).isEqualTo("metric");
- assertThat(result.getOperator()).isEqualTo("LT");
- assertThat(result.getWarning()).isEqualTo("warning");
- assertThat(result.getError()).isEqualTo("error");
- assertThat(result.getPeriod()).isEqualTo(1);
- }
-
- @Test
- public void fail_when_no_quality_gate() {
- expectedException.expect(IllegalArgumentException.class);
- expectedException.expectMessage("Quality gate id is mandatory and must not be empty");
-
- underTest
- .setMetricKey("metric")
- .setOperator("LT")
- .setWarning("warning")
- .build();
- }
-
- @Test
- public void fail_when_no_metric() {
- expectedException.expect(IllegalArgumentException.class);
- expectedException.expectMessage("Metric key is mandatory and must not be empty");
-
- underTest
- .setQualityGateId(10)
- .setOperator("LT")
- .setWarning("warning")
- .build();
- }
-
- @Test
- public void fail_when_no_operator() {
- expectedException.expect(IllegalArgumentException.class);
- expectedException.expectMessage("Operator is mandatory and must not be empty");
-
- underTest
- .setQualityGateId(10)
- .setMetricKey("metric")
- .setWarning("warning")
- .build();
- }
-
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonarqube.ws.client.qualitygate;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonarqube.ws.WsQualityGates.CreateConditionWsResponse;
-import org.sonarqube.ws.WsQualityGates.CreateWsResponse;
-import org.sonarqube.ws.WsQualityGates.ProjectStatusWsResponse;
-import org.sonarqube.ws.WsQualityGates.UpdateConditionWsResponse;
-import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.PostRequest;
-import org.sonarqube.ws.client.ServiceTester;
-import org.sonarqube.ws.client.WsConnector;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ANALYSIS_ID;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ERROR;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_GATE_ID;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ID;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_METRIC;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_NAME;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_OPERATOR;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PERIOD;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PROJECT_ID;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PROJECT_KEY;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_WARNING;
-
-public class QualityGatesServiceTest {
- private static final String PROJECT_ID_VALUE = "195";
- private static final String PROJECT_KEY_VALUE = "project_key_value";
- private static final Long GATE_ID_VALUE = 243L;
-
- @Rule
- public ServiceTester<QualityGatesService> serviceTester = new ServiceTester<>(new QualityGatesService(mock(WsConnector.class)));
-
- private QualityGatesService underTest = serviceTester.getInstanceUnderTest();
-
- @Test
- public void associate_project() {
- underTest.associateProject(new SelectWsRequest()
- .setGateId(GATE_ID_VALUE)
- .setProjectId(PROJECT_ID_VALUE)
- .setProjectKey(PROJECT_KEY_VALUE));
-
- assertThat(serviceTester.getPostParser()).isNull();
-
- PostRequest postRequest = serviceTester.getPostRequest();
-
- serviceTester.assertThat(postRequest)
- .hasPath("select")
- .hasParam(PARAM_GATE_ID, String.valueOf(GATE_ID_VALUE))
- .hasParam(PARAM_PROJECT_ID, String.valueOf(PROJECT_ID_VALUE))
- .hasParam(PARAM_PROJECT_KEY, PROJECT_KEY_VALUE)
- .andNoOtherParam();
- }
-
- @Test
- public void project_status() {
- underTest.projectStatus(new ProjectStatusWsRequest()
- .setAnalysisId("analysisId")
- .setProjectId("projectId")
- .setProjectKey("projectKey"));
- GetRequest getRequest = serviceTester.getGetRequest();
-
- assertThat(serviceTester.getGetParser()).isSameAs(ProjectStatusWsResponse.parser());
- serviceTester.assertThat(getRequest)
- .hasParam(PARAM_ANALYSIS_ID, "analysisId")
- .hasParam(PARAM_PROJECT_ID, "projectId")
- .hasParam(PARAM_PROJECT_KEY, "projectKey")
- .andNoOtherParam();
- }
-
- @Test
- public void create() {
- underTest.create("Default");
- PostRequest request = serviceTester.getPostRequest();
-
- assertThat(serviceTester.getPostParser()).isSameAs(CreateWsResponse.parser());
- serviceTester.assertThat(request)
- .hasParam(PARAM_NAME, "Default")
- .andNoOtherParam();
- }
-
- @Test
- public void create_condition() {
- underTest.createCondition(CreateConditionRequest.builder()
- .setQualityGateId(10)
- .setMetricKey("metric")
- .setOperator("LT")
- .setWarning("warning")
- .setError("error")
- .setPeriod(1)
- .build());
-
- PostRequest request = serviceTester.getPostRequest();
-
- assertThat(serviceTester.getPostParser()).isSameAs(CreateConditionWsResponse.parser());
- serviceTester.assertThat(request)
- .hasPath("create_condition")
- .hasParam(PARAM_GATE_ID, 10)
- .hasParam(PARAM_METRIC, "metric")
- .hasParam(PARAM_OPERATOR, "LT")
- .hasParam(PARAM_WARNING, "warning")
- .hasParam(PARAM_ERROR, "error")
- .hasParam(PARAM_PERIOD, 1)
- .andNoOtherParam();
- }
-
- @Test
- public void update_condition() {
- underTest.updateCondition(UpdateConditionRequest.builder()
- .setConditionId(10)
- .setMetricKey("metric")
- .setOperator("LT")
- .setWarning("warning")
- .setError("error")
- .setPeriod(1)
- .build());
-
- PostRequest request = serviceTester.getPostRequest();
-
- assertThat(serviceTester.getPostParser()).isSameAs(UpdateConditionWsResponse.parser());
- serviceTester.assertThat(request)
- .hasPath("update_condition")
- .hasParam(PARAM_ID, 10)
- .hasParam(PARAM_METRIC, "metric")
- .hasParam(PARAM_OPERATOR, "LT")
- .hasParam(PARAM_WARNING, "warning")
- .hasParam(PARAM_ERROR, "error")
- .hasParam(PARAM_PERIOD, 1)
- .andNoOtherParam();
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonarqube.ws.client.qualitygate;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class UpdateConditionRequestTest {
-
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- UpdateConditionRequest.Builder underTest = UpdateConditionRequest.builder();
-
- @Test
- public void create_condition_request() {
- UpdateConditionRequest result = underTest
- .setConditionId(10)
- .setMetricKey("metric")
- .setOperator("LT")
- .setWarning("warning")
- .setError("error")
- .setPeriod(1)
- .build();
-
- assertThat(result.getConditionId()).isEqualTo(10);
- assertThat(result.getMetricKey()).isEqualTo("metric");
- assertThat(result.getOperator()).isEqualTo("LT");
- assertThat(result.getWarning()).isEqualTo("warning");
- assertThat(result.getError()).isEqualTo("error");
- assertThat(result.getPeriod()).isEqualTo(1);
- }
-
- @Test
- public void fail_when_no_quality_gate() {
- expectedException.expect(IllegalArgumentException.class);
- expectedException.expectMessage("Condition id is mandatory and must not be empty");
-
- underTest
- .setMetricKey("metric")
- .setOperator("LT")
- .setWarning("warning")
- .build();
- }
-
- @Test
- public void fail_when_no_metric() {
- expectedException.expect(IllegalArgumentException.class);
- expectedException.expectMessage("Metric key is mandatory and must not be empty");
-
- underTest
- .setConditionId(10)
- .setOperator("LT")
- .setWarning("warning")
- .build();
- }
-
- @Test
- public void fail_when_no_operator() {
- expectedException.expect(IllegalArgumentException.class);
- expectedException.expectMessage("Operator is mandatory and must not be empty");
-
- underTest
- .setConditionId(10)
- .setMetricKey("metric")
- .setWarning("warning")
- .build();
- }
-
-}
import org.junit.Rule;
import org.junit.Test;
import org.sonarqube.ws.Common.Severity;
-import org.sonarqube.ws.QualityProfiles;
-import org.sonarqube.ws.QualityProfiles.SearchWsResponse;
-import org.sonarqube.ws.QualityProfiles.ShowResponse;
+import org.sonarqube.ws.Qualityprofiles;
+import org.sonarqube.ws.Qualityprofiles.SearchWsResponse;
+import org.sonarqube.ws.Qualityprofiles.ShowResponse;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.ServiceTester;
import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_KEY;
import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_QUALITY_PROFILE;
import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROJECT_KEY;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_QUALITY_PROFILE;
import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_RULE;
import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_SEVERITY;
import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_TO_NAME;
);
GetRequest getRequest = serviceTester.getGetRequest();
- assertThat(serviceTester.getGetParser()).isSameAs(QualityProfiles.SearchUsersResponse.parser());
+ assertThat(serviceTester.getGetParser()).isSameAs(Qualityprofiles.SearchUsersResponse.parser());
serviceTester.assertThat(getRequest)
.hasPath("search_users")
.hasParam(PARAM_ORGANIZATION, "O1")
);
GetRequest getRequest = serviceTester.getGetRequest();
- assertThat(serviceTester.getGetParser()).isSameAs(QualityProfiles.SearchGroupsResponse.parser());
+ assertThat(serviceTester.getGetParser()).isSameAs(Qualityprofiles.SearchGroupsResponse.parser());
serviceTester.assertThat(getRequest)
.hasPath("search_groups")
.hasParam(PARAM_ORGANIZATION, "O1")
public class SystemServiceTest {
@Rule
- public ServiceTester<SystemService> serviceTester = new ServiceTester<>(new SystemService(mock(WsConnector.class)));
+ public ServiceTester<SystemServiceOld> serviceTester = new ServiceTester<>(new SystemServiceOld(mock(WsConnector.class)));
- private SystemService underTest = serviceTester.getInstanceUnderTest();
+ private SystemServiceOld underTest = serviceTester.getInstanceUnderTest();
@Test
public void test_health() throws Exception {
import org.junit.Rule;
import org.junit.Test;
-import org.sonarqube.ws.WsUsers;
-import org.sonarqube.ws.WsUsers.CreateWsResponse;
-import org.sonarqube.ws.WsUsers.GroupsWsResponse;
+import org.sonarqube.ws.Users;
+import org.sonarqube.ws.Users.CreateWsResponse;
+import org.sonarqube.ws.Users.GroupsWsResponse;
import org.sonarqube.ws.client.ServiceTester;
import org.sonarqube.ws.client.WsConnector;
.setPossibleFields(asList("email", "name"))
.build());
- assertThat(serviceTester.getGetParser()).isSameAs(WsUsers.SearchWsResponse.parser());
+ assertThat(serviceTester.getGetParser()).isSameAs(Users.SearchWsResponse.parser());
serviceTester.assertThat(serviceTester.getGetRequest())
.hasParam(TEXT_QUERY, "john")
.hasParam(PAGE, 10)
public void current() {
underTest.current();
- assertThat(serviceTester.getGetParser()).isSameAs(WsUsers.CurrentWsResponse.parser());
+ assertThat(serviceTester.getGetParser()).isSameAs(Users.CurrentWsResponse.parser());
}
}
import static java.util.Arrays.asList;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
-import static org.sonarqube.ws.WsUserGroups.CreateWsResponse;
-import static org.sonarqube.ws.WsUserGroups.SearchWsResponse;
-import static org.sonarqube.ws.WsUserGroups.UpdateWsResponse;
+import static org.sonarqube.ws.UserGroups.CreateWsResponse;
+import static org.sonarqube.ws.UserGroups.SearchWsResponse;
+import static org.sonarqube.ws.UserGroups.UpdateWsResponse;
public class UserGroupsServiceTest {
import org.sonar.api.server.ws.Response;
import org.sonar.api.server.ws.WebService;
import org.sonarqube.ws.MediaTypes;
-import org.sonarqube.ws.WsCe;
+import org.sonarqube.ws.Ce;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.LocalWsClientFactory;
import org.sonarqube.ws.client.WsClient;
public void handle(Request request, Response response) throws Exception {
WsClient client = wsClientFactory.newClient(request.localConnector());
- WsCe.TaskTypesWsResponse ceTaskTypes = client.ce().taskTypes();
+ Ce.TaskTypesWsResponse ceTaskTypes = client.ce().taskTypes();
response.stream().setStatus(ceTaskTypes.getTaskTypesCount() > 0 ? 200 : 500);
}
}
<version>${orchestrator.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <!-- required for overriding ws-client 4.5 to have complete error stacktraces
+ in Issue tests -->
+ <groupId>org.codehaus.sonar</groupId>
+ <artifactId>sonar-ws-client</artifactId>
+ <version>5.0</version>
+ </dependency>
<dependency>
<groupId>org.sonarsource.sonarqube</groupId>
<artifactId>sonar-application</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>org.codehaus.sonar</groupId>
- <artifactId>sonar-ws-client</artifactId>
- <version>5.0</version>
- </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
</dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-guava</artifactId>
- </dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<artifactId>jsonassert</artifactId>
<version>1.2.0</version>
</dependency>
- <dependency>
- <groupId>org.jsoup</groupId>
- <artifactId>jsoup</artifactId>
- <version>1.8.3</version>
- </dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>mockwebserver</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-email</artifactId>
- </dependency>
<dependency>
<groupId>org.subethamail</groupId>
<artifactId>subethasmtp</artifactId>
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.sonarqube.tests.ce.BackgroundTasksTest;
-import org.sonarqube.tests.projectAdministration.ProjectAdministrationTest;
import org.sonarqube.tests.settings.DeprecatedPropertiesWsTest;
import org.sonarqube.tests.settings.EmailsTest;
import org.sonarqube.tests.settings.PropertySetsTest;
@RunWith(Suite.class)
@Suite.SuiteClasses({
UsersPageTest.class,
- ProjectAdministrationTest.class,
BackgroundTasksTest.class,
DeprecatedPropertiesWsTest.class,
EmailsTest.class,
.addPlugin(pluginArtifact("property-sets-plugin"))
.addPlugin(pluginArtifact("sonar-subcategories-plugin"))
- // Used in I18nTest
- .addPlugin(pluginArtifact("l10n-fr-pack"))
-
- // 1 second. Required for notification test.
- .setServerProperty("sonar.notifications.delay", "1")
-
// Used in SettingsTest.global_property_change_extension_point
.addPlugin(pluginArtifact("global-property-change-plugin"))
// Used in SettingsTest.should_get_settings_default_value
.addPlugin(pluginArtifact("server-plugin"))
+
+ // Used in I18nTest
+ .addPlugin(pluginArtifact("l10n-fr-pack"))
+
+ // 1 second. Required for notification test.
+ .setServerProperty("sonar.notifications.delay", "1")
+
.addPlugin(pluginArtifact("posttask-plugin"))
// reduce memory for Elasticsearch to 128M
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
-import org.sonarqube.tests.Byteman;
import org.sonarqube.qa.util.Tester;
+import org.sonarqube.tests.Byteman;
+import org.sonarqube.ws.Ce;
import org.sonarqube.ws.Common;
import org.sonarqube.ws.Issues;
import org.sonarqube.ws.Organizations.Organization;
-import org.sonarqube.ws.QualityProfiles.CreateWsResponse.QualityProfile;
-import org.sonarqube.ws.WsCe;
-import org.sonarqube.ws.WsProjects;
-import org.sonarqube.ws.WsUsers.CreateWsResponse.User;
-import org.sonarqube.ws.client.ce.TaskWsRequest;
+import org.sonarqube.ws.Qualityprofiles.CreateWsResponse.QualityProfile;
+import org.sonarqube.ws.Projects;
+import org.sonarqube.ws.Users.CreateWsResponse.User;
+import org.sonarqube.ws.client.ce.TaskRequest;
import org.sonarqube.ws.client.component.SuggestionsWsRequest;
import org.sonarqube.ws.client.issue.SearchWsRequest;
import util.ItUtils;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.tuple;
import static org.sonarqube.tests.Byteman.Process.CE;
-import static org.sonarqube.ws.WsCe.TaskStatus.FAILED;
+import static org.sonarqube.ws.Ce.TaskStatus.FAILED;
import static util.ItUtils.projectDir;
public class AnalysisEsResilienceTest {
public void activation_and_deactivation_of_rule_is_resilient_to_indexing_errors() throws Exception {
Organization organization = tester.organizations().generate();
User orgAdministrator = tester.users().generateAdministrator(organization);
- WsProjects.CreateWsResponse.Project project = tester.projects().generate(organization);
+ Projects.CreateWsResponse.Project project = tester.projects().provision(organization);
String projectKey = project.getKey();
String fileKey = projectKey + ":src/main/xoo/sample/Sample.xoo";
String file2Key = projectKey + ":src/main/xoo/sample/Sample2.xoo";
public void purge_mechanism_must_be_resilient_at_next_analysis() throws Exception {
Organization organization = tester.organizations().generate();
User orgAdministrator = tester.users().generateAdministrator(organization);
- WsProjects.CreateWsResponse.Project project = tester.projects().generate(organization);
+ Projects.CreateWsResponse.Project project = tester.projects().provision(organization);
String projectKey = project.getKey();
String fileKey = projectKey + ":src/main/xoo/sample/Sample.xoo";
String taskUuid = executeAnalysis(projectKey, organization, orgAdministrator, "analysis/resilience/resilience-purge", "2000-01-02");
// The task has failed
- TaskWsRequest request = TaskWsRequest.newBuilder(taskUuid).withErrorStacktrace().build();
- WsCe.Task task = tester.wsClient().ce().task(request).getTask();
- assertThat(task.getStatus()).isEqualTo(WsCe.TaskStatus.FAILED);
+ TaskRequest request = new TaskRequest().setId(taskUuid).setAdditionalFields(Collections.singletonList("stacktrace"));
+ Ce.Task task = tester.wsClient().ce().task(request).getTask();
+ assertThat(task.getStatus()).isEqualTo(Ce.TaskStatus.FAILED);
assertThat(task.getErrorMessage()).contains("Unrecoverable indexation failures");
assertThat(task.getErrorStacktrace())
.contains("Caused by: java.lang.IllegalStateException: Unrecoverable indexation failures");
public void compute_engine_task_must_be_red_when_es_is_not_available() throws Exception {
Organization organization = tester.organizations().generate();
User orgAdministrator = tester.users().generateAdministrator(organization);
- WsProjects.CreateWsResponse.Project project = tester.projects().generate(organization);
+ Projects.CreateWsResponse.Project project = tester.projects().provision(organization);
String projectKey = project.getKey();
String fileKey = projectKey + ":src/main/xoo/sample/Sample.xoo";
tester.elasticsearch().lockWrites("issues");
String analysisKey = executeAnalysis(projectKey, organization, orgAdministrator, "analysis/resilience/resilience-sample-v1", null);
- WsCe.TaskResponse task = tester.wsClient().ce().task(analysisKey);
+ Ce.TaskResponse task = tester.wsClient().ce().task(new TaskRequest().setId(analysisKey));
assertThat(task.getTask().getStatus()).isEqualTo(FAILED);
}
import org.junit.Test;
import org.sonarqube.ws.Favorites;
import org.sonarqube.ws.Favorites.Favorite;
-import org.sonarqube.ws.WsPermissions;
+import org.sonarqube.ws.Permissions;
import org.sonarqube.ws.client.WsClient;
import org.sonarqube.ws.client.favorite.SearchRequest;
import org.sonarqube.ws.client.permission.AddProjectCreatorToTemplateWsRequest;
}
private void addProjectCreatorPermission() {
- WsPermissions.SearchTemplatesWsResponse permissionTemplates = adminWsClient.permissions().searchTemplates(new SearchTemplatesWsRequest());
+ Permissions.SearchTemplatesWsResponse permissionTemplates = adminWsClient.permissions().searchTemplates(new SearchTemplatesWsRequest());
assertThat(permissionTemplates.getDefaultTemplatesCount()).isEqualTo(1);
adminWsClient.permissions().addProjectCreatorToTemplate(AddProjectCreatorToTemplateWsRequest.builder()
.setTemplateId(permissionTemplates.getDefaultTemplates(0).getTemplateId())
}
private void removeProjectCreatorPermission() {
- WsPermissions.SearchTemplatesWsResponse permissionTemplates = adminWsClient.permissions().searchTemplates(new SearchTemplatesWsRequest());
+ Permissions.SearchTemplatesWsResponse permissionTemplates = adminWsClient.permissions().searchTemplates(new SearchTemplatesWsRequest());
assertThat(permissionTemplates.getDefaultTemplatesCount()).isEqualTo(1);
adminWsClient.permissions().removeProjectCreatorFromTemplate(RemoveProjectCreatorFromTemplateWsRequest.builder()
.setTemplateId(permissionTemplates.getDefaultTemplates(0).getTemplateId())
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
-import org.sonarqube.ws.WsComponents.Component;
+import org.sonarqube.ws.Components.Component;
import org.sonarqube.ws.client.component.TreeWsRequest;
import util.ItUtils;
import com.sonar.orchestrator.Orchestrator;
import com.sonar.orchestrator.build.BuildResult;
import com.sonar.orchestrator.build.SonarScanner;
-import org.sonarqube.tests.Category4Suite;
import java.util.Map;
-import org.junit.Before;
import org.junit.ClassRule;
+import org.junit.Rule;
import org.junit.Test;
+import org.sonarqube.qa.util.Tester;
+import org.sonarqube.tests.Category4Suite;
+import org.sonarqube.ws.client.qualityprofile.AddProjectRequest;
import util.ItUtils;
import static org.assertj.core.api.Assertions.assertThat;
@ClassRule
public static Orchestrator orchestrator = Category4Suite.ORCHESTRATOR;
- @Before
- public void resetData() {
- orchestrator.resetData();
- }
+ @Rule
+ public Tester tester = new Tester(orchestrator)
+ // all the tests of Category4Suite must disable organizations
+ .disableOrganizations();
@Test
public void should_not_exclude_anything() {
protected BuildResult scan(String... properties) {
ItUtils.restoreProfile(orchestrator, getClass().getResource("/exclusions/IssueExclusionsTest/with-many-rules.xml"));
- orchestrator.getServer().provisionProject("com.sonarsource.it.samples:multi-modules-exclusions",
- "Sonar :: Integration Tests :: Multi-modules With Exclusions");
- orchestrator.getServer().associateProjectToQualityProfile("com.sonarsource.it.samples:multi-modules-exclusions", "xoo", "with-many-rules");
+
+ tester.projects().provision(p -> p
+ .setKey("com.sonarsource.it.samples:multi-modules-exclusions")
+ .setName("Sonar :: Integration Tests :: Multi-modules With Exclusions"));
+ tester.wsClient().qualityProfiles().addProject(AddProjectRequest.builder().setProjectKey("com.sonarsource.it.samples:multi-modules-exclusions")
+ .setLanguage("xoo").setQualityProfile("with-many-rules").build());
SonarScanner scan = SonarScanner.create(ItUtils.projectDir(PROJECT_DIR))
.setProperty("sonar.cpd.exclusions", "**/*")
import org.junit.After;
import org.junit.ClassRule;
import org.junit.Test;
-import org.sonarqube.ws.WsProjectLinks;
+import org.sonarqube.ws.ProjectLinks;
import org.sonarqube.ws.client.WsClient;
import org.sonarqube.ws.client.projectlinks.SearchWsRequest;
import util.ItUtils;
private void verifyLinks() {
WsClient wsClient = ItUtils.newWsClient(orchestrator);
- List<WsProjectLinks.Link> links = wsClient.projectLinks().search(new SearchWsRequest().setProjectKey(PROJECT_KEY)).getLinksList();
+ List<ProjectLinks.Link> links = wsClient.projectLinks().search(new SearchWsRequest().setProjectKey(PROJECT_KEY)).getLinksList();
verifyLink(links, "homepage", "http://www.simplesample.org_OVERRIDDEN");
verifyLink(links, "ci", "http://bamboo.ci.codehaus.org/browse/SIMPLESAMPLE");
verifyLink(links, "issue", "http://jira.codehaus.org/browse/SIMPLESAMPLE");
verifyLink(links, "scm_dev", "scm:git:git@github.com:SonarSource/simplesample.git");
}
- private void verifyLink(List<WsProjectLinks.Link> links, String expectedType, String expectedUrl) {
- Optional<WsProjectLinks.Link> link = links.stream()
+ private void verifyLink(List<ProjectLinks.Link> links, String expectedType, String expectedUrl) {
+ Optional<ProjectLinks.Link> link = links.stream()
.filter(l -> l.getType().equals(expectedType))
.findFirst();
assertThat(link).isPresent();
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
-import org.sonarqube.ws.WsUserTokens;
+import org.sonarqube.ws.UserTokens;
import org.sonarqube.ws.client.WsClient;
import org.sonarqube.ws.client.permission.AddUserWsRequest;
import org.sonarqube.ws.client.usertoken.GenerateWsRequest;
createUserWithProvisioningAndScanPermissions();
String tokenName = "For test";
- WsUserTokens.GenerateWsResponse generateWsResponse = userTokensWsClient.generate(new GenerateWsRequest()
+ UserTokens.GenerateWsResponse generateWsResponse = userTokensWsClient.generate(new GenerateWsRequest()
.setLogin(A_LOGIN)
.setName(tokenName));
SonarScanner sampleProject = SonarScanner.create(projectDir("shared/xoo-sample"));
ExecuteAnalysisPermissionTest.class,
IssuePermissionTest.class,
PermissionSearchTest.class,
+ PermissionTemplatePageTest.class,
ProvisioningPermissionTest.class,
QualityProfileAdminPermissionTest.class,
SystemPasscodeTest.class
import org.junit.Test;
import org.junit.rules.RuleChain;
import org.sonarqube.qa.util.Tester;
-import org.sonarqube.ws.WsPermissions;
-import org.sonarqube.ws.WsPermissions.Permission;
-import org.sonarqube.ws.WsPermissions.SearchTemplatesWsResponse;
+import org.sonarqube.ws.Permissions;
+import org.sonarqube.ws.Permissions.Permission;
+import org.sonarqube.ws.Permissions.SearchTemplatesWsResponse;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.permission.AddGroupToTemplateWsRequest;
import org.sonarqube.ws.client.permission.AddGroupWsRequest;
.setPermission("admin")
.setGroupName(GROUP_NAME));
- WsPermissions.WsSearchGlobalPermissionsResponse searchGlobalPermissionsWsResponse = tester.wsClient().permissions().searchGlobalPermissions();
+ Permissions.WsSearchGlobalPermissionsResponse searchGlobalPermissionsWsResponse = tester.wsClient().permissions().searchGlobalPermissions();
assertThat(searchGlobalPermissionsWsResponse.getPermissionsList().get(0).getKey()).isEqualTo("admin");
assertThat(searchGlobalPermissionsWsResponse.getPermissionsList().get(0).getUsersCount()).isEqualTo(1);
// by default, a group has the global admin permission
assertThat(searchGlobalPermissionsWsResponse.getPermissionsList().get(0).getGroupsCount()).isEqualTo(2);
- WsPermissions.UsersWsResponse users = tester.wsClient().permissions()
+ Permissions.UsersWsResponse users = tester.wsClient().permissions()
.users(new UsersWsRequest().setPermission("admin"));
assertThat(users.getUsersList()).extracting("login").contains(LOGIN);
- WsPermissions.WsGroupsResponse groupsResponse = tester.wsClient().permissions()
+ Permissions.WsGroupsResponse groupsResponse = tester.wsClient().permissions()
.groups(new GroupsWsRequest()
.setPermission("admin"));
assertThat(groupsResponse.getGroupsList()).extracting("name").contains(GROUP_NAME);
@Test
public void template_permission_web_services() {
- WsPermissions.CreateTemplateWsResponse createTemplateWsResponse = tester.wsClient().permissions().createTemplate(
+ Permissions.CreateTemplateWsResponse createTemplateWsResponse = tester.wsClient().permissions().createTemplate(
new CreateTemplateWsRequest()
.setName("my-new-template")
.setDescription("template-used-in-tests"));
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonarqube.tests.authorization;
+
+import com.sonar.orchestrator.Orchestrator;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.sonarqube.qa.util.Tester;
+import org.sonarqube.qa.util.pageobjects.ProjectsManagementPage;
+import org.sonarqube.ws.Permissions;
+import org.sonarqube.ws.client.permission.AddUserToTemplateWsRequest;
+import org.sonarqube.ws.client.permission.CreateTemplateWsRequest;
+import org.sonarqube.ws.client.permission.UsersWsRequest;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class PermissionTemplatePageTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = AuthorizationSuite.ORCHESTRATOR;
+
+ @Rule
+ public Tester tester = new Tester(orchestrator)
+ // all the tests of AuthorizationSuite must disable organizations
+ .disableOrganizations();
+
+ @Test
+ public void bulk_apply_permission_template() {
+ String project = tester.projects().provision().getKey();
+ String userLogin = tester.users().generateMemberOfDefaultOrganization().getLogin();
+ String adminLogin = tester.users().generateAdministratorOnDefaultOrganization().getLogin();
+
+ tester.wsClient().permissions().createTemplate(new CreateTemplateWsRequest().setName("foo-template"));
+ tester.wsClient().permissions().addUserToTemplate(
+ new AddUserToTemplateWsRequest()
+ .setPermission("admin")
+ .setTemplateName("foo-template")
+ .setLogin(userLogin));
+
+ ProjectsManagementPage page = tester.openBrowser().logIn().submitCredentials(adminLogin).openProjectsManagement();
+ page.shouldHaveProject(project);
+ page.bulkApplyPermissionTemplate("foo-template");
+ Permissions.UsersWsResponse usersResponse = tester.wsClient().permissions().users(new UsersWsRequest()
+ .setProjectKey(project)
+ .setPermission("admin")
+ );
+ assertThat(usersResponse.getUsersCount()).isEqualTo(1);
+ assertThat(usersResponse.getUsers(0).getLogin()).isEqualTo(userLogin);
+ }
+
+}
import org.sonarqube.tests.Category6Suite;
import org.sonarqube.qa.util.Tester;
import org.sonarqube.ws.Organizations.Organization;
-import org.sonarqube.ws.WsPermissions;
-import org.sonarqube.ws.WsPermissions.CreateTemplateWsResponse;
-import org.sonarqube.ws.WsProjects.CreateWsResponse.Project;
-import org.sonarqube.ws.WsUsers.CreateWsResponse;
+import org.sonarqube.ws.Permissions;
+import org.sonarqube.ws.Permissions.CreateTemplateWsResponse;
+import org.sonarqube.ws.Projects.CreateWsResponse.Project;
+import org.sonarqube.ws.Users.CreateWsResponse;
import org.sonarqube.ws.client.WsClient;
import org.sonarqube.ws.client.component.SearchProjectsRequest;
import org.sonarqube.ws.client.permission.AddUserToTemplateWsRequest;
Organization organization = tester.organizations().generate();
CreateWsResponse.User user = tester.users().generateMember(organization);
CreateWsResponse.User anotherUser = tester.users().generateMember(organization);
- WsPermissions.PermissionTemplate template = createTemplate(organization).getPermissionTemplate();
+ Permissions.PermissionTemplate template = createTemplate(organization).getPermissionTemplate();
tester.wsClient().permissions().addUserToTemplate(new AddUserToTemplateWsRequest()
.setOrganization(organization.getKey())
.setTemplateId(template.getId())
}
private Project createPrivateProject(Organization organization) {
- return tester.projects().generate(organization, p -> p.setVisibility("private"));
+ return tester.projects().provision(organization, p -> p.setVisibility("private"));
}
private void assertThatUserHasPermission(CreateWsResponse.User user, Organization organization, Project project) {
.setOrganization(organization.getKey())
.setProjectKey(project.getKey())
.setPermission("user");
- WsPermissions.UsersWsResponse response = tester.wsClient().permissions().users(request);
- Optional<WsPermissions.User> found = response.getUsersList().stream()
+ Permissions.UsersWsResponse response = tester.wsClient().permissions().users(request);
+ Optional<Permissions.User> found = response.getUsersList().stream()
.filter(u -> user.getLogin().equals(u.getLogin()))
.findFirst();
return found.isPresent();
import org.junit.Test;
import org.junit.rules.RuleChain;
import org.sonarqube.qa.util.Tester;
-import org.sonarqube.ws.WsProjects.CreateWsResponse.Project;
+import org.sonarqube.ws.Projects.CreateWsResponse.Project;
import org.sonarqube.ws.client.permission.AddGroupWsRequest;
import org.sonarqube.ws.client.permission.AddUserWsRequest;
import org.sonarqube.ws.client.permission.RemoveGroupWsRequest;
import org.junit.rules.Timeout;
import org.sonarqube.qa.util.LogsTailer;
import org.sonarqube.ws.client.WsClient;
-import org.sonarqube.ws.client.ce.ActivityStatusWsRequest;
+import org.sonarqube.ws.client.ce.ActivityStatusRequest;
import util.ItUtils;
import static com.google.common.base.Preconditions.checkState;
}
int countInProgressTasks() {
- return adminWsClient.ce().activityStatus(ActivityStatusWsRequest.newBuilder().build()).getInProgress();
+ return adminWsClient.ce().activityStatus(new ActivityStatusRequest()).getInProgress();
}
boolean hasTaskFinishedSuccessfully() throws Exception {
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
-import org.sonarqube.ws.WsCe;
+import org.sonarqube.ws.Ce;
+import org.sonarqube.ws.Ce;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsClient;
-import org.sonarqube.ws.client.ce.ActivityWsRequest;
+import org.sonarqube.ws.client.ce.ActivityRequest;
import util.ItUtils;
import static com.google.common.collect.ImmutableSet.copyOf;
waitForEmptyQueue();
- assertThat(adminWsClient.ce().activity(new ActivityWsRequest()
+ assertThat(adminWsClient.ce().activity(new ActivityRequest()
.setType("OOM")
.setStatus(ImmutableList.of("FAILED")))
.getTasksCount())
waitForEmptyQueue();
- assertThat(adminWsClient.ce().activity(new ActivityWsRequest()
+ assertThat(adminWsClient.ce().activity(new ActivityRequest()
.setType("OK")
.setStatus(ImmutableList.of("SUCCESS")))
.getTasksCount())
waitForEmptyQueue();
- assertThat(adminWsClient.ce().activity(new ActivityWsRequest()
+ assertThat(adminWsClient.ce().activity(new ActivityRequest()
.setType("ISE")
.setStatus(ImmutableList.of("FAILED")))
.getTasksCount())
waitForEmptyQueue();
- assertThat(adminWsClient.ce().activity(new ActivityWsRequest()
+ assertThat(adminWsClient.ce().activity(new ActivityRequest()
.setType("OK")
.setStatus(ImmutableList.of("SUCCESS")))
.getTasksCount())
@Test
public void ce_worker_is_resilient_to_OOM_and_RuntimeException_when_starting_or_stopping_analysis_report_container() throws IOException {
- int initSuccessReportTaskCount = adminWsClient.ce().activity(new ActivityWsRequest()
+ int initSuccessReportTaskCount = adminWsClient.ce().activity(new ActivityRequest()
.setType("REPORT")
.setStatus(ImmutableList.of("SUCCESS")))
.getTasksCount();
- int initFailedReportTaskCount = adminWsClient.ce().activity(new ActivityWsRequest()
+ int initFailedReportTaskCount = adminWsClient.ce().activity(new ActivityRequest()
.setType("REPORT")
.setStatus(ImmutableList.of("FAILED")))
.getTasksCount();
orchestrator.executeBuild(sonarRunner, true);
// failure while starting components does fail the tasks
- assertThat(adminWsClient.ce().activity(new ActivityWsRequest()
+ assertThat(adminWsClient.ce().activity(new ActivityRequest()
.setType("REPORT")
.setStatus(ImmutableList.of("FAILED")))
.getTasksCount())
.isEqualTo(initFailedReportTaskCount + 2);
// failure while stopping components does not fail the tasks
- assertThat(adminWsClient.ce().activity(new ActivityWsRequest()
+ assertThat(adminWsClient.ce().activity(new ActivityRequest()
.setType("REPORT")
.setStatus(ImmutableList.of("SUCCESS")))
.getTasksCount())
private void verifyAnalysesRunInParallel(MappedByteBuffer mappedByteBuffer, int workerCount) {
assertThat(adminWsClient.ce().workerCount())
- .extracting(WsCe.WorkerCountResponse::getValue, WsCe.WorkerCountResponse::getCanSetWorkerCount)
+ .extracting(Ce.WorkerCountResponse::getValue, Ce.WorkerCountResponse::getCanSetWorkerCount)
.containsOnly(workerCount, true);
blockAnyAnalysisWithFakeGovernancePlugin(mappedByteBuffer);
orchestrator.executeBuild(sonarRunner, false);
}
- List<WsCe.Task> tasksList = waitForWsCallStatus(
+ List<Ce.Task> tasksList = waitForWsCallStatus(
this::getTasksAllTasks,
(tasks) -> verifyInProgressTaskCount(tasks, workerCount));
assertThat(tasksList.stream()
.filter(CeWorkersTest::pending)
- .map(WsCe.Task::getComponentKey)
+ .map(Ce.Task::getComponentKey)
.collect(toSet()))
.isEqualTo(copyOf(projectKeys.subList(workerCount, projectKeys.size())));
assertThat(tasksList.stream()
.filter(CeWorkersTest::inProgress)
- .map(WsCe.Task::getComponentKey)
+ .map(Ce.Task::getComponentKey)
.collect(toSet()))
.isEqualTo(copyOf(projectKeys.subList(0, workerCount)));
}
}
- private static boolean verifyInProgressTaskCount(List<WsCe.Task> tasksList, int workerCount) {
+ private static boolean verifyInProgressTaskCount(List<Ce.Task> tasksList, int workerCount) {
return tasksList.stream().filter(CeWorkersTest::inProgress).count() >= workerCount;
}
- private static boolean pending(WsCe.Task task) {
- return WsCe.TaskStatus.PENDING == task.getStatus();
+ private static boolean pending(Ce.Task task) {
+ return Ce.TaskStatus.PENDING == task.getStatus();
}
- private static boolean inProgress(WsCe.Task task) {
- return WsCe.TaskStatus.IN_PROGRESS == task.getStatus();
+ private static boolean inProgress(Ce.Task task) {
+ return Ce.TaskStatus.IN_PROGRESS == task.getStatus();
}
- private List<WsCe.Task> getTasksAllTasks(WsClient wsClient) {
- return wsClient.ce().activity(new ActivityWsRequest()
+ private List<Ce.Task> getTasksAllTasks(WsClient wsClient) {
+ return wsClient.ce().activity(new ActivityRequest()
.setStatus(ImmutableList.of(STATUS_PENDING, STATUS_IN_PROGRESS)))
.getTasksList();
}
int tasksCount;
do {
Thread.sleep(delay);
- tasksCount = adminWsClient.ce().activity(new ActivityWsRequest()
+ tasksCount = adminWsClient.ce().activity(new ActivityRequest()
.setStatus(ImmutableList.of("PENDING", "IN_PROGRESS")))
.getTasksCount();
i++;
import com.sonar.orchestrator.Orchestrator;
import com.sonar.orchestrator.build.BuildResult;
import com.sonar.orchestrator.build.SonarScanner;
-import org.sonarqube.tests.Category4Suite;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
-import org.sonarqube.ws.WsCe;
+import org.sonarqube.tests.Category4Suite;
+import org.sonarqube.ws.Ce;
+import org.sonarqube.ws.Ce;
import org.sonarqube.ws.client.WsClient;
-import org.sonarqube.ws.client.ce.ActivityWsRequest;
+import org.sonarqube.ws.client.ce.ActivityRequest;
+import org.sonarqube.ws.client.ce.TaskRequest;
import util.ItUtils;
import static com.google.common.collect.Lists.newArrayList;
@Test
public void activity() {
- WsCe.ActivityResponse response = wsClient.ce().activity(new ActivityWsRequest()
+ Ce.ActivityResponse response = wsClient.ce().activity(new ActivityRequest()
.setStatus(newArrayList("SUCCESS"))
.setType("REPORT")
- .setOnlyCurrents(true)
- .setPage(1)
- .setPageSize(100));
+ .setOnlyCurrents(String.valueOf(true))
+ .setP(String.valueOf(1))
+ .setPs(String.valueOf(100)));
assertThat(response).isNotNull();
assertThat(response.getTasksCount()).isGreaterThan(0);
- WsCe.Task firstTask = response.getTasks(0);
+ Ce.Task firstTask = response.getTasks(0);
assertThat(firstTask.getId()).isNotEmpty();
}
@Test
public void task() {
- WsCe.TaskResponse taskResponse = wsClient.ce().task(taskUuid);
+ Ce.TaskResponse taskResponse = wsClient.ce().task(new TaskRequest().setId(taskUuid));
assertThat(taskResponse.hasTask()).isTrue();
- WsCe.Task task = taskResponse.getTask();
+ Ce.Task task = taskResponse.getTask();
assertThat(task.getId()).isEqualTo(taskUuid);
assertThat(task.hasErrorMessage()).isFalse();
assertThat(task.hasHasScannerContext()).isTrue();
@Test
public void task_types() {
- WsCe.TaskTypesWsResponse response = wsClient.ce().taskTypes();
+ Ce.TaskTypesWsResponse response = wsClient.ce().taskTypes();
assertThat(response).isNotNull();
assertThat(response.getTaskTypesCount()).isGreaterThan(0);
import org.sonarqube.tests.Category6Suite;
import org.sonarqube.qa.util.Tester;
import org.sonarqube.ws.Organizations;
-import org.sonarqube.ws.WsProjects;
-import org.sonarqube.ws.WsUsers;
+import org.sonarqube.ws.Projects;
+import org.sonarqube.ws.Users;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsClient;
import org.sonarqube.ws.client.permission.AddUserWsRequest;
@Test
public void send_notification_on_report_processing_failures_to_global_and_project_subscribers() throws Exception {
Organizations.Organization organization = tester.organizations().getDefaultOrganization();
- WsUsers.CreateWsResponse.User user1 = tester.users().generateMember(organization, t -> t.setPassword("user1").setEmail("user1@bar.com"));
- WsUsers.CreateWsResponse.User user2 = tester.users().generateMember(organization, t -> t.setPassword("user2").setEmail("user2@bar.com"));
- WsUsers.CreateWsResponse.User user3 = tester.users().generateMember(organization, t -> t.setPassword("user3").setEmail("user3@bar.com"));
- WsProjects.CreateWsResponse.Project project1 = tester.projects().generate(organization, t -> t.setName("Project1"));
- WsProjects.CreateWsResponse.Project project2 = tester.projects().generate(organization, t -> t.setName("Project2"));
- WsProjects.CreateWsResponse.Project project3 = tester.projects().generate(organization, t -> t.setName("Project3"));
+ Users.CreateWsResponse.User user1 = tester.users().generateMember(organization, t -> t.setPassword("user1").setEmail("user1@bar.com"));
+ Users.CreateWsResponse.User user2 = tester.users().generateMember(organization, t -> t.setPassword("user2").setEmail("user2@bar.com"));
+ Users.CreateWsResponse.User user3 = tester.users().generateMember(organization, t -> t.setPassword("user3").setEmail("user3@bar.com"));
+ Projects.CreateWsResponse.Project project1 = tester.projects().provision(organization, t -> t.setName("Project1"));
+ Projects.CreateWsResponse.Project project2 = tester.projects().provision(organization, t -> t.setName("Project2"));
+ Projects.CreateWsResponse.Project project3 = tester.projects().provision(organization, t -> t.setName("Project3"));
// user 1 is admin of project 1 and will subscribe to global notifications
tester.wsClient().permissions().addUser(new AddUserWsRequest()
.setLogin(user1.getLogin())
assertThat(waitForEmails()).isEmpty();
}
- private static void assertSubjectAndContent(WsProjects.CreateWsResponse.Project project, List<MimeMessage> messages) {
+ private static void assertSubjectAndContent(Projects.CreateWsResponse.Project project, List<MimeMessage> messages) {
assertThat(messages.stream().map(toSubject()).collect(Collectors.toSet()))
.containsOnly("[SONARQUBE] " + project.getName() + ": Background task in failure");
Set<String> content = messages.stream().map(toContent()).collect(Collectors.toSet());
};
}
- private void subscribeToReportFailures(WsUsers.CreateWsResponse.User user1, String password, @Nullable WsProjects.CreateWsResponse.Project project) {
+ private void subscribeToReportFailures(Users.CreateWsResponse.User user1, String password, @Nullable Projects.CreateWsResponse.Project project) {
WsClient wsClient = newUserWsClient(orchestrator, user1.getLogin(), password);
PostRequest request = new PostRequest("api/notifications/add")
.setParam("type", "CeReportTaskFailure")
.failIfNotSuccessful();
}
- private void unsubscribeFromReportFailures(WsUsers.CreateWsResponse.User user1, String password, @Nullable WsProjects.CreateWsResponse.Project project) {
+ private void unsubscribeFromReportFailures(Users.CreateWsResponse.User user1, String password, @Nullable Projects.CreateWsResponse.Project project) {
WsClient wsClient = newUserWsClient(orchestrator, user1.getLogin(), password);
PostRequest request = new PostRequest("api/notifications/remove")
.setParam("type", "CeReportTaskFailure")
.failIfNotSuccessful();
}
- private void executeAnalysis(WsProjects.CreateWsResponse.Project project) {
+ private void executeAnalysis(Projects.CreateWsResponse.Project project) {
SonarScanner sonarScanner = SonarScanner.create(projectDir("shared/xoo-sample"),
"sonar.projectKey", project.getKey(),
"sonar.projectName", project.getName());
import org.junit.Test;
import org.sonarqube.qa.util.Tester;
import org.sonarqube.ws.Common;
-import org.sonarqube.ws.WsBranches;
+import org.sonarqube.ws.ProjectBranches;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.WsResponse;
import util.ItUtils;
public void list_branches_contains_main_branch() {
runProjectAnalysis(orchestrator, "shared/xoo-sample");
- WsBranches.ListWsResponse result = tester.wsClient().projectBranches().list("sample");
+ ProjectBranches.ListWsResponse result = tester.wsClient().projectBranches().list("sample");
assertThat(result.getBranchesList())
- .extracting(WsBranches.Branch::getName, WsBranches.Branch::getType, WsBranches.Branch::getIsMain)
+ .extracting(ProjectBranches.Branch::getName, ProjectBranches.Branch::getType, ProjectBranches.Branch::getIsMain)
.containsExactlyInAnyOrder(Tuple.tuple("master", Common.BranchType.LONG, true));
}
import org.junit.Rule;
import org.junit.Test;
import org.sonarqube.qa.util.Tester;
-import org.sonarqube.ws.WsProjects.CreateWsResponse.Project;
+import org.sonarqube.ws.Projects.CreateWsResponse.Project;
import static util.ItUtils.projectDir;
@Test
public void code_page() {
- Project project = tester.projects().generate(null);
+ Project project = tester.projects().provision();
executeAnalysis(project);
tester.openBrowser().openCode(project.getKey())
@Test
public void expand_root_dir() {
- Project project = tester.projects().generate(null);
+ Project project = tester.projects().provision();
executeAnalysis(project, "shared/xoo-sample-with-root-dir");
tester.openBrowser().openCode(project.getKey())
import org.junit.Test;
import org.junit.rules.RuleChain;
import org.sonarqube.qa.util.Tester;
-import org.sonarqube.ws.WsComponents;
+import org.sonarqube.ws.Components;
import org.sonarqube.ws.client.component.SearchWsRequest;
import org.sonarqube.ws.client.component.ShowWsRequest;
@Test
public void show() {
- WsComponents.ShowWsResponse response = tester.wsClient().components().show(new ShowWsRequest().setKey(FILE_KEY));
+ Components.ShowWsResponse response = tester.wsClient().components().show(new ShowWsRequest().setKey(FILE_KEY));
assertThat(response).isNotNull();
assertThat(response.getComponent().getKey()).isEqualTo(FILE_KEY);
@Test
public void search() {
- WsComponents.SearchWsResponse response = tester.wsClient().components().search(new SearchWsRequest()
+ Components.SearchWsResponse response = tester.wsClient().components().search(new SearchWsRequest()
.setQualifiers(singletonList("FIL")));
assertThat(response).isNotNull();
import org.junit.Test;
import org.junit.rules.RuleChain;
import org.sonarqube.qa.util.Tester;
-import org.sonarqube.ws.WsMeasures;
+import org.sonarqube.ws.Measures;
import static java.lang.Double.parseDouble;
import static org.assertj.core.api.Assertions.assertThat;
@Test
public void new_duplications_on_project() throws Exception {
- Map<String, WsMeasures.Measure> measures = getMeasures("new-duplications");
+ Map<String, Measures.Measure> measures = getMeasures("new-duplications");
assertThat(parseDouble(measures.get("new_lines").getPeriods().getPeriodsValue(0).getValue())).isEqualTo(83d, DEFAULT_OFFSET);
assertThat(parseDouble(measures.get("new_duplicated_lines").getPeriods().getPeriodsValue(0).getValue())).isEqualTo(71d, DEFAULT_OFFSET);
assertThat(parseDouble(measures.get("new_duplicated_lines_density").getPeriods().getPeriodsValue(0).getValue())).isEqualTo(85.5d, DEFAULT_OFFSET);
@Test
public void new_duplications_on_directory() throws Exception {
- Map<String, WsMeasures.Measure> measures = getMeasures("new-duplications:src/main/xoo/duplicated_lines_with_other_dir1");
+ Map<String, Measures.Measure> measures = getMeasures("new-duplications:src/main/xoo/duplicated_lines_with_other_dir1");
assertThat(parseDouble(measures.get("new_lines").getPeriods().getPeriodsValue(0).getValue())).isEqualTo(24d, DEFAULT_OFFSET);
assertThat(parseDouble(measures.get("new_duplicated_lines").getPeriods().getPeriodsValue(0).getValue())).isEqualTo(24d, DEFAULT_OFFSET);
assertThat(parseDouble(measures.get("new_duplicated_lines_density").getPeriods().getPeriodsValue(0).getValue())).isEqualTo(100d, DEFAULT_OFFSET);
@Test
public void new_duplications_on_file() throws Exception {
- Map<String, WsMeasures.Measure> measures = getMeasures("new-duplications:src/main/xoo/duplicated_lines_within_same_file/DuplicatedLinesInSameFile.xoo");
+ Map<String, Measures.Measure> measures = getMeasures("new-duplications:src/main/xoo/duplicated_lines_within_same_file/DuplicatedLinesInSameFile.xoo");
assertThat(parseDouble(measures.get("new_lines").getPeriods().getPeriodsValue(0).getValue())).isEqualTo(41d, DEFAULT_OFFSET);
assertThat(parseDouble(measures.get("new_duplicated_lines").getPeriods().getPeriodsValue(0).getValue())).isEqualTo(29d, DEFAULT_OFFSET);
assertThat(parseDouble(measures.get("new_duplicated_lines_density").getPeriods().getPeriodsValue(0).getValue())).isEqualTo(70.7d, DEFAULT_OFFSET);
assertThat(parseDouble(measures.get("new_duplicated_blocks").getPeriods().getPeriodsValue(0).getValue())).isEqualTo(2d, DEFAULT_OFFSET);
}
- private static Map<String, WsMeasures.Measure> getMeasures(String key) {
+ private static Map<String, Measures.Measure> getMeasures(String key) {
return getMeasuresWithVariationsByMetricKey(orchestrator, key, "new_lines", "new_duplicated_lines", "new_duplicated_lines_density", "new_duplicated_blocks");
}
}
import org.junit.Test;
import org.sonar.wsclient.issue.Issue;
import org.sonar.wsclient.issue.IssueQuery;
-import org.sonarqube.ws.WsUsers;
+import org.sonarqube.ws.Users;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsClient;
import org.sonarqube.ws.client.user.CreateRequest;
private static void deleteAllUsers() {
WsClient wsClient = newAdminWsClient(ORCHESTRATOR);
- WsUsers.SearchWsResponse searchResponse = wsClient.users().search(SearchRequest.builder().build());
+ Users.SearchWsResponse searchResponse = wsClient.users().search(SearchRequest.builder().build());
searchResponse.getUsersList().forEach(user -> {
wsClient.wsConnector().call(new PostRequest("api/users/deactivate").setParam("login", user.getLogin()));
});
import org.sonarqube.ws.Issues.Issue;
import org.sonarqube.ws.Issues.SearchWsResponse;
import org.sonarqube.ws.Organizations.Organization;
-import org.sonarqube.ws.QualityProfiles;
-import org.sonarqube.ws.WsProjects.CreateWsResponse.Project;
-import org.sonarqube.ws.WsUsers;
-import org.sonarqube.ws.WsUsers.CreateWsResponse.User;
+import org.sonarqube.ws.Qualityprofiles;
+import org.sonarqube.ws.Projects.CreateWsResponse.Project;
+import org.sonarqube.ws.Users;
+import org.sonarqube.ws.Users.CreateWsResponse.User;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsClient;
import org.sonarqube.ws.client.issue.AssignRequest;
private void createSampleProject(String visibility) {
// Create project
- QualityProfiles.CreateWsResponse.QualityProfile profile = tester.qProfiles().createXooProfile(organization);
- Project project = tester.projects().generate(organization, p -> p.setKey(PROJECT_KEY)
+ Qualityprofiles.CreateWsResponse.QualityProfile profile = tester.qProfiles().createXooProfile(organization);
+ Project project = tester.projects().provision(organization, p -> p.setKey(PROJECT_KEY)
.setName("Sample")
.setVisibility(visibility));
tester.qProfiles()
}).collect(Collectors.toList());
}
- private void addNotificationsTo(WsUsers.CreateWsResponse.User user) {
+ private void addNotificationsTo(Users.CreateWsResponse.User user) {
// Add notifications to the test user
WsClient wsClient = tester.as(user.getLogin()).wsClient();
wsClient.wsConnector().call(new PostRequest("api/notifications/add")
import org.junit.Test;
import org.sonarqube.qa.util.Tester;
import org.sonarqube.ws.Organizations.Organization;
-import org.sonarqube.ws.WsUsers.CreateWsResponse.User;
+import org.sonarqube.ws.Users.CreateWsResponse.User;
import org.sonarqube.ws.client.issue.SearchWsRequest;
import org.sonarqube.ws.client.permission.AddUserWsRequest;
import org.sonarqube.ws.client.project.CreateRequest;
import org.junit.Before;
import org.junit.Test;
import org.sonar.wsclient.issue.IssueQuery;
-import org.sonarqube.ws.WsMeasures;
-import org.sonarqube.ws.WsMeasures.Measure;
+import org.sonarqube.ws.Measures;
+import org.sonarqube.ws.Measures.Measure;
import util.ItUtils;
import static java.lang.Integer.parseInt;
assertThat(ORCHESTRATOR.getServer().wsClient().issueClient().find(IssueQuery.create()).list()).isNotEmpty();
Map<String, Measure> measures = getMeasuresWithVariationsByMetricKey(ORCHESTRATOR, "sample", "new_violations", "violations", "ncloc");
- assertThat(measures.get("new_violations").getPeriods().getPeriodsValueList()).extracting(WsMeasures.PeriodValue::getValue).containsOnly("17");
+ assertThat(measures.get("new_violations").getPeriods().getPeriodsValueList()).extracting(Measures.PeriodValue::getValue).containsOnly("17");
Measure violations = measures.get("violations");
assertThat(parseInt(violations.getValue())).isEqualTo(43);
import org.sonarqube.ws.Issues;
import org.sonarqube.ws.Issues.Issue;
import org.sonarqube.ws.Organizations;
-import org.sonarqube.ws.WsUsers.CreateWsResponse.User;
+import org.sonarqube.ws.Users.CreateWsResponse.User;
import org.sonarqube.ws.client.issue.AssignRequest;
import org.sonarqube.ws.client.issue.BulkChangeRequest;
import org.sonarqube.ws.client.issue.SearchWsRequest;
import org.sonarqube.tests.Category6Suite;
import org.sonarqube.qa.util.Tester;
import org.sonarqube.ws.Organizations;
-import org.sonarqube.ws.WsUsers;
+import org.sonarqube.ws.Users;
import util.issue.IssueRule;
import static util.ItUtils.restoreProfile;
private Organizations.Organization org1;
private Organizations.Organization org2;
- private WsUsers.CreateWsResponse.User user1;
- private WsUsers.CreateWsResponse.User user2;
+ private Users.CreateWsResponse.User user1;
+ private Users.CreateWsResponse.User user2;
@Before
public void setUp() throws Exception {
}
private String provisionProject(Organizations.Organization organization) {
- return tester.projects().generate(organization).getKey();
+ return tester.projects().provision(organization).getKey();
}
private void analyseProject(String projectKey, String organization) {
import org.junit.rules.RuleChain;
import org.sonarqube.qa.util.Tester;
import org.sonarqube.ws.Issues;
-import org.sonarqube.ws.WsComponents;
-import org.sonarqube.ws.WsMeasures;
+import org.sonarqube.ws.Components;
+import org.sonarqube.ws.Measures;
import org.sonarqube.ws.client.component.TreeWsRequest;
import org.sonarqube.ws.client.issue.IssuesService;
import org.sonarqube.ws.client.issue.SearchWsRequest;
@Test
public void call_components_ws() {
// files in project
- WsComponents.TreeWsResponse tree = tester.wsClient().components().tree(new TreeWsRequest()
+ Components.TreeWsResponse tree = tester.wsClient().components().tree(new TreeWsRequest()
.setBaseComponentKey(PROJECT_KEY)
.setQualifiers(singletonList("FIL")));
assertThat(tree.getComponentsCount()).isEqualTo(4);
public void call_measures_ws() {
// project measures
MeasuresService measuresService = tester.wsClient().measures();
- WsMeasures.ComponentWsResponse component = measuresService.component(new ComponentWsRequest()
+ Measures.ComponentWsResponse component = measuresService.component(new ComponentWsRequest()
.setComponentKey(PROJECT_KEY)
.setMetricKeys(asList("lines", "ncloc", "files")));
assertThat(component.getComponent().getMeasuresCount()).isEqualTo(3);
// file measures
- WsMeasures.ComponentTreeWsResponse tree = measuresService.componentTree(new ComponentTreeWsRequest()
+ Measures.ComponentTreeWsResponse tree = measuresService.componentTree(new ComponentTreeWsRequest()
.setBaseComponentKey(PROJECT_KEY)
.setQualifiers(singletonList("FIL"))
.setMetricKeys(asList("lines", "ncloc")));
import org.junit.Rule;
import org.junit.Test;
import org.sonarqube.qa.util.Tester;
-import org.sonarqube.ws.WsMeasures;
-import org.sonarqube.ws.WsMeasures.ComponentTreeWsResponse;
-import org.sonarqube.ws.WsMeasures.ComponentWsResponse;
+import org.sonarqube.ws.Measures;
+import org.sonarqube.ws.Measures.ComponentTreeWsResponse;
+import org.sonarqube.ws.Measures.ComponentWsResponse;
import org.sonarqube.ws.client.measure.ComponentTreeWsRequest;
import org.sonarqube.ws.client.measure.ComponentWsRequest;
assertThat(response).isNotNull();
assertThat(response.getBaseComponent().getKey()).isEqualTo("sample");
assertThat(response.getMetrics().getMetricsList()).extracting("key").containsOnly("ncloc");
- List<WsMeasures.Component> components = response.getComponentsList();
+ List<Measures.Component> components = response.getComponentsList();
assertThat(components).hasSize(2).extracting("key").containsOnly(DIR_KEY, FILE_KEY);
assertThat(components.get(0).getMeasuresList().get(0).getValue()).isEqualTo("13");
}
.setMetricKeys(singletonList("ncloc"))
.setAdditionalFields(newArrayList("metrics", "periods")));
- WsMeasures.Component component = response.getComponent();
+ Measures.Component component = response.getComponent();
assertThat(component.getKey()).isEqualTo("sample");
assertThat(component.getMeasuresList()).isNotEmpty();
assertThat(response.getMetrics().getMetricsList()).extracting("key").containsOnly("ncloc");
import static java.lang.Integer.parseInt;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.sonarqube.ws.WsMeasures.Measure;
-import static org.sonarqube.ws.WsMeasures.PeriodValue;
+import static org.sonarqube.ws.Measures.Measure;
+import static org.sonarqube.ws.Measures.PeriodValue;
import static util.ItUtils.getLeakPeriodValue;
import static util.ItUtils.getMeasureWithVariation;
import static util.ItUtils.projectDir;
import org.junit.Test;
import org.junit.rules.RuleChain;
import org.sonarqube.qa.util.Tester;
-import org.sonarqube.ws.WsMeasures;
+import org.sonarqube.ws.Measures;
import util.ItUtils;
import static java.lang.Integer.parseInt;
}
private void checkMeasure(String metric, int variation) {
- WsMeasures.Measure measure = getMeasureWithVariation(orchestrator, PROJECT, metric);
+ Measures.Measure measure = getMeasureWithVariation(orchestrator, PROJECT, metric);
assertThat(measure.getPeriods().getPeriodsValueList()).extracting(periodValue -> parseInt(periodValue.getValue())).containsOnly(variation);
}
import org.junit.Test;
import org.junit.rules.RuleChain;
import org.sonarqube.qa.util.Tester;
-import org.sonarqube.ws.WsMeasures.Measure;
-import org.sonarqube.ws.WsMeasures.SearchHistoryResponse;
-import org.sonarqube.ws.WsMeasures.SearchHistoryResponse.HistoryValue;
+import org.sonarqube.ws.Measures.Measure;
+import org.sonarqube.ws.Measures.SearchHistoryResponse;
+import org.sonarqube.ws.Measures.SearchHistoryResponse.HistoryValue;
import org.sonarqube.ws.client.measure.SearchHistoryRequest;
import util.ItUtils;
import util.ItUtils.ComponentNavigation;
import org.sonarqube.qa.util.Tester;
import org.sonarqube.qa.util.pageobjects.Navigation;
import org.sonarqube.ws.Organizations;
-import org.sonarqube.ws.WsUsers.CreateWsResponse.User;
+import org.sonarqube.ws.Users.CreateWsResponse.User;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.WsResponse;
+import org.sonarqube.ws.client.ce.TaskRequest;
import org.sonarqube.ws.client.organization.UpdateProjectVisibilityWsRequest;
import org.sonarqube.ws.client.project.CreateRequest;
import org.sonarqube.ws.client.project.UpdateVisibilityRequest;
import static java.lang.String.format;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.sonarqube.ws.WsCe.TaskResponse;
+import static org.sonarqube.ws.Ce.TaskResponse;
import static util.ItUtils.expectHttpError;
import static util.ItUtils.newProjectKey;
import static util.ItUtils.projectDir;
String taskUuid = executeAnalysis(newProjectKey());
- TaskResponse taskResponse = tester.wsClient().ce().task(taskUuid);
+ TaskResponse taskResponse = tester.wsClient().ce().task(new TaskRequest().setId(taskUuid));
assertThat(taskResponse.getTask().hasErrorMessage()).isFalse();
}
String taskUuid = executeAnalysis(newProjectKey());
- TaskResponse taskResponse = tester.wsClient().ce().task(taskUuid);
+ TaskResponse taskResponse = tester.wsClient().ce().task(new TaskRequest().setId(taskUuid));
assertThat(taskResponse.getTask().hasErrorMessage()).isTrue();
assertThat(taskResponse.getTask().getErrorMessage()).contains(format("Organization %s cannot perform analysis", organization.getKey()));
}
}
private String createPublicProject() {
- return tester.projects().generate(organization).getKey();
+ return tester.projects().provision(organization).getKey();
}
private String executeAnalysis(String projectKey) {
import org.junit.rules.ExpectedException;
import org.sonarqube.qa.util.Tester;
import org.sonarqube.ws.Organizations.Organization;
-import org.sonarqube.ws.WsUsers.CreateWsResponse.User;
+import org.sonarqube.ws.Users.CreateWsResponse.User;
import org.sonarqube.ws.client.HttpException;
import org.sonarqube.ws.client.permission.AddUserWsRequest;
import org.sonarqube.qa.util.Tester;
import org.sonarqube.qa.util.pageobjects.organization.MembersPage;
import org.sonarqube.ws.Organizations.Organization;
-import org.sonarqube.ws.WsUsers.CreateWsResponse.User;
+import org.sonarqube.ws.Users.CreateWsResponse.User;
public class OrganizationMembershipUiTest {
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
-import org.junit.rules.ExpectedException;
import org.sonarqube.qa.util.OrganizationTester;
import org.sonarqube.qa.util.Tester;
+import org.sonarqube.ws.Components;
import org.sonarqube.ws.Organizations.Organization;
-import org.sonarqube.ws.QualityProfiles;
+import org.sonarqube.ws.Qualityprofiles;
import org.sonarqube.ws.Rules;
-import org.sonarqube.ws.WsComponents;
-import org.sonarqube.ws.WsUserGroups.Group;
-import org.sonarqube.ws.WsUsers;
-import org.sonarqube.ws.WsUsers.CreateWsResponse.User;
+import org.sonarqube.ws.UserGroups.Group;
+import org.sonarqube.ws.Users;
+import org.sonarqube.ws.Users.CreateWsResponse.User;
import org.sonarqube.ws.client.component.ComponentsService;
import org.sonarqube.ws.client.organization.CreateWsRequest;
import org.sonarqube.ws.client.organization.OrganizationService;
import static util.ItUtils.expectNotFoundError;
import static util.ItUtils.expectUnauthorizedError;
import static util.ItUtils.runProjectAnalysis;
-import static util.ItUtils.setServerProperty;
public class OrganizationTest {
private static final String SETTING_ANYONE_CAN_CREATE_ORGANIZATIONS = "sonar.organizations.anyoneCanCreate";
private static final String DEFAULT_ORGANIZATION_KEY = "default-organization";
private static final String NAME = "Foo Company";
- // private static final String KEY = "foo-company";
private static final String DESCRIPTION = "the description of Foo company";
private static final String URL = "https://www.foo.fr";
private static final String AVATAR_URL = "https://www.foo.fr/corporate_logo.png";
@ClassRule
public static Orchestrator orchestrator = OrganizationSuite.ORCHESTRATOR;
+
@Rule
public Tester tester = new Tester(orchestrator);
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
@After
public void tearDown() {
- setServerProperty(orchestrator, SETTING_ANYONE_CAN_CREATE_ORGANIZATIONS, null);
+ tester.settings().resetSettings(SETTING_ANYONE_CAN_CREATE_ORGANIZATIONS);
}
@Test
Group group = tester.groups().generate(organization);
tester.groups().addMemberToGroups(organization, user.getLogin(), group.getName());
- List<WsUsers.GroupsWsResponse.Group> memberOfGroups = tester.groups().getGroupsOfUser(organization, user.getLogin());
+ List<Users.GroupsWsResponse.Group> memberOfGroups = tester.groups().getGroupsOfUser(organization, user.getLogin());
- assertThat(memberOfGroups).extracting(WsUsers.GroupsWsResponse.Group::getName)
+ assertThat(memberOfGroups).extracting(Users.GroupsWsResponse.Group::getName)
.containsExactlyInAnyOrder(group.getName(), "Members");
}
@Test
public void anonymous_cannot_create_organizations_even_if_anyone_is_allowed_to() {
- setServerProperty(orchestrator, SETTING_ANYONE_CAN_CREATE_ORGANIZATIONS, "true");
+ tester.settings().setGlobalSettings(SETTING_ANYONE_CAN_CREATE_ORGANIZATIONS, "true");
expectUnauthorizedError(() -> tester.asAnonymous().organizations().generate());
}
@Test
public void logged_in_user_can_create_organizations_if_anyone_is_allowed_to() {
- setServerProperty(orchestrator, SETTING_ANYONE_CAN_CREATE_ORGANIZATIONS, "true");
+ tester.settings().setGlobalSettings(SETTING_ANYONE_CAN_CREATE_ORGANIZATIONS, "true");
User user = tester.users().generate();
Organization organization = tester.as(user.getLogin()).organizations().generate();
.hasSize(1);
}
- private WsComponents.SearchWsResponse searchSampleProject(String organizationKey, ComponentsService componentsService) {
+ private Components.SearchWsResponse searchSampleProject(String organizationKey, ComponentsService componentsService) {
return componentsService
.search(new org.sonarqube.ws.client.component.SearchWsRequest()
.setOrganization(organizationKey)
}
private void verifyOrganization(Organization createdOrganization, String name, String description, String url,
- String avatarUrl) {
+ String avatarUrl) {
SearchWsRequest request = new SearchWsRequest.Builder().setOrganizations(createdOrganization.getKey()).build();
List<Organization> result = tester.organizations().service().search(request).getOrganizationsList();
assertThat(result).hasSize(1);
private void assertThatBuiltInQualityProfilesExist(Organization org) {
org.sonarqube.ws.client.qualityprofile.SearchWsRequest profilesRequest = new org.sonarqube.ws.client.qualityprofile.SearchWsRequest()
.setOrganizationKey(org.getKey());
- QualityProfiles.SearchWsResponse response = tester.wsClient().qualityProfiles().search(profilesRequest);
+ Qualityprofiles.SearchWsResponse response = tester.wsClient().qualityProfiles().search(profilesRequest);
assertThat(response.getProfilesCount()).isGreaterThan(0);
response.getProfilesList().forEach(p -> {
import org.openqa.selenium.By;
import org.sonarqube.qa.util.Tester;
import org.sonarqube.ws.Organizations.Organization;
-import org.sonarqube.ws.WsUsers.CreateWsResponse.User;
+import org.sonarqube.ws.Users.CreateWsResponse.User;
import static com.codeborne.selenide.Condition.text;
import static com.codeborne.selenide.Selenide.$;
import com.sonar.orchestrator.Orchestrator;
import java.util.List;
-import org.junit.After;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.sonarqube.qa.util.Tester;
import org.sonarqube.ws.Organizations;
-import org.sonarqube.ws.WsUsers;
+import org.sonarqube.ws.Users;
import org.sonarqube.ws.client.organization.SearchWsRequest;
import static org.assertj.core.api.Assertions.assertThat;
-import static util.ItUtils.setServerProperty;
public class PersonalOrganizationTest {
@Before
public void setUp() {
- setServerProperty(orchestrator, SETTING_CREATE_PERSONAL_ORG, "true");
- }
-
- @After
- public void tearDown() {
- setServerProperty(orchestrator, SETTING_CREATE_PERSONAL_ORG, null);
+ tester.settings().setGlobalSettings(SETTING_CREATE_PERSONAL_ORG, "true");
}
@Test
public void personal_organizations_are_created_for_new_users() {
- WsUsers.CreateWsResponse.User user = tester.users().generate();
+ Users.CreateWsResponse.User user = tester.users().generate();
List<Organizations.Organization> existing = tester.wsClient().organizations().search(SearchWsRequest.builder().build()).getOrganizationsList();
assertThat(existing)
- .filteredOn(o -> o.getGuarded())
+ .filteredOn(Organizations.Organization::getGuarded)
.filteredOn(o -> o.getKey().equals(user.getLogin()))
.hasSize(1)
.matches(l -> l.get(0).getName().equals(user.getName()));
import org.junit.Test;
import org.sonarqube.qa.util.Tester;
import org.sonarqube.qa.util.TesterSession;
-import org.sonarqube.ws.WsRoot;
-import org.sonarqube.ws.WsUsers;
+import org.sonarqube.ws.Root;
+import org.sonarqube.ws.Users;
import util.user.UserRule;
import static org.assertj.core.api.Assertions.assertThat;
@Test
public void system_administrator_is_flagged_as_root_when_he_enables_organization_support() {
assertThat(tester.wsClient().roots().search().getRootsList())
- .extracting(WsRoot.Root::getLogin)
+ .extracting(Root.RootContent::getLogin)
.containsExactly(UserRule.ADMIN_LOGIN);
}
@Test
public void a_root_can_flag_other_user_as_root() {
- WsUsers.CreateWsResponse.User user = tester.users().generate();
+ Users.CreateWsResponse.User user = tester.users().generate();
tester.wsClient().roots().setRoot(user.getLogin());
assertThat(tester.wsClient().roots().search().getRootsList())
- .extracting(WsRoot.Root::getLogin)
+ .extracting(Root.RootContent::getLogin)
.containsExactlyInAnyOrder(UserRule.ADMIN_LOGIN, user.getLogin());
}
@Test
public void root_can_be_set_and_unset_via_web_services() {
- WsUsers.CreateWsResponse.User user1 = tester.users().generate();
- WsUsers.CreateWsResponse.User user2 = tester.users().generate();
+ Users.CreateWsResponse.User user1 = tester.users().generate();
+ Users.CreateWsResponse.User user2 = tester.users().generate();
TesterSession user1Session = tester.as(user1.getLogin());
TesterSession user2Session = tester.as(user2.getLogin());
import java.util.Properties;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
-import org.hamcrest.CustomMatcher;
import org.junit.Rule;
-import org.junit.rules.ErrorCollector;
import org.junit.rules.TestName;
import static org.assertj.core.api.Assertions.assertThat;
assertThat(Math.abs(variation)).as(String.format("Expected %d ms, got %d ms", expectedDuration, duration)).isLessThan(ACCEPTED_DURATION_VARIATION_IN_PERCENTS);
}
- protected void assertDurationAround(ErrorCollector collector, long duration, long expectedDuration) {
- double variation = 100.0 * (0.0 + duration - expectedDuration) / expectedDuration;
- System.out.printf("Test %s : executed in %d ms (%.2f %% from target)\n", testName.getMethodName(), duration, variation);
- collector.checkThat(String.format("Expected %d ms, got %d ms", expectedDuration, duration), Math.abs(variation), new CustomMatcher<Double>("a value less than "
- + ACCEPTED_DURATION_VARIATION_IN_PERCENTS) {
- @Override
- public boolean matches(Object item) {
- return ((item instanceof Double) && ((Double) item).compareTo(ACCEPTED_DURATION_VARIATION_IN_PERCENTS) < 0);
- }
- });
- }
-
protected void assertDurationLessThan(long duration, long maxDuration) {
System.out.printf("Test %s : %d ms (max allowed is %d)\n", testName.getMethodName(), duration, maxDuration);
assertThat(duration).as(String.format("Expected less than %d ms, got %d ms", maxDuration, duration)).isLessThanOrEqualTo(maxDuration);
}
- protected void assertDurationLessThan(ErrorCollector collector, long duration, final long maxDuration) {
- System.out.printf("Test %s : %d ms (max allowed is %d)\n", testName.getMethodName(), duration, maxDuration);
- collector.checkThat(String.format("Expected less than %d ms, got %d ms", maxDuration, duration), duration, new CustomMatcher<Long>("a value less than "
- + maxDuration) {
- @Override
- public boolean matches(Object item) {
- return ((item instanceof Long) && ((Long) item).compareTo(maxDuration) < 0);
- }
- });
- }
-
protected Properties readProfiling(File baseDir, String moduleKey) throws IOException {
File profilingFile = new File(baseDir, ".sonar/profiling/" + moduleKey + "-profiler.properties");
Properties props = new Properties();
package org.sonarqube.tests.performance;
import com.google.common.base.Joiner;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
import org.hamcrest.CustomMatcher;
import org.junit.rules.ErrorCollector;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
public abstract class PerfRule extends ErrorCollector {
private final int runCount;
- private final List<List<Long>> recordedResults = new ArrayList<List<Long>>();
+ private final List<List<Long>> recordedResults = new ArrayList<>();
private int currentRun;
- private String testName;
public PerfRule(int runCount) {
this.runCount = runCount;
@Override
public Statement apply(final Statement base, Description description) {
- this.testName = description.getMethodName();
return new Statement() {
@Override
public void evaluate() throws Throwable {
for (currentRun = 1; currentRun <= runCount; currentRun++) {
- recordedResults.add(new ArrayList<Long>());
+ recordedResults.add(new ArrayList<>());
beforeEachRun();
base.evaluate();
}
long meanDuration = computeAverageDurationOfCurrentStep();
double variation = 100.0 * (0.0 + meanDuration - expectedDuration) / expectedDuration;
checkThat(String.format("Expected %d ms in average, got %d ms [%s]", expectedDuration, meanDuration, Joiner.on(",").join(getAllResultsOfCurrentStep())), Math.abs(variation),
+
new CustomMatcher<Double>(
"a value less than "
+ AbstractPerfTest.ACCEPTED_DURATION_VARIATION_IN_PERCENTS) {
return recordedResults.get(currentRun - 1);
}
- public void assertDurationLessThan(long duration, final long maxDuration) {
- currentResults().add(duration);
- if (isLastRun()) {
- long meanDuration = computeAverageDurationOfCurrentStep();
- checkThat(String.format("Expected less than %d ms in average, got %d ms [%s]", maxDuration, meanDuration, Joiner.on(",").join(getAllResultsOfCurrentStep())), meanDuration,
- new CustomMatcher<Long>("a value less than "
- + maxDuration) {
- @Override
- public boolean matches(Object item) {
- return ((item instanceof Long) && ((Long) item).compareTo(maxDuration) < 0);
- }
- });
- }
- }
-
private boolean isLastRun() {
return currentRun == runCount;
}
import org.junit.rules.ErrorCollector;
import org.junit.rules.TemporaryFolder;
import org.sonarqube.tests.performance.AbstractPerfTest;
-import org.sonarqube.ws.WsMeasures;
+import org.sonarqube.ws.Measures;
import org.sonarqube.ws.client.HttpConnector;
import org.sonarqube.ws.client.WsClient;
import org.sonarqube.ws.client.WsClientFactories;
.setMetricKeys(asList("duplicated_lines", "duplicated_blocks", "duplicated_files", "duplicated_lines_density")))
.getComponent().getMeasuresList()
.stream()
- .collect(Collectors.toMap(WsMeasures.Measure::getMetric, measure -> parseDouble(measure.getValue())));
+ .collect(Collectors.toMap(Measures.Measure::getMetric, measure -> parseDouble(measure.getValue())));
}
private WsClient newWsClient() {
import org.junit.Rule;
import org.junit.Test;
import org.sonarqube.qa.util.Tester;
-import org.sonarqube.ws.WsProjects.CreateWsResponse.Project;
+import org.sonarqube.ws.Projects.CreateWsResponse.Project;
import org.sonarqube.ws.client.component.SearchProjectsRequest;
import static com.codeborne.selenide.Condition.text;
*/
@Test
public void bulk_deletion_on_selected_projects() throws Exception {
- Project project1 = tester.projects().generate(null, t -> t.setName("Foo"));
- Project project2 = tester.projects().generate(null, t -> t.setName("Bar"));
- Project project3 = tester.projects().generate(null, t -> t.setName("FooQux"));
+ Project project1 = tester.projects().provision(p -> p.setName("Foo"));
+ Project project2 = tester.projects().provision(p -> p.setName("Bar"));
+ Project project3 = tester.projects().provision(p -> p.setName("FooQux"));
tester.openBrowser().logIn().submitCredentials(sysAdminLogin).open("/organizations/default-organization/projects_management");
$("#projects-management-page").shouldHave(text(project1.getName())).shouldHave(text(project2.getName())).shouldHave(text(project3.getName()));
import org.junit.Test;
import org.sonarqube.qa.util.Tester;
import org.sonarqube.ws.Organizations;
-import org.sonarqube.ws.WsProjects.CreateWsResponse;
-import org.sonarqube.ws.WsProjects.SearchWsResponse.Component;
+import org.sonarqube.ws.Projects.CreateWsResponse;
+import org.sonarqube.ws.Projects.SearchWsResponse.Component;
import org.sonarqube.ws.client.project.SearchWsRequest;
import static org.assertj.core.api.Assertions.assertThat;
@Test
public void delete_projects() {
Organizations.Organization organization = tester.organizations().generate();
- CreateWsResponse.Project firstProvisionedProject = tester.projects().generate(organization, p -> p.setKey("first-provisioned-project"));
- CreateWsResponse.Project secondProvisionedProject = tester.projects().generate(organization, p -> p.setKey("second-provisioned-project"));
- CreateWsResponse.Project analyzedProject = tester.projects().generate(organization);
+ CreateWsResponse.Project firstProvisionedProject = tester.projects().provision(organization, p -> p.setKey("first-provisioned-project"));
+ CreateWsResponse.Project secondProvisionedProject = tester.projects().provision(organization, p -> p.setKey("second-provisioned-project"));
+ CreateWsResponse.Project analyzedProject = tester.projects().provision(organization);
analyzeProject(analyzedProject.getKey(), organization.getKey());
@Test
public void delete_more_than_50_projects_at_the_same_time() {
Organizations.Organization organization = tester.organizations().generate();
- IntStream.range(0, 60).forEach(i -> tester.projects().generate(organization));
+ IntStream.range(0, 60).forEach(i -> tester.projects().provision(organization));
SearchWsRequest request = SearchWsRequest.builder().setOrganization(organization.getKey()).build();
assertThat(tester.wsClient().projects().search(request).getPaging().getTotal()).isEqualTo(60);
import org.junit.rules.Timeout;
import org.sonarqube.qa.util.Tester;
import org.sonarqube.ws.Organizations;
-import org.sonarqube.ws.WsComponents;
-import org.sonarqube.ws.WsProjects;
-import org.sonarqube.ws.WsProjects.CreateWsResponse.Project;
-import org.sonarqube.ws.WsUsers;
+import org.sonarqube.ws.Components;
+import org.sonarqube.ws.Projects;
+import org.sonarqube.ws.Projects.CreateWsResponse.Project;
+import org.sonarqube.ws.Users;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.WsClient;
import org.sonarqube.ws.client.WsResponse;
ItUtils.expectUnauthorizedError(() -> executeDeleteRequest(tester.asAnonymous().wsClient(), projectKey));
// fail if insufficient privilege
- WsUsers.CreateWsResponse.User user = tester.users().generate();
+ Users.CreateWsResponse.User user = tester.users().generate();
ItUtils.expectForbiddenError(() -> executeDeleteRequest(tester.as(user.getLogin()).wsClient(), projectKey));
// succeed to delete if administrator
* Projects administration page - uses database
*/
private boolean isInProjectsSearch(Organizations.Organization organization, String name) {
- WsProjects.SearchWsResponse response = tester.wsClient().projects().search(
+ Projects.SearchWsResponse response = tester.wsClient().projects().search(
SearchWsRequest.builder().setOrganization(organization.getKey()).setQuery(name).setQualifiers(singletonList("TRK")).build());
return response.getComponentsCount() > 0;
}
* Projects page - api/components/search_projects - uses ES + DB
*/
private boolean isInComponentSearchProjects(String name) {
- WsComponents.SearchProjectsWsResponse response = tester.wsClient().components().searchProjects(
+ Components.SearchProjectsWsResponse response = tester.wsClient().components().searchProjects(
SearchProjectsRequest.builder().setFilter("query=\"" + name + "\"").build());
return response.getComponentsCount() > 0;
}
import org.sonarqube.qa.util.Tester;
import org.sonarqube.ws.Common;
import org.sonarqube.ws.Organizations.Organization;
-import org.sonarqube.ws.WsComponents.Component;
-import org.sonarqube.ws.WsComponents.SearchProjectsWsResponse;
+import org.sonarqube.ws.Components.Component;
+import org.sonarqube.ws.Components.SearchProjectsWsResponse;
import org.sonarqube.ws.client.component.SearchProjectsRequest;
import org.sonarqube.ws.client.project.CreateRequest;
import org.junit.rules.TestRule;
import org.junit.rules.Timeout;
import org.sonarqube.qa.util.Tester;
+import org.sonarqube.ws.Components;
import org.sonarqube.ws.Organizations;
-import org.sonarqube.ws.WsComponents;
-import org.sonarqube.ws.WsProjects;
+import org.sonarqube.ws.Projects;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.WsResponse;
import org.sonarqube.ws.client.component.SearchProjectsRequest;
public void update_key() {
analyzeXooSample();
String newProjectKey = "another_project_key";
- WsComponents.Component project = tester.wsClient().components().show(new ShowWsRequest().setKey(PROJECT_KEY)).getComponent();
+ Components.Component project = tester.wsClient().components().show(new ShowWsRequest().setKey(PROJECT_KEY)).getComponent();
assertThat(project.getKey()).isEqualTo(PROJECT_KEY);
tester.wsClient().projects().updateKey(UpdateKeyWsRequest.builder()
public void bulk_update_key() {
analyzeXooSample();
String newProjectKey = "another_project_key";
- WsComponents.Component project = tester.wsClient().components().show(new ShowWsRequest().setKey(PROJECT_KEY)).getComponent();
+ Components.Component project = tester.wsClient().components().show(new ShowWsRequest().setKey(PROJECT_KEY)).getComponent();
assertThat(project.getKey()).isEqualTo(PROJECT_KEY);
- WsProjects.BulkUpdateKeyWsResponse result = tester.wsClient().projects().bulkUpdateKey(BulkUpdateKeyWsRequest.builder()
+ Projects.BulkUpdateKeyWsResponse result = tester.wsClient().projects().bulkUpdateKey(BulkUpdateKeyWsRequest.builder()
.setKey(PROJECT_KEY)
.setFrom(PROJECT_KEY)
.setTo(newProjectKey)
assertThat(tester.wsClient().components().show(new ShowWsRequest().setId(project.getId())).getComponent().getKey()).isEqualTo(newProjectKey);
assertThat(result.getKeysCount()).isEqualTo(1);
assertThat(result.getKeys(0))
- .extracting(WsProjects.BulkUpdateKeyWsResponse.Key::getKey, WsProjects.BulkUpdateKeyWsResponse.Key::getNewKey, WsProjects.BulkUpdateKeyWsResponse.Key::getDuplicate)
+ .extracting(Projects.BulkUpdateKeyWsResponse.Key::getKey, Projects.BulkUpdateKeyWsResponse.Key::getNewKey, Projects.BulkUpdateKeyWsResponse.Key::getDuplicate)
.containsOnlyOnce(PROJECT_KEY, newProjectKey, false);
}
@Test
public void update_key_of_provisioned_project() {
Organizations.Organization organization = tester.organizations().generate();
- WsProjects.CreateWsResponse.Project project = createProject(organization, "one", "Foo");
+ Projects.CreateWsResponse.Project project = createProject(organization, "one", "Foo");
updateKey(project, "two");
@Test
public void recover_indexing_errors_when_updating_key_of_provisioned_project() throws Exception {
Organizations.Organization organization = tester.organizations().generate();
- WsProjects.CreateWsResponse.Project project = createProject(organization, "one", "Foo");
+ Projects.CreateWsResponse.Project project = createProject(organization, "one", "Foo");
lockWritesOnProjectIndices();
tester.elasticsearch().unlockWrites("projectmeasures");
}
- private void updateKey(WsProjects.CreateWsResponse.Project project, String newKey) {
+ private void updateKey(Projects.CreateWsResponse.Project project, String newKey) {
tester.wsClient().projects().updateKey(UpdateKeyWsRequest.builder().setKey(project.getKey()).setNewKey(newKey).build());
}
tester.wsClient().projects().updateKey(UpdateKeyWsRequest.builder().setKey(initialKey).setNewKey(newKey).build());
}
- private WsProjects.CreateWsResponse.Project createProject(Organizations.Organization organization, String key, String name) {
+ private Projects.CreateWsResponse.Project createProject(Organizations.Organization organization, String key, String name) {
CreateRequest createRequest = CreateRequest.builder().setKey(key).setName(name).setOrganization(organization.getKey()).build();
return tester.wsClient().projects().create(createRequest).getProject();
}
*/
@CheckForNull
private String keyInComponentSearchProjects(String name) {
- WsComponents.SearchProjectsWsResponse response = tester.wsClient().components().searchProjects(
+ Components.SearchProjectsWsResponse response = tester.wsClient().components().searchProjects(
SearchProjectsRequest.builder().setFilter("query=\"" + name + "\"").build());
if (response.getComponentsCount() > 0) {
return response.getComponents(0).getKey();
import org.sonarqube.qa.util.Tester;
import org.sonarqube.qa.util.pageobjects.ProjectLinkItem;
import org.sonarqube.qa.util.pageobjects.ProjectLinksPage;
-import org.sonarqube.ws.WsProjectLinks.CreateWsResponse;
+import org.sonarqube.ws.ProjectLinks.CreateWsResponse;
import org.sonarqube.ws.client.projectlinks.CreateWsRequest;
import org.sonarqube.ws.client.projectlinks.DeleteWsRequest;
import org.junit.rules.Timeout;
import org.sonarqube.qa.util.Tester;
import org.sonarqube.ws.Organizations;
-import org.sonarqube.ws.WsComponents;
-import org.sonarqube.ws.WsProjects;
-import org.sonarqube.ws.WsProjects.CreateWsResponse.Project;
+import org.sonarqube.ws.Components;
+import org.sonarqube.ws.Projects;
+import org.sonarqube.ws.Projects.CreateWsResponse.Project;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.WsResponse;
import org.sonarqube.ws.client.component.SearchProjectsRequest;
* Projects administration page - uses database
*/
private boolean isInProjectsSearch(Organizations.Organization organization, String name) {
- WsProjects.SearchWsResponse response = tester.wsClient().projects().search(
+ Projects.SearchWsResponse response = tester.wsClient().projects().search(
SearchWsRequest.builder().setOrganization(organization.getKey()).setQuery(name).setQualifiers(singletonList("TRK")).build());
return response.getComponentsCount() > 0;
}
* Projects page - api/components/search_projects - uses ES + DB
*/
private boolean isInComponentSearchProjects(String name) {
- WsComponents.SearchProjectsWsResponse response = tester.wsClient().components().searchProjects(
+ Components.SearchProjectsWsResponse response = tester.wsClient().components().searchProjects(
SearchProjectsRequest.builder().setFilter("query=\"" + name + "\"").build());
return response.getComponentsCount() > 0;
}
import org.junit.Test;
import org.sonarqube.qa.util.Tester;
import org.sonarqube.ws.Organizations;
-import org.sonarqube.ws.WsProjects.CreateWsResponse;
-import org.sonarqube.ws.WsProjects.SearchWsResponse;
-import org.sonarqube.ws.WsProjects.SearchWsResponse.Component;
+import org.sonarqube.ws.Projects.CreateWsResponse;
+import org.sonarqube.ws.Projects.SearchWsResponse;
+import org.sonarqube.ws.Projects.SearchWsResponse.Component;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.project.SearchWsRequest;
@Test
public void search_old_projects() {
Organizations.Organization organization = tester.organizations().generate();
- CreateWsResponse.Project oldProject = tester.projects().generate(organization);
- CreateWsResponse.Project recentProject = tester.projects().generate(organization);
+ CreateWsResponse.Project oldProject = tester.projects().provision(organization);
+ CreateWsResponse.Project recentProject = tester.projects().provision(organization);
Date now = new Date();
Date oneYearAgo = DateUtils.addDays(now, -365);
Date moreThanOneYearAgo = DateUtils.addDays(now, -366);
@Test
public void search_on_key_query_partial_match_case_insensitive() {
Organizations.Organization organization = tester.organizations().generate();
- CreateWsResponse.Project lowerCaseProject = tester.projects().generate(organization, p -> p.setKey("project-key"));
- CreateWsResponse.Project upperCaseProject = tester.projects().generate(organization, p -> p.setKey("PROJECT-KEY"));
- CreateWsResponse.Project anotherProject = tester.projects().generate(organization, p -> p.setKey("another-project"));
+ CreateWsResponse.Project lowerCaseProject = tester.projects().provision(organization, p -> p.setKey("project-key"));
+ CreateWsResponse.Project upperCaseProject = tester.projects().provision(organization, p -> p.setKey("PROJECT-KEY"));
+ CreateWsResponse.Project anotherProject = tester.projects().provision(organization, p -> p.setKey("another-project"));
analyzeProject(lowerCaseProject.getKey(), organization.getKey());
analyzeProject(upperCaseProject.getKey(), organization.getKey());
@Test
public void search_provisioned_projects() {
Organizations.Organization organization = tester.organizations().generate();
- CreateWsResponse.Project firstProvisionedProject = tester.projects().generate(organization);
- CreateWsResponse.Project secondProvisionedProject = tester.projects().generate(organization);
- CreateWsResponse.Project analyzedProject = tester.projects().generate(organization);
+ CreateWsResponse.Project firstProvisionedProject = tester.projects().provision(organization);
+ CreateWsResponse.Project secondProvisionedProject = tester.projects().provision(organization);
+ CreateWsResponse.Project analyzedProject = tester.projects().provision(organization);
analyzeProject(analyzedProject.getKey(), organization.getKey());
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonarqube.tests.project;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.SonarScanner;
+import java.io.UnsupportedEncodingException;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.sonarqube.qa.util.Tester;
+import org.sonarqube.qa.util.pageobjects.Navigation;
+import org.sonarqube.qa.util.pageobjects.settings.SettingsPage;
+
+import static com.codeborne.selenide.Selenide.$;
+import static util.ItUtils.projectDir;
+
+public class ProjectSettingsTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = ProjectSuite.ORCHESTRATOR;
+
+ @Rule
+ public Tester tester = new Tester(orchestrator);
+
+ private String adminUser;
+
+ @Before
+ public void setUp() {
+ adminUser = tester.users().generateAdministratorOnDefaultOrganization().getLogin();
+ }
+
+ @Test
+ public void display_project_settings() {
+ analyzeSample();
+
+ SettingsPage page = tester.openBrowser()
+ .logIn()
+ .submitCredentials(adminUser)
+ .openSettings("sample")
+ .assertMenuContains("Analysis Scope")
+ .assertMenuContains("Category 1")
+ .assertMenuContains("project-only")
+ .assertMenuContains("Xoo")
+ .assertSettingDisplayed("sonar.dbcleaner.hoursBeforeKeepingOnlyOneSnapshotByDay");
+
+ page.openCategory("project-only")
+ .assertSettingDisplayed("prop_only_on_project");
+
+ page.openCategory("General")
+ .assertStringSettingValue("sonar.dbcleaner.daysBeforeDeletingClosedIssues", "30")
+ .assertStringSettingValue("sonar.leak.period", "previous_version")
+ .assertBooleanSettingValue("sonar.dbcleaner.cleanDirectory", true)
+ .setStringValue("sonar.dbcleaner.hoursBeforeKeepingOnlyOneSnapshotByDay", "48")
+ .assertStringSettingValue("sonar.dbcleaner.hoursBeforeKeepingOnlyOneSnapshotByDay", "48");
+ }
+
+ /**
+ * Values set on project level must not appear on global level
+ */
+ @Test
+ public void display_correct_global_setting() {
+ analyzeSample();
+ Navigation nav = tester.openBrowser();
+ SettingsPage page = nav.logIn()
+ .submitCredentials(adminUser)
+ .openSettings("sample")
+ .openCategory("Analysis Scope")
+ .assertSettingDisplayed("sonar.coverage.exclusions")
+ .setStringValue("sonar.coverage.exclusions", "foo")
+ .assertStringSettingValue("sonar.coverage.exclusions", "foo");
+ nav.logOut();
+
+ // login as root
+ tester.wsClient().users().skipOnboardingTutorial();
+ nav.logIn().submitCredentials("admin", "admin");
+ $(".global-navbar-menu ").$(By.linkText("Administration")).click();
+ page
+ .openCategory("Analysis Scope")
+ .assertSettingDisplayed("sonar.coverage.exclusions")
+ .assertStringSettingValue("sonar.coverage.exclusions", "");
+ }
+
+ @Test
+ public void display_module_settings() throws UnsupportedEncodingException {
+ orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-multi-modules-sample")));
+
+ tester.openBrowser().logIn().submitCredentials(adminUser)
+ .openSettings("com.sonarsource.it.samples:multi-modules-sample:module_a")
+ .assertMenuContains("Analysis Scope")
+ .assertSettingDisplayed("sonar.coverage.exclusions");
+ }
+
+ private void analyzeSample() {
+ SonarScanner scan = SonarScanner.create(projectDir("shared/xoo-sample"))
+ .setProperty("sonar.cpd.exclusions", "**/*");
+ orchestrator.executeBuild(scan);
+ }
+}
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
+import static util.ItUtils.pluginArtifact;
import static util.ItUtils.xooPlugin;
@RunWith(Suite.class)
ProjectsPageTest.class,
ProjectProvisioningTest.class,
ProjectSearchTest.class,
+ ProjectSettingsTest.class,
ProjectVisibilityPageTest.class
})
public class ProjectSuite {
- public static final int SEARCH_HTTP_PORT = NetworkUtils.getNextAvailablePort(InetAddress.getLoopbackAddress());
+ static final int SEARCH_HTTP_PORT = NetworkUtils.getNextAvailablePort(InetAddress.getLoopbackAddress());
@ClassRule
public static final Orchestrator ORCHESTRATOR = Orchestrator.builderEnv()
.addPlugin(xooPlugin())
+ // for ProjectSettingsTest
+ .addPlugin(pluginArtifact("sonar-subcategories-plugin"))
+
.build();
}
import org.junit.Test;
import org.sonarqube.qa.util.Tester;
import org.sonarqube.qa.util.pageobjects.ProjectsManagementPage;
-import org.sonarqube.ws.WsComponents;
+import org.sonarqube.ws.Components;
import org.sonarqube.ws.client.component.SearchProjectsRequest;
import org.sonarqube.ws.client.permission.RemoveGroupWsRequest;
import org.sonarqube.ws.client.project.UpdateVisibilityRequest;
.createProject("foo", "foo", visibility)
.shouldHaveProjectsCount(1);
- WsComponents.SearchProjectsWsResponse response = newAdminWsClient(orchestrator).components().searchProjects(
+ Components.SearchProjectsWsResponse response = newAdminWsClient(orchestrator).components().searchProjects(
SearchProjectsRequest.builder().build());
assertThat(response.getComponentsCount()).isEqualTo(1);
assertThat(response.getComponents(0).getKey()).isEqualTo("foo");
import org.sonarqube.qa.util.Tester;
import org.sonarqube.qa.util.pageobjects.Navigation;
import org.sonarqube.qa.util.pageobjects.projects.ProjectsPage;
-import org.sonarqube.ws.WsUsers;
+import org.sonarqube.ws.Users;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsClient;
page.shouldHaveTotal(2).shouldDisplayAllProjectsWidthSort("-analysis_date");
// all projects by default for logged in user
- WsUsers.CreateWsResponse.User administrator = tester.users().generateAdministratorOnDefaultOrganization();
+ Users.CreateWsResponse.User administrator = tester.users().generateAdministratorOnDefaultOrganization();
page = nav.logIn().submitCredentials(administrator.getLogin()).openProjects();
page.shouldHaveTotal(2).shouldDisplayAllProjects();
@Test
public void should_switch_between_perspectives() {
- WsUsers.CreateWsResponse.User administrator = tester.users().generateAdministratorOnDefaultOrganization();
+ Users.CreateWsResponse.User administrator = tester.users().generateAdministratorOnDefaultOrganization();
ProjectsPage page = tester.openBrowser()
.logIn().submitCredentials(administrator.getLogin())
.openProjects();
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonarqube.tests.projectAdministration;
-
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.SonarScanner;
-import java.io.UnsupportedEncodingException;
-import java.sql.SQLException;
-import javax.annotation.Nullable;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.openqa.selenium.By;
-import org.sonarqube.qa.util.Tester;
-import org.sonarqube.qa.util.pageobjects.Navigation;
-import org.sonarqube.qa.util.pageobjects.ProjectsManagementPage;
-import org.sonarqube.qa.util.pageobjects.settings.SettingsPage;
-import org.sonarqube.tests.Category1Suite;
-import org.sonarqube.ws.WsPermissions;
-import org.sonarqube.ws.client.permission.AddUserToTemplateWsRequest;
-import org.sonarqube.ws.client.permission.CreateTemplateWsRequest;
-import org.sonarqube.ws.client.permission.UsersWsRequest;
-
-import static com.codeborne.selenide.Selenide.$;
-import static org.assertj.core.api.Assertions.assertThat;
-import static util.ItUtils.projectDir;
-
-/**
- * TODO to be split and moved to project package
- */
-public class ProjectAdministrationTest {
-
- @ClassRule
- public static Orchestrator orchestrator = Category1Suite.ORCHESTRATOR;
-
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- @Rule
- public Tester tester = new Tester(orchestrator).disableOrganizations();
-
- private Navigation nav = Navigation.create(orchestrator);
-
- private String adminUser;
-
- @Before
- public void deleteAnalysisData() throws SQLException {
- orchestrator.resetData();
- adminUser = tester.users().generateAdministrator().getLogin();
- }
-
- @Test
- public void display_project_settings() throws UnsupportedEncodingException {
- scanSample(null, null);
-
- SettingsPage page = nav.logIn().submitCredentials(adminUser).openSettings("sample")
- .assertMenuContains("Analysis Scope")
- .assertMenuContains("Category 1")
- .assertMenuContains("DEV")
- .assertMenuContains("project-only")
- .assertMenuContains("Xoo")
- .assertSettingDisplayed("sonar.dbcleaner.hoursBeforeKeepingOnlyOneSnapshotByDay");
-
- page.openCategory("project-only")
- .assertSettingDisplayed("prop_only_on_project");
-
- page.openCategory("General")
- .assertStringSettingValue("sonar.dbcleaner.daysBeforeDeletingClosedIssues", "30")
- .assertStringSettingValue("sonar.leak.period", "previous_version")
- .assertBooleanSettingValue("sonar.dbcleaner.cleanDirectory", true)
- .setStringValue("sonar.dbcleaner.hoursBeforeKeepingOnlyOneSnapshotByDay", "48")
- .assertStringSettingValue("sonar.dbcleaner.hoursBeforeKeepingOnlyOneSnapshotByDay", "48");
- }
-
- @Test
- public void display_correct_global_setting () throws UnsupportedEncodingException {
- scanSample(null, null);
- SettingsPage page = nav.logIn().submitCredentials(adminUser).openSettings("sample")
- .openCategory("Analysis Scope")
- .assertSettingDisplayed("sonar.coverage.exclusions")
- .setStringValue("sonar.coverage.exclusions", "foo")
- .assertStringSettingValue("sonar.coverage.exclusions", "foo");
-
- $(".global-navbar-menu ").$(By.linkText("Administration")).click();
- page
- .openCategory("Analysis Scope")
- .assertSettingDisplayed("sonar.coverage.exclusions")
- .assertStringSettingValue("sonar.coverage.exclusions", "");
- }
-
- @Test
- public void display_module_settings() throws UnsupportedEncodingException {
- orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-multi-modules-sample")));
-
- nav.logIn().submitCredentials(adminUser)
- .openSettings("com.sonarsource.it.samples:multi-modules-sample:module_a")
- .assertMenuContains("Analysis Scope")
- .assertSettingDisplayed("sonar.coverage.exclusions");
- }
-
- @Test
- public void bulk_apply_permission_template() {
- String project = tester.projects().generate(null).getKey();
- String user = tester.users().generate().getLogin();
- tester.wsClient().permissions().createTemplate(new CreateTemplateWsRequest().setName("foo-template"));
- tester.wsClient().permissions().addUserToTemplate(
- new AddUserToTemplateWsRequest()
- .setPermission("admin")
- .setTemplateName("foo-template")
- .setLogin(user));
- ProjectsManagementPage page = nav.logIn().submitCredentials(adminUser).openProjectsManagement();
- page.shouldHaveProject(project);
- page.bulkApplyPermissionTemplate("foo-template");
- WsPermissions.UsersWsResponse usersResponse = tester.wsClient().permissions().users(new UsersWsRequest()
- .setProjectKey(project)
- .setPermission("admin")
- );
- assertThat(usersResponse.getUsersCount()).isEqualTo(1);
- assertThat(usersResponse.getUsers(0).getLogin()).isEqualTo(user);
- }
-
- private void scanSample(@Nullable String date, @Nullable String profile) {
- SonarScanner scan = SonarScanner.create(projectDir("shared/xoo-sample"))
- .setProperty("sonar.cpd.exclusions", "**/*");
- if (date != null) {
- scan.setProperty("sonar.projectDate", date);
- }
- if (profile != null) {
- scan.setProfile(profile);
- }
- orchestrator.executeBuild(scan);
- }
-}
import org.sonarqube.qa.util.Tester;
import org.sonarqube.ws.MediaTypes;
import org.sonarqube.ws.Organizations;
-import org.sonarqube.ws.WsCe;
-import org.sonarqube.ws.WsProjects.CreateWsResponse.Project;
-import org.sonarqube.ws.WsQualityGates;
-import org.sonarqube.ws.WsQualityGates.CreateWsResponse;
-import org.sonarqube.ws.WsUsers;
+import org.sonarqube.ws.Ce;
+import org.sonarqube.ws.Projects.CreateWsResponse.Project;
+import org.sonarqube.ws.Qualitygates;
+import org.sonarqube.ws.Qualitygates.CreateWsResponse;
+import org.sonarqube.ws.Users;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.WsResponse;
-import org.sonarqube.ws.client.qualitygate.CreateConditionRequest;
-import org.sonarqube.ws.client.qualitygate.ProjectStatusWsRequest;
-import org.sonarqube.ws.client.qualitygate.UpdateConditionRequest;
+import org.sonarqube.ws.client.qualitygates.CreateConditionRequest;
+import org.sonarqube.ws.client.qualitygates.ProjectStatusRequest;
+import org.sonarqube.ws.client.qualitygates.UpdateConditionRequest;
import static org.assertj.core.api.Assertions.assertThat;
import static util.ItUtils.getMeasure;
@Test
public void do_not_fail_quality_gate_with_poor_LEAK_coverage_and_a_max_of_19_lines_of_NEW_code() throws Exception {
Organizations.Organization organization = tester.organizations().generate();
- Project project = tester.projects().generate(organization);
+ Project project = tester.projects().provision(organization);
CreateWsResponse qualityGate = tester.qGates().generate();
tester.qGates().associateProject(qualityGate, project);
- WsQualityGates.CreateConditionWsResponse condition = tester.wsClient().qualityGates().createCondition(CreateConditionRequest.builder()
- .setQualityGateId(qualityGate.getId())
- .setMetricKey("new_coverage")
- .setOperator("LT")
+ Qualitygates.CreateConditionWsResponse condition = tester.wsClient().qualityGates().createCondition(new CreateConditionRequest()
+ .setGateId(String.valueOf(qualityGate.getId()))
+ .setMetric("new_coverage")
+ .setOp("LT")
.setWarning("90")
.setError("80")
- .setPeriod(1)
- .build());
+ .setPeriod("1"));
tester.settings().setProjectSetting(project.getKey(), "sonar.leak.period", "previous_version");
String password = "password1";
- WsUsers.CreateWsResponse.User user = tester.users().generateAdministrator(organization, u -> u.setPassword(password));
+ Users.CreateWsResponse.User user = tester.users().generateAdministrator(organization, u -> u.setPassword(password));
// no leak => use usual behaviour
SonarScanner analysis = SonarScanner
assertIgnoredConditions("qualitygate/small-changesets/v2-1019-lines", true);
// small leak => if coverage is OK anyways, we do not have to ignore anything
- tester.wsClient().qualityGates().updateCondition(UpdateConditionRequest.builder()
- .setConditionId(condition.getId())
- .setMetricKey("new_coverage")
- .setOperator("LT")
+ tester.wsClient().qualityGates().updateCondition(new UpdateConditionRequest()
+ .setId(String.valueOf(condition.getId()))
+ .setMetric("new_coverage")
+ .setOp("LT")
.setWarning("10")
.setError("20")
- .setPeriod(1)
- .build());
+ .setPeriod("1"));
SonarScanner analysis3 = SonarScanner
.create(projectDir("qualitygate/small-changesets/v2-1019-lines"))
.setProperty("sonar.projectKey", project.getKey())
assertIgnoredConditions("qualitygate/small-changesets/v2-1019-lines", false);
// big leak => use usual behaviour
- tester.wsClient().qualityGates().updateCondition(UpdateConditionRequest.builder()
- .setConditionId(condition.getId())
- .setMetricKey("new_coverage")
- .setOperator("LT")
+ tester.wsClient().qualityGates().updateCondition(new UpdateConditionRequest()
+ .setId(String.valueOf(condition.getId()))
+ .setMetric("new_coverage")
+ .setOp("LT")
.setWarning(null)
.setError("70")
- .setPeriod(1)
- .build());
+ .setPeriod("1"));
SonarScanner analysis4 = SonarScanner
.create(projectDir("qualitygate/small-changesets/v2-1020-lines"))
.setProperty("sonar.projectKey", project.getKey())
private void assertIgnoredConditions(String projectDir, boolean expected) throws IOException {
String analysisId = getAnalysisId(getTaskIdInLocalReport(projectDir(projectDir)));
boolean ignoredConditions = tester.wsClient().qualityGates()
- .projectStatus(new ProjectStatusWsRequest().setAnalysisId(analysisId))
+ .projectStatus(new ProjectStatusRequest().setAnalysisId(analysisId))
.getProjectStatus()
.getIgnoredConditions();
assertThat(ignoredConditions).isEqualTo(expected);
.call(new GetRequest("api/ce/task")
.setParam("id", taskId)
.setMediaType(MediaTypes.PROTOBUF));
- WsCe.TaskResponse activityWsResponse = WsCe.TaskResponse.parseFrom(activity.contentStream());
+ Ce.TaskResponse activityWsResponse = Ce.TaskResponse.parseFrom(activity.contentStream());
return activityWsResponse.getTask().getAnalysisId();
}
import org.junit.Test;
import org.sonarqube.qa.util.Tester;
import org.sonarqube.ws.Organizations.Organization;
-import org.sonarqube.ws.WsProjects.CreateWsResponse.Project;
-import org.sonarqube.ws.WsQualityGates.CreateWsResponse;
-import org.sonarqube.ws.WsUsers;
+import org.sonarqube.ws.Projects.CreateWsResponse.Project;
+import org.sonarqube.ws.Qualitygates.CreateWsResponse;
+import org.sonarqube.ws.Users;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.WsResponse;
-import org.sonarqube.ws.client.qualitygate.CreateConditionRequest;
+import org.sonarqube.ws.client.qualitygates.CreateConditionRequest;
import util.ItUtils;
import static org.assertj.core.api.Assertions.assertThat;
@Test
public void always_display_current_quality_gate_in_effect() throws Exception {
Organization organization = tester.organizations().generate();
- Project project = tester.projects().generate(organization);
+ Project project = tester.projects().provision(organization);
CreateWsResponse qualityGate = tester.qGates().generate();
tester.qGates().associateProject(qualityGate, project);
- tester.wsClient().qualityGates().createCondition(CreateConditionRequest.builder()
- .setQualityGateId(qualityGate.getId())
- .setMetricKey("new_coverage")
- .setOperator("LT")
+ tester.wsClient().qualityGates().createCondition(new CreateConditionRequest()
+ .setGateId(String.valueOf(qualityGate.getId()))
+ .setMetric("new_coverage")
+ .setOp("LT")
.setWarning("90")
.setError("80")
- .setPeriod(1)
- .build());
+ .setPeriod("1"));
tester.settings().setProjectSetting(project.getKey(), "sonar.leak.period", "previous_version");
String password = "password1";
- WsUsers.CreateWsResponse.User user = tester.users().generateAdministrator(organization, u -> u.setPassword(password));
+ Users.CreateWsResponse.User user = tester.users().generateAdministrator(organization, u -> u.setPassword(password));
WsResponse response = tester.wsClient().wsConnector().call(new GetRequest("api/navigation/component").setParam("componentKey", project.getKey()));
Map currentQualityGate = (Map) ItUtils.jsonToMap(response.content()).get("qualityGate");
CreateWsResponse qualityGate2 = tester.qGates().generate();
tester.qGates().associateProject(qualityGate2, project);
- tester.wsClient().qualityGates().createCondition(CreateConditionRequest.builder()
- .setQualityGateId(qualityGate2.getId())
- .setMetricKey("new_coverage")
- .setOperator("LT")
+ tester.wsClient().qualityGates().createCondition(new CreateConditionRequest()
+ .setGateId(String.valueOf(qualityGate2.getId()))
+ .setMetric("new_coverage")
+ .setOp("LT")
.setWarning("90")
.setError("80")
- .setPeriod(1)
- .build());
+ .setPeriod("1"));
WsResponse response3 = tester.wsClient().wsConnector().call(new GetRequest("api/navigation/component").setParam("componentKey", project.getKey()));
Map currentQualityGate3 = (Map) ItUtils.jsonToMap(response3.content()).get("qualityGate");
import org.sonarqube.qa.util.pageobjects.ProjectDashboardPage;
import org.sonarqube.qa.util.pageobjects.QualityGatePage;
import org.sonarqube.ws.Organizations;
-import org.sonarqube.ws.WsUsers;
+import org.sonarqube.ws.Users;
import util.issue.IssueRule;
import static com.codeborne.selenide.Selenide.$;
public IssueRule issueRule = IssueRule.from(orchestrator);
private Organizations.Organization organization;
- private WsUsers.CreateWsResponse.User user;
- private WsUsers.CreateWsResponse.User gateAdmin;
+ private Users.CreateWsResponse.User user;
+ private Users.CreateWsResponse.User gateAdmin;
@Before
public void setUp() throws Exception {
@Test
public void quality_gate_link_on_project_dashboard_should_have_organization_context() {
- String project = tester.projects().generate(organization).getKey();
+ String project = tester.projects().provision(organization).getKey();
runProjectAnalysis(orchestrator, "shared/xoo-multi-modules-sample",
"sonar.projectKey", project,
"sonar.organization", organization.getKey(),
import org.sonarqube.qa.util.pageobjects.Navigation;
import org.sonarqube.qa.util.pageobjects.ProjectQualityGatePage;
import org.sonarqube.ws.client.PostRequest;
-import org.sonarqube.ws.client.qualitygate.SelectWsRequest;
+import org.sonarqube.ws.client.qualitygates.SelectRequest;
public class ProjectQualityGatePageTest {
}
private void associateWithQualityGate(QualityGate qualityGate) {
- tester.wsClient().qualityGates().associateProject(new SelectWsRequest().setProjectKey("sample").setGateId(qualityGate.id()));
+ tester.wsClient().qualityGates().select(new SelectRequest().setProjectKey("sample").setGateId(String.valueOf(qualityGate.id())));
}
private QualityGateClient qualityGateClient() {
import org.junit.Rule;
import org.junit.Test;
import org.sonarqube.qa.util.Tester;
-import org.sonarqube.ws.WsProjects.CreateWsResponse.Project;
-import org.sonarqube.ws.WsQualityGates;
+import org.sonarqube.ws.Projects.CreateWsResponse.Project;
+import org.sonarqube.ws.Qualitygates;
import org.sonarqube.ws.client.PostRequest;
-import org.sonarqube.ws.client.qualitygate.CreateConditionRequest;
+import org.sonarqube.ws.client.qualitygates.CreateConditionRequest;
import org.subethamail.wiser.Wiser;
import org.subethamail.wiser.WiserMessage;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.sonarqube.ws.WsMeasures.Measure;
+import static org.sonarqube.ws.Measures.Measure;
import static util.ItUtils.getMeasure;
import static util.ItUtils.projectDir;
.failIfNotSuccessful();
// Create quality gate with conditions on variations
- WsQualityGates.CreateWsResponse simple = tester.qGates().generate();
+ Qualitygates.CreateWsResponse simple = tester.qGates().generate();
tester.qGates().service()
- .createCondition(CreateConditionRequest.builder().setQualityGateId(simple.getId()).setMetricKey("ncloc").setPeriod(1).setOperator("EQ").setWarning("0").build());
- Project project = tester.projects().generate(null);
+ .createCondition(new CreateConditionRequest().setGateId(String.valueOf(simple.getId())).setMetric("ncloc").setPeriod("1").setOp("EQ").setWarning("0"));
+ Project project = tester.projects().provision();
tester.qGates().associateProject(simple, project);
SonarScanner analysis = SonarScanner.create(projectDir("qualitygate/xoo-sample")).setProperty("sonar.projectKey", project.getKey());
import org.junit.Rule;
import org.junit.Test;
import org.sonarqube.qa.util.Tester;
-import org.sonarqube.ws.WsMeasures;
-import org.sonarqube.ws.WsProjects.CreateWsResponse.Project;
-import org.sonarqube.ws.WsQualityGates;
-import org.sonarqube.ws.client.qualitygate.CreateConditionRequest;
+import org.sonarqube.ws.Measures;
+import org.sonarqube.ws.Projects.CreateWsResponse.Project;
+import org.sonarqube.ws.Qualitygates;
+import org.sonarqube.ws.client.qualitygates.CreateConditionRequest;
import util.ItUtils;
import static org.assertj.core.api.Assertions.assertThat;
@Test
public void generate_warning_qgate_on_rating_metric() throws Exception {
- Project project = tester.projects().generate(null);
- WsQualityGates.CreateWsResponse qualityGate = tester.qGates().generate();
+ Project project = tester.projects().provision();
+ Qualitygates.CreateWsResponse qualityGate = tester.qGates().generate();
tester.qGates().associateProject(qualityGate, project);
- tester.qGates().service().createCondition(CreateConditionRequest.builder()
- .setQualityGateId(qualityGate.getId())
- .setMetricKey("security_rating")
- .setOperator("GT")
- .setWarning("3")
- .build());
+ tester.qGates().service().createCondition(new CreateConditionRequest()
+ .setGateId(String.valueOf(qualityGate.getId()))
+ .setMetric("security_rating")
+ .setOp("GT")
+ .setWarning("3"));
ItUtils.restoreProfile(orchestrator, getClass().getResource("/qualityGate/QualityGateOnRatingMeasuresTest/with-many-rules.xml"));
orchestrator.getServer().associateProjectToQualityProfile(project.getKey(), "xoo", "with-many-rules");
@Test
public void generate_error_qgate_on_rating_metric_on_leak_period() throws Exception {
- Project project = tester.projects().generate(null);
- WsQualityGates.CreateWsResponse qualityGate = tester.qGates().generate();
+ Project project = tester.projects().provision();
+ Qualitygates.CreateWsResponse qualityGate = tester.qGates().generate();
tester.qGates().associateProject(qualityGate, project);
tester.settings().setGlobalSetting("sonar.leak.period", "previous_version");
- tester.wsClient().qualityGates().createCondition(CreateConditionRequest.builder()
- .setQualityGateId(qualityGate.getId())
- .setMetricKey("new_security_rating")
- .setOperator("GT")
+ tester.wsClient().qualityGates().createCondition(new CreateConditionRequest()
+ .setGateId(String.valueOf(qualityGate.getId()))
+ .setMetric("new_security_rating")
+ .setOp("GT")
.setError("3")
- .setPeriod(1)
- .build());
+ .setPeriod("1"));
// Run first analysis with empty quality gate -> quality gate is green
orchestrator.getServer().associateProjectToQualityProfile(project.getKey(), "xoo", "empty");
assertThat(getGateStatusMeasure(project).getValue()).isEqualTo("ERROR");
}
- private WsMeasures.Measure getGateStatusMeasure(Project project) {
+ private Measures.Measure getGateStatusMeasure(Project project) {
return getMeasure(orchestrator, project.getKey(), "alert_status");
}
import org.sonar.wsclient.qualitygate.QualityGateClient;
import org.sonarqube.qa.util.Tester;
import org.sonarqube.qa.util.TesterSession;
+import org.sonarqube.ws.Ce;
import org.sonarqube.ws.MediaTypes;
import org.sonarqube.ws.Organizations.Organization;
-import org.sonarqube.ws.WsCe;
-import org.sonarqube.ws.WsMeasures.Measure;
-import org.sonarqube.ws.WsProjects.CreateWsResponse.Project;
-import org.sonarqube.ws.WsQualityGates;
-import org.sonarqube.ws.WsQualityGates.ProjectStatusWsResponse;
-import org.sonarqube.ws.WsUsers;
+import org.sonarqube.ws.Measures.Measure;
+import org.sonarqube.ws.Projects.CreateWsResponse.Project;
+import org.sonarqube.ws.Qualitygates;
+import org.sonarqube.ws.Qualitygates.ProjectStatusWsResponse;
+import org.sonarqube.ws.Users;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsResponse;
import org.sonarqube.ws.client.permission.AddUserWsRequest;
-import org.sonarqube.ws.client.qualitygate.CreateConditionRequest;
-import org.sonarqube.ws.client.qualitygate.ProjectStatusWsRequest;
-import org.sonarqube.ws.client.qualitygate.QualityGatesService;
-import org.sonarqube.ws.client.qualitygate.SelectWsRequest;
-import org.sonarqube.ws.client.qualitygate.UpdateConditionRequest;
+import org.sonarqube.ws.client.qualitygates.CreateConditionRequest;
+import org.sonarqube.ws.client.qualitygates.CreateRequest;
+import org.sonarqube.ws.client.qualitygates.ProjectStatusRequest;
+import org.sonarqube.ws.client.qualitygates.QualitygatesService;
+import org.sonarqube.ws.client.qualitygates.SelectRequest;
+import org.sonarqube.ws.client.qualitygates.UpdateConditionRequest;
import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic;
import static org.assertj.core.api.Assertions.assertThat;
String taskId = getTaskIdInLocalReport(projectDir("qualitygate/xoo-sample"));
String analysisId = getAnalysisId(taskId);
- ProjectStatusWsResponse projectStatusWsResponse = tester.wsClient().qualityGates().projectStatus(new ProjectStatusWsRequest().setAnalysisId(analysisId));
+ ProjectStatusWsResponse projectStatusWsResponse = tester.wsClient().qualityGates().projectStatus(new ProjectStatusRequest().setAnalysisId(analysisId));
ProjectStatusWsResponse.ProjectStatus projectStatus = projectStatusWsResponse.getProjectStatus();
assertThat(projectStatus.getStatus()).isEqualTo(ProjectStatusWsResponse.Status.ERROR);
assertThat(projectStatus.getConditionsCount()).isEqualTo(1);
@Test
public void does_not_fail_when_condition_is_on_removed_metric() throws Exception {
// create project
- Project project = tester.projects().generate(null);
+ Project project = tester.projects().provision();
String projectKey = project.getKey();
// create custom metric
createCustomIntMetric(customMetricKey);
try {
// create quality gate
- WsQualityGates.CreateWsResponse simple = tester.wsClient().qualityGates().create("OnCustomMetric");
+ Qualitygates.CreateWsResponse simple = tester.wsClient().qualityGates().create(new CreateRequest().setName("OnCustomMetric"));
Long qualityGateId = simple.getId();
qgClient().createCondition(NewCondition.create(qualityGateId).metricKey(customMetricKey).operator("GT").warningThreshold("40"));
deleteCustomMetric(customMetricKey);
// run analysis
- tester.wsClient().qualityGates().associateProject(new SelectWsRequest().setProjectKey(projectKey).setGateId(qualityGateId));
+ tester.wsClient().qualityGates().select(new SelectRequest().setProjectKey(projectKey).setGateId(String.valueOf(qualityGateId)));
BuildResult buildResult = executeAnalysis(projectKey);
// verify quality gate
public void administrate_quality_gate_with_gateadmin_permission() {
// user is quality gate admin of default organization
Organization organization = tester.organizations().getDefaultOrganization();
- WsUsers.CreateWsResponse.User user = tester.users().generateMember(organization);
+ Users.CreateWsResponse.User user = tester.users().generateMember(organization);
tester.wsClient().permissions().addUser(new AddUserWsRequest().setLogin(user.getLogin()).setPermission("gateadmin").setOrganization(organization.getKey()));
TesterSession qGateAdminTester = tester.as(user.getLogin());
- QualityGatesService qGateService = qGateAdminTester.qGates().service();
+ QualitygatesService qGateService = qGateAdminTester.qGates().service();
// perform administration operations
- WsQualityGates.CreateWsResponse qualityGate = qGateAdminTester.qGates().generate();
- WsQualityGates.CreateConditionWsResponse condition = qGateService.createCondition(CreateConditionRequest.builder()
- .setQualityGateId(qualityGate.getId()).setMetricKey("coverage").setOperator("LT").setError("90").build());
- qGateService.updateCondition(UpdateConditionRequest.builder()
- .setConditionId(condition.getId()).setMetricKey("coverage").setOperator("LT").setError("90").setWarning("80").build());
+ Qualitygates.CreateWsResponse qualityGate = qGateAdminTester.qGates().generate();
+ Qualitygates.CreateConditionWsResponse condition = qGateService.createCondition(new CreateConditionRequest()
+ .setGateId(String.valueOf(qualityGate.getId())).setMetric("coverage").setOp("LT").setError("90"));
+ qGateService.updateCondition(new UpdateConditionRequest()
+ .setId(String.valueOf(condition.getId())).setMetric("coverage").setOp("LT").setError("90").setWarning("80"));
qGateAdminTester.wsClient().wsConnector().call(new PostRequest("api/qualitygates/set_as_default").setParam("id", qualityGate.getId()));
qGateAdminTester.wsClient().wsConnector().call(new PostRequest("api/qualitygates/delete_condition").setParam("id", condition.getId()));
qGateAdminTester.wsClient().wsConnector().call(new PostRequest("api/qualitygates/unset_default").setParam("id", qualityGate.getId()));
.call(new GetRequest("api/ce/task")
.setParam("id", taskId)
.setMediaType(MediaTypes.PROTOBUF));
- WsCe.TaskResponse activityWsResponse = WsCe.TaskResponse.parseFrom(activity.contentStream());
+ Ce.TaskResponse activityWsResponse = Ce.TaskResponse.parseFrom(activity.contentStream());
return activityWsResponse.getTask().getAnalysisId();
}
import org.sonarqube.qa.util.Tester;
import org.sonarqube.qa.util.pageobjects.Navigation;
import org.sonarqube.qa.util.pageobjects.ProjectActivityPage;
-import org.sonarqube.ws.WsProjects.CreateWsResponse.Project;
-import org.sonarqube.ws.WsQualityGates;
-import org.sonarqube.ws.client.qualitygate.CreateConditionRequest;
-import org.sonarqube.ws.client.qualitygate.UpdateConditionRequest;
+import org.sonarqube.ws.Projects.CreateWsResponse.Project;
+import org.sonarqube.ws.Qualitygates;
+import org.sonarqube.ws.client.qualitygates.CreateConditionRequest;
+import org.sonarqube.ws.client.qualitygates.UpdateConditionRequest;
import static com.codeborne.selenide.Selenide.$;
import static org.apache.commons.lang.time.DateUtils.addDays;
*/
@Test
public void display_alerts_correctly_in_history_page() {
- Project project = tester.projects().generate(null);
- WsQualityGates.CreateWsResponse qGate = tester.qGates().generate();
+ Project project = tester.projects().provision();
+ Qualitygates.CreateWsResponse qGate = tester.qGates().generate();
tester.qGates().associateProject(qGate, project);
String firstAnalysisDate = DateFormatUtils.ISO_DATE_FORMAT.format(addDays(new Date(), -2));
String secondAnalysisDate = DateFormatUtils.ISO_DATE_FORMAT.format(addDays(new Date(), -1));
// with this configuration, project should have an Orange alert
- WsQualityGates.CreateConditionWsResponse lowThresholds = tester.qGates().service()
- .createCondition(CreateConditionRequest.builder().setQualityGateId(qGate.getId()).setMetricKey("lines").setOperator("GT").setWarning("5").setError("50").build());
+ Qualitygates.CreateConditionWsResponse lowThresholds = tester.qGates().service()
+ .createCondition(new CreateConditionRequest().setGateId(String.valueOf(qGate.getId())).setMetric("lines").setOp("GT").setWarning("5").setError("50"));
scanSampleWithDate(project, firstAnalysisDate);
// with this configuration, project should have a Green alert
- tester.qGates().service().updateCondition(UpdateConditionRequest.builder().setConditionId(lowThresholds.getId()).setMetricKey("lines").setOperator("GT").setWarning("5000").setError("5000").build());
+ tester.qGates().service().updateCondition(new UpdateConditionRequest().setId(String.valueOf(lowThresholds.getId())).setMetric("lines").setOp("GT").setWarning("5000").setError("5000"));
scanSampleWithDate(project, secondAnalysisDate);
Navigation nav = Navigation.create(orchestrator);
import org.junit.Rule;
import org.junit.Test;
import org.sonarqube.qa.util.Tester;
-import org.sonarqube.ws.WsMeasures;
+import org.sonarqube.ws.Measures;
import util.ItUtils;
import static java.lang.Double.parseDouble;
}
private void assertMeasures(String componentKey, int expectedBugs, int expectedReliabilityRemediationEffort, int expectedReliabilityRating) {
- Map<String, WsMeasures.Measure> measures = getMeasuresByMetricKey(orchestrator, componentKey, METRICS);
+ Map<String, Measures.Measure> measures = getMeasuresByMetricKey(orchestrator, componentKey, METRICS);
assertThat(parseDouble(measures.get(BUGS_METRIC).getValue())).isEqualTo(expectedBugs);
assertThat(parseDouble(measures.get(RELIABILITY_REMEDIATION_EFFORT_METRIC).getValue())).isEqualTo(expectedReliabilityRemediationEffort);
assertThat(parseDouble(measures.get(RELIABILITY_RATING_METRIC).getValue())).isEqualTo(expectedReliabilityRating);
import org.junit.Rule;
import org.junit.Test;
import org.sonarqube.qa.util.Tester;
-import org.sonarqube.ws.WsMeasures;
+import org.sonarqube.ws.Measures;
import util.ItUtils;
import static java.lang.Double.parseDouble;
}
private void assertMeasures(String componentKey, int expectedVulnerabilities, int expectedReliabilityRemediationEffort, int expectedReliabilityRating) {
- Map<String, WsMeasures.Measure> measures = getMeasuresByMetricKey(orchestrator, componentKey, METRICS);
+ Map<String, Measures.Measure> measures = getMeasuresByMetricKey(orchestrator, componentKey, METRICS);
assertThat(parseDouble(measures.get(VULNERABILITIES_METRIC).getValue())).isEqualTo(expectedVulnerabilities);
assertThat(parseDouble(measures.get(SECURITY_REMEDIATION_EFFORT_METRIC).getValue())).isEqualTo(expectedReliabilityRemediationEffort);
assertThat(parseDouble(measures.get(SECURITY_RATING_METRIC).getValue())).isEqualTo(expectedReliabilityRating);
import org.sonarqube.tests.Byteman;
import org.sonarqube.qa.util.Tester;
import org.sonarqube.ws.Organizations;
-import org.sonarqube.ws.QualityProfiles;
+import org.sonarqube.ws.Qualityprofiles;
import org.sonarqube.ws.client.rule.SearchWsRequest;
import util.ItUtils;
@Test
public void activation_and_deactivation_of_rule_is_resilient_to_indexing_errors() throws Exception {
Organizations.Organization organization = tester.organizations().generate();
- QualityProfiles.CreateWsResponse.QualityProfile profile = tester.qProfiles().createXooProfile(organization);
+ Qualityprofiles.CreateWsResponse.QualityProfile profile = tester.qProfiles().createXooProfile(organization);
// step 1. activation
tester.qProfiles().activateRule(profile.getKey(), RULE_ONE_BUG_PER_LINE);
assertThat(searchActiveRules(profile)).isEqualTo(0);
}
- private long searchActiveRules(QualityProfiles.CreateWsResponse.QualityProfile profile) {
+ private long searchActiveRules(Qualityprofiles.CreateWsResponse.QualityProfile profile) {
SearchWsRequest request = new SearchWsRequest().setActivation(true).setQProfile(profile.getKey());
return tester.wsClient().rules().search(request).getRulesCount();
}
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.sonarqube.ws.WsUsers;
+import org.sonarqube.ws.Users;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsClient;
import org.sonarqube.ws.client.permission.AddGroupWsRequest;
.build();
orchestrator.start();
userRule = UserRule.from(orchestrator);
- WsUsers.CreateWsResponse.User profileAdmin1 = userRule.generate();
+ Users.CreateWsResponse.User profileAdmin1 = userRule.generate();
WsClient wsClient = ItUtils.newAdminWsClient(orchestrator);
wsClient.permissions().addUser(new AddUserWsRequest().setLogin(profileAdmin1.getLogin()).setPermission("profileadmin"));
userRule = UserRule.from(orchestrator);
// Create a quality profile administrator (user having direct permission)
- WsUsers.CreateWsResponse.User profileAdmin1 = userRule.generate();
+ Users.CreateWsResponse.User profileAdmin1 = userRule.generate();
WsClient wsClient = ItUtils.newAdminWsClient(orchestrator);
wsClient.permissions().addUser(new AddUserWsRequest().setLogin(profileAdmin1.getLogin()).setPermission("profileadmin"));
// Create a quality profile administrator (user having permission from a group)
- WsUsers.CreateWsResponse.User profileAdmin2 = userRule.generate();
+ Users.CreateWsResponse.User profileAdmin2 = userRule.generate();
String groupName = randomAlphanumeric(20);
wsClient.wsConnector().call(new PostRequest("api/user_groups/create").setParam("name", groupName)).failIfNotSuccessful();
wsClient.permissions().addGroup(new AddGroupWsRequest().setPermission("profileadmin").setGroupName(groupName));
wsClient.wsConnector().call(new PostRequest("api/user_groups/add_user").setParam("name", groupName).setParam("login", profileAdmin2.getLogin())).failIfNotSuccessful();
// Create a user not being quality profile administrator
- WsUsers.CreateWsResponse.User noProfileAdmin = userRule.generate();
+ Users.CreateWsResponse.User noProfileAdmin = userRule.generate();
// Create a child profile on the built-in profile => The notification should not take into account updates of this profile
wsClient.qualityProfiles().create(CreateRequest.builder().setLanguage("foo").setName("child").build());
.build();
orchestrator.start();
userRule = UserRule.from(orchestrator);
- WsUsers.CreateWsResponse.User profileAdmin1 = userRule.generate();
+ Users.CreateWsResponse.User profileAdmin1 = userRule.generate();
WsClient wsClient = ItUtils.newAdminWsClient(orchestrator);
wsClient.permissions().addUser(new AddUserWsRequest().setLogin(profileAdmin1.getLogin()).setPermission("profileadmin"));
import org.sonarqube.qa.util.TesterSession;
import org.sonarqube.qa.util.Tester;
import org.sonarqube.ws.Organizations.Organization;
-import org.sonarqube.ws.QualityProfiles;
-import org.sonarqube.ws.QualityProfiles.CreateWsResponse;
-import org.sonarqube.ws.QualityProfiles.SearchWsResponse;
-import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile;
-import org.sonarqube.ws.WsUsers.CreateWsResponse.User;
+import org.sonarqube.ws.Qualityprofiles;
+import org.sonarqube.ws.Qualityprofiles.CreateWsResponse;
+import org.sonarqube.ws.Qualityprofiles.SearchWsResponse;
+import org.sonarqube.ws.Qualityprofiles.SearchWsResponse.QualityProfile;
+import org.sonarqube.ws.Users.CreateWsResponse.User;
import org.sonarqube.ws.client.qualityprofile.ChangeParentRequest;
import org.sonarqube.ws.client.qualityprofile.CopyRequest;
import org.sonarqube.ws.client.qualityprofile.QualityProfilesService;
QualityProfile builtInProfile = getProfile(org, p -> p.getIsBuiltIn() && "Basic".equals(p.getName()) && "xoo".equals(p.getLanguage()));
TesterSession adminSession = tester.as(administrator.getLogin());
- QualityProfiles.CopyWsResponse copyResponse = adminSession.qProfiles().service().copy(new CopyRequest(builtInProfile.getKey(), "My copy"));
+ Qualityprofiles.CopyWsResponse copyResponse = adminSession.qProfiles().service().copy(new CopyRequest(builtInProfile.getKey(), "My copy"));
assertThat(copyResponse.getIsDefault()).isFalse();
assertThat(copyResponse.getKey()).isNotEmpty().isNotEqualTo(builtInProfile.getKey());
QualityProfile builtInProfile = getProfile(org, p -> p.getIsBuiltIn() && "Basic".equals(p.getName()) && "xoo".equals(p.getLanguage()));
TesterSession adminSession = tester.as(administrator.getLogin());
- QualityProfiles.CopyWsResponse copyResponse = adminSession.qProfiles().service().copy(new CopyRequest(builtInProfile.getKey(), "My copy"));
+ Qualityprofiles.CopyWsResponse copyResponse = adminSession.qProfiles().service().copy(new CopyRequest(builtInProfile.getKey(), "My copy"));
adminSession.qProfiles().service().changeParent(
ChangeParentRequest.builder().setParentKey(builtInProfile.getKey()).setProfileKey(copyResponse.getKey()).build());
import org.sonarqube.qa.util.TesterSession;
import org.sonarqube.qa.util.Tester;
import org.sonarqube.ws.Organizations.Organization;
-import org.sonarqube.ws.QualityProfiles;
-import org.sonarqube.ws.QualityProfiles.CreateWsResponse.QualityProfile;
-import org.sonarqube.ws.WsUsers.CreateWsResponse.User;
+import org.sonarqube.ws.Qualityprofiles;
+import org.sonarqube.ws.Qualityprofiles.CreateWsResponse.QualityProfile;
+import org.sonarqube.ws.Users.CreateWsResponse.User;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.qualityprofile.AddProjectRequest;
QualityProfile parentProfile = adminSession.createXooProfile(org);
// Copied profile
- QualityProfiles.SearchWsResponse.QualityProfile builtInProfile = getProfile(org, p -> p.getIsBuiltIn() && "Basic".equals(p.getName()) && "xoo".equals(p.getLanguage()));
- QualityProfiles.CopyWsResponse copyResponse = adminSession.service().copy(new CopyRequest(builtInProfile.getKey(), "My copy"));
+ Qualityprofiles.SearchWsResponse.QualityProfile builtInProfile = getProfile(org, p -> p.getIsBuiltIn() && "Basic".equals(p.getName()) && "xoo".equals(p.getLanguage()));
+ Qualityprofiles.CopyWsResponse copyResponse = adminSession.service().copy(new CopyRequest(builtInProfile.getKey(), "My copy"));
// Inherited profile from custom
QualityProfile inheritedProfile1 = adminSession.service().create(
adminSession.qProfiles().service().changeParent(
ChangeParentRequest.builder().setParentKey(parentProfile.getKey()).setProfileKey(inheritedProfile.getKey()).build());
- QualityProfiles.SearchWsResponse.QualityProfile inheritedQualityPropfile = getProfile(org, p -> p.getKey().equals(inheritedProfile.getKey()));
+ Qualityprofiles.SearchWsResponse.QualityProfile inheritedQualityPropfile = getProfile(org, p -> p.getKey().equals(inheritedProfile.getKey()));
assertThat(inheritedQualityPropfile.getParentKey()).isEqualTo(parentProfile.getKey());
assertThat(inheritedQualityPropfile.getParentName()).isEqualTo(parentProfile.getName());
.setProjectKey(projectKey)
.setProjectName(projectName));
- QualityProfiles.SearchWsResponse.QualityProfile defaultProfile = getProfile(org, p -> "xoo".equals(p.getLanguage()) &&
+ Qualityprofiles.SearchWsResponse.QualityProfile defaultProfile = getProfile(org, p -> "xoo".equals(p.getLanguage()) &&
p.getIsDefault());
assertThatQualityProfileIsUsedFor(projectKey, defaultProfile.getKey());
assertThat(((Map) ((List) components.get("qualityProfiles")).get(0)).get("key")).isEqualTo(qualityProfileKey);
}
- private QualityProfiles.SearchWsResponse.QualityProfile getProfile(Organization organization, Predicate<QualityProfiles.SearchWsResponse.QualityProfile> filter) {
+ private Qualityprofiles.SearchWsResponse.QualityProfile getProfile(Organization organization, Predicate<Qualityprofiles.SearchWsResponse.QualityProfile> filter) {
return tester.qProfiles().service().search(new SearchWsRequest()
.setOrganizationKey(organization.getKey())).getProfilesList()
.stream()
import org.sonarqube.qa.util.pageobjects.RulesPage;
import org.sonarqube.tests.Category6Suite;
import org.sonarqube.ws.Organizations.Organization;
-import org.sonarqube.ws.QualityProfiles;
-import org.sonarqube.ws.WsUsers.CreateWsResponse.User;
+import org.sonarqube.ws.Qualityprofiles;
+import org.sonarqube.ws.Users.CreateWsResponse.User;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.qualityprofile.AddProjectRequest;
import org.sonarqube.ws.client.qualityprofile.ChangeParentRequest;
@Test
public void testSonarWayComparison() {
- QualityProfiles.CreateWsResponse.QualityProfile xooProfile = tester.qProfiles().createXooProfile(organization);
+ Qualityprofiles.CreateWsResponse.QualityProfile xooProfile = tester.qProfiles().createXooProfile(organization);
tester.qProfiles().activateRule(xooProfile, "xoo:OneBugIssuePerLine");
tester.qProfiles().activateRule(xooProfile, "xoo:OneIssuePerLine");
Navigation nav = tester.openBrowser();
import org.sonarqube.qa.util.Tester;
import org.sonarqube.ws.Common;
import org.sonarqube.ws.Organizations.Organization;
-import org.sonarqube.ws.QualityProfiles.CreateWsResponse;
-import org.sonarqube.ws.QualityProfiles.SearchGroupsResponse;
-import org.sonarqube.ws.QualityProfiles.SearchUsersResponse;
-import org.sonarqube.ws.QualityProfiles.SearchWsResponse;
-import org.sonarqube.ws.WsUserGroups;
-import org.sonarqube.ws.WsUsers.CreateWsResponse.User;
+import org.sonarqube.ws.Qualityprofiles.CreateWsResponse;
+import org.sonarqube.ws.Qualityprofiles.SearchGroupsResponse;
+import org.sonarqube.ws.Qualityprofiles.SearchUsersResponse;
+import org.sonarqube.ws.Qualityprofiles.SearchWsResponse;
+import org.sonarqube.ws.UserGroups;
+import org.sonarqube.ws.Users.CreateWsResponse.User;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.permission.AddUserWsRequest;
import org.sonarqube.ws.client.qualityprofile.AddGroupRequest;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.tuple;
-import static org.sonarqube.ws.QualityProfiles.SearchGroupsResponse.Group;
+import static org.sonarqube.ws.Qualityprofiles.SearchGroupsResponse.Group;
public class QualityProfilesEditTest {
private static final String RULE_ONE_BUG_PER_LINE = "xoo:OneBugIssuePerLine";
@Test
public void search_groups_allowed_to_edit_a_profile() {
Organization organization = tester.organizations().generate();
- WsUserGroups.Group group1 = tester.groups().generate(organization);
- WsUserGroups.Group group2 = tester.groups().generate(organization);
- WsUserGroups.Group group3 = tester.groups().generate(organization);
+ UserGroups.Group group1 = tester.groups().generate(organization);
+ UserGroups.Group group2 = tester.groups().generate(organization);
+ UserGroups.Group group3 = tester.groups().generate(organization);
CreateWsResponse.QualityProfile xooProfile = tester.qProfiles().createXooProfile(organization);
addGroupPermission(organization, group1, xooProfile);
addGroupPermission(organization, group2, xooProfile);
@Test
public void add_and_remove_group() {
Organization organization = tester.organizations().generate();
- WsUserGroups.Group group1 = tester.groups().generate(organization);
- WsUserGroups.Group group2 = tester.groups().generate(organization);
+ UserGroups.Group group1 = tester.groups().generate(organization);
+ UserGroups.Group group2 = tester.groups().generate(organization);
CreateWsResponse.QualityProfile xooProfile = tester.qProfiles().createXooProfile(organization);
// No group added
CreateWsResponse.QualityProfile xooProfile1 = tester.qProfiles().createXooProfile(organization);
addUserPermission(organization, user, xooProfile1);
CreateWsResponse.QualityProfile xooProfile2 = tester.qProfiles().createXooProfile(organization);
- WsUserGroups.Group group = tester.groups().generate(organization);
+ UserGroups.Group group = tester.groups().generate(organization);
tester.groups().addMemberToGroups(organization, user.getLogin(), group.getName());
addGroupPermission(organization, group, xooProfile2);
CreateWsResponse.QualityProfile xooProfile3 = tester.qProfiles().createXooProfile(organization);
CreateWsResponse.QualityProfile xooProfile = tester.qProfiles().createXooProfile(org);
User individualEditor = tester.users().generateMember(org);
addUserPermission(org, individualEditor, xooProfile);
- WsUserGroups.Group group = tester.groups().generate(org);
+ UserGroups.Group group = tester.groups().generate(org);
addGroupPermission(org, group, xooProfile);
User groupEditor = tester.users().generateMember(org);
tester.groups().addMemberToGroups(org, groupEditor.getLogin(), group.getName());
.build());
}
- private void addGroupPermission(Organization organization, WsUserGroups.Group group, CreateWsResponse.QualityProfile qProfile) {
+ private void addGroupPermission(Organization organization, UserGroups.Group group, CreateWsResponse.QualityProfile qProfile) {
tester.qProfiles().service().addGroup(AddGroupRequest.builder()
.setOrganization(organization.getKey())
.setQualityProfile(qProfile.getName())
import org.sonarqube.tests.Category6Suite;
import org.sonarqube.qa.util.Tester;
import org.sonarqube.ws.Organizations.Organization;
-import org.sonarqube.ws.QualityProfiles.CreateWsResponse;
-import org.sonarqube.ws.QualityProfiles.SearchWsResponse;
-import org.sonarqube.ws.QualityProfiles.ShowResponse;
-import org.sonarqube.ws.QualityProfiles.ShowResponse.CompareToSonarWay;
-import org.sonarqube.ws.QualityProfiles.ShowResponse.QualityProfile;
+import org.sonarqube.ws.Qualityprofiles.CreateWsResponse;
+import org.sonarqube.ws.Qualityprofiles.SearchWsResponse;
+import org.sonarqube.ws.Qualityprofiles.ShowResponse;
+import org.sonarqube.ws.Qualityprofiles.ShowResponse.CompareToSonarWay;
+import org.sonarqube.ws.Qualityprofiles.ShowResponse.QualityProfile;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsResponse;
import org.sonarqube.tests.Category6Suite;
import org.sonarqube.qa.util.Tester;
import org.sonarqube.ws.Organizations.Organization;
-import org.sonarqube.ws.QualityProfiles.CreateWsResponse;
-import org.sonarqube.ws.QualityProfiles.SearchWsResponse;
+import org.sonarqube.ws.Qualityprofiles.CreateWsResponse;
+import org.sonarqube.ws.Qualityprofiles.SearchWsResponse;
import org.sonarqube.ws.Rules;
import org.sonarqube.ws.client.rule.SearchWsRequest;
import org.junit.rules.ExpectedException;
import org.junit.rules.TestRule;
import org.junit.rules.Timeout;
-import org.sonarqube.ws.WsSystem;
+import org.sonarqube.ws.System;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsClient;
import org.sonarqube.ws.client.permission.AddUserWsRequest;
createSystemAdministrator("big", "boss");
ItUtils.newUserWsClient(orchestrator, "big", "boss").system().restart();
- assertThat(newAdminWsClient(orchestrator).system().status().getStatus()).isEqualTo(WsSystem.Status.RESTARTING);
+ assertThat(newAdminWsClient(orchestrator).system().status().getStatus()).isEqualTo(System.Status.RESTARTING);
// we just wait five seconds, for a lack of a better approach to waiting for the restart process to start in SQ
Thread.sleep(5000);
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import org.sonarqube.ws.WsSystem;
+import org.sonarqube.ws.System;
import util.ItUtils;
import static org.assertj.core.api.Assertions.assertThat;
.build();
orchestrator.start();
- assertThat(newAdminWsClient(orchestrator).system().status().getStatus()).isEqualTo(WsSystem.Status.UP);
+ assertThat(newAdminWsClient(orchestrator).system().status().getStatus()).isEqualTo(System.Status.UP);
}
// SONAR-4748
import org.junit.Test;
import org.sonarqube.tests.Category4Suite;
import org.sonarqube.qa.util.Tester;
-import org.sonarqube.ws.WsSystem;
+import org.sonarqube.ws.System;
import util.ItUtils;
import util.selenium.Selenese;
@Test
public void get_sonarqube_version() {
- WsSystem.StatusResponse response = tester.wsClient().system().status();
+ System.StatusResponse response = tester.wsClient().system().status();
String version = response.getVersion();
if (!startsWithAny(version, new String[]{"6.", "7.", "8."})) {
import org.junit.rules.TestRule;
import org.junit.rules.Timeout;
import org.sonarqube.qa.util.Elasticsearch;
-import org.sonarqube.ws.WsSystem;
+import org.sonarqube.ws.System;
import org.sonarqube.ws.client.WsClient;
import static com.google.common.base.Preconditions.checkState;
commander.start(lock);
commander.waitFor(() -> commander.webLogsContain("ServerStartupLock - Waiting for file to be deleted"));
- commander.verifyStatus(WsSystem.Status.STARTING);
- commander.verifyHealth(WsSystem.Health.RED, "SonarQube webserver is not up");
+ commander.verifyStatus(System.Status.STARTING);
+ commander.verifyHealth(System.Health.RED, "SonarQube webserver is not up");
lock.unlockWeb();
// status is UP as soon as web server is up, whatever the status of Compute Engine
- commander.waitFor(() -> WsSystem.Status.UP == commander.status().orElse(null));
- commander.verifyHealth(WsSystem.Health.RED, "Compute Engine is not operational");
+ commander.waitFor(() -> System.Status.UP == commander.status().orElse(null));
+ commander.verifyHealth(System.Health.RED, "Compute Engine is not operational");
lock.unlockCe();
- commander.waitForHealth(WsSystem.Health.GREEN);
- commander.verifyStatus(WsSystem.Status.UP);
+ commander.waitForHealth(System.Health.GREEN);
+ commander.verifyStatus(System.Status.UP);
}
}
public void test_status_and_health_when_ES_becomes_yellow() throws Exception {
try (Commander commander = new Commander()) {
commander.start();
- commander.waitForHealth(WsSystem.Health.GREEN);
+ commander.waitForHealth(System.Health.GREEN);
commander.makeElasticsearchYellow();
- commander.waitForHealth(WsSystem.Health.YELLOW, "Elasticsearch status is YELLOW");
- commander.verifyStatus(WsSystem.Status.UP);
+ commander.waitForHealth(System.Health.YELLOW, "Elasticsearch status is YELLOW");
+ commander.verifyStatus(System.Status.UP);
commander.makeElasticsearchGreen();
- commander.waitForHealth(WsSystem.Health.GREEN);
+ commander.waitForHealth(System.Health.GREEN);
// status does not change after being UP
- commander.verifyStatus(WsSystem.Status.UP);
+ commander.verifyStatus(System.Status.UP);
}
}
}
}
- Optional<WsSystem.Status> status() {
+ Optional<System.Status> status() {
if (orchestrator.getServer() != null) {
WsClient wsClient = newWsClient(orchestrator);
try {
return Optional.empty();
}
- void verifyStatus(WsSystem.Status expectedStatus) {
+ void verifyStatus(System.Status expectedStatus) {
assertThat(status()).hasValue(expectedStatus);
}
- Optional<WsSystem.Health> health() {
- Optional<WsSystem.HealthResponse> response = healthResponse();
- return response.map(WsSystem.HealthResponse::getHealth);
+ Optional<System.Health> health() {
+ Optional<System.HealthResponse> response = healthResponse();
+ return response.map(System.HealthResponse::getHealth);
}
- Optional<WsSystem.HealthResponse> healthResponse() {
+ Optional<System.HealthResponse> healthResponse() {
if (orchestrator.getServer() != null) {
WsClient wsClient = newSystemUserWsClient(orchestrator, systemPassCode);
try {
return Optional.empty();
}
- void waitForHealth(WsSystem.Health expectedHealth, String... expectedMessages) {
+ void waitForHealth(System.Health expectedHealth, String... expectedMessages) {
waitFor(() -> expectedHealth == health().orElse(null));
verifyHealth(expectedHealth, expectedMessages);
}
- void verifyHealth(WsSystem.Health expectedHealth, String... expectedMessages) {
- WsSystem.HealthResponse response = healthResponse().get();
+ void verifyHealth(System.Health expectedHealth, String... expectedMessages) {
+ System.HealthResponse response = healthResponse().get();
assertThat(response.getHealth())
.describedAs("Expected status %s in response %s", expectedHealth, response)
.isEqualTo(expectedHealth);
assertThat(response.getCausesList())
- .extracting(WsSystem.Cause::getMessage)
+ .extracting(System.Cause::getMessage)
.describedAs("Expected causes %s in response %s", Arrays.asList(expectedMessages), response)
.containsExactlyInAnyOrder(expectedMessages);
}
import com.google.common.base.Throwables;
import com.google.gson.Gson;
import com.sonar.orchestrator.Orchestrator;
+import org.junit.rules.RuleChain;
import org.sonarqube.tests.Category1Suite;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
@ClassRule
public static Orchestrator orchestrator = Category1Suite.ORCHESTRATOR;
+ private static UserRule userRule = UserRule.from(orchestrator);
+
@ClassRule
- public static UserRule userRule = UserRule.from(orchestrator);
+ public static RuleChain ruleChain = RuleChain.outerRule(orchestrator).around(userRule);
static WsClient adminWsClient;
static WsClient userWsClient;
import com.google.common.collect.ImmutableMap;
import com.sonar.orchestrator.Orchestrator;
+import org.junit.rules.RuleChain;
import org.sonarqube.tests.Category1Suite;
import java.io.IOException;
import java.util.List;
@ClassRule
public static Orchestrator orchestrator = Category1Suite.ORCHESTRATOR;
+ private static UserRule userRule = UserRule.from(orchestrator);
+
@ClassRule
- public static UserRule userRule = UserRule.from(orchestrator);
+ public static RuleChain ruleChain = RuleChain.outerRule(orchestrator).around(userRule);
private static WsClient adminWsClient;
private static SettingsService anonymousSettingsService;
import org.junit.rules.Timeout;
import org.sonarqube.qa.util.LogsTailer;
import org.sonarqube.qa.util.Tester;
-import org.sonarqube.ws.WsUsers;
+import org.sonarqube.ws.Users;
import org.sonarqube.ws.client.user.SearchRequest;
import static org.assertj.core.api.Assertions.assertThat;
sonarQube.resume();
sonarQubeIsUpWatcher.waitForLog(20, TimeUnit.SECONDS);
SearchRequest searchRequest = SearchRequest.builder().setQuery("admin").build();
- WsUsers.SearchWsResponse searchWsResponse = sonarQube.tester.wsClient().users().search(searchRequest);
+ Users.SearchWsResponse searchWsResponse = sonarQube.tester.wsClient().users().search(searchRequest);
assertThat(searchWsResponse.getUsersCount()).isEqualTo(1);
assertThat(searchWsResponse.getUsers(0).getName()).isEqualTo("Administrator");
}
import org.junit.Rule;
import org.junit.Test;
import org.sonarqube.qa.util.Tester;
-import org.sonarqube.ws.WsMeasures;
+import org.sonarqube.ws.Measures;
import static java.lang.Double.parseDouble;
import static org.assertj.core.api.Assertions.assertThat;
orchestrator.executeBuilds(SonarScanner.create(projectDir("testing/xoo-sample-new-coverage-v2"))
.setProperty("sonar.scm.disabled", "false"));
- Map<String, WsMeasures.Measure> measures = getMeasuresWithVariationsByMetricKey(orchestrator, PROJECT_KEY, ALL_NEW_COVERAGE_METRICS);
+ Map<String, Measures.Measure> measures = getMeasuresWithVariationsByMetricKey(orchestrator, PROJECT_KEY, ALL_NEW_COVERAGE_METRICS);
assertThat(parseDouble(measures.get("new_coverage").getPeriods().getPeriodsValue(0).getValue())).isEqualTo(66.6d, DEFAULT_OFFSET);
assertThat(parseDouble(measures.get("new_line_coverage").getPeriods().getPeriodsValue(0).getValue())).isEqualTo(100d, DEFAULT_OFFSET);
assertThat(parseDouble(measures.get("new_branch_coverage").getPeriods().getPeriodsValue(0).getValue())).isEqualTo(42.8, DEFAULT_OFFSET);
import org.junit.Test;
import org.openqa.selenium.By;
import org.sonarqube.qa.util.Tester;
-import org.sonarqube.ws.WsProjects;
-import org.sonarqube.ws.WsUsers.CreateWsResponse.User;
+import org.sonarqube.ws.Projects;
+import org.sonarqube.ws.Users.CreateWsResponse.User;
import org.sonarqube.ws.client.project.CreateRequest;
import util.ItUtils;
import util.selenium.Selenese;
@Test
public void test_project_page() {
- WsProjects.CreateWsResponse.Project project = createSampleProject();
+ Projects.CreateWsResponse.Project project = createSampleProject();
tester.openBrowser().open("/dashboard?id=" + project.getKey());
@Test
public void test_project_administration_page() {
- WsProjects.CreateWsResponse.Project project = createSampleProject();
+ Projects.CreateWsResponse.Project project = createSampleProject();
User administrator = tester.users().generateAdministrator();
tester.openBrowser()
$("body").shouldHave(text("uiextensionsplugin/project_admin_page"));
}
- private WsProjects.CreateWsResponse.Project createSampleProject() {
+ private Projects.CreateWsResponse.Project createSampleProject() {
String projectKey = ItUtils.newProjectKey();
return tester.wsClient().projects().create(CreateRequest.builder()
.setKey(projectKey)
import org.junit.After;
import org.junit.Test;
import org.sonarqube.qa.util.SelenideConfig;
-import org.sonarqube.ws.WsMeasures.Measure;
+import org.sonarqube.ws.Measures.Measure;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.HttpConnector;
import org.sonarqube.ws.client.WsClient;
package org.sonarqube.tests.user;
import com.google.common.base.Joiner;
-import com.google.common.base.Optional;
import com.sonar.orchestrator.Orchestrator;
import java.io.File;
+import java.util.Optional;
import org.apache.commons.io.FileUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
+import org.junit.rules.RuleChain;
import org.sonarqube.qa.util.pageobjects.Navigation;
import org.sonarqube.tests.Category4Suite;
import org.sonarqube.ws.client.GetRequest;
import util.user.Users;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.guava.api.Assertions.assertThat;
import static util.ItUtils.newAdminWsClient;
import static util.ItUtils.resetSettings;
import static util.ItUtils.setServerProperty;
@ClassRule
public static Orchestrator ORCHESTRATOR = Category4Suite.ORCHESTRATOR;
+ private static UserRule userRule = UserRule.from(ORCHESTRATOR);
+
@ClassRule
- public static UserRule userRule = UserRule.from(ORCHESTRATOR);
+ public static RuleChain ruleChain = RuleChain.outerRule(ORCHESTRATOR).around(userRule);
static String FAKE_PROVIDER_KEY = "fake-base-id-provider";
import org.junit.Rule;
import org.junit.Test;
import org.sonarqube.qa.util.Tester;
-import org.sonarqube.ws.WsUsers.CreateWsResponse.User;
+import org.sonarqube.ws.Users.CreateWsResponse.User;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsClient;
import org.sonarqube.qa.util.pageobjects.LoginPage;
import org.sonarqube.qa.util.pageobjects.Navigation;
import org.sonarqube.tests.Category4Suite;
-import org.sonarqube.ws.WsUserTokens;
-import org.sonarqube.ws.WsUsers;
-import org.sonarqube.ws.WsUsers.CreateWsResponse.User;
+import org.sonarqube.ws.UserTokens;
+import org.sonarqube.ws.Users;
+import org.sonarqube.ws.Users.CreateWsResponse.User;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.HttpConnector;
import org.sonarqube.ws.client.PostRequest;
User user = tester.users().generate();
String tokenName = "Validate token based authentication";
UserTokensService tokensService = tester.wsClient().userTokens();
- WsUserTokens.GenerateWsResponse generateWsResponse = tokensService.generate(new GenerateWsRequest()
+ UserTokens.GenerateWsResponse generateWsResponse = tokensService.generate(new GenerateWsRequest()
.setLogin(user.getLogin())
.setName(tokenName));
WsClient wsClient = WsClientFactories.getDefault().newClient(HttpConnector.newBuilder()
assertThat(response.content()).isEqualTo("{\"valid\":true}");
- WsUserTokens.SearchWsResponse searchResponse = tokensService.search(new SearchWsRequest().setLogin(user.getLogin()));
+ UserTokens.SearchWsResponse searchResponse = tokensService.search(new SearchWsRequest().setLogin(user.getLogin()));
assertThat(searchResponse.getUserTokensCount()).isEqualTo(1);
tokensService.revoke(new RevokeWsRequest().setLogin(user.getLogin()).setName(tokenName));
searchResponse = tokensService.search(new SearchWsRequest().setLogin(user.getLogin()));
assertThat(checkAuthenticationWithAuthenticateWebService("test", "password")).isTrue();
assertThat(tester.users().getByLogin("test").get())
- .extracting(WsUsers.SearchWsResponse.User::getLogin, WsUsers.SearchWsResponse.User::getName, WsUsers.SearchWsResponse.User::getEmail, u -> u.getScmAccounts().getScmAccountsList(),
- WsUsers.SearchWsResponse.User::getExternalIdentity, WsUsers.SearchWsResponse.User::getExternalProvider)
+ .extracting(Users.SearchWsResponse.User::getLogin, Users.SearchWsResponse.User::getName, Users.SearchWsResponse.User::getEmail, u -> u.getScmAccounts().getScmAccountsList(),
+ Users.SearchWsResponse.User::getExternalIdentity, Users.SearchWsResponse.User::getExternalProvider)
.containsOnly("test", "Test", "test@email.com", asList("test1", "test2"), "test", "sonarqube");
}
import org.sonarqube.qa.util.pageobjects.Navigation;
import org.sonarqube.tests.Category4Suite;
import org.sonarqube.qa.util.Tester;
-import org.sonarqube.ws.WsUsers.CreateWsResponse.User;
+import org.sonarqube.ws.Users.CreateWsResponse.User;
import org.sonarqube.ws.client.PostRequest;
import static com.codeborne.selenide.Condition.text;
import org.sonarqube.qa.util.Tester;
import org.sonarqube.qa.util.pageobjects.Navigation;
import org.sonarqube.tests.Category4Suite;
-import org.sonarqube.ws.WsUsers.SearchWsResponse.User;
+import org.sonarqube.ws.Users.SearchWsResponse.User;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.WsResponse;
import org.sonarqube.ws.client.permission.AddUserWsRequest;
package org.sonarqube.tests.user;
import com.sonar.orchestrator.Orchestrator;
-import org.junit.After;
-import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.sonarqube.qa.util.Tester;
-import org.sonarqube.ws.WsUsers.CreateWsResponse.User;
+import org.sonarqube.ws.Users.CreateWsResponse.User;
import org.sonarqube.ws.client.WsClient;
import util.ItUtils;
import static org.assertj.core.api.Assertions.assertThat;
-import static util.ItUtils.resetSettings;
-import static util.ItUtils.setServerProperty;
public class OnboardingTest {
@Rule
public Tester tester = new Tester(orchestrator).disableOrganizations();
- @Before
- public void setUp() {
- resetSettings(orchestrator, null, ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS);
- }
-
- @After
- public void reset() {
- resetSettings(orchestrator, null, ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS);
- }
-
@Test
public void by_default_new_user_does_not_see_onboarding_tutorial() {
User user = tester.users().generate();
verifyTutorial(reactivatedUser, true);
}
- private static void setShownOnboardingSetting(boolean showTutorial) {
- setServerProperty(orchestrator, ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS, String.valueOf(showTutorial));
+ private void setShownOnboardingSetting(boolean showTutorial) {
+ tester.settings().setGlobalSettings(ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS, String.valueOf(showTutorial));
}
private void verifyTutorial(User user, boolean expectedTutorial) {
import com.google.common.base.Joiner;
import com.sonar.orchestrator.Orchestrator;
-import org.sonarqube.tests.Category6Suite;
import org.junit.After;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.sonarqube.qa.util.Tester;
-import org.sonarqube.ws.WsUserGroups.Group;
-import org.sonarqube.ws.WsUsers.CreateWsResponse.User;
+import org.sonarqube.tests.Category6Suite;
+import org.sonarqube.ws.UserGroups.Group;
+import org.sonarqube.ws.Users.CreateWsResponse.User;
import org.sonarqube.ws.client.GetRequest;
-import static util.ItUtils.resetSettings;
-import static util.ItUtils.setServerProperty;
-
public class OrganizationIdentityProviderTest {
@ClassRule
@Rule
public Tester tester = new Tester(orchestrator);
-
@Before
public void setUp() {
// enable the fake authentication plugin
- setServerProperty(orchestrator, "sonar.auth.fake-base-id-provider.enabled", "true");
+ tester.settings().setGlobalSettings("sonar.auth.fake-base-id-provider.enabled", "true");
}
@After
public void tearDown() {
- resetSettings(orchestrator, null, "sonar.auth.fake-base-id-provider.enabled", "sonar.auth.fake-base-id-provider.user",
+ tester.settings().resetSettings("sonar.auth.fake-base-id-provider.enabled", "sonar.auth.fake-base-id-provider.user",
"sonar.auth.fake-base-id-provider.throwUnauthorizedMessage", "sonar.auth.fake-base-id-provider.enabledGroupsSync", "sonar.auth.fake-base-id-provider.groups",
"sonar.auth.fake-base-id-provider.allowsUsersToSignUp");
}
@Test
- public void default_group_is_not_added_for_new_user_when_organizations_are_enabled() {
+ public void default_group_is_not_added_for_new_user_when_organizations_are_enabled() {
Group group = tester.groups().generate(null);
enableUserCreationByAuthPlugin("aLogin");
setGroupsReturnedByAuthPlugin(group.getName());
tester.groups().assertThatUserIsOnlyMemberOf(null, user.getLogin());
}
- private static void enableUserCreationByAuthPlugin(String login) {
- setServerProperty(orchestrator, "sonar.auth.fake-base-id-provider.user", login + ",fake-john,John,john@email.com");
+ private void enableUserCreationByAuthPlugin(String login) {
+ tester.settings().setGlobalSettings("sonar.auth.fake-base-id-provider.user", login + ",fake-john,John,john@email.com");
}
- private static void setGroupsReturnedByAuthPlugin(String... groups) {
- setServerProperty(orchestrator, "sonar.auth.fake-base-id-provider.enabledGroupsSync", "true");
+ private void setGroupsReturnedByAuthPlugin(String... groups) {
+ tester.settings().setGlobalSettings("sonar.auth.fake-base-id-provider.enabledGroupsSync", "true");
if (groups.length > 0) {
- setServerProperty(orchestrator, "sonar.auth.fake-base-id-provider.groups", Joiner.on(",").join(groups));
+ tester.settings().setGlobalSettings("sonar.auth.fake-base-id-provider.groups", Joiner.on(",").join(groups));
}
}
import org.sonar.wsclient.connectors.HttpClient4Connector;
import org.sonar.wsclient.services.AuthenticationQuery;
import org.sonar.wsclient.user.UserParameters;
-import org.sonarqube.qa.util.pageobjects.SystemInfoPage;
import org.sonarqube.qa.util.Tester;
+import org.sonarqube.qa.util.pageobjects.SystemInfoPage;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.WsResponse;
import org.sonarqube.ws.client.user.CreateRequest;
import static java.net.HttpURLConnection.HTTP_UNAUTHORIZED;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.fail;
-import static util.ItUtils.newAdminWsClient;
import static util.ItUtils.newUserWsClient;
import static util.ItUtils.pluginArtifact;
import static util.ItUtils.resetSettings;
-import static util.ItUtils.setServerProperty;
import static util.selenium.Selenese.runSelenese;
/**
verifyAuthenticationIsNotOk(login, null);
verifyAuthenticationIsOk(null, null);
- setServerProperty(orchestrator, "sonar.forceAuthentication", "true");
+ tester.settings().setGlobalSettings("sonar.forceAuthentication", "true");
verifyAuthenticationIsOk(login, password);
verifyAuthenticationIsNotOk("wrong", password);
@Test
public void provision_user_before_authentication() {
- newAdminWsClient(orchestrator).users().create(CreateRequest.builder()
+ tester.wsClient().users().create(CreateRequest.builder()
.setLogin(USER_LOGIN)
.setName("Tester Testerovich")
.setEmail("tester@example.org")
/**
* Updates information about users in security-plugin.
*/
- private static void updateUsersInExtAuth(Map<String, String> users) {
- setServerProperty(orchestrator, USERS_PROPERTY, format(users));
+ private void updateUsersInExtAuth(Map<String, String> users) {
+ tester.settings().setGlobalSettings(USERS_PROPERTY, format(users));
}
private void createUserInDb(String login, String password) {
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
+import org.junit.rules.RuleChain;
import util.user.UserRule;
import static java.nio.charset.StandardCharsets.UTF_8;
.setServerProperty("sonar.web.sso.groupsHeader", GROUPS_HEADER)
.build();
+ private static UserRule userRule = UserRule.from(orchestrator);
+
@ClassRule
- public static UserRule USER_RULE = UserRule.from(orchestrator);
+ public static RuleChain ruleChain = RuleChain.outerRule(orchestrator).around(userRule);
@Before
public void resetData() throws Exception {
- USER_RULE.resetUsers();
+ userRule.resetUsers();
}
@Test
public void authenticate() {
doCall(USER_LOGIN, USER_NAME, USER_EMAIL, null);
- USER_RULE.verifyUserExists(USER_LOGIN, USER_NAME, USER_EMAIL);
+ userRule.verifyUserExists(USER_LOGIN, USER_NAME, USER_EMAIL);
}
@Test
public void authenticate_with_only_login() throws Exception {
doCall(USER_LOGIN, null, null, null);
- USER_RULE.verifyUserExists(USER_LOGIN, USER_LOGIN, null);
+ userRule.verifyUserExists(USER_LOGIN, USER_LOGIN, null);
}
@Test
public void update_user_when_headers_are_updated() {
doCall(USER_LOGIN, USER_NAME, USER_EMAIL, null);
- USER_RULE.verifyUserExists(USER_LOGIN, USER_NAME, USER_EMAIL);
+ userRule.verifyUserExists(USER_LOGIN, USER_NAME, USER_EMAIL);
// As we don't keep the JWT token is the test, the user is updated
doCall(USER_LOGIN, "new name", "new email", null);
- USER_RULE.verifyUserExists(USER_LOGIN, "new name", "new email");
+ userRule.verifyUserExists(USER_LOGIN, "new name", "new email");
}
@Test
public void authenticate_with_groups() {
doCall(USER_LOGIN, null, null, GROUP_1);
- USER_RULE.verifyUserGroupMembership(USER_LOGIN, GROUP_1, "sonar-users");
+ userRule.verifyUserGroupMembership(USER_LOGIN, GROUP_1, "sonar-users");
}
@Test
public void synchronize_groups_when_authenticating_existing_user() throws Exception {
- USER_RULE.createGroup(GROUP_1);
- USER_RULE.createGroup(GROUP_2);
- USER_RULE.createGroup(GROUP_3);
- USER_RULE.createUser(USER_LOGIN, "password");
- USER_RULE.associateGroupsToUser(USER_LOGIN, GROUP_1, GROUP_2);
+ userRule.createGroup(GROUP_1);
+ userRule.createGroup(GROUP_2);
+ userRule.createGroup(GROUP_3);
+ userRule.createUser(USER_LOGIN, "password");
+ userRule.associateGroupsToUser(USER_LOGIN, GROUP_1, GROUP_2);
doCall(USER_LOGIN, null, null, GROUP_2 + "," + GROUP_3);
- USER_RULE.verifyUserGroupMembership(USER_LOGIN, GROUP_2, GROUP_3, "sonar-users");
+ userRule.verifyUserGroupMembership(USER_LOGIN, GROUP_2, GROUP_3, "sonar-users");
}
@Test
public void authentication_with_local_user_is_possible_when_no_header() throws Exception {
- USER_RULE.createUser(USER_LOGIN, "password");
+ userRule.createUser(USER_LOGIN, "password");
checkLocalAuthentication(USER_LOGIN, "password");
}
List<String> logsLines = FileUtils.readLines(orchestrator.getServer().getWebLogs(), UTF_8);
assertThat(logsLines).doesNotContain("org.sonar.server.exceptions.BadRequestException: Use only letters, numbers, and .-_@ please.");
- USER_RULE.verifyUserDoesNotExist(USER_LOGIN);
+ userRule.verifyUserDoesNotExist(USER_LOGIN);
}
@Test
public void fail_when_email_already_exists() throws Exception {
- USER_RULE.createUser("another", "Another", USER_EMAIL, "another");
+ userRule.createUser("another", "Another", USER_EMAIL, "another");
Response response = doCall(USER_LOGIN, USER_NAME, USER_EMAIL, null);
import org.junit.rules.Timeout;
import org.sonarqube.tests.Byteman;
import org.sonarqube.qa.util.Tester;
-import org.sonarqube.ws.WsUsers.CreateWsResponse.User;
+import org.sonarqube.ws.Users.CreateWsResponse.User;
import org.sonarqube.ws.client.user.SearchRequest;
import org.sonarqube.ws.client.user.UpdateRequest;
import util.ItUtils;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
-import org.sonarqube.ws.WsUsers;
+import org.sonarqube.ws.Users;
import org.sonarqube.ws.client.WsClient;
import org.sonarqube.ws.client.user.GroupsRequest;
import util.selenium.Selenese;
userRule.createGroup(group);
userRule.associateGroupsToUser(login, group);
- List<WsUsers.GroupsWsResponse.Group> result = adminClient.users().groups(GroupsRequest.builder().setLogin(login).build()).getGroupsList();
+ List<Users.GroupsWsResponse.Group> result = adminClient.users().groups(GroupsRequest.builder().setLogin(login).build()).getGroupsList();
- assertThat(result).extracting(WsUsers.GroupsWsResponse.Group::getName).contains(group);
+ assertThat(result).extracting(Users.GroupsWsResponse.Group::getName).contains(group);
}
}
import org.sonar.wsclient.issue.IssueQuery;
import org.sonarqube.qa.util.SettingTester;
import org.sonarqube.qa.util.Tester;
-import org.sonarqube.ws.WsComponents.Component;
-import org.sonarqube.ws.WsMeasures;
-import org.sonarqube.ws.WsMeasures.Measure;
+import org.sonarqube.ws.Components.Component;
+import org.sonarqube.ws.Measures;
+import org.sonarqube.ws.Measures.Measure;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.HttpConnector;
import org.sonarqube.ws.client.WsClient;
@CheckForNull
public static Measure getMeasureWithVariation(Orchestrator orchestrator, String componentKey, String metricKey) {
- WsMeasures.ComponentWsResponse response = newWsClient(orchestrator).measures().component(new ComponentWsRequest()
+ Measures.ComponentWsResponse response = newWsClient(orchestrator).measures().component(new ComponentWsRequest()
.setComponentKey(componentKey)
.setMetricKeys(singletonList(metricKey))
.setAdditionalFields(singletonList("periods")));
*/
@CheckForNull
public static Double getLeakPeriodValue(Orchestrator orchestrator, String componentKey, String metricKey) {
- List<WsMeasures.PeriodValue> periodsValueList = getMeasureWithVariation(orchestrator, componentKey, metricKey).getPeriods().getPeriodsValueList();
+ List<Measures.PeriodValue> periodsValueList = getMeasureWithVariation(orchestrator, componentKey, metricKey).getPeriods().getPeriodsValueList();
return periodsValueList.size() > 0 ? Double.parseDouble(periodsValueList.get(0).getValue()) : null;
}
*/
package util.user;
-import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
-import com.google.common.collect.FluentIterable;
import com.sonar.orchestrator.Orchestrator;
import java.util.List;
+import java.util.Optional;
import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.Predicate;
import java.util.stream.Collectors;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.junit.rules.ExternalResource;
import org.sonarqube.qa.util.Tester;
-import org.sonarqube.ws.WsUsers;
+import org.sonarqube.ws.Users;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsClient;
import static java.util.Objects.requireNonNull;
import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.guava.api.Assertions.assertThat;
import static util.ItUtils.newAdminWsClient;
/**
// *****************
public void resetUsers() {
- for (Users.User user : getUsers().getUsers()) {
+ for (util.user.Users.User user : getUsers().getUsers()) {
String userLogin = user.getLogin();
if (!userLogin.equals(ADMIN_LOGIN)) {
deactivateUsers(userLogin);
}
}
- public Users.User verifyUserExists(String login, String name, @Nullable String email) {
- Optional<Users.User> user = getUserByLogin(login);
+ public util.user.Users.User verifyUserExists(String login, String name, @Nullable String email) {
+ Optional<util.user.Users.User> user = getUserByLogin(login);
assertThat(user).as("User with login '%s' hasn't been found", login).isPresent();
assertThat(user.get().getLogin()).isEqualTo(login);
assertThat(user.get().getName()).isEqualTo(name);
}
public void verifyUserExists(String login, String name, @Nullable String email, boolean local) {
- Users.User user = verifyUserExists(login, name, email);
+ util.user.Users.User user = verifyUserExists(login, name, email);
assertThat(user.isLocal()).isEqualTo(local);
}
public void verifyUserDoesNotExist(String login) {
- assertThat(getUserByLogin(login)).as("Unexpected user with login '%s' has been found", login).isAbsent();
+ assertThat(getUserByLogin(login)).as("Unexpected user with login '%s' has been found", login).isEmpty();
}
- public WsUsers.CreateWsResponse.User createUser(String login, String name, @Nullable String email, String password) {
+ public Users.CreateWsResponse.User createUser(String login, String name, @Nullable String email, String password) {
CreateRequest.Builder request = CreateRequest.builder()
.setLogin(login)
.setName(name)
* Create user with randomly generated values. By default password is the login.
*/
@SafeVarargs
- public final WsUsers.CreateWsResponse.User generate(Consumer<CreateRequest.Builder>... populators) {
+ public final org.sonarqube.ws.Users.CreateWsResponse.User generate(Consumer<CreateRequest.Builder>... populators) {
int id = ID_GENERATOR.getAndIncrement();
String login = "login" + id;
CreateRequest.Builder request = CreateRequest.builder()
adminWsClient().roots().setRoot(login);
}
- public Optional<Users.User> getUserByLogin(String login) {
- return FluentIterable.from(getUsers().getUsers()).firstMatch(new MatchUserLogin(login));
+ public Optional<util.user.Users.User> getUserByLogin(String login) {
+ return getUsers().getUsers().stream().filter(new MatchUserLogin(login)).findFirst();
}
- public Users getUsers() {
+ public util.user.Users getUsers() {
WsResponse response = adminWsClient().wsConnector().call(
new GetRequest("api/users/search"))
.failIfNotSuccessful();
- return Users.parse(response.content());
+ return util.user.Users.parse(response.content());
}
public void deactivateUsers(List<String> userLogins) {
// User groups
// *****************
- public GroupManagement forOrganization(String organizationKey) {
- return new GroupManagementImpl(organizationKey);
- }
-
private final class GroupManagementImpl implements GroupManagement {
@CheckForNull
private final String organizationKey;
@Override
public java.util.Optional<Groups.Group> getGroupByName(String name) {
- return getGroups().getGroups().stream().filter(new MatchGroupName(name)::apply).findFirst();
+ return getGroups().getGroups().stream().filter(new MatchGroupName(name)).findFirst();
}
@Override
return adminWsClient;
}
- private class MatchUserLogin implements Predicate<Users.User> {
+ private class MatchUserLogin implements Predicate<util.user.Users.User> {
private final String login;
private MatchUserLogin(String login) {
}
@Override
- public boolean apply(@Nonnull Users.User user) {
+ public boolean test(@Nonnull util.user.Users.User user) {
String login = user.getLogin();
return login != null && login.equals(this.login) && user.isActive();
}
}
@Override
- public boolean apply(@Nonnull Groups.Group group) {
+ public boolean test(@Nonnull Groups.Group group) {
String groupName = group.getName();
return groupName != null && groupName.equals(this.groupName);
}
import com.google.gson.Gson;
import java.util.List;
+@Deprecated
public class Users {
private List<User> users;