Class: Prof::Environment::CloudFoundry
- Inherits:
-
Object
- Object
- Prof::Environment::CloudFoundry
- Defined in:
- lib/prof/environment/cloud_foundry.rb
Instance Attribute Summary collapse
-
#bosh_service_broker_job_name ⇒ Object
readonly
Returns the value of attribute bosh_service_broker_job_name.
Instance Method Summary collapse
- #bosh_director ⇒ Object
- #bosh_manifest ⇒ Object
- #broker_api_version ⇒ Object
- #cloud_foundry ⇒ Object
- #cloud_foundry_domain ⇒ Object
- #cloud_foundry_uaa ⇒ Object
- #http_proxy ⇒ Object
-
#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:) ⇒ CloudFoundry
constructor
A new instance of CloudFoundry.
- #service_broker ⇒ Object
- #service_broker_name ⇒ Object
- #socks4_proxy ⇒ Object
- #ssh_gateway ⇒ Object
Constructor Details
#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:) ⇒ CloudFoundry
Returns a new instance of CloudFoundry.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# 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 |
Instance Attribute Details
#bosh_service_broker_job_name ⇒ Object (readonly)
Returns the value of attribute bosh_service_broker_job_name.
24 25 26 |
# File 'lib/prof/environment/cloud_foundry.rb', line 24 def bosh_service_broker_job_name @bosh_service_broker_job_name end |
Instance Method Details
#bosh_director ⇒ Object
109 110 111 112 113 114 115 116 117 118 |
# 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 ⇒ Object
83 84 85 |
# 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 ⇒ Object
91 92 93 |
# File 'lib/prof/environment/cloud_foundry.rb', line 91 def broker_api_version @broker_api_version end |
#cloud_foundry ⇒ Object
74 75 76 77 78 79 80 81 |
# 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 ⇒ Object
87 88 89 |
# 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 ⇒ Object
135 136 137 138 139 140 141 |
# 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 ⇒ Object
151 152 153 |
# 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 ⇒ Object
95 96 97 98 99 100 101 102 103 |
# 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 ⇒ Object
105 106 107 |
# File 'lib/prof/environment/cloud_foundry.rb', line 105 def service_broker_name broker_registrar_properties.fetch('name') end |
#socks4_proxy ⇒ Object
143 144 145 146 147 148 149 |
# 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 ⇒ Object
120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# 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 |