debian-mirror-gitlab/lib/api/entities/container_registry.rb

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

44 lines
1.2 KiB
Ruby
Raw Normal View History

2019-03-02 22:35:43 +05:30
# frozen_string_literal: true
module API
module Entities
module ContainerRegistry
2019-10-12 21:52:04 +05:30
class Tag < Grape::Entity
2019-03-02 22:35:43 +05:30
expose :name
expose :path
expose :location
end
2019-10-12 21:52:04 +05:30
class Repository < Grape::Entity
2021-01-29 00:20:46 +05:30
include ::API::Helpers::RelatedResourcesHelpers
2019-10-12 21:52:04 +05:30
expose :id
2019-03-02 22:35:43 +05:30
expose :name
expose :path
2019-10-12 21:52:04 +05:30
expose :project_id
2019-03-02 22:35:43 +05:30
expose :location
2019-10-12 21:52:04 +05:30
expose :created_at
2021-01-03 14:25:43 +05:30
expose :expiration_policy_started_at, as: :cleanup_policy_started_at
2020-06-23 00:09:42 +05:30
expose :tags_count, if: -> (_, options) { options[:tags_count] }
2019-10-12 21:52:04 +05:30
expose :tags, using: Tag, if: -> (_, options) { options[:tags] }
2021-01-29 00:20:46 +05:30
expose :delete_api_path, if: ->(object, options) { Ability.allowed?(options[:user], :admin_container_image, object) }
2022-05-07 20:08:51 +05:30
expose :size, if: -> (_, options) { options[:size] }
2021-01-29 00:20:46 +05:30
private
def delete_api_path
expose_url api_v4_projects_registry_repositories_path(repository_id: object.id, id: object.project_id)
end
2019-03-02 22:35:43 +05:30
end
class TagDetails < Tag
expose :revision
expose :short_revision
expose :digest
expose :created_at
expose :total_size
end
end
end
end