Class: Opsmgr::Settings::Microbosh::Product
- Inherits:
-
Object
- Object
- Opsmgr::Settings::Microbosh::Product
- Defined in:
- lib/opsmgr/settings/microbosh/product.rb
Instance Attribute Summary collapse
-
#product_hash ⇒ Object
readonly
Returns the value of attribute product_hash.
Instance Method Summary collapse
- #availability_zone_references=(zones_array) ⇒ Object
- #disabled_post_deploy_errand_names(errands = nil) ⇒ Object
- #for_job(job_name) {|job_result| ... } ⇒ Object
- #guid ⇒ Object
-
#initialize(product_hash) ⇒ Product
constructor
A new instance of Product.
- #job(job_name) ⇒ Object
- #jobs ⇒ Object
- #name ⇒ Object
- #network_reference=(network_references) ⇒ Object
- #product_version ⇒ Object
- #property(name) ⇒ Object
- #set_property(name, value) ⇒ Object
- #singleton_availability_zone ⇒ Object
- #singleton_availability_zone=(value) ⇒ Object
Constructor Details
#initialize(product_hash) ⇒ Product
Returns a new instance of Product.
9 10 11 |
# File 'lib/opsmgr/settings/microbosh/product.rb', line 9 def initialize(product_hash) @product_hash = product_hash end |
Instance Attribute Details
#product_hash ⇒ Object (readonly)
Returns the value of attribute product_hash.
7 8 9 |
# File 'lib/opsmgr/settings/microbosh/product.rb', line 7 def product_hash @product_hash end |
Instance Method Details
#availability_zone_references=(zones_array) ⇒ Object
25 26 27 |
# File 'lib/opsmgr/settings/microbosh/product.rb', line 25 def availability_zone_references=(zones_array) product_hash['availability_zone_references'] = zones_array end |
#disabled_post_deploy_errand_names(errands = nil) ⇒ Object
21 22 23 |
# File 'lib/opsmgr/settings/microbosh/product.rb', line 21 def disabled_post_deploy_errand_names(errands = nil) product_hash['disabled_post_deploy_errand_names'] = errands end |
#for_job(job_name) {|job_result| ... } ⇒ Object
41 42 43 44 |
# File 'lib/opsmgr/settings/microbosh/product.rb', line 41 def for_job(job_name) job_result = job(job_name) yield job_result if job_result end |
#guid ⇒ Object
13 14 15 |
# File 'lib/opsmgr/settings/microbosh/product.rb', line 13 def guid product_hash.fetch('guid') end |
#job(job_name) ⇒ Object
46 47 48 |
# File 'lib/opsmgr/settings/microbosh/product.rb', line 46 def job(job_name) jobs.find { |job| job.name == job_name } end |
#jobs ⇒ Object
50 51 52 |
# File 'lib/opsmgr/settings/microbosh/product.rb', line 50 def jobs product_hash['jobs'].map { |h| Opsmgr::Settings::Microbosh::Job.new(h) } end |
#name ⇒ Object
17 18 19 |
# File 'lib/opsmgr/settings/microbosh/product.rb', line 17 def name product_hash.fetch('identifier') rescue product_hash.fetch('type') end |
#network_reference=(network_references) ⇒ Object
33 34 35 |
# File 'lib/opsmgr/settings/microbosh/product.rb', line 33 def network_reference=(network_references) product_hash['network_reference'] = network_references end |
#product_version ⇒ Object
54 55 56 |
# File 'lib/opsmgr/settings/microbosh/product.rb', line 54 def product_version product_hash['product_version'] end |
#property(name) ⇒ Object
62 63 64 65 66 |
# File 'lib/opsmgr/settings/microbosh/product.rb', line 62 def property(name) return nil if properties.empty? key = properties.first['identifier'] ? 'identifier' : 'definition' properties.find { |property| property[key] == name } end |
#set_property(name, value) ⇒ Object
37 38 39 |
# File 'lib/opsmgr/settings/microbosh/product.rb', line 37 def set_property(name, value) property(name)['value'] = value end |
#singleton_availability_zone ⇒ Object
58 59 60 |
# File 'lib/opsmgr/settings/microbosh/product.rb', line 58 def singleton_availability_zone product_hash['singleton_availability_zone_reference'] end |
#singleton_availability_zone=(value) ⇒ Object
29 30 31 |
# File 'lib/opsmgr/settings/microbosh/product.rb', line 29 def singleton_availability_zone=(value) product_hash['singleton_availability_zone_reference'] = value end |