Class: Fog::Terremark::Real

Inherits:
Object
  • Object
show all
Defined in:
lib/fog/terremark.rb,
lib/fog/terremark/requests/get_vdc.rb,
lib/fog/terremark/requests/get_catalog.rb,
lib/fog/terremark/requests/get_catalog_item.rb,
lib/fog/terremark/requests/get_organization.rb,
lib/fog/terremark/requests/get_organizations.rb,
lib/fog/terremark/requests/get_vapp_template.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Real

Returns a new instance of Real.



48
49
50
51
52
53
54
55
56
# File 'lib/fog/terremark.rb', line 48

def initialize(options={})
  @terremark_password = options[:terremark_password]
  @terremark_username = options[:terremark_username]
  @host   = options[:host]   || "services.vcloudexpress.terremark.com"
  @path   = options[:path]   || "/api/v0.8"
  @port   = options[:port]   || 443
  @scheme = options[:scheme] || 'https'
  @cookie = get_organizations.headers['Set-Cookie']
end

Instance Method Details

#get_catalog(vdc_id) ⇒ Object

Get details of a catalog

Parameters

  • vdc_id<~Integer> - Id of vdc to view catalog for

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘CatalogItems’<~Array>

        • ‘href’<~String> - linke to item

        • ‘name’<~String> - name of item

        • ‘type’<~String> - type of item

      • ‘description’<~String> - Description of catalog

      • ‘name’<~String> - Name of catalog



21
22
23
24
25
26
27
28
# File 'lib/fog/terremark/requests/get_catalog.rb', line 21

def get_catalog(vdc_id)
  request(
    :expects  => 200,
    :method   => 'GET',
    :parser   => Fog::Parsers::Terremark::GetCatalog.new,
    :path     => "vdc/#{vdc_id}/catalog"
  )
end

#get_catalog_item(catalog_item_id) ⇒ Object

  • ‘CatalogItems’<~Array>

      * 'href'<~String> - linke to item
      * 'name'<~String> - name of item
      * 'type'<~String> - type of item
    * 'description'<~String> - Description of catalog
    * 'name'<~String> - Name of catalog
    


24
25
26
27
28
29
30
31
# File 'lib/fog/terremark/requests/get_catalog_item.rb', line 24

def get_catalog_item(catalog_item_id)
  request(
    :expects  => 200,
    :method   => 'GET',
    :parser   => Fog::Parsers::Terremark::GetCatalogItem.new,
    :path     => "catalogItem/#{catalog_item_id}"
  )
end

#get_organization(organization_id) ⇒ Object

Get details of an organization

Parameters

  • organization_id<~Integer> - Id of organization to lookup

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘description’<~String> - Description of organization

      • ‘links’<~Array> - An array of links to entities in the organization

        • ‘href’<~String> - location of link

        • ‘name’<~String> - name of link

        • ‘rel’<~String> - action to perform

        • ‘type’<~String> - type of link

      • ‘name’<~String> - Name of organization



22
23
24
25
26
27
28
29
30
# File 'lib/fog/terremark/requests/get_organization.rb', line 22

def get_organization(organization_id)
  response = request(
    :expects  => 200,
    :method   => 'GET',
    :parser   => Fog::Parsers::Terremark::GetOrganization.new,
    :path     => "org/#{organization_id}"
  )
  response
end

#get_organizationsObject

Get list of organizations

Returns

  • response<~Excon::Response>:

    • body<~Array>:

      • ‘description’<~String> - Description of organization

      • ‘links’<~Array> - An array of links to entities in the organization

      • ‘name’<~String> - Name of organization



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/fog/terremark/requests/get_organizations.rb', line 15

def get_organizations
  request({
    :body     => '',
    :expects  => 200,
    :headers  => {
      'Authorization' => "Basic #{Base64.encode64("#{@terremark_username}:#{@terremark_password}").chomp!}"
    },
    :method   => 'POST',
    :parser   => Fog::Parsers::Terremark::GetOrganizations.new,
    :path     => 'login'
  })
end

#get_vapp_template(vapp_template_id) ⇒ Object

  • ‘CatalogItems’<~Array>

      * 'href'<~String> - linke to item
      * 'name'<~String> - name of item
      * 'type'<~String> - type of item
    * 'description'<~String> - Description of catalog
    * 'name'<~String> - Name of catalog
    


24
25
26
27
28
29
30
31
# File 'lib/fog/terremark/requests/get_vapp_template.rb', line 24

def get_vapp_template(vapp_template_id)
  request(
    :expects  => 200,
    :method   => 'GET',
    :parser   => Fog::Parsers::Terremark::GetVappTemplate.new,
    :path     => "vAppTemplate/#{vapp_template_id}"
  )
end

#get_vdc(vdc_id) ⇒ Object

  • ‘CatalogItems’<~Array>

      * 'href'<~String> - linke to item
      * 'name'<~String> - name of item
      * 'type'<~String> - type of item
    * 'description'<~String> - Description of catalog
    * 'name'<~String> - Name of catalog
    


24
25
26
27
28
29
30
31
# File 'lib/fog/terremark/requests/get_vdc.rb', line 24

def get_vdc(vdc_id)
  request(
    :expects  => 200,
    :method   => 'GET',
    :parser   => Fog::Parsers::Terremark::GetVdc.new,
    :path     => "vdc/#{vdc_id}"
  )
end