class Opsmgr::Api::InstallationSettingsResult
Attributes
install_hash[R]
Public Class Methods
new(install_hash)
click to toggle source
# File lib/opsmgr/api/results.rb, line 100 def initialize(install_hash) @install_hash = install_hash end
Public Instance Methods
apps_domain()
click to toggle source
# File lib/opsmgr/api/results.rb, line 152 def apps_domain properties = cc_job.fetch('properties') property_list = Opsmgr::Settings::Microbosh::PropertyList.new(properties) credential_property = property_list.find { |property| property.name == 'apps_domain' } credential_property.fetch('value') end
as_hash()
click to toggle source
# File lib/opsmgr/api/results.rb, line 175 def as_hash install_hash end
director_ip()
click to toggle source
# File lib/opsmgr/api/results.rb, line 104 def director_ip ips_for_job(product_name: 'p-bosh', job_name: 'director').first || ips_for_job(product_name: 'microbosh', job_name: 'director').first end
director_password()
click to toggle source
# File lib/opsmgr/api/results.rb, line 125 def director_password microbosh_jobs = microbosh_settings.fetch('jobs') microbosh_job_list = Opsmgr::Settings::Microbosh::JobList.new(microbosh_jobs) director_job = microbosh_job_list.find { |job| job.name == 'director' } properties = director_job.fetch('properties') property_list = Opsmgr::Settings::Microbosh::PropertyList.new(properties) credential_property = property_list.find { |property| property.name == 'director_credentials' } credential_property.fetch('value').fetch('password') end
ips_for_job(product_name:, job_name:)
click to toggle source
# File lib/opsmgr/api/results.rb, line 109 def ips_for_job(product_name:, job_name:) product = products.find { |p| p.name == product_name } return [] if product.nil? if install_hash['ip_assignments'] install_hash['ip_assignments']['assignments'][product['guid']].each do |job_guid, assignment| return assignment.values.flatten if job_guid.starts_with?(job_name) end else product.fetch('ips').each do |job_guid, ips| return ips if job_guid.starts_with?(job_name) end end [] end
ops_manager_installation_settings()
click to toggle source
# File lib/opsmgr/api/results.rb, line 171 def ops_manager_installation_settings Opsmgr::Settings::Microbosh::InstallationSettings.from_api_result(self) end
product_version(product_guid)
click to toggle source
# File lib/opsmgr/api/results.rb, line 159 def product_version(product_guid) product = products.find { |p| p.guid == product_guid } return nil if product.nil? product.fetch('product_version') end
product_version_by_name(product_name)
click to toggle source
# File lib/opsmgr/api/results.rb, line 165 def product_version_by_name(product_name) product = products.find { |p| p.name == product_name } return nil if product.nil? product.fetch('product_version') end
system_domain()
click to toggle source
# File lib/opsmgr/api/results.rb, line 145 def system_domain properties = cc_job.fetch('properties') property_list = Opsmgr::Settings::Microbosh::PropertyList.new(properties) credential_property = property_list.find { |property| property.name == 'system_domain' } credential_property.fetch('value') end
uaa_admin_password()
click to toggle source
# File lib/opsmgr/api/results.rb, line 135 def uaa_admin_password jobs = cf_settings.fetch('jobs') job_list = Opsmgr::Settings::Microbosh::JobList.new(jobs) uaa_job = job_list.find { |job| job.name == 'uaa' } properties = uaa_job.fetch('properties') property_list = Opsmgr::Settings::Microbosh::PropertyList.new(properties) credential_property = property_list.find { |property| property.name == 'admin_credentials' } credential_property.fetch('value').fetch('password') end
Private Instance Methods
cc_job()
click to toggle source
# File lib/opsmgr/api/results.rb, line 201 def cc_job cf_settings.fetch('jobs') cf_jobs = cf_settings.fetch('jobs') cf_job_list = Opsmgr::Settings::Microbosh::JobList.new(cf_jobs) cf_job_list.find { |job| job.name == 'cloud_controller' } end
cf_settings()
click to toggle source
# File lib/opsmgr/api/results.rb, line 187 def cf_settings products.find { |product| product.name == 'cf' } || fail('cf not found') end
microbosh_settings()
click to toggle source
# File lib/opsmgr/api/results.rb, line 183 def microbosh_settings products.find { |product| product.name == 'p-bosh' || product.name == 'microbosh' } || fail('microbosh not found') end
products()
click to toggle source
# File lib/opsmgr/api/results.rb, line 191 def products if install_hash.key?('products') Opsmgr::Settings::Microbosh::ProductList.new(install_hash.fetch('products')) elsif install_hash.key?('components') Opsmgr::Settings::Microbosh::ProductList.new(install_hash.fetch('components')) else fail "Unable to find products in OpsManager response. Check installation schema: #{install_hash.inspect}." end end