Class: Fog::Terremark::Real
- Inherits:
-
Object
- Object
- Fog::Terremark::Real
- Defined in:
- lib/fog/terremark.rb,
lib/fog/terremark/requests/reset.rb,
lib/fog/terremark/requests/get_vdc.rb,
lib/fog/terremark/requests/get_task.rb,
lib/fog/terremark/requests/get_vapp.rb,
lib/fog/terremark/requests/power_on.rb,
lib/fog/terremark/requests/shutdown.rb,
lib/fog/terremark/requests/power_off.rb,
lib/fog/terremark/requests/delete_vapp.rb,
lib/fog/terremark/requests/deploy_vapp.rb,
lib/fog/terremark/requests/get_catalog.rb,
lib/fog/terremark/requests/get_public_ips.rb,
lib/fog/terremark/requests/get_tasks_list.rb,
lib/fog/terremark/requests/add_node_service.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,
lib/fog/terremark/requests/delete_node_service.rb,
lib/fog/terremark/requests/add_internet_service.rb,
lib/fog/terremark/requests/create_internet_service.rb,
lib/fog/terremark/requests/delete_internet_service.rb,
lib/fog/terremark/requests/instantiate_vapp_template.rb
Instance Method Summary collapse
-
#add_internet_service(ip_id, name, protocol, port, options = {}) ⇒ Object
Reserve requested resources and deploy vApp.
-
#add_node_service(service_id, ip, name, port, options = {}) ⇒ Object
Reserve requested resources and deploy vApp.
-
#create_internet_service(vdc_id, name, protocol, port, options = {}) ⇒ Object
Reserve requested resources and deploy vApp.
- #default_network_id ⇒ Object
-
#default_organization_id ⇒ Object
TODO: bust cache on organization creation?.
- #default_public_ip_id ⇒ Object
- #default_vdc_id ⇒ Object
-
#delete_internet_service(internet_service_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.
-
-
#delete_node_service(node_service_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.
-
-
#delete_vapp(vapp_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.
-
-
#deploy_vapp(vapp_id) ⇒ Object
Reserve requested resources and deploy vApp.
-
#get_catalog(vdc_id) ⇒ Object
Get details of a catalog.
-
#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.
-
-
#get_organization(organization_id) ⇒ Object
Get details of an organization.
-
#get_organizations ⇒ Object
Get list of organizations.
-
#get_public_ips(vdc_id) ⇒ Object
Get list of public ips.
-
#get_task(task_id) ⇒ Object
Get details of a task.
-
#get_tasks_list(tasks_list_id) ⇒ Object
Get list of tasks.
-
#get_vapp(vapp_id) ⇒ Object
-
‘endTime’<~String> - endTime of task * ‘href’<~String> - link to task * ‘startTime’<~String> - startTime of task * ‘status’<~String> - status of task * ‘type’<~String> - type of task * ‘Owner’<~String> - * ‘href’<~String> - href of owner * ‘name’<~String> - name of owner * ‘type’<~String> - type of owner * ‘Result’<~String> - * ‘href’<~String> - href of result * ‘name’<~String> - name of result * ‘type’<~String> - type of result.
-
-
#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.
-
-
#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.
-
-
#initialize(options = {}) ⇒ Real
constructor
A new instance of Real.
-
#instantiate_vapp_template(name) ⇒ 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.
-
-
#power_off(vapp_id) ⇒ Object
Power off a vapp.
-
#power_on(vapp_id) ⇒ Object
Power on a vapp.
-
#reset(vapp_id) ⇒ Object
Reset a vapp.
-
#shutdown(vapp_id) ⇒ Object
Shutdown a vapp.
Constructor Details
#initialize(options = {}) ⇒ Real
Returns a new instance of Real.
65 66 67 68 69 70 71 72 73 |
# File 'lib/fog/terremark.rb', line 65 def initialize(={}) @terremark_password = [:terremark_password] @terremark_username = [:terremark_username] @host = [:host] || "services.vcloudexpress.terremark.com" @path = [:path] || "/api/v0.8" @port = [:port] || 443 @scheme = [:scheme] || 'https' @cookie = get_organizations.headers['Set-Cookie'] end |
Instance Method Details
#add_internet_service(ip_id, name, protocol, port, options = {}) ⇒ Object
Reserve requested resources and deploy vApp
Parameters
-
ip_id<~Integer> - Id of ip to add service to
-
name<~String> - Name of service
-
protocol<~String> - Protocol of service
-
port<~Integer> - Port of service
-
options<~Hash>:
-
Enabled<~Boolean>: defaults to true
-
Description<~String>: optional description
-
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘endTime’<~String> - endTime of task
-
‘href’<~String> - link to task
-
‘startTime’<~String> - startTime of task
-
‘status’<~String> - status of task
-
‘type’<~String> - type of task
-
‘Owner’<~String> -
-
‘href’<~String> - href of owner
-
‘name’<~String> - name of owner
-
‘type’<~String> - type of owner
-
-
-
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/fog/terremark/requests/add_internet_service.rb', line 30 def add_internet_service(ip_id, name, protocol, port, = {}) unless .has_key?('Enabled') ['Enabled'] = true end data = <<-DATA <InternetService xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:tmrk:vCloudExpress-1.0:request:createInternetService"> <Name>#{name}</Name> <Protocol>#{protocol.upcase}</Protocol> <Port>#{port}</Port> <Enabled>#{['Enabled']}</Enabled> <Description>#{['Description']}</Description> </InternetService> DATA request( :body => data, :expects => 200, :headers => {'Content-Type' => 'application/xml'}, :method => 'POST', :parser => Fog::Parsers::Terremark::InternetService.new, :path => "publicIps/#{ip_id}/internetServices" ) end |
#add_node_service(service_id, ip, name, port, options = {}) ⇒ Object
Reserve requested resources and deploy vApp
Parameters
-
service_id<~String> - Id of service to add node to
-
ip<~String> - Private ip of server to add to node
-
name<~String> - Name of service
-
port<~Integer> - Port of service
-
options<~Hash>:
-
Enabled<~Boolean>: defaults to true
-
Description<~String>: optional description
-
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘endTime’<~String> - endTime of task
-
‘href’<~String> - link to task
-
‘startTime’<~String> - startTime of task
-
‘status’<~String> - status of task
-
‘type’<~String> - type of task
-
‘Owner’<~String> -
-
‘href’<~String> - href of owner
-
‘name’<~String> - name of owner
-
‘type’<~String> - type of owner
-
-
-
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/fog/terremark/requests/add_node_service.rb', line 30 def add_node_service(service_id, ip, name, port, = {}) unless .has_key?('Enabled') ['Enabled'] = true end data = <<-DATA <NodeService xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:tmrk:vCloudExpress-1.0:request:createNodeService"> <IpAddress>#{ip}</IpAddress> <Name>#{name}</Name> <Port>#{port}</Port> <Enabled>#{['Enabled']}</Enabled> <Description>#{['Description']}</Description> </NodeService> DATA request( :body => data, :expects => 200, :headers => {'Content-Type' => 'application/xml'}, :method => 'POST', :parser => Fog::Parsers::Terremark::InternetService.new, :path => "internetServices/#{service_id}/nodes" ) end |
#create_internet_service(vdc_id, name, protocol, port, options = {}) ⇒ Object
Reserve requested resources and deploy vApp
Parameters
-
vdc_id<~Integer> - Id of vDc to add internet service to
-
name<~String> - Name of service
-
protocol<~String> - Protocol of service
-
port<~Integer> - Port of service
-
options<~Hash>:
-
Enabled<~Boolean>: defaults to true
-
Description<~String>: optional description
-
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘endTime’<~String> - endTime of task
-
‘href’<~String> - link to task
-
‘startTime’<~String> - startTime of task
-
‘status’<~String> - status of task
-
‘type’<~String> - type of task
-
‘Owner’<~String> -
-
‘href’<~String> - href of owner
-
‘name’<~String> - name of owner
-
‘type’<~String> - type of owner
-
-
-
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/fog/terremark/requests/create_internet_service.rb', line 30 def create_internet_service(vdc_id, name, protocol, port, = {}) unless .has_key?('Enabled') ['Enabled'] = true end data = <<-DATA <InternetService xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:tmrk:vCloudExpress-1.0:request:createInternetService"> <Name>#{name}</Name> <Protocol>#{protocol.upcase}</Protocol> <Port>#{port}</Port> <Enabled>#{['Enabled']}</Enabled> <Description>#{['Description']}</Description> </InternetService> DATA request( :body => data, :expects => 200, :headers => {'Content-Type' => 'application/xml'}, :method => 'POST', :parser => Fog::Parsers::Terremark::InternetService.new, :path => "vdc/#{vdc_id}/internetServices" ) end |
#default_network_id ⇒ Object
104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/fog/terremark.rb', line 104 def default_network_id if default_vdc_id @default_network_id ||= begin networks = get_vdc(default_vdc_id).body['AvailableNetworks'] if networks.length == 1 networks.first['href'].split('/').last.to_i else nil end end else nil end end |
#default_organization_id ⇒ Object
TODO: bust cache on organization creation?
76 77 78 79 80 81 82 83 84 85 |
# File 'lib/fog/terremark.rb', line 76 def default_organization_id @default_organization_id ||= begin org_list = get_organizations.body['OrgList'] if org_list.length == 1 org_list.first['href'].split('/').last.to_i else nil end end end |
#default_public_ip_id ⇒ Object
119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/fog/terremark.rb', line 119 def default_public_ip_id if default_vdc_id @default_public_ip_id ||= begin ips = get_public_ips(default_vdc_id).body['PublicIpAddresses'] if ips.length == 1 ips.first['Href'].split('/').last.to_i else nil end end else nil end end |
#default_vdc_id ⇒ Object
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/fog/terremark.rb', line 87 def default_vdc_id if default_organization_id @default_vdc_id ||= begin vdcs = get_organization(default_organization_id).body['Links'].select {|link| link['type'] == 'application/vnd.vmware.vcloud.vdc+xml' } if vdcs.length == 1 vdcs.first['href'].split('/').last.to_i else nil end end else nil end end |
#delete_internet_service(internet_service_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
22 23 24 25 26 27 28 |
# File 'lib/fog/terremark/requests/delete_internet_service.rb', line 22 def delete_internet_service(internet_service_id) request( :expects => 200, :method => 'DELETE', :path => "InternetServices/#{internet_service_id}" ) end |
#delete_node_service(node_service_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
22 23 24 25 26 27 28 |
# File 'lib/fog/terremark/requests/delete_node_service.rb', line 22 def delete_node_service(node_service_id) request( :expects => 200, :method => 'DELETE', :path => "nodeServices/#{node_service_id}" ) end |
#delete_vapp(vapp_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
22 23 24 25 26 27 28 |
# File 'lib/fog/terremark/requests/delete_vapp.rb', line 22 def delete_vapp(vapp_id) request( :expects => 202, :method => 'DELETE', :path => "vApp/#{vapp_id}" ) end |
#deploy_vapp(vapp_id) ⇒ Object
Reserve requested resources and deploy vApp
Parameters
-
vapp_id<~Integer> - Id of vApp to deploy
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘endTime’<~String> - endTime of task
-
‘href’<~String> - link to task
-
‘startTime’<~String> - startTime of task
-
‘status’<~String> - status of task
-
‘type’<~String> - type of task
-
‘Owner’<~String> -
-
‘href’<~String> - href of owner
-
‘name’<~String> - name of owner
-
‘type’<~String> - type of owner
-
-
-
24 25 26 27 28 29 30 31 |
# File 'lib/fog/terremark/requests/deploy_vapp.rb', line 24 def deploy_vapp(vapp_id) request( :expects => 202, :method => 'POST', :parser => Fog::Parsers::Terremark::Task.new, :path => "vApp/#{vapp_id}/action/deploy" ) end |
#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_organizations ⇒ Object
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 |
# File 'lib/fog/terremark/requests/get_organizations.rb', line 15 def get_organizations request({ :expects => 200, :headers => { 'Authorization' => "Basic #{Base64.encode64("#{@terremark_username}:#{@terremark_password}").chomp!}" }, :method => 'POST', :parser => Fog::Parsers::Terremark::GetOrganizations.new, :path => 'login' }) end |
#get_public_ips(vdc_id) ⇒ Object
Get list of public ips
Parameters
-
vdc_id<~Integer> - Id of vdc to find public ips for
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘PublicIpAddresses’<~Array>
-
‘href’<~String> - linke to item
-
‘name’<~String> - name of item
-
-
-
18 19 20 21 22 23 24 25 |
# File 'lib/fog/terremark/requests/get_public_ips.rb', line 18 def get_public_ips(vdc_id) request( :expects => 200, :method => 'GET', :parser => Fog::Parsers::Terremark::GetPublicIps.new, :path => "vdc/#{vdc_id}/publicIps" ) end |
#get_task(task_id) ⇒ Object
Get details of a task
Parameters
-
task_id<~Integer> - Id of task to lookup
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘endTime’<~String> - endTime of task
-
‘href’<~String> - link to task
-
‘startTime’<~String> - startTime of task
-
‘status’<~String> - status of task
-
‘type’<~String> - type of task
-
‘Owner’<~String> -
-
‘href’<~String> - href of owner
-
‘name’<~String> - name of owner
-
‘type’<~String> - type of owner
-
-
‘Result’<~String> -
-
‘href’<~String> - href of result
-
‘name’<~String> - name of result
-
‘type’<~String> - type of result
-
-
-
28 29 30 31 32 33 34 35 |
# File 'lib/fog/terremark/requests/get_task.rb', line 28 def get_task(task_id) request( :expects => 200, :method => 'GET', :parser => Fog::Parsers::Terremark::Task.new, :path => "task/#{task_id}" ) end |
#get_tasks_list(tasks_list_id) ⇒ Object
Get list of tasks
Parameters
-
tasks_list_id<~Integer> - Id of tasks lists to view
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_tasks_list.rb', line 21 def get_tasks_list(tasks_list_id) request( :expects => 200, :method => 'GET', :parser => Fog::Parsers::Terremark::GetTasksList.new, :path => "tasksList/#{tasks_list_id}" ) end |
#get_vapp(vapp_id) ⇒ Object
-
‘endTime’<~String> - endTime of task
* 'href'<~String> - link to task * 'startTime'<~String> - startTime of task * 'status'<~String> - status of task * 'type'<~String> - type of task * 'Owner'<~String> - * 'href'<~String> - href of owner * 'name'<~String> - name of owner * 'type'<~String> - type of owner * 'Result'<~String> - * 'href'<~String> - href of result * 'name'<~String> - name of result * 'type'<~String> - type of result
31 32 33 34 35 36 37 38 |
# File 'lib/fog/terremark/requests/get_vapp.rb', line 31 def get_vapp(vapp_id) request( :expects => 200, :method => 'GET', :parser => Fog::Parsers::Terremark::Vapp.new, :path => "vapp/#{vapp_id}" ) 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 |
#instantiate_vapp_template(name) ⇒ 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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/fog/terremark/requests/instantiate_vapp_template.rb', line 24 def instantiate_vapp_template(name) # FIXME: much cheating to commence vdc_id = default_vdc_id network_id = default_network_id catalog_item = 12 # Ubuntu JeOS 9.10 (64-bit) # case UNRESOLVED: # return "0"; # case RESOLVED: # return "1"; # case OFF: # return "2"; # case SUSPENDED: # return "3"; # case ON: # return "4"; # default: # # /** # * The vApp is unresolved (one or more file references are unavailable in the cloud) # */ # UNRESOLVED, # /** # * The vApp is resolved (all file references are available in the cloud) but not deployed # */ # RESOLVED, # /** # * The vApp is deployed and powered off # */ # OFF, # /** # * The vApp is deployed and suspended # */ # SUSPENDED, # /** # * The vApp is deployed and powered on # */ # ON; data = <<-DATA <?xml version="1.0" encoding="UTF-8"?> <InstantiateVAppTemplateParams name="#{name}" xmlns="http://www.vmware.com/vcloud/v0.8" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v0.8 http://services.vcloudexpress.terremark.com/api/v0.8/ns/vcloud.xsd"> <VAppTemplate href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/#{catalog_item}" /> <InstantiationParams xmlns:vmw="http://www.vmware.com/schema/ovf"> <ProductSection xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:q1="http://www.vmware.com/vcloud/v0.8"/> <VirtualHardwareSection xmlns:q1="http://www.vmware.com/vcloud/v0.8"> <Item xmlns="http://schemas.dmtf.org/ovf/envelope/1"> <InstanceID xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">1</InstanceID> <ResourceType xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">3</ResourceType> <VirtualQuantity xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">1</VirtualQuantity> </Item> <Item xmlns="http://schemas.dmtf.org/ovf/envelope/1"> <InstanceID xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">2</InstanceID> <ResourceType xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">4</ResourceType> <VirtualQuantity xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">512</VirtualQuantity> </Item> </VirtualHardwareSection> <NetworkConfigSection> <NetworkConfig name="Network 1"> <Features> <vmw:FenceMode>allowInOut</vmw:FenceMode> <vmw:Dhcp>true</vmw:Dhcp> </Features> <NetworkAssociation href="https://services.vcloudexpress.terremark.com/api/v8/network/#{network_id}" /> </NetworkConfig> </NetworkConfigSection> </InstantiationParams> </InstantiateVAppTemplateParams> DATA request( :body => data, :expects => 200, :headers => { 'Content-Type' => 'application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml' }, :method => 'POST', :parser => Fog::Parsers::Terremark::InstantiateVappTemplate.new, :path => "vdc/#{vdc_id}/action/instantiatevAppTemplate" ) end |
#power_off(vapp_id) ⇒ Object
Power off a vapp
Parameters
-
vapp_id<~Integer> - Id of vapp to power off
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘endTime’<~String> - endTime of task
-
‘href’<~String> - link to task
-
‘startTime’<~String> - startTime of task
-
‘status’<~String> - status of task
-
‘type’<~String> - type of task
-
‘Owner’<~String> -
-
‘href’<~String> - href of owner
-
‘name’<~String> - name of owner
-
‘type’<~String> - type of owner
-
-
-
24 25 26 27 28 29 30 31 |
# File 'lib/fog/terremark/requests/power_off.rb', line 24 def power_off(vapp_id) request( :expects => 202, :method => 'POST', :parser => Fog::Parsers::Terremark::Task.new, :path => "vApp/#{vapp_id}/power/action/powerOff" ) end |
#power_on(vapp_id) ⇒ Object
Power on a vapp
Parameters
-
vapp_id<~Integer> - Id of vapp to power on
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘endTime’<~String> - endTime of task
-
‘href’<~String> - link to task
-
‘startTime’<~String> - startTime of task
-
‘status’<~String> - status of task
-
‘type’<~String> - type of task
-
‘Owner’<~String> -
-
‘href’<~String> - href of owner
-
‘name’<~String> - name of owner
-
‘type’<~String> - type of owner
-
-
-
24 25 26 27 28 29 30 31 |
# File 'lib/fog/terremark/requests/power_on.rb', line 24 def power_on(vapp_id) request( :expects => 202, :method => 'POST', :parser => Fog::Parsers::Terremark::Task.new, :path => "vApp/#{vapp_id}/power/action/powerOn" ) end |
#reset(vapp_id) ⇒ Object
Reset a vapp
Parameters
-
vapp_id<~Integer> - Id of vapp to reset
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘endTime’<~String> - endTime of task
-
‘href’<~String> - link to task
-
‘startTime’<~String> - startTime of task
-
‘status’<~String> - status of task
-
‘type’<~String> - type of task
-
‘Owner’<~String> -
-
‘href’<~String> - href of owner
-
‘name’<~String> - name of owner
-
‘type’<~String> - type of owner
-
-
-
24 25 26 27 28 29 30 31 |
# File 'lib/fog/terremark/requests/reset.rb', line 24 def reset(vapp_id) request( :expects => 202, :method => 'POST', :parser => Fog::Parsers::Terremark::Task.new, :path => "vApp/#{vapp_id}/power/action/reset" ) end |
#shutdown(vapp_id) ⇒ Object
Shutdown a vapp
Parameters
-
vapp_id<~Integer> - Id of vapp to shutdown
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘endTime’<~String> - endTime of task
-
‘href’<~String> - link to task
-
‘startTime’<~String> - startTime of task
-
‘status’<~String> - status of task
-
‘type’<~String> - type of task
-
‘Owner’<~String> -
-
‘href’<~String> - href of owner
-
‘name’<~String> - name of owner
-
‘type’<~String> - type of owner
-
-
-
24 25 26 27 28 29 30 31 |
# File 'lib/fog/terremark/requests/shutdown.rb', line 24 def shutdown(vapp_id) request( :expects => 202, :method => 'POST', :parser => Fog::Parsers::Terremark::Task.new, :path => "vApp/#{vapp_id}/power/action/shutdown" ) end |