Module: Bosh::Providers

Extended by:
Providers
Included in:
Providers
Defined in:
lib/bosh/providers.rb,
lib/bosh/providers/cli/provider_cli.rb,
lib/bosh/providers/cli/aws_provider_cli.rb,
lib/bosh/providers/constants/aws_constants.rb,
lib/bosh/providers/cli/openstack_provider_cli.rb,
lib/bosh/providers/clients/aws_provider_client.rb,
lib/bosh/providers/clients/fog_provider_client.rb,
lib/bosh/providers/constants/openstack_constants.rb,
lib/bosh/providers/clients/openstack_provider_client.rb

Defined Under Namespace

Modules: Cli, Clients, Constants

Instance Method Summary collapse

Instance Method Details

#provider_cli(provider_name, provider_settings) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/bosh/providers.rb', line 29

def provider_cli(provider_name, provider_settings)
  case provider_name.to_sym
  when :aws
    require "bosh/providers/cli/aws_provider_cli"
    Bosh::Providers::Cli::AwsProviderCli.new(provider_settings)
  when :openstack
    require "bosh/providers/cli/openstack_provider_cli"
    Bosh::Providers::Cli::OpenStackProviderCli.new(provider_settings)
  else
    nil
  end
end

#provider_client(attributes) ⇒ Object

returns a BOSH provider (CPI) specific object with helpers related to that provider returns nil if provider_name is unknown



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/bosh/providers.rb', line 11

def provider_client(attributes)
  attributes = attributes.is_a?(Hash) ? Settingslogic.new(attributes) : attributes
  case attributes.name.to_sym
  when :aws
    @aws_provider_client ||= begin
      require "bosh/providers/clients/aws_provider_client"
      Bosh::Providers::Clients::AwsProviderClient.new(attributes)
    end
  when :openstack
    @openstack_provider_client ||= begin
      require "bosh/providers/clients/openstack_provider_client"
      Bosh::Providers::Clients::OpenStackProviderClient.new(attributes)
    end
  else
    nil
  end
end