2020-10-30 08:08:44 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module API
|
|
|
|
class ContainerRepositories < ::API::Base
|
|
|
|
include Gitlab::Utils::StrongMemoize
|
2021-10-11 14:09:46 -04:00
|
|
|
include ::API::Helpers::ContainerRegistryHelpers
|
|
|
|
|
2020-10-30 08:08:44 -04:00
|
|
|
helpers ::API::Helpers::PackagesHelpers
|
|
|
|
|
|
|
|
before { authenticate! }
|
|
|
|
|
2020-11-02 10:08:52 -05:00
|
|
|
feature_category :container_registry
|
2022-05-06 17:08:35 -04:00
|
|
|
urgency :low
|
2020-11-02 10:08:52 -05:00
|
|
|
|
2020-10-30 08:08:44 -04:00
|
|
|
namespace 'registry' do
|
|
|
|
params do
|
|
|
|
requires :id, type: String, desc: 'The ID of a project'
|
|
|
|
end
|
|
|
|
resource :repositories, requirements: { id: /[0-9]*/ } do
|
|
|
|
desc 'Get a container repository' do
|
|
|
|
detail 'This feature was introduced in GitLab 13.6.'
|
|
|
|
success Entities::ContainerRegistry::Repository
|
|
|
|
end
|
|
|
|
params do
|
|
|
|
optional :tags, type: Boolean, default: false, desc: 'Determines if tags should be included'
|
|
|
|
optional :tags_count, type: Boolean, default: false, desc: 'Determines if the tags count should be included'
|
2022-02-18 07:15:31 -05:00
|
|
|
optional :size, type: Boolean, default: false, desc: 'Determines if the size should be included'
|
2020-10-30 08:08:44 -04:00
|
|
|
end
|
|
|
|
get ':id' do
|
|
|
|
authorize!(:read_container_image, repository)
|
|
|
|
|
2022-02-18 07:15:31 -05:00
|
|
|
present repository,
|
|
|
|
with: Entities::ContainerRegistry::Repository,
|
|
|
|
tags: params[:tags],
|
|
|
|
tags_count: params[:tags_count],
|
|
|
|
size: params[:size],
|
|
|
|
user: current_user
|
2020-10-30 08:08:44 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
helpers do
|
|
|
|
def repository
|
|
|
|
strong_memoize(:repository) do
|
|
|
|
ContainerRepository.find(params[:id])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|