1 package org.apache.archiva.rest.api.services;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import io.swagger.v3.oas.annotations.tags.Tag;
23 import org.apache.archiva.maven2.model.Artifact;
24 import org.apache.archiva.redback.authorization.RedbackAuthorization;
25 import org.apache.archiva.repository.scanner.RepositoryScanStatistics;
26 import org.apache.archiva.rest.api.model.ActionStatus;
27 import org.apache.archiva.rest.api.model.ArtifactTransferRequest;
28 import org.apache.archiva.rest.api.model.PermissionStatus;
29 import org.apache.archiva.rest.api.model.ScanStatus;
30 import org.apache.archiva.rest.api.model.StringList;
31 import org.apache.archiva.security.common.ArchivaRoleConstants;
33 import javax.ws.rs.Consumes;
34 import javax.ws.rs.DELETE;
35 import javax.ws.rs.GET;
36 import javax.ws.rs.POST;
37 import javax.ws.rs.Path;
38 import javax.ws.rs.PathParam;
39 import javax.ws.rs.Produces;
40 import javax.ws.rs.QueryParam;
41 import javax.ws.rs.core.MediaType;
44 * @author Olivier Lamy
47 @Path ("/repositoriesService/")
48 @Tag( name="Repositories", description = "Managing repositories")
49 public interface RepositoriesService
55 @Path ("scanRepository")
57 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
58 @RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_RUN_INDEXER)
59 ActionStatus scanRepository( @QueryParam ("repositoryId") String repositoryId,
60 @QueryParam ("fullScan") boolean fullScan )
61 throws ArchivaRestServiceException;
68 @Path ("scanRepositoryDirectoriesNow/{repositoryId}")
70 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
71 @RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_RUN_INDEXER)
72 RepositoryScanStatistics scanRepositoryDirectoriesNow( @PathParam ("repositoryId") String repositoryId )
73 throws ArchivaRestServiceException;
77 * Returns the scan status of the given repository
78 * @param repositoryId the repository identifier
80 * @throws ArchivaRestServiceException
83 @Path ("alreadyScanning/{repositoryId}")
85 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
86 @RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_RUN_INDEXER)
87 ScanStatus getScanStatus( @PathParam ("repositoryId") String repositoryId )
88 throws ArchivaRestServiceException;
90 @Path ("removeScanningTaskFromQueue/{repositoryId}")
92 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
93 @RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_RUN_INDEXER)
94 ActionStatus removeScanningTaskFromQueue( @PathParam ("repositoryId") String repositoryId )
95 throws ArchivaRestServiceException;
97 @Path ("scanRepositoryNow")
99 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
100 @RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_RUN_INDEXER)
101 ActionStatus scanRepositoryNow( @QueryParam ("repositoryId") String repositoryId,
102 @QueryParam ("fullScan") boolean fullScan )
103 throws ArchivaRestServiceException;
106 * permissions are checked in impl
107 * will copy an artifact from the source repository to the target repository
109 @Path ("copyArtifact")
111 @Consumes ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
112 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
113 @RedbackAuthorization (noPermission = true)
114 ActionStatus copyArtifact( ArtifactTransferRequest artifactTransferRequest )
115 throws ArchivaRestServiceException;
117 @Path ("scheduleDownloadRemoteIndex")
119 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
120 @RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_RUN_INDEXER)
121 ActionStatus scheduleDownloadRemoteIndex( @QueryParam ("repositoryId") String repositoryId,
122 @QueryParam ("now") boolean now,
123 @QueryParam ("fullDownload") boolean fullDownload )
124 throws ArchivaRestServiceException;
128 * <b>permissions are checked in impl</b>
131 @Path ("deleteArtifact")
133 @Consumes ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
134 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
135 @RedbackAuthorization (noPermission = true)
136 ActionStatus deleteArtifact( Artifact artifact )
137 throws ArchivaRestServiceException;
140 * <b>permissions are checked in impl</b>
143 @Path ("projectVersion/{repositoryId}/{namespace}/{projectId}/{version}")
145 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
146 @RedbackAuthorization (noPermission = true)
147 ActionStatus removeProjectVersion( @PathParam ( "repositoryId" ) String repositoryId,
148 @PathParam ( "namespace" ) String namespace, @PathParam ( "projectId" ) String projectId,
149 @PathParam ( "version" ) String version )
150 throws ArchivaRestServiceException;
153 * Returns the permission status for the current user and the given repository.
154 * @param repoId the repository identifier
156 * @throws ArchivaRestServiceException
159 @Path ("isAuthorizedToDeleteArtifacts/{repositoryId}")
161 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
162 @RedbackAuthorization (noPermission = true, noRestriction = true)
163 PermissionStatus getPermissionStatus( @PathParam ("repositoryId") String repoId )
164 throws ArchivaRestServiceException;
167 * <b>permissions are checked in impl</b>
170 @Path ("deleteGroupId")
172 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
173 @RedbackAuthorization (noPermission = true)
174 ActionStatus deleteGroupId( @QueryParam ("groupId") String groupId, @QueryParam ("repositoryId") String repositoryId )
175 throws ArchivaRestServiceException;
178 * <b>permissions are checked in impl</b>
181 @Path ("project/{repositoryId}/{groupId}/{projectId}")
183 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
184 @RedbackAuthorization (noPermission = true)
185 ActionStatus deleteProject( @PathParam ("groupId") String groupId, @PathParam ("projectId") String projectId,
186 @PathParam ("repositoryId") String repositoryId )
187 throws ArchivaRestServiceException;
192 @Path ("runningRemoteDownloadIds")
194 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
195 @RedbackAuthorization (noPermission = true)
196 StringList getRunningRemoteDownloadIds();