]> source.dussan.org Git - archiva.git/blob
77544cc8ee90150b35386c4e51835b60de72aa54
[archiva.git] /
1 package org.apache.archiva.rest.api.services;
2 /*
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  */
20
21 import io.swagger.v3.oas.annotations.Operation;
22 import io.swagger.v3.oas.annotations.Parameter;
23 import io.swagger.v3.oas.annotations.tags.Tag;
24 import org.apache.archiva.admin.model.beans.FileType;
25 import org.apache.archiva.admin.model.beans.LegacyArtifactPath;
26 import org.apache.archiva.admin.model.beans.NetworkConfiguration;
27 import org.apache.archiva.admin.model.beans.OrganisationInformation;
28 import org.apache.archiva.admin.model.beans.UiConfiguration;
29 import org.apache.archiva.redback.authorization.RedbackAuthorization;
30 import org.apache.archiva.rest.api.model.AdminRepositoryConsumer;
31 import org.apache.archiva.security.common.ArchivaRoleConstants;
32
33 import javax.ws.rs.Consumes;
34 import javax.ws.rs.GET;
35 import javax.ws.rs.POST;
36 import javax.ws.rs.Path;
37 import javax.ws.rs.PathParam;
38 import javax.ws.rs.Produces;
39 import javax.ws.rs.QueryParam;
40 import javax.ws.rs.core.MediaType;
41 import java.util.List;
42
43 /**
44  * @author Olivier Lamy
45  * @since 1.4-M1
46  */
47 @Path( "/archivaAdministrationService/" )
48 @Tag( name = "Administration", description = "Admin Service" )
49 public interface ArchivaAdministrationService
50 {
51     @Path( "getLegacyArtifactPaths" )
52     @GET
53     @Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML} )
54     @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
55     List<LegacyArtifactPath> getLegacyArtifactPaths( )
56         throws ArchivaRestServiceException;
57
58     @Path( "deleteLegacyArtifactPath" )
59     @GET
60     @Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN} )
61     @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
62     Boolean deleteLegacyArtifactPath( @QueryParam( "path" ) String path )
63         throws ArchivaRestServiceException;
64
65     @Path( "addFileTypePattern" )
66     @GET
67     @Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN} )
68     @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
69     Boolean addFileTypePattern( @QueryParam( "fileTypeId" ) String fileTypeId, @QueryParam( "pattern" ) String pattern )
70         throws ArchivaRestServiceException;
71
72     @Path( "removeFileTypePattern" )
73     @GET
74     @Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN} )
75     @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
76     Boolean removeFileTypePattern( @QueryParam( "fileTypeId" ) String fileTypeId,
77                                    @QueryParam( "pattern" ) String pattern )
78         throws ArchivaRestServiceException;
79
80     @Path( "getFileType" )
81     @GET
82     @Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML} )
83     @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
84     @Operation(
85         summary = "Return the file type and its patterns",
86         description = "Returns a object that contains the file type and the configured patterns for this type"
87
88     )
89     FileType getFileType(
90         @Parameter( name = "fileTypeId", description = "The identifier of the file type",
91             allowEmptyValue = false, required = true )
92         @QueryParam( "fileTypeId" ) String fileTypeId )
93         throws ArchivaRestServiceException;
94
95     @Path( "addFileType" )
96     @POST
97     @Consumes( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML} )
98     @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
99     void addFileType( FileType fileType )
100         throws ArchivaRestServiceException;
101
102     @Path( "removeFileType" )
103     @GET
104     @Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN} )
105     @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
106     Boolean removeFileType( @QueryParam( "fileTypeId" ) String fileTypeId )
107         throws ArchivaRestServiceException;
108
109     @Path( "enabledKnownContentConsumer/{knownContentConsumer}" )
110     @GET
111     @Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN} )
112     @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
113     Boolean enabledKnownContentConsumer( @PathParam( "knownContentConsumer" ) String knownContentConsumer )
114         throws ArchivaRestServiceException;
115
116     @Path( "enabledKnownContentConsumers" )
117     @POST
118     @Consumes( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML} )
119     @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
120     void enabledKnownContentConsumers( List<String> knownContentConsumers )
121         throws ArchivaRestServiceException;
122
123
124     @Path( "disabledKnownContentConsumer/{knownContentConsumer}" )
125     @GET
126     @Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN} )
127     @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
128     Boolean disabledKnownContentConsumer( @PathParam( "knownContentConsumer" ) String knownContentConsumer )
129         throws ArchivaRestServiceException;
130
131     @Path( "enabledInvalidContentConsumer/{invalidContentConsumer}" )
132     @GET
133     @Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN} )
134     @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
135     Boolean enabledInvalidContentConsumer( @PathParam( "invalidContentConsumer" ) String invalidContentConsumer )
136         throws ArchivaRestServiceException;
137
138     @Path( "enabledInvalidContentConsumers" )
139     @POST
140     @Consumes( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML} )
141     @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
142     void enabledInvalidContentConsumers( List<String> invalidContentConsumers )
143         throws ArchivaRestServiceException;
144
145     @Path( "disabledInvalidContentConsumer/{invalidContentConsumer}" )
146     @GET
147     @Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN} )
148     @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
149     Boolean disabledInvalidContentConsumer( @PathParam( "invalidContentConsumer" ) String invalidContentConsumer )
150         throws ArchivaRestServiceException;
151
152     @Path( "getFileTypes" )
153     @GET
154     @Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML} )
155     @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
156     List<FileType> getFileTypes( )
157         throws ArchivaRestServiceException;
158
159     @Path( "getKnownContentConsumers" )
160     @GET
161     @Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML} )
162     @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
163     List<String> getKnownContentConsumers( )
164         throws ArchivaRestServiceException;
165
166     /**
167      * @since 1.4-M3
168      */
169     @Path( "getKnownContentAdminRepositoryConsumers" )
170     @GET
171     @Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML} )
172     @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
173     List<AdminRepositoryConsumer> getKnownContentAdminRepositoryConsumers( )
174         throws ArchivaRestServiceException;
175
176     /**
177      * @since 1.4-M3
178      */
179     @Path( "getInvalidContentAdminRepositoryConsumers" )
180     @GET
181     @Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML} )
182     @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
183     List<AdminRepositoryConsumer> getInvalidContentAdminRepositoryConsumers( )
184         throws ArchivaRestServiceException;
185
186     @Path( "getInvalidContentConsumers" )
187     @GET
188     @Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML} )
189     @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
190     List<String> getInvalidContentConsumers( )
191         throws ArchivaRestServiceException;
192
193     @Path( "getOrganisationInformation" )
194     @GET
195     @Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN} )
196     @RedbackAuthorization( noPermission = true, noRestriction = true )
197     OrganisationInformation getOrganisationInformation( )
198         throws ArchivaRestServiceException;
199
200     @Path( "setOrganisationInformation" )
201     @POST
202     @Consumes( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML} )
203     @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
204     void setOrganisationInformation( OrganisationInformation organisationInformation )
205         throws ArchivaRestServiceException;
206
207     @Path( "getUiConfiguration" )
208     @GET
209     @Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML} )
210     @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
211     UiConfiguration getUiConfiguration( )
212         throws ArchivaRestServiceException;
213
214     @Path( "registrationDisabled" )
215     @GET
216     @Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML} )
217     @RedbackAuthorization( noRestriction = true, noPermission = true )
218     Boolean registrationDisabled( )
219         throws ArchivaRestServiceException;
220
221     @Path( "setUiConfiguration" )
222     @POST
223     @Consumes( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML} )
224     @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
225     void setUiConfiguration( UiConfiguration uiConfiguration )
226         throws ArchivaRestServiceException;
227
228     /**
229      * @since 1.4-M3
230      */
231     @Path( "applicationUrl" )
232     @GET
233     @Produces( MediaType.TEXT_PLAIN )
234     @RedbackAuthorization( noRestriction = true, noPermission = true )
235     String getApplicationUrl( )
236         throws ArchivaRestServiceException;
237
238
239     @Path( "getNetworkConfiguration" )
240     @GET
241     @Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML} )
242     @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
243     NetworkConfiguration getNetworkConfiguration( )
244         throws ArchivaRestServiceException;
245
246     @Path( "setNetworkConfiguration" )
247     @POST
248     @Consumes( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML} )
249     @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
250     void setNetworkConfiguration( NetworkConfiguration networkConfiguration )
251         throws ArchivaRestServiceException;
252 }
253