summaryrefslogtreecommitdiff
path: root/app/services
diff options
context:
space:
mode:
authorThong Kuah <tkuah@gitlab.com>2019-04-13 00:19:28 +1200
committerStan Hu <stanhu@gmail.com>2019-04-29 22:55:12 -0700
commitabb530a61958518f6e0c739406f34c558c504206 (patch)
tree14df66a315ff5dde728225d48b646a6596822d05 /app/services
parent43c284b711ddd4db55908de0590f946de5227db6 (diff)
downloadgitlab-ce-abb530a61958518f6e0c739406f34c558c504206.tar.gz
DELETE clusters/:id/:application endpoint
Add endpoint to delete/uninstall a cluster application
Diffstat (limited to 'app/services')
-rw-r--r--app/services/clusters/applications/destroy_service.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/app/services/clusters/applications/destroy_service.rb b/app/services/clusters/applications/destroy_service.rb
new file mode 100644
index 00000000000..fc74e1300a9
--- /dev/null
+++ b/app/services/clusters/applications/destroy_service.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+module Clusters
+ module Applications
+ class DestroyService < ::Clusters::Applications::BaseService
+ def execute(_request)
+ instantiate_application.tap do |application|
+ break unless application.can_uninstall?
+
+ application.make_scheduled!
+
+ Clusters::Applications::UninstallWorker.perform_async(application.name, application.id)
+ end
+ end
+
+ private
+
+ def builder
+ cluster.method("application_#{application_name}").call
+ end
+ end
+ end
+end