You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RepositoriesService.java 8.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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. import io.swagger.v3.oas.annotations.tags.Tag;
  21. import org.apache.archiva.maven.model.Artifact;
  22. import org.apache.archiva.redback.authorization.RedbackAuthorization;
  23. import org.apache.archiva.repository.scanner.RepositoryScanStatistics;
  24. import org.apache.archiva.rest.api.model.ActionStatus;
  25. import org.apache.archiva.rest.api.model.ArtifactTransferRequest;
  26. import org.apache.archiva.rest.api.model.PermissionStatus;
  27. import org.apache.archiva.rest.api.model.ScanStatus;
  28. import org.apache.archiva.rest.api.model.StringList;
  29. import org.apache.archiva.security.common.ArchivaRoleConstants;
  30. import javax.ws.rs.Consumes;
  31. import javax.ws.rs.DELETE;
  32. import javax.ws.rs.GET;
  33. import javax.ws.rs.POST;
  34. import javax.ws.rs.Path;
  35. import javax.ws.rs.PathParam;
  36. import javax.ws.rs.Produces;
  37. import javax.ws.rs.QueryParam;
  38. import javax.ws.rs.core.MediaType;
  39. /**
  40. * @author Olivier Lamy
  41. * @since 1.4-M1
  42. */
  43. @Path ("/repositoriesService/")
  44. @Tag( name="Repositories", description = "Managing repositories")
  45. public interface RepositoriesService
  46. {
  47. /**
  48. * index repository
  49. */
  50. @Path ("scanRepository")
  51. @GET
  52. @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
  53. @RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_RUN_INDEXER)
  54. ActionStatus scanRepository( @QueryParam ("repositoryId") String repositoryId,
  55. @QueryParam ("fullScan") boolean fullScan )
  56. throws ArchivaRestServiceException;
  57. /**
  58. * scan directories
  59. * @since 1.4-M3
  60. */
  61. @Path ("scanRepositoryDirectoriesNow/{repositoryId}")
  62. @GET
  63. @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
  64. @RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_RUN_INDEXER)
  65. RepositoryScanStatistics scanRepositoryDirectoriesNow( @PathParam ("repositoryId") String repositoryId )
  66. throws ArchivaRestServiceException;
  67. /**
  68. * Returns the scan status of the given repository
  69. * @param repositoryId the repository identifier
  70. * @return the status
  71. * @throws ArchivaRestServiceException
  72. * @since 3.0
  73. */
  74. @Path ("alreadyScanning/{repositoryId}")
  75. @GET
  76. @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
  77. @RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_RUN_INDEXER)
  78. ScanStatus getScanStatus( @PathParam ("repositoryId") String repositoryId )
  79. throws ArchivaRestServiceException;
  80. @Path ("removeScanningTaskFromQueue/{repositoryId}")
  81. @GET
  82. @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
  83. @RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_RUN_INDEXER)
  84. ActionStatus removeScanningTaskFromQueue( @PathParam ("repositoryId") String repositoryId )
  85. throws ArchivaRestServiceException;
  86. @Path ("scanRepositoryNow")
  87. @GET
  88. @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
  89. @RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_RUN_INDEXER)
  90. ActionStatus scanRepositoryNow( @QueryParam ("repositoryId") String repositoryId,
  91. @QueryParam ("fullScan") boolean fullScan )
  92. throws ArchivaRestServiceException;
  93. /**
  94. * permissions are checked in impl
  95. * will copy an artifact from the source repository to the target repository
  96. */
  97. @Path ("copyArtifact")
  98. @POST
  99. @Consumes ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
  100. @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
  101. @RedbackAuthorization (noPermission = true)
  102. ActionStatus copyArtifact( ArtifactTransferRequest artifactTransferRequest )
  103. throws ArchivaRestServiceException;
  104. @Path ("scheduleDownloadRemoteIndex")
  105. @GET
  106. @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
  107. @RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_RUN_INDEXER)
  108. ActionStatus scheduleDownloadRemoteIndex( @QueryParam ("repositoryId") String repositoryId,
  109. @QueryParam ("now") boolean now,
  110. @QueryParam ("fullDownload") boolean fullDownload )
  111. throws ArchivaRestServiceException;
  112. /**
  113. * <b>permissions are checked in impl</b>
  114. * @since 1.4-M2
  115. */
  116. @Path ("deleteArtifact")
  117. @POST
  118. @Consumes ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
  119. @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
  120. @RedbackAuthorization (noPermission = true)
  121. ActionStatus deleteArtifact( Artifact artifact )
  122. throws ArchivaRestServiceException;
  123. /**
  124. * <b>permissions are checked in impl</b>
  125. * @since 1.4-M4
  126. */
  127. @Path ("projectVersion/{repositoryId}/{namespace}/{projectId}/{version}")
  128. @DELETE
  129. @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
  130. @RedbackAuthorization (noPermission = true)
  131. ActionStatus removeProjectVersion( @PathParam ( "repositoryId" ) String repositoryId,
  132. @PathParam ( "namespace" ) String namespace, @PathParam ( "projectId" ) String projectId,
  133. @PathParam ( "version" ) String version )
  134. throws ArchivaRestServiceException;
  135. /**
  136. * Returns the permission status for the current user and the given repository.
  137. * @param repoId the repository identifier
  138. * @return the status
  139. * @throws ArchivaRestServiceException
  140. * @since 3.0
  141. */
  142. @Path ("isAuthorizedToDeleteArtifacts/{repositoryId}")
  143. @GET
  144. @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
  145. @RedbackAuthorization (noPermission = true, noRestriction = true)
  146. PermissionStatus getPermissionStatus( @PathParam ("repositoryId") String repoId )
  147. throws ArchivaRestServiceException;
  148. /**
  149. * <b>permissions are checked in impl</b>
  150. * @since 1.4-M3
  151. */
  152. @Path ("deleteGroupId")
  153. @GET
  154. @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
  155. @RedbackAuthorization (noPermission = true)
  156. ActionStatus deleteGroupId( @QueryParam ("groupId") String groupId, @QueryParam ("repositoryId") String repositoryId )
  157. throws ArchivaRestServiceException;
  158. /**
  159. * <b>permissions are checked in impl</b>
  160. * @since 1.4-M4
  161. */
  162. @Path ("project/{repositoryId}/{groupId}/{projectId}")
  163. @DELETE
  164. @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
  165. @RedbackAuthorization (noPermission = true)
  166. ActionStatus deleteProject( @PathParam ("groupId") String groupId, @PathParam ("projectId") String projectId,
  167. @PathParam ("repositoryId") String repositoryId )
  168. throws ArchivaRestServiceException;
  169. /**
  170. * @since 2.0
  171. */
  172. @Path ("runningRemoteDownloadIds")
  173. @GET
  174. @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
  175. @RedbackAuthorization (noPermission = true)
  176. StringList getRunningRemoteDownloadIds();
  177. }