summaryrefslogtreecommitdiff
path: root/lib/api/project_debian_distributions.rb
blob: 856b4097b5aa83b160fcabdae16b868779d05515 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# frozen_string_literal: true

module API
  class ProjectDebianDistributions < ::API::Base
    params do
      requires :id, types: [String, Integer], desc: 'The ID or URL-encoded path of the project'
    end

    before do
      not_found! if Gitlab::FIPS.enabled?
    end

    resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
      after_validation do
        require_packages_enabled!

        not_found! unless ::Feature.enabled?(:debian_packages, project_or_group)
      end

      namespace ':id' do
        helpers do
          def project_or_group(action = :read_package)
            user_project(action: action)
          end
        end

        include ::API::Concerns::Packages::DebianDistributionEndpoints
      end
    end
  end
end