2020-09-30 12:09:53 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Types
|
|
|
|
module Terraform
|
|
|
|
class StateType < BaseObject
|
|
|
|
graphql_name 'TerraformState'
|
|
|
|
|
|
|
|
authorize :read_terraform_state
|
|
|
|
|
2020-10-23 18:08:31 +00:00
|
|
|
connection_type_class(Types::CountableConnectionType)
|
|
|
|
|
2021-07-23 12:09:05 +00:00
|
|
|
field :id, GraphQL::Types::ID,
|
2020-09-30 12:09:53 +00:00
|
|
|
null: false,
|
2021-02-05 15:09:28 +00:00
|
|
|
description: 'ID of the Terraform state.'
|
2020-09-30 12:09:53 +00:00
|
|
|
|
2021-07-23 12:09:05 +00:00
|
|
|
field :name, GraphQL::Types::String,
|
2020-09-30 12:09:53 +00:00
|
|
|
null: false,
|
2021-02-05 15:09:28 +00:00
|
|
|
description: 'Name of the Terraform state.'
|
2020-09-30 12:09:53 +00:00
|
|
|
|
|
|
|
field :locked_by_user, Types::UserType,
|
|
|
|
null: true,
|
2021-08-31 15:10:29 +00:00
|
|
|
description: 'User currently holding a lock on the Terraform state.'
|
2020-09-30 12:09:53 +00:00
|
|
|
|
|
|
|
field :locked_at, Types::TimeType,
|
|
|
|
null: true,
|
2021-02-05 15:09:28 +00:00
|
|
|
description: 'Timestamp the Terraform state was locked.'
|
2020-09-30 12:09:53 +00:00
|
|
|
|
2020-10-29 18:09:11 +00:00
|
|
|
field :latest_version, Types::Terraform::StateVersionType,
|
|
|
|
complexity: 3,
|
|
|
|
null: true,
|
2021-08-31 15:10:29 +00:00
|
|
|
description: 'Latest version of the Terraform state.'
|
2020-10-29 18:09:11 +00:00
|
|
|
|
2020-09-30 12:09:53 +00:00
|
|
|
field :created_at, Types::TimeType,
|
|
|
|
null: false,
|
2021-02-05 15:09:28 +00:00
|
|
|
description: 'Timestamp the Terraform state was created.'
|
2020-09-30 12:09:53 +00:00
|
|
|
|
|
|
|
field :updated_at, Types::TimeType,
|
|
|
|
null: false,
|
2021-02-05 15:09:28 +00:00
|
|
|
description: 'Timestamp the Terraform state was updated.'
|
2020-12-01 12:09:17 +00:00
|
|
|
|
2022-06-07 15:08:12 +00:00
|
|
|
field :deleted_at, Types::TimeType,
|
|
|
|
null: true,
|
|
|
|
description: 'Timestamp the Terraform state was deleted.'
|
|
|
|
|
2020-12-01 12:09:17 +00:00
|
|
|
def locked_by_user
|
|
|
|
Gitlab::Graphql::Loaders::BatchModelLoader.new(User, object.locked_by_user_id).find
|
|
|
|
end
|
2020-09-30 12:09:53 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|