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

32 lines
774 B
Ruby
Raw Normal View History

2021-09-04 01:27:46 +05:30
# frozen_string_literal: true
module API
class ProjectDebianDistributions < ::API::Base
params do
2023-01-13 00:05:48 +05:30
requires :id, types: [String, Integer], desc: 'The ID or URL-encoded path of the project'
2021-09-04 01:27:46 +05:30
end
2022-08-13 15:12:31 +05:30
before do
not_found! if Gitlab::FIPS.enabled?
end
2021-09-04 01:27:46 +05:30
resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
after_validation do
require_packages_enabled!
2023-03-17 16:20:25 +05:30
not_found! unless ::Feature.enabled?(:debian_packages, project_or_group)
2021-09-04 01:27:46 +05:30
end
namespace ':id' do
helpers do
2023-03-17 16:20:25 +05:30
def project_or_group(action = :read_package)
user_project(action: action)
2021-09-04 01:27:46 +05:30
end
end
include ::API::Concerns::Packages::DebianDistributionEndpoints
end
end
end
end