Class: Mutations::Environments::CanaryIngress::Update

Inherits:
BaseMutation
  • Object
show all
Defined in:
app/graphql/mutations/environments/canary_ingress/update.rb

Constant Summary collapse

REMOVAL_ERR_MSG =
'This endpoint was deactivated as part of the certificate-based' \
'kubernetes integration removal. See Epic:' \
'https://gitlab.com/groups/gitlab-org/configure/-/epics/8'

Constants inherited from BaseMutation

BaseMutation::ERROR_MESSAGE

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, #ready?, #unauthorized_object

Methods included from Gitlab::Graphql::Authorize::AuthorizeResource

#authorize!, #authorized_find!, #authorized_resource?, #raise_resource_not_available_error!

Instance Method Details

#find_object(id:) ⇒ Object


38
39
40
# File 'app/graphql/mutations/environments/canary_ingress/update.rb', line 38

def find_object(id:)
  GitlabSchema.find_by_gid(id)
end

#resolve(id:, **kwargs) ⇒ Object


26
27
28
29
30
31
32
33
34
35
36
# File 'app/graphql/mutations/environments/canary_ingress/update.rb', line 26

def resolve(id:, **kwargs)
  return { errors: [REMOVAL_ERR_MSG] } unless certificate_based_clusters_enabled?

  environment = authorized_find!(id: id)

  result = ::Environments::CanaryIngress::UpdateService
    .new(environment.project, current_user, kwargs)
    .execute_async(environment)

  { errors: Array.wrap(result[:message]) }
end