Class: Clusters::Agents::DeleteService

Inherits:
BaseContainerService show all
Defined in:
app/services/clusters/agents/delete_service.rb

Instance Attribute Summary

Attributes inherited from BaseContainerService

#container, #current_user, #group, #params, #project

Instance Method Summary collapse

Methods inherited from BaseContainerService

#group_container?, #initialize, #namespace_container?, #project_container?, #project_group

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?

Constructor Details

This class inherits a constructor from BaseContainerService

Instance Method Details

#execute(cluster_agent) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'app/services/clusters/agents/delete_service.rb', line 6

def execute(cluster_agent)
  return error_no_permissions unless current_user.can?(:admin_cluster, cluster_agent)

  if cluster_agent.destroy
    ServiceResponse.success
  else
    ServiceResponse.error(message: cluster_agent.errors.full_messages)
  end
end