debian-mirror-gitlab/app/graphql/types/terraform/state_type.rb

47 lines
1.3 KiB
Ruby
Raw Normal View History

2021-01-03 14:25:43 +05:30
# frozen_string_literal: true
module Types
module Terraform
class StateType < BaseObject
graphql_name 'TerraformState'
authorize :read_terraform_state
2021-01-29 00:20:46 +05:30
connection_type_class(Types::CountableConnectionType)
2021-01-03 14:25:43 +05:30
field :id, GraphQL::ID_TYPE,
null: false,
2021-03-11 19:13:27 +05:30
description: 'ID of the Terraform state.'
2021-01-03 14:25:43 +05:30
field :name, GraphQL::STRING_TYPE,
null: false,
2021-03-11 19:13:27 +05:30
description: 'Name of the Terraform state.'
2021-01-03 14:25:43 +05:30
field :locked_by_user, Types::UserType,
null: true,
2021-03-11 19:13:27 +05:30
description: 'The user currently holding a lock on the Terraform state.'
2021-01-03 14:25:43 +05:30
field :locked_at, Types::TimeType,
null: true,
2021-03-11 19:13:27 +05:30
description: 'Timestamp the Terraform state was locked.'
2021-01-03 14:25:43 +05:30
2021-01-29 00:20:46 +05:30
field :latest_version, Types::Terraform::StateVersionType,
complexity: 3,
null: true,
2021-03-11 19:13:27 +05:30
description: 'The latest version of the Terraform state.'
2021-01-29 00:20:46 +05:30
2021-01-03 14:25:43 +05:30
field :created_at, Types::TimeType,
null: false,
2021-03-11 19:13:27 +05:30
description: 'Timestamp the Terraform state was created.'
2021-01-03 14:25:43 +05:30
field :updated_at, Types::TimeType,
null: false,
2021-03-11 19:13:27 +05:30
description: 'Timestamp the Terraform state was updated.'
2021-02-22 17:27:13 +05:30
def locked_by_user
Gitlab::Graphql::Loaders::BatchModelLoader.new(User, object.locked_by_user_id).find
end
2021-01-03 14:25:43 +05:30
end
end
end