Class: Mutations::Terraform::State::Lock
- Inherits:
-
Base
- Object
- GraphQL::Schema::RelayClassicMutation
- BaseMutation
- Base
- Mutations::Terraform::State::Lock
- Defined in:
- app/graphql/mutations/terraform/state/lock.rb
Constant Summary
Constants inherited from BaseMutation
Constants included from Gitlab::Graphql::Authorize::AuthorizeResource
Gitlab::Graphql::Authorize::AuthorizeResource::ConfigurationError, Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR
Instance Method Summary collapse
Methods inherited from BaseMutation
#api_user?, authorization, authorized?, authorizes_object?, #current_user, #errors_on_object, #load_application_object, #read_only?, #ready?, #unauthorized_object
Methods included from Gitlab::Graphql::Authorize::AuthorizeResource
#authorize!, #authorized_find!, #authorized_resource?, #find_object, #raise_resource_not_available_error!
Instance Method Details
#resolve(id:) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/graphql/mutations/terraform/state/lock.rb', line 9 def resolve(id:) state = (id: id) if state.locked? state.errors.add(:base, 'state is already locked') else state.update(lock_xid: lock_xid, locked_by_user: current_user, locked_at: Time.current) end { errors: errors_on_object(state) } end |