Class: Bcome::Orchestrator::NodeTarget::Base
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#validate_and_set
Constructor Details
#initialize(json) ⇒ Base
Returns a new instance of Base.
26
27
28
|
# File 'lib/orchestrator/node_target/base.rb', line 26
def initialize(json)
validate_and_set(json) unless override_validate_and_set?
end
|
Instance Attribute Details
#node_selections ⇒ Object
Returns the value of attribute node_selections.
24
25
26
|
# File 'lib/orchestrator/node_target/base.rb', line 24
def node_selections
@node_selections
end
|
#target_key ⇒ Object
Returns the value of attribute target_key.
24
25
26
|
# File 'lib/orchestrator/node_target/base.rb', line 24
def target_key
@target_key
end
|
Class Method Details
.new_of_type_from(json, machines) ⇒ Object
5
6
7
8
9
10
11
|
# File 'lib/orchestrator/node_target/base.rb', line 5
def new_of_type_from(json, machines)
raise "Missing node target type in #{json.inspect}" unless json.has_key?(:type)
raise "Invalid node target of type #{json[:type]} in #{json.inspect}" unless klass_for_type.keys.include?(json[:type])
node_target = klass_for_type[json[:type]].new(json)
node_target.set_machines(machines)
return node_target
end
|
Instance Method Details
#json_attributes ⇒ Object
34
35
36
|
# File 'lib/orchestrator/node_target/base.rb', line 34
def json_attributes
[:target_key, :selectors]
end
|
#override_validate_and_set? ⇒ Boolean
30
31
32
|
# File 'lib/orchestrator/node_target/base.rb', line 30
def override_validate_and_set?
false
end
|
#set_machines(*params) ⇒ Object
38
39
40
|
# File 'lib/orchestrator/node_target/base.rb', line 38
def set_machines(*params)
raise "Override set_machines in derived types - each type has its own distinct selector, and is passed an array of machines available at the current bcome context."
end
|