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

agent_token.rb « clusters « resource « qa « qa - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cbd2964c31d0dc2545a0efd1f4688f06eccf307d (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
34
35
36
37
38
39
40
# frozen_string_literal: true

module QA
  module Resource
    module Clusters
      class AgentToken < QA::Resource::Base
        attribute :id
        attribute :token
        attribute :agent do
          QA::Resource::Clusters::Agent.fabricate_via_api!
        end

        def fabricate!
        end

        def resource_web_url(resource)
          super
        rescue ResourceURLMissingError
          # this particular resource does not expose a web_url property
        end

        def api_get_path
          "/projects/#{agent.project.id}/cluster_agents/#{agent.id}/tokens/#{id}"
        end

        def api_post_path
          "/projects/#{agent.project.id}/cluster_agents/#{agent.id}/tokens"
        end

        def api_post_body
          {
            id: agent.project.id,
            agent_id: agent.id,
            name: agent.name
          }
        end
      end
    end
  end
end