Welcome to mirror list, hosted at ThFree Co, Russian Federation.

repository_storage_moves.rb « api « runtime « qa « qa - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c94a693289fc356aa8427d46b7af4681ba810653 (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
32
33
# frozen_string_literal: true

module QA
  module Runtime
    module API
      module RepositoryStorageMoves
        extend self
        extend Support::Api

        RepositoryStorageMovesError = Class.new(RuntimeError)

        def has_status?(project, status, destination_storage = Env.additional_repository_storage)
          all.any? do |move|
            move[:project][:path_with_namespace] == project.path_with_namespace &&
            move[:state] == status &&
            move[:destination_storage_name] == destination_storage
          end
        end

        def all
          Logger.debug('Getting repository storage moves')
          parse_body(get(Request.new(api_client, '/project_repository_storage_moves').url))
        end

        private

        def api_client
          @api_client ||= Client.as_admin
        end
      end
    end
  end
end