summaryrefslogtreecommitdiff
path: root/app/services/clusters/applications/schedule_installation_service.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/clusters/applications/schedule_installation_service.rb')
-rw-r--r--app/services/clusters/applications/schedule_installation_service.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/app/services/clusters/applications/schedule_installation_service.rb b/app/services/clusters/applications/schedule_installation_service.rb
new file mode 100644
index 00000000000..eb8caa68ef7
--- /dev/null
+++ b/app/services/clusters/applications/schedule_installation_service.rb
@@ -0,0 +1,22 @@
+module Clusters
+ module Applications
+ class ScheduleInstallationService < ::BaseService
+ def execute
+ application_class.find_or_create_by!(cluster: cluster).try do |application|
+ application.make_scheduled!
+ ClusterInstallAppWorker.perform_async(application.name, application.id)
+ end
+ end
+
+ private
+
+ def application_class
+ params[:application_class]
+ end
+
+ def cluster
+ params[:cluster]
+ end
+ end
+ end
+end