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
27 28 29 |
# File 'lib/opsmgr/settings/microbosh/product.rb', line 27 def availability_zone_references=(zones_array) product_hash['availability_zone_references'] = zones_array end |
#disabled_post_deploy_errand_names(errands = nil) ⇒ Object
23 24 25 |
# File 'lib/opsmgr/settings/microbosh/product.rb', line 23 def disabled_post_deploy_errand_names(errands = nil) product_hash['disabled_post_deploy_errand_names'] = errands end |
#for_job(job_name) {|job_result| ... } ⇒ Object
43 44 45 46 |
# File 'lib/opsmgr/settings/microbosh/product.rb', line 43 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
48 49 50 |
# File 'lib/opsmgr/settings/microbosh/product.rb', line 48 def job(job_name) jobs.find { |job| job.name == job_name } end |
#jobs ⇒ Object
52 53 54 |
# File 'lib/opsmgr/settings/microbosh/product.rb', line 52 def jobs product_hash['jobs'].map { |h| Opsmgr::Settings::Microbosh::Job.new(h) } end |
#name ⇒ Object
17 18 19 20 21 |
# 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
35 36 37 |
# File 'lib/opsmgr/settings/microbosh/product.rb', line 35 def network_reference=(network_references) product_hash['network_reference'] = network_references end |
#product_version ⇒ Object
56 57 58 |
# File 'lib/opsmgr/settings/microbosh/product.rb', line 56 def product_version product_hash['product_version'] end |
#property(name) ⇒ Object
64 65 66 67 68 |
# File 'lib/opsmgr/settings/microbosh/product.rb', line 64 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
39 40 41 |
# File 'lib/opsmgr/settings/microbosh/product.rb', line 39 def set_property(name, value) property(name)['value'] = value end |
#singleton_availability_zone ⇒ Object
60 61 62 |
# File 'lib/opsmgr/settings/microbosh/product.rb', line 60 def singleton_availability_zone product_hash['singleton_availability_zone_reference'] end |
#singleton_availability_zone=(value) ⇒ Object
31 32 33 |
# File 'lib/opsmgr/settings/microbosh/product.rb', line 31 def singleton_availability_zone=(value) product_hash['singleton_availability_zone_reference'] = value end |