Module: Cyoi::Providers

Extended by:
Providers
Included in:
Providers
Defined in:
lib/cyoi/providers.rb,
lib/cyoi/providers/constants/aws_constants.rb,
lib/cyoi/providers/clients/aws_provider_client.rb,
lib/cyoi/providers/clients/fog_provider_client.rb,
lib/cyoi/providers/constants/openstack_constants.rb,
lib/cyoi/providers/clients/vsphere_provider_client.rb,
lib/cyoi/providers/clients/openstack_provider_client.rb

Defined Under Namespace

Modules: Clients, Constants

Instance Method Summary collapse

Instance Method Details

#provider_client(attributes) ⇒ Object

returns a Infrastructure provider specific object with helpers related to that provider returns nil if attributes.name is unknown



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/cyoi/providers.rb', line 11

def provider_client(attributes)
  attributes = attributes.is_a?(Hash) ? ReadWriteSettings.new(attributes) : attributes
  case attributes.name.to_sym
  when :aws
    @aws_provider_client ||= begin
      require "cyoi/providers/clients/aws_provider_client"
      Cyoi::Providers::Clients::AwsProviderClient.new(attributes)
    end
  when :openstack
    @openstack_provider_client ||= begin
      require "cyoi/providers/clients/openstack_provider_client"
      Cyoi::Providers::Clients::OpenStackProviderClient.new(attributes)
    end
  when :vsphere
    @vsphere_provider_client ||= begin
      puts "vsphere!"
      require "cyoi/providers/clients/vsphere_provider_client"
      Cyoi::Providers::Clients::VsphereProviderClient.new(attributes)
    end
  else
    nil
  end
end