Module: Vcloud

Defined in:
lib/fog/bin/vcloud.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.complete_service_options?(service) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
19
20
21
22
23
24
25
26
# File 'lib/fog/bin/vcloud.rb', line 16

def complete_service_options?(service)
  if Fog.credentials.has_key?(:vcloud)
    if Fog.credentials[:vcloud].has_key?(service)
      service = Fog.credentials[:vcloud][service]
      if Fog::Vcloud.requirements.all? { |option| service.has_key?(option) }
        return true
      end
    end
  end
  false
end

.registered_servicesObject



12
13
14
# File 'lib/fog/bin/vcloud.rb', line 12

def registered_services
  Vcloud.services.map { |service| ":" << service.to_s }.join(", ")
end

.servicesObject



4
5
6
7
8
9
10
# File 'lib/fog/bin/vcloud.rb', line 4

def services
  if Fog.credentials.has_key?(:vcloud)
    Fog.credentials[:vcloud].keys.sort { |a,b| a.to_s <=> b.to_s }
  else
    []
  end
end

Instance Method Details

#[](service) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/fog/bin/vcloud.rb', line 38

def [](service)
  @@connections ||= Hash.new do |hash, key|
    if credentials = Fog.credentials[:vcloud][key]
      credentials = credentials.dup
      _module_ = eval(credentials.delete(:module))
      hash[key] = _module_.new(credentials)
    else
      raise ArgumentError.new("Unregistered service: :#{key}. Registered services are: #{Vcloud.registered_services}")
    end
  end
  @@connections[service]
end

#initialized?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/fog/bin/vcloud.rb', line 30

def initialized?
  true
end

#startup_noticeObject



34
35
36
# File 'lib/fog/bin/vcloud.rb', line 34

def startup_notice
  Formatador.display_line("You have access to the following Vcloud services: #{Vcloud.registered_services}.")
end