mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[terremark] rough first cut of vcloud express lifecycle functionality
This commit is contained in:
parent
1037840421
commit
d3e375f2a1
21 changed files with 704 additions and 10 deletions
|
@ -1,9 +1,19 @@
|
|||
require 'fog/terremark/requests/delete_vapp'
|
||||
require 'fog/terremark/requests/deploy_vapp'
|
||||
require 'fog/terremark/requests/get_catalog'
|
||||
require 'fog/terremark/requests/get_catalog_item'
|
||||
require 'fog/terremark/requests/get_organization'
|
||||
require 'fog/terremark/requests/get_organizations'
|
||||
require 'fog/terremark/requests/get_task'
|
||||
require 'fog/terremark/requests/get_tasks_list'
|
||||
require 'fog/terremark/requests/get_vapp'
|
||||
require 'fog/terremark/requests/get_vapp_template'
|
||||
require 'fog/terremark/requests/get_vdc'
|
||||
require 'fog/terremark/requests/instantiate_vapp_template'
|
||||
require 'fog/terremark/requests/reset'
|
||||
require 'fog/terremark/requests/power_off'
|
||||
require 'fog/terremark/requests/power_on'
|
||||
require 'fog/terremark/requests/shutdown'
|
||||
|
||||
module Fog
|
||||
module Terremark
|
||||
|
|
|
@ -21,7 +21,8 @@ module Fog
|
|||
catalog = {}
|
||||
until attributes.empty?
|
||||
if attributes.first.is_a?(Array)
|
||||
catalog[attributes.first.first] = attributes.shift.last
|
||||
attribute = attributes.shift
|
||||
catalog[attribute.first] = attribute.last
|
||||
else
|
||||
catalog[attributes.shift] = attributes.shift
|
||||
end
|
||||
|
|
|
@ -5,7 +5,6 @@ module Fog
|
|||
class GetCatalogItem < Fog::Parsers::Base
|
||||
|
||||
def reset
|
||||
@property_key
|
||||
@response = { 'Entity' => {}, 'Properties' => {} }
|
||||
end
|
||||
|
||||
|
@ -20,7 +19,8 @@ module Fog
|
|||
catalog_item = {}
|
||||
until attributes.empty?
|
||||
if attributes.first.is_a?(Array)
|
||||
catalog_item[attributes.first.first] = attributes.shift.last
|
||||
attribute = attributes.shift
|
||||
catalog_item[attribute.first] = attribute.last
|
||||
else
|
||||
catalog_item[attributes.shift] = attributes.shift
|
||||
end
|
||||
|
|
|
@ -21,7 +21,8 @@ module Fog
|
|||
org = {}
|
||||
until attributes.empty?
|
||||
if attributes.first.is_a?(Array)
|
||||
org[attributes.first.first] = attributes.shift.last
|
||||
attribute = attributes.shift
|
||||
org[attribute.first] = attribute.last
|
||||
else
|
||||
org[attributes.shift] = attributes.shift
|
||||
end
|
||||
|
|
50
lib/fog/terremark/parsers/get_tasks_list.rb
Normal file
50
lib/fog/terremark/parsers/get_tasks_list.rb
Normal file
|
@ -0,0 +1,50 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module Terremark
|
||||
|
||||
class GetTasksList < Fog::Parsers::Base
|
||||
|
||||
def reset
|
||||
@response = { 'Tasks' => [] }
|
||||
@task = {}
|
||||
end
|
||||
|
||||
def start_element(name, attributes)
|
||||
@value = ''
|
||||
case name
|
||||
when 'Owner', 'Result'
|
||||
data = {}
|
||||
until attributes.empty?
|
||||
data[attributes.shift] = attributes.shift
|
||||
end
|
||||
@task[name] = data
|
||||
when 'Task'
|
||||
until attributes.empty?
|
||||
@task[attributes.shift] = attributes.shift
|
||||
end
|
||||
when 'TasksList'
|
||||
tasks_list = {}
|
||||
until attributes.empty?
|
||||
if attributes.first.is_a?(Array)
|
||||
attribute = attributes.shift
|
||||
tasks_list[attribute.first] = attribute.last
|
||||
else
|
||||
tasks_list[attributes.shift] = attributes.shift
|
||||
end
|
||||
end
|
||||
@response['href'] = tasks_list['href']
|
||||
end
|
||||
end
|
||||
|
||||
def end_element(name)
|
||||
if name == 'Task'
|
||||
@response['Tasks'] << @task
|
||||
@task = {}
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
|
@ -5,7 +5,6 @@ module Fog
|
|||
class GetVappTemplate < Fog::Parsers::Base
|
||||
|
||||
def reset
|
||||
@property_key
|
||||
@response = { 'Links' => [] }
|
||||
end
|
||||
|
||||
|
@ -22,7 +21,8 @@ module Fog
|
|||
vapp_template = {}
|
||||
until attributes.empty?
|
||||
if attributes.first.is_a?(Array)
|
||||
vapp_template[attributes.first.first] = attributes.shift.last
|
||||
attribute = attributes.shift
|
||||
vapp_template[attribute.first] = attribute.last
|
||||
else
|
||||
vapp_template[attributes.shift] = attributes.shift
|
||||
end
|
||||
|
|
|
@ -20,7 +20,7 @@ module Fog
|
|||
'Memory' => {}
|
||||
},
|
||||
'StorageCapacity' => {},
|
||||
'ResourceEntities' => {}
|
||||
'ResourceEntities' => []
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -52,14 +52,15 @@ module Fog
|
|||
until attributes.empty?
|
||||
resource_entity[attributes.shift] = attributes.shift
|
||||
end
|
||||
@response['ResourceEntity'] << resource_entity
|
||||
@response['ResourceEntities'] << resource_entity
|
||||
when 'StorageCapacity'
|
||||
@in_storage_capacity = true
|
||||
when 'Vdc'
|
||||
vdc = {}
|
||||
until attributes.empty?
|
||||
if attributes.first.is_a?(Array)
|
||||
vdc[attributes.first.first] = attributes.shift.last
|
||||
attribute = attributes.shift
|
||||
vdc[attribute.first] = attribute.last
|
||||
else
|
||||
vdc[attributes.shift] = attributes.shift
|
||||
end
|
||||
|
|
39
lib/fog/terremark/parsers/instantiate_vapp_template.rb
Normal file
39
lib/fog/terremark/parsers/instantiate_vapp_template.rb
Normal file
|
@ -0,0 +1,39 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module Terremark
|
||||
|
||||
class InstantiateVappTemplate < Fog::Parsers::Base
|
||||
|
||||
def reset
|
||||
@property_key
|
||||
@response = { 'Links' => [] }
|
||||
end
|
||||
|
||||
def start_element(name, attributes)
|
||||
@value = ''
|
||||
case name
|
||||
when 'Link'
|
||||
link = {}
|
||||
until attributes.empty?
|
||||
link[attributes.shift] = attributes.shift
|
||||
end
|
||||
@response['Links'] << link
|
||||
when 'VApp'
|
||||
vapp_template = {}
|
||||
until attributes.empty?
|
||||
if attributes.first.is_a?(Array)
|
||||
attribute = attributes.shift
|
||||
vapp_template[attribute.first] = attribute.last
|
||||
else
|
||||
vapp_template[attributes.shift] = attributes.shift
|
||||
end
|
||||
end
|
||||
@response.merge!(vapp_template.reject {|key, value| !['href', 'name', 'size', 'status', 'type'].include?(key)})
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
38
lib/fog/terremark/parsers/task.rb
Normal file
38
lib/fog/terremark/parsers/task.rb
Normal file
|
@ -0,0 +1,38 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module Terremark
|
||||
|
||||
class Task < Fog::Parsers::Base
|
||||
|
||||
def reset
|
||||
@response = {}
|
||||
end
|
||||
|
||||
def start_element(name, attributes)
|
||||
@value = ''
|
||||
case name
|
||||
when 'Owner', 'Result'
|
||||
data = {}
|
||||
until attributes.empty?
|
||||
data[attributes.shift] = attributes.shift
|
||||
end
|
||||
@response[name] = data
|
||||
when 'Task'
|
||||
task = {}
|
||||
until attributes.empty?
|
||||
if attributes.first.is_a?(Array)
|
||||
attribute = attributes.shift
|
||||
task[attribute.first] = attribute.last
|
||||
else
|
||||
task[attributes.shift] = attributes.shift
|
||||
end
|
||||
end
|
||||
@response.merge!(task.reject {|key,value| !['endTime', 'href', 'startTime', 'status', 'type'].include?(key)})
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
45
lib/fog/terremark/parsers/vapp.rb
Normal file
45
lib/fog/terremark/parsers/vapp.rb
Normal file
|
@ -0,0 +1,45 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module Terremark
|
||||
|
||||
class Vapp < Fog::Parsers::Base
|
||||
|
||||
def reset
|
||||
@response = { 'Links' => [] }
|
||||
end
|
||||
|
||||
def start_element(name, attributes)
|
||||
@value = ''
|
||||
case name
|
||||
when 'Link'
|
||||
link = {}
|
||||
until attributes.empty?
|
||||
link[attributes.shift] = attributes.shift
|
||||
end
|
||||
@response['Links'] << link
|
||||
when 'Vapp'
|
||||
vapp = {}
|
||||
until attributes.empty?
|
||||
if attributes.first.is_a?(Array)
|
||||
attribute = attributes.shift
|
||||
vapp[attribute.first] = attribute.last
|
||||
else
|
||||
vapp[attributes.shift] = attributes.shift
|
||||
end
|
||||
end
|
||||
@response.merge!(task.reject {|key,value| !['href', 'name', 'size', 'status', 'type'].include?(key)})
|
||||
end
|
||||
end
|
||||
|
||||
def end_element(name)
|
||||
case name
|
||||
when 'IpAddress'
|
||||
@response['IpAddress'] = @value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
40
lib/fog/terremark/requests/delete_vapp.rb
Normal file
40
lib/fog/terremark/requests/delete_vapp.rb
Normal file
|
@ -0,0 +1,40 @@
|
|||
module Fog
|
||||
module Terremark
|
||||
class Real
|
||||
|
||||
# Destroy a vapp
|
||||
#
|
||||
# ==== Parameters
|
||||
# * vapp_id<~Integer> - Id of vapp to destroy
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Hash>:
|
||||
|
||||
# FIXME
|
||||
|
||||
# * '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
|
||||
def delete_vapp(vapp_id)
|
||||
request(
|
||||
:expects => 202,
|
||||
:method => 'DELETE',
|
||||
:path => "vApp/#{vapp_id}"
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def delete_vapp(vapp_id)
|
||||
raise MockNotImplemented.new("Contributions welcome!")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
43
lib/fog/terremark/requests/deploy_vapp.rb
Normal file
43
lib/fog/terremark/requests/deploy_vapp.rb
Normal file
|
@ -0,0 +1,43 @@
|
|||
module Fog
|
||||
module Terremark
|
||||
class Real
|
||||
|
||||
require 'fog/terremark/parsers/task'
|
||||
|
||||
# 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
|
||||
def deploy_vapp(vapp_id)
|
||||
request(
|
||||
:expects => 202,
|
||||
:method => 'POST',
|
||||
:parser => Fog::Parsers::Terremark::Task.new,
|
||||
:path => "/vApp/#{vapp_id}/action/deploy"
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def deploy_vapp(task_id)
|
||||
raise MockNotImplemented.new("Contributions welcome!")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
|
@ -14,7 +14,6 @@ module Fog
|
|||
# * 'name'<~String> - Name of organization
|
||||
def get_organizations
|
||||
request({
|
||||
:body => '',
|
||||
:expects => 200,
|
||||
:headers => {
|
||||
'Authorization' => "Basic #{Base64.encode64("#{@terremark_username}:#{@terremark_password}").chomp!}"
|
||||
|
|
47
lib/fog/terremark/requests/get_task.rb
Normal file
47
lib/fog/terremark/requests/get_task.rb
Normal file
|
@ -0,0 +1,47 @@
|
|||
module Fog
|
||||
module Terremark
|
||||
class Real
|
||||
|
||||
require 'fog/terremark/parsers/task'
|
||||
|
||||
# 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
|
||||
def get_task(task_id)
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'GET',
|
||||
:parser => Fog::Parsers::Terremark::Task.new,
|
||||
:path => "/task/#{task_id}"
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def get_task(task_id)
|
||||
raise MockNotImplemented.new("Contributions welcome!")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
40
lib/fog/terremark/requests/get_tasks_list.rb
Normal file
40
lib/fog/terremark/requests/get_tasks_list.rb
Normal file
|
@ -0,0 +1,40 @@
|
|||
module Fog
|
||||
module Terremark
|
||||
class Real
|
||||
|
||||
require 'fog/terremark/parsers/get_tasks_list'
|
||||
|
||||
# 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
|
||||
def get_tasks_list(tasks_list_id)
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'GET',
|
||||
:parser => Fog::Parsers::Terremark::GetTasksList.new,
|
||||
:path => "/tasksList/#{tasks_list_id}"
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def get_tasks_list(tasks_list_id)
|
||||
raise MockNotImplemented.new("Contributions welcome!")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
50
lib/fog/terremark/requests/get_vapp.rb
Normal file
50
lib/fog/terremark/requests/get_vapp.rb
Normal file
|
@ -0,0 +1,50 @@
|
|||
module Fog
|
||||
module Terremark
|
||||
class Real
|
||||
|
||||
require 'fog/terremark/parsers/vapp'
|
||||
|
||||
# Get details of a vapp
|
||||
#
|
||||
# ==== Parameters
|
||||
# * vapp_id<~Integer> - Id of vapp to lookup
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Hash>:
|
||||
|
||||
# FIXME
|
||||
|
||||
# * '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
|
||||
def get_vapp(vapp_id)
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'GET',
|
||||
:parser => Fog::Parsers::Terremark::Vapp.new,
|
||||
:path => "/vapp/#{vapp_id}"
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def get_vapp(vapp_id)
|
||||
raise MockNotImplemented.new("Contributions welcome!")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
118
lib/fog/terremark/requests/instantiate_vapp_template.rb
Normal file
118
lib/fog/terremark/requests/instantiate_vapp_template.rb
Normal file
|
@ -0,0 +1,118 @@
|
|||
module Fog
|
||||
module Terremark
|
||||
class Real
|
||||
|
||||
require 'fog/terremark/parsers/instantiate_vapp_template'
|
||||
|
||||
# Instatiate a vapp template
|
||||
#
|
||||
# ==== Parameters
|
||||
# * vdc_id<~Integer> - Id of vdc to instantiate template in
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Hash>:
|
||||
|
||||
# FIXME
|
||||
|
||||
# * '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
|
||||
def instantiate_vapp_template(name)
|
||||
# FIXME: much cheating to commence
|
||||
|
||||
organization_id = get_organizations.body['OrgList'].first['href'].split('/').last
|
||||
organization = get_organization(organization_id).body
|
||||
vdc_id = organization['Links'].select {|link| link['type'] == 'application/vnd.vmware.vcloud.vdc+xml'}.first['href'].split('/').last
|
||||
vdc = get_vdc(vdc_id).body
|
||||
network_id = vdc['AvailableNetworks'].first['href'].split('/').last
|
||||
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
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def instatiate_vapp_template(vapp_template_id)
|
||||
raise MockNotImplemented.new("Contributions welcome!")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
43
lib/fog/terremark/requests/power_off.rb
Normal file
43
lib/fog/terremark/requests/power_off.rb
Normal file
|
@ -0,0 +1,43 @@
|
|||
module Fog
|
||||
module Terremark
|
||||
class Real
|
||||
|
||||
require 'fog/terremark/parsers/task'
|
||||
|
||||
# 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
|
||||
def power_off(vapp_id)
|
||||
request(
|
||||
:expects => 202,
|
||||
:method => 'POST',
|
||||
:parser => Fog::Parsers::Terremark::Task.new,
|
||||
:path => "/vApp/#{vapp_id}/power/action/powerOff"
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def power_off(vapp_id)
|
||||
raise MockNotImplemented.new("Contributions welcome!")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
43
lib/fog/terremark/requests/power_on.rb
Normal file
43
lib/fog/terremark/requests/power_on.rb
Normal file
|
@ -0,0 +1,43 @@
|
|||
module Fog
|
||||
module Terremark
|
||||
class Real
|
||||
|
||||
require 'fog/terremark/parsers/task'
|
||||
|
||||
# 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
|
||||
def power_on(vapp_id)
|
||||
request(
|
||||
:expects => 202,
|
||||
:method => 'POST',
|
||||
:parser => Fog::Parsers::Terremark::Task.new,
|
||||
:path => "/vApp/#{vapp_id}/power/action/powerOn"
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def power_on(vapp_id)
|
||||
raise MockNotImplemented.new("Contributions welcome!")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
43
lib/fog/terremark/requests/reset.rb
Normal file
43
lib/fog/terremark/requests/reset.rb
Normal file
|
@ -0,0 +1,43 @@
|
|||
module Fog
|
||||
module Terremark
|
||||
class Real
|
||||
|
||||
require 'fog/terremark/parsers/task'
|
||||
|
||||
# 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
|
||||
def reset(vapp_id)
|
||||
request(
|
||||
:expects => 202,
|
||||
:method => 'POST',
|
||||
:parser => Fog::Parsers::Terremark::Task.new,
|
||||
:path => "/vApp/#{vapp_id}/power/action/reset"
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def reset(vapp_id)
|
||||
raise MockNotImplemented.new("Contributions welcome!")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
43
lib/fog/terremark/requests/shutdown.rb
Normal file
43
lib/fog/terremark/requests/shutdown.rb
Normal file
|
@ -0,0 +1,43 @@
|
|||
module Fog
|
||||
module Terremark
|
||||
class Real
|
||||
|
||||
require 'fog/terremark/parsers/task'
|
||||
|
||||
# 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
|
||||
def shutdown(vapp_id)
|
||||
request(
|
||||
:expects => 202,
|
||||
:method => 'POST',
|
||||
:parser => Fog::Parsers::Terremark::Task.new,
|
||||
:path => "/vApp/#{vapp_id}/power/action/shutdown"
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def shutdown(vapp_id)
|
||||
raise MockNotImplemented.new("Contributions welcome!")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue