debian-mirror-gitlab/lib/api/group_container_repositories.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

54 lines
1.7 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
module API
2021-01-03 14:25:43 +05:30
class GroupContainerRepositories < ::API::Base
2019-10-12 21:52:04 +05:30
include PaginationParams
2021-11-18 22:05:49 +05:30
include ::API::Helpers::ContainerRegistryHelpers
2019-10-12 21:52:04 +05:30
2021-01-03 14:25:43 +05:30
helpers ::API::Helpers::PackagesHelpers
2019-10-12 21:52:04 +05:30
before { authorize_read_group_container_images! }
2022-07-16 23:28:13 +05:30
feature_category :container_registry
urgency :low
2021-01-29 00:20:46 +05:30
2019-10-12 21:52:04 +05:30
REPOSITORY_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(
tag_name: API::NO_SLASH_URL_PART_REGEX)
params do
2023-01-13 00:05:48 +05:30
requires :id, types: [String, Integer],
desc: 'The ID or URL-encoded path of the group accessible by the authenticated user'
2019-10-12 21:52:04 +05:30
end
resource :groups, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
2023-01-13 00:05:48 +05:30
desc 'List registry repositories within a group' do
detail 'Get a list of registry repositories in a group. This feature was introduced in GitLab 12.2.'
2019-10-12 21:52:04 +05:30
success Entities::ContainerRegistry::Repository
2023-01-13 00:05:48 +05:30
failure [
{ code: 401, message: 'Unauthorized' },
{ code: 404, message: 'Group Not Found' }
]
is_array true
tags %w[container_registry]
2019-10-12 21:52:04 +05:30
end
params do
use :pagination
end
get ':id/registry/repositories' do
repositories = ContainerRepositoriesFinder.new(
2019-12-26 22:10:19 +05:30
user: current_user, subject: user_group
2019-10-12 21:52:04 +05:30
).execute
2023-05-27 22:25:52 +05:30
track_package_event('list_repositories', :container, namespace: user_group)
2019-12-26 22:10:19 +05:30
2022-07-16 23:28:13 +05:30
present paginate(repositories), with: Entities::ContainerRegistry::Repository, tags: false, tags_count: false
2019-10-12 21:52:04 +05:30
end
end
helpers do
def authorize_read_group_container_images!
authorize! :read_container_image, user_group
end
end
end
end