2018-12-10 07:33:36 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
module Clusters
|
|
|
|
class BuildService
|
|
|
|
def initialize(subject)
|
|
|
|
@subject = subject
|
|
|
|
end
|
|
|
|
|
|
|
|
def execute
|
|
|
|
::Clusters::Cluster.new.tap do |cluster|
|
|
|
|
case @subject
|
|
|
|
when ::Project
|
|
|
|
cluster.cluster_type = :project_type
|
|
|
|
when ::Group
|
|
|
|
cluster.cluster_type = :group_type
|
2019-04-09 22:13:43 -04:00
|
|
|
when Instance
|
|
|
|
cluster.cluster_type = :instance_type
|
2018-12-10 07:33:36 -05:00
|
|
|
else
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|