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

agent_token_type.rb « clusters « types « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 94c5fc46a5d2f251e0a6ebebb02332c72786b585 (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
41
42
43
44
45
46
47
48
49
50
51
52
# frozen_string_literal: true

module Types
  module Clusters
    class AgentTokenType < BaseObject
      graphql_name 'ClusterAgentToken'

      authorize :admin_cluster

      connection_type_class(Types::CountableConnectionType)

      field :cluster_agent,
            Types::Clusters::AgentType,
            description: 'Cluster agent this token is associated with.',
            null: true

      field :created_at,
            Types::TimeType,
            null: true,
            description: 'Timestamp the token was created.'

      field :created_by_user,
            Types::UserType,
            null: true,
            description: 'User who created the token.'

      field :description,
            GraphQL::Types::String,
            null: true,
            description: 'Description of the token.'

      field :last_used_at,
            Types::TimeType,
            null: true,
            description: 'Timestamp the token was last used.'

      field :id,
            ::Types::GlobalIDType[::Clusters::AgentToken],
            null: false,
            description: 'Global ID of the token.'

      field :name,
            GraphQL::Types::String,
            null: true,
            description: 'Name given to the token.'

      def cluster_agent
        Gitlab::Graphql::Loaders::BatchModelLoader.new(::Clusters::Agent, object.agent_id).find
      end
    end
  end
end