Class: Fog::Vcloud::Real

Inherits:
Object
  • Object
show all
Defined in:
lib/fog/vcloud.rb,
lib/fog/vcloud/models/vdcs.rb,
lib/fog/vcloud/requests/login.rb,
lib/fog/vcloud/requests/get_vdc.rb,
lib/fog/vcloud/requests/get_versions.rb,
lib/fog/vcloud/requests/get_organization.rb

Direct Known Subclasses

Mock

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Real

Returns a new instance of Real.



25
26
27
28
29
30
31
32
33
# File 'lib/fog/vcloud.rb', line 25

def initialize(options = {})
  @connections = {}
  @versions_uri = URI.parse(options[:versions_uri])
  @module = options[:module]
  @version = options[:version]
  @username = options[:username]
  @password = options[:password]
  @login_uri = 
end

Instance Attribute Details

#login_uriObject

Returns the value of attribute login_uri.



22
23
24
# File 'lib/fog/vcloud.rb', line 22

def 
  @login_uri
end

#supported_versionsObject (readonly)

Returns the value of attribute supported_versions.



23
24
25
# File 'lib/fog/vcloud.rb', line 23

def supported_versions
  @supported_versions
end

Instance Method Details

#default_organization_uriObject



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/fog/vcloud.rb', line 35

def default_organization_uri
  @default_organization_uri ||= begin
    unless @login_results
      
    end
    org_list = @login_results.body.organizations
    if organization = @login_results.body.organizations.first
      organization[:href]
    else
      nil
    end
  end
end

#get_organization(organization_uri) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/fog/vcloud/requests/get_organization.rb', line 5

def get_organization(organization_uri)
  response = request(
    :expects  => 200,
    :method   => 'GET',
    :parser   => Fog::Parsers::Vcloud::GetOrganization.new,
    :uri      => organization_uri
  )
  response
end

#get_vdc(vdc_uri) ⇒ Object

Get details of a vdc



6
7
8
9
10
11
12
13
# File 'lib/fog/vcloud/requests/get_vdc.rb', line 6

def get_vdc(vdc_uri)
  request(
    :expects  => 200,
    :method   => 'GET',
    :parser   => Fog::Parsers::Vcloud::GetVdc.new,
    :uri      => vdc_uri
  )
end

#get_versionsObject



6
7
8
9
10
11
12
13
# File 'lib/fog/vcloud/requests/get_versions.rb', line 6

def get_versions
  unauthenticated_request({
    :expects  => 200,
    :method   => 'GET',
    :parser   => Fog::Parsers::Vcloud::GetVersions.new,
    :uri      => @versions_uri
  })
end

#loginObject



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/fog/vcloud/requests/login.rb', line 7

def 
  unauthenticated_request({
    :expects  => 200,
    :headers  => {
      'Authorization' => authorization_header
    },
    :method   => 'POST',
    :parser   => Fog::Parsers::Vcloud::Login.new,
    :uri      => @login_uri
  })
end

#vdcs(options = {}) ⇒ Object



10
11
12
# File 'lib/fog/vcloud/models/vdcs.rb', line 10

def vdcs(options = {})
  @vdcs ||= Fog::Vcloud::Vdcs.new(options.merge(:connection => self))
end