diff options
Diffstat (limited to 'app/controllers/concerns/harbor/tag.rb')
-rw-r--r-- | app/controllers/concerns/harbor/tag.rb | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/app/controllers/concerns/harbor/tag.rb b/app/controllers/concerns/harbor/tag.rb new file mode 100644 index 00000000000..e0c00d1155a --- /dev/null +++ b/app/controllers/concerns/harbor/tag.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +module Harbor + module Tag + def index + respond_to do |format| + format.json do + tags + end + end + end + + private + + def query_params + params.permit(:repository_id, :artifact_id, :sort, :page, :limit) + end + + def query + Gitlab::Harbor::Query.new(container.harbor_integration, query_params) + end + + def tags + unless query.valid? + return render( + json: { message: 'Invalid parameters', errors: query.errors }, + status: :unprocessable_entity + ) + end + + tags_json = ::Integrations::HarborSerializers::TagSerializer.new + .with_pagination(request, response) + .represent(query.tags) + render json: tags_json + end + + def container + raise NotImplementedError + end + end +end |