diff options
author | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2015-11-13 10:42:27 +0100 |
---|---|---|
committer | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2015-11-17 13:41:03 +0100 |
commit | 563fbccfafb8d7225b7fe3f98f87f415c805217a (patch) | |
tree | 225d90c98bf83503208b6dd4419cdd69bc2ae372 /sonar-ws | |
parent | c40eb47f54f7cfe94bd5cf6a9856a731a1b4dfc6 (diff) | |
download | sonarqube-563fbccfafb8d7225b7fe3f98f87f415c805217a.tar.gz sonarqube-563fbccfafb8d7225b7fe3f98f87f415c805217a.zip |
SONAR-6947 api/permissions/search_templates use SearchTemplatesWsRequest
Diffstat (limited to 'sonar-ws')
3 files changed, 47 insertions, 1 deletions
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsWsClient.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsWsClient.java index d79ff4e6568..102e7351a96 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsWsClient.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsWsClient.java @@ -23,6 +23,7 @@ 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.WsSearchGlobalPermissionsResponse; import org.sonarqube.ws.client.WsClient; @@ -167,6 +168,13 @@ public class PermissionsWsClient { SearchProjectPermissionsWsResponse.parser()); } + public SearchTemplatesWsResponse searchTemplates(SearchTemplatesWsRequest request) { + return wsClient.execute( + newGetRequest("search_templates") + .setParam("q", request.getQuery()), + SearchTemplatesWsResponse.parser()); + } + private static String action(String action) { return PermissionsWsParameters.ENDPOINT + "/" + action; } diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SearchTemplatesWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SearchTemplatesWsRequest.java new file mode 100644 index 00000000000..5159f80c19b --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SearchTemplatesWsRequest.java @@ -0,0 +1,38 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2014 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. + */ + +package org.sonarqube.ws.client.permission; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +public class SearchTemplatesWsRequest { + private String query; + + @CheckForNull + public String getQuery() { + return query; + } + + public SearchTemplatesWsRequest setQuery(@Nullable String query) { + this.query = query; + return this; + } +} diff --git a/sonar-ws/src/main/protobuf/ws-permissions.proto b/sonar-ws/src/main/protobuf/ws-permissions.proto index d4ed7629541..6f0c6243f0c 100644 --- a/sonar-ws/src/main/protobuf/ws-permissions.proto +++ b/sonar-ws/src/main/protobuf/ws-permissions.proto @@ -66,7 +66,7 @@ message WsUpdatePermissionTemplateResponse { optional PermissionTemplate permissionTemplate = 1; } -message WsSearchTemplatesResponse { +message SearchTemplatesWsResponse { message TemplateIdQualifier { optional string templateId = 1; optional string qualifier = 2; |