summaryrefslogtreecommitdiff
path: root/qa/qa/resource/clusters/agent_token.rb
diff options
context:
space:
mode:
Diffstat (limited to 'qa/qa/resource/clusters/agent_token.rb')
-rw-r--r--qa/qa/resource/clusters/agent_token.rb49
1 files changed, 49 insertions, 0 deletions
diff --git a/qa/qa/resource/clusters/agent_token.rb b/qa/qa/resource/clusters/agent_token.rb
new file mode 100644
index 00000000000..6a5e861b650
--- /dev/null
+++ b/qa/qa/resource/clusters/agent_token.rb
@@ -0,0 +1,49 @@
+# frozen_string_literal: true
+
+module QA
+ module Resource
+ module Clusters
+ class AgentToken < QA::Resource::Base
+ attribute :id
+ attribute :secret
+ attribute :agent do
+ QA::Resource::Clusters::Agent.fabricate_via_api!
+ end
+
+ def fabricate!
+ puts 'TODO: FABRICATE VIA UI'
+ end
+ # TODO
+ #
+ # The UI for this model is not yet implemented. So far it can only be
+ # created through the GraphQL API
+ # def fabricate
+ #
+ # end
+
+ def api_get_path
+ "gid://gitlab/Clusters::AgentToken/#{id}"
+ end
+
+ def api_post_path
+ "/graphql"
+ end
+
+ def api_post_body
+ <<~GQL
+ mutation createToken {
+ clusterAgentTokenCreate(input: { clusterAgentId: "gid://gitlab/Clusters::Agent/#{agent.id}" }) {
+ secret # This is the value you need to use on the next step
+ token {
+ createdAt
+ id
+ }
+ errors
+ }
+ }
+ GQL
+ end
+ end
+ end
+ end
+end