class Prof::Environment::CloudFoundry
Attributes
bosh_ca_cert_path[R]
bosh_env_login[R]
bosh_manifest_path[R]
bosh_password[R]
bosh_service_broker_job_name[R]
bosh_target[R]
bosh_username[R]
cloud_controller_identity[R]
cloud_controller_password[R]
cloud_foundry_api_url[R]
cloud_foundry_password[R]
cloud_foundry_username[R]
ssh_gateway_host[R]
ssh_gateway_password[R]
ssh_gateway_private_key[R]
ssh_gateway_username[R]
use_proxy[R]
Public Class Methods
new( cloud_foundry_domain: nil, cloud_controller_identity: 'cloud_controller', cloud_controller_password: 'cc-secret', cloud_foundry_username: 'admin', cloud_foundry_password: 'admin', cloud_foundry_api_url: nil, bosh_target: 'https://192.168.50.4:25555', bosh_username: 'admin', bosh_password: 'admin', bosh_ca_cert_path: nil, bosh_env_login: false, ssh_gateway_host: '192.168.50.4', ssh_gateway_username: 'vagrant', ssh_gateway_password: 'vagrant', ssh_gateway_private_key: nil, bosh_service_broker_job_name:, bosh_manifest_path:, use_proxy: true, broker_api_version: )
click to toggle source
# File lib/prof/environment/cloud_foundry.rb, line 26 def initialize( cloud_foundry_domain: nil, cloud_controller_identity: 'cloud_controller', cloud_controller_password: 'cc-secret', cloud_foundry_username: 'admin', cloud_foundry_password: 'admin', cloud_foundry_api_url: nil, bosh_target: 'https://192.168.50.4:25555', bosh_username: 'admin', bosh_password: 'admin', bosh_ca_cert_path: nil, bosh_env_login: false, ssh_gateway_host: '192.168.50.4', ssh_gateway_username: 'vagrant', ssh_gateway_password: 'vagrant', ssh_gateway_private_key: nil, bosh_service_broker_job_name:, bosh_manifest_path:, use_proxy: true, broker_api_version: ) @cloud_foundry_domain = cloud_foundry_domain @cloud_controller_identity = cloud_controller_identity @cloud_controller_password = cloud_controller_password @cloud_foundry_username = cloud_foundry_username @cloud_foundry_password = cloud_foundry_password @bosh_target = bosh_target @bosh_username = bosh_username @bosh_password = bosh_password @bosh_ca_cert_path = bosh_ca_cert_path @bosh_env_login = bosh_env_login @ssh_gateway_host = ssh_gateway_host @ssh_gateway_username = ssh_gateway_username @ssh_gateway_password = ssh_gateway_password @ssh_gateway_private_key = ssh_gateway_private_key @bosh_service_broker_job_name = bosh_service_broker_job_name @bosh_manifest_path = bosh_manifest_path @cloud_foundry_api_url = cloud_foundry_api_url @use_proxy = use_proxy @broker_api_version = broker_api_version end
Public Instance Methods
bosh_director()
click to toggle source
# File lib/prof/environment/cloud_foundry.rb, line 109 def bosh_director @bosh_director ||= Hula::BoshDirector.new( target_url: bosh_target, username: bosh_username, password: bosh_password, manifest_path: bosh_manifest_path, certificate_path: bosh_ca_cert_path, env_login: bosh_env_login ) end
bosh_manifest()
click to toggle source
# File lib/prof/environment/cloud_foundry.rb, line 83 def bosh_manifest @bosh_manifest ||= Hula::BoshManifest.from_file(bosh_manifest_path) end
broker_api_version()
click to toggle source
# File lib/prof/environment/cloud_foundry.rb, line 91 def broker_api_version @broker_api_version end
cloud_foundry()
click to toggle source
# File lib/prof/environment/cloud_foundry.rb, line 74 def cloud_foundry @cloud_foundry ||= ::Prof::CloudFoundry.new( domain: cloud_foundry_domain, username: cloud_foundry_username, password: cloud_foundry_password, api_url: cloud_foundry_api_url ) end
cloud_foundry_domain()
click to toggle source
# File lib/prof/environment/cloud_foundry.rb, line 87 def cloud_foundry_domain @cloud_foundry_domain ||= bosh_manifest.property('cf.domain') end
cloud_foundry_uaa()
click to toggle source
# File lib/prof/environment/cloud_foundry.rb, line 135 def cloud_foundry_uaa @cloud_foundry_uaa ||= UAAClient.new( cloud_foundry_domain, cloud_controller_identity, cloud_controller_password ) end
http_proxy()
click to toggle source
# File lib/prof/environment/cloud_foundry.rb, line 151 def http_proxy @http_proxy ||= Hula::HttpProxyUpstreamSocks.new(socks_proxy: socks4_proxy).tap(&:start) end
service_broker()
click to toggle source
# File lib/prof/environment/cloud_foundry.rb, line 95 def service_broker @service_broker ||= Hula::ServiceBroker::Client.new( url: URI::HTTPS.build(host: broker_registrar_properties.fetch('host')), username: broker_registrar_properties.fetch('username'), password: broker_registrar_properties.fetch('password'), http_client: http_json_client(use_proxy: use_proxy), broker_api_version: broker_api_version ) end
service_broker_name()
click to toggle source
# File lib/prof/environment/cloud_foundry.rb, line 105 def service_broker_name broker_registrar_properties.fetch('name') end
socks4_proxy()
click to toggle source
# File lib/prof/environment/cloud_foundry.rb, line 143 def socks4_proxy @socks4_proxy ||= Hula::Socks4ProxySsh.new( ssh_username: ssh_gateway_username, ssh_password: ssh_gateway_password, ssh_host: ssh_gateway_host ).tap(&:start) end
ssh_gateway()
click to toggle source
# File lib/prof/environment/cloud_foundry.rb, line 120 def ssh_gateway opts = { gateway_host: ssh_gateway_host, gateway_username: ssh_gateway_username, } if @ssh_gateway_private_key opts[:gateway_private_key] = ssh_gateway_private_key else opts[:gateway_password] = ssh_gateway_password end @ssh_gateway ||= Prof::SshGateway.new(opts) end
Private Instance Methods
broker_registrar_properties()
click to toggle source
# File lib/prof/environment/cloud_foundry.rb, line 162 def broker_registrar_properties begin bosh_manifest.job('broker-registrar').properties.fetch('broker') rescue RuntimeError # for colocated errands, the errand's instance group might not exist bosh_manifest.properties.fetch('broker') end end
http_json_client(use_proxy:)
click to toggle source
# File lib/prof/environment/cloud_foundry.rb, line 171 def http_json_client(use_proxy:) proxy = use_proxy ? http_proxy : Hula::ServiceBroker::HttpProxyNull.new @http_json_client ||= Hula::ServiceBroker::HttpJsonClient.new(http_proxy: proxy) end