Class: OVH::Provisioner::Spawner
- Inherits:
-
Object
- Object
- OVH::Provisioner::Spawner
- Includes:
- Celluloid
- Defined in:
- lib/ovh/provisioner/spawner.rb
Overview
Is responsible for spawning other cells
Constant Summary collapse
- NAME =
'Spawner'
Instance Method Summary collapse
-
#get(class_name, *args, parent: nil, id: nil) ⇒ Object
Return and create on demand a given api_object or api_list.
Instance Method Details
#get(class_name, *args, parent: nil, id: nil) ⇒ Object
Return and create on demand a given api_object or api_list
-
class_name is an api_object class name
-
args is an array of arguments used to object creation
-
parent is the requester (like a vrack asking for its tasks)
-
id is the id of the api_object (nil for api_list)
Example:
-
get(‘Vrack’, id: ‘pn-123’): Vrack.new(‘pn-123’)
-
get(‘Task’, parent: ‘vrack/pn-12’, id: ‘98’):
Task('98', 'vrack/pn-12')
-
get(‘DedicatedServer’, ‘03’): APIList.new(DedicatedServer, ‘03’)
42 43 44 45 46 47 |
# File 'lib/ovh/provisioner/spawner.rb', line 42 def get(class_name, *args, parent: nil, id: nil) cell_name = "#{parent}:#{class_name}@#{id}##{args}" cell = Actor[cell_name.to_sym] ||= create(class_name, parent, id, args) cell.init_properties cell end |