summaryrefslogtreecommitdiff
path: root/app/services/clusters/applications/schedule_installation_service.rb
blob: eb8caa68ef75ab4dddda42a71e7e94fb926a0d1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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