Reserve requested resources and deploy vApp
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
response<~Excon::Response>:
body<~Hash>:
# File lib/fog/terremark/requests/shared/add_internet_service.rb, line 29 def add_internet_service(ip_id, name, protocol, port, options = {}) unless options.has_key?('Enabled') options['Enabled'] = true end 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>#{options['Enabled']}</Enabled> <Description>#{options['Description']}</Description> </InternetService> request( :body => data, :expects => 200, :headers => {'Content-Type' => 'application/xml'}, :method => 'POST', :parser => Fog::Parsers::Terremark::Shared::InternetService.new, :path => "publicIps/#{ip_id}/internetServices" ) end
Reserve requested resources and deploy vApp
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
response<~Excon::Response>:
body<~Hash>:
# File lib/fog/terremark/requests/shared/add_node_service.rb, line 29 def add_node_service(service_id, ip, name, port, options = {}) unless options.has_key?('Enabled') options['Enabled'] = true end 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>#{options['Enabled']}</Enabled> <Description>#{options['Description']}</Description> </NodeService> request( :body => data, :expects => 200, :headers => {'Content-Type' => 'application/xml'}, :method => 'POST', :parser => Fog::Parsers::Terremark::Shared::InternetService.new, :path => "internetServices/#{service_id}/nodes" ) end
# File lib/fog/terremark/models/shared/addresses.rb, line 12 def addresses(options = {}) Fog::Terremark::Shared::Addresses.new(options.merge(:connection => self)) end
Reserve requested resources and deploy vApp
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
response<~Excon::Response>:
body<~Hash>:
# File lib/fog/terremark/requests/shared/create_internet_service.rb, line 29 def create_internet_service(vdc_id, name, protocol, port, options = {}) unless options.has_key?('Enabled') options['Enabled'] = true end 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>#{options['Enabled']}</Enabled> <Description>#{options['Description']}</Description> </InternetService> request( :body => data, :expects => 200, :headers => {'Content-Type' => 'application/xml'}, :method => 'POST', :parser => Fog::Parsers::Terremark::Shared::InternetService.new, :path => "vdc/#{vdc_id}/internetServices" ) end
Destroy an internet service
internet_service_id<~Integer> - Id of service to destroy
# File lib/fog/terremark/requests/shared/delete_internet_service.rb, line 11 def delete_internet_service(internet_service_id) request( :expects => 200, :method => 'DELETE', :path => "InternetServices/#{internet_service_id}" ) end
Destroy a node
node_service_id<~Integer> - Id of node to destroy
# File lib/fog/terremark/requests/shared/delete_node_service.rb, line 11 def delete_node_service(node_service_id) request( :expects => 200, :method => 'DELETE', :path => "nodeServices/#{node_service_id}" ) end
Destroy a public ip
public_ip_id<~Integer> - Id of public ip to destroy
# File lib/fog/terremark/requests/shared/delete_public_ip.rb, line 11 def delete_public_ip(public_ip_id) request( :expects => 200, :method => 'DELETE', :path => "publicIps/#{public_ip_id}" ) end
Destroy a vapp
vapp_id<~Integer> - Id of vapp to destroy
# File lib/fog/terremark/requests/shared/delete_vapp.rb, line 11 def delete_vapp(vapp_id) request( :expects => 202, :method => 'DELETE', :path => "vApp/#{vapp_id}" ) end
Reserve requested resources and deploy vApp
vapp_id<~Integer> - Id of vApp to deploy
response<~Excon::Response>:
body<~Hash>:
# File lib/fog/terremark/requests/shared/deploy_vapp.rb, line 23 def deploy_vapp(vapp_id) request( :expects => 202, :method => 'POST', :parser => Fog::Parsers::Terremark::Shared::Task.new, :path => "vApp/#{vapp_id}/action/deploy" ) end
Get details of a catalog
vdc_id<~Integer> - Id of vdc to view catalog for
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
# File lib/fog/terremark/requests/shared/get_catalog.rb, line 20 def get_catalog(vdc_id) request( :expects => 200, :method => 'GET', :parser => Fog::Parsers::Terremark::Shared::GetCatalog.new, :path => "vdc/#{vdc_id}/catalog" ) end
'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
# File lib/fog/terremark/requests/shared/get_catalog_item.rb, line 23 def get_catalog_item(catalog_item_id) request( :expects => 200, :method => 'GET', :parser => Fog::Parsers::Terremark::Shared::GetCatalogItem.new, :path => "catalogItem/#{catalog_item_id}" ) end
Get a list of all internet services for a vdc
vdc_id<~Integer> - Id of vDc to get list of internet services for
response<~Excon::Response>:
body<~Hash>:
'InternetServices'<~Array>
'id'<~String> => id of the internet service
'name'<~String> => name of service
'PublicIPAddress'<~Hash>
'Id'<~String> => id of the public IP
'name'<~String> => actual ip address
# File lib/fog/terremark/requests/shared/get_internet_services.rb, line 23 def get_internet_services(vdc_id) request( :expects => 200, :method => 'GET', :parser => Fog::Parsers::Terremark::Shared::GetInternetServices.new, :path => "vdc/#{vdc_id}/internetServices" ) end
Get details for a Network
network_id<~Integer> - Id of the network to look up
response<~Excon::Response>:
body<~Hash>:
FIXME
# File lib/fog/terremark/requests/shared/get_network.rb, line 15 def get_network(network_id) request( :expects => 200, :method => 'GET', :parser => Fog::Parsers::Terremark::Shared::Network.new, :path => "network/#{network_id}" ) end
Get details for a Network
network_id<~Integer> - Id of the network to look up
response<~Excon::Response>:
body<~Hash>:
FIXME
# File lib/fog/terremark/requests/shared/get_network_ips.rb, line 15 def get_network_ips(network_id) opts = { :expects => 200, :method => 'GET', :parser => Fog::Parsers::Terremark::Shared::GetNetworkIps.new, :path => "network/#{network_id}/ipAddresses" } if self.is_a?(Fog::Terremark::Ecloud::Real) opts[:path] = "/extensions/network/#{network_id}/ips" end request(opts) end
# File lib/fog/terremark/requests/shared/get_node_services.rb, line 18 def get_node_services(service_id) request( :expects => 200, :method => 'GET', :parser => Fog::Parsers::Terremark::Shared::GetNodeServices.new, :path => "InternetServices/#{service_id}/nodes" ) end
Get details of an organization
organization_id<~Integer> - Id of organization to lookup
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
# File lib/fog/terremark/requests/shared/get_organization.rb, line 21 def get_organization(organization_id) response = request( :expects => 200, :method => 'GET', :parser => Fog::Parsers::Terremark::Shared::GetOrganization.new, :path => "org/#{organization_id}" ) response end
Get list of organizations
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
# File lib/fog/terremark/requests/shared/get_organizations.rb, line 14 def get_organizations request({ :expects => 200, :headers => { 'Authorization' => "Basic #{Base64.encode64("#{@terremark_username}:#{@terremark_password}").chomp!}", # Terremark said they're going to remove passing in the Content-Type to login in a future release 'Content-Type' => "application/vnd.vmware.vcloud.orgList+xml" }, :method => 'POST', :parser => Fog::Parsers::Terremark::Shared::GetOrganizations.new, :path => 'login' }) end
Get details for a public ip
public_ip_id<~Integer> - Id of public ip to look up
response<~Excon::Response>:
body<~Hash>:
'PublicIpAddresses'<~Array>
'href'<~String> - linke to item
'name'<~String> - name of item
# File lib/fog/terremark/requests/shared/get_public_ip.rb, line 17 def get_public_ip(public_ip_id) opts = { :expects => 200, :method => 'GET', :parser => Fog::Parsers::Terremark::Shared::PublicIp.new, :path => "publicIps/#{public_ip_id}" } if self.class == Fog::Terremark::Ecloud::Real opts[:path] = "extensions/publicIp/#{public_ip_id}" end request(opts) end
Get list of public ips
vdc_id<~Integer> - Id of vdc to find public ips for
response<~Excon::Response>:
body<~Hash>:
'PublicIpAddresses'<~Array>
'href'<~String> - link to item
'name'<~String> - name of item
# File lib/fog/terremark/requests/shared/get_public_ips.rb, line 17 def get_public_ips(vdc_id) opts = { :expects => 200, :method => 'GET', :parser => Fog::Parsers::Terremark::Shared::GetPublicIps.new, :path => "vdc/#{vdc_id}/publicIps" } if self.class == Fog::Terremark::Ecloud::Real opts[:path] = "extensions/vdc/#{vdc_id}/publicIps" end request(opts) end
Get details of a task
task_id<~Integer> - Id of task to lookup
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
# File lib/fog/terremark/requests/shared/get_task.rb, line 27 def get_task(task_id) request( :expects => 200, :method => 'GET', :parser => Fog::Parsers::Terremark::Shared::Task.new, :path => "task/#{task_id}" ) end
Get list of tasks
tasks_list_id<~Integer> - Id of tasks lists to view
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
# File lib/fog/terremark/requests/shared/get_tasks_list.rb, line 20 def get_tasks_list(tasks_list_id) request( :expects => 200, :method => 'GET', :parser => Fog::Parsers::Terremark::Shared::GetTasksList.new, :path => "tasksList/#{tasks_list_id}" ) end
'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
# File lib/fog/terremark/requests/shared/get_vapp.rb, line 30 def get_vapp(vapp_id) request( :expects => 200, :method => 'GET', :parser => Fog::Parsers::Terremark::Shared::Vapp.new, :path => "vapp/#{vapp_id}" ) end
'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
# File lib/fog/terremark/requests/shared/get_vapp_template.rb, line 23 def get_vapp_template(vapp_template_id) request( :expects => 200, :method => 'GET', :parser => Fog::Parsers::Terremark::Shared::GetVappTemplate.new, :path => "vAppTemplate/#{vapp_template_id}" ) end
'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
# File lib/fog/terremark/requests/shared/get_vdc.rb, line 23 def get_vdc(vdc_id) request( :expects => 200, :method => 'GET', :parser => Fog::Parsers::Terremark::Shared::GetVdc.new, :path => "vdc/#{vdc_id}" ) end
Instatiate a vapp template
name<~String>: Name of the resulting vapp .. must start with letter, up to 15 chars alphanumeric.
options<~Hash>:
cpus<~Integer>: Number of cpus in [1, 2, 4, 8], defaults to 1
memory<~Integer>: Amount of memory either 512 or a multiple of 1024, defaults to 512
vapp_template<~String>: id of the vapp template to be instantiated
response<~Excon::Response>:
body<~Hash>:
'Links;<~Array> (e.g. up to vdc)
'href'<~String> Link to the resulting vapp
'name'<~String> - name of item
'type'<~String> - type of item
'status'<~String> - 0(pending) --> 2(off) -->4(on)
# File lib/fog/terremark/requests/shared/instantiate_vapp_template.rb, line 22 def instantiate_vapp_template(name, vapp_template, options = {}) unless name.length < 15 raise ArgumentError.new('Name must be fewer than 15 characters') end options['cpus'] ||= 1 options['memory'] ||= 512 options['network_id'] ||= default_network_id options['vdc_id'] ||= default_vdc_id 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="#{@scheme}://#{@host}/#{@path}/vAppTemplate/#{vapp_template}" /> <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">#{options['cpus']}</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">#{options['memory']}</VirtualQuantity> </Item> </VirtualHardwareSection> <NetworkConfigSection> <NetworkConfig> <NetworkAssociation href="#{@scheme}://#{@host}/#{@path}/network/#{options['network_id']}"/> </NetworkConfig> </NetworkConfigSection> </InstantiationParams></InstantiateVAppTemplateParams> request( :body => data, :expects => 200, :headers => { 'Content-Type' => 'application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml' }, :method => 'POST', :parser => Fog::Parsers::Terremark::Shared::InstantiateVappTemplate.new, :path => "vdc/#{options['vdc_id']}/action/instantiatevAppTemplate" ) end
# File lib/fog/terremark/models/shared/networks.rb, line 12 def networks(options = {}) Fog::Terremark::Shared::Networks.new(options.merge(:connection => self)) end
Power off a vapp
vapp_id<~Integer> - Id of vapp to power off
response<~Excon::Response>:
body<~Hash>:
# File lib/fog/terremark/requests/shared/power_off.rb, line 23 def power_off(vapp_id) request( :expects => 202, :method => 'POST', :parser => Fog::Parsers::Terremark::Shared::Task.new, :path => "vApp/#{vapp_id}/power/action/powerOff" ) end
Power on a vapp
vapp_id<~Integer> - Id of vapp to power on
response<~Excon::Response>:
body<~Hash>:
# File lib/fog/terremark/requests/shared/power_on.rb, line 23 def power_on(vapp_id) request( :expects => 202, :method => 'POST', :parser => Fog::Parsers::Terremark::Shared::Task.new, :path => "vApp/#{vapp_id}/power/action/powerOn" ) end
Reset a vapp
vapp_id<~Integer> - Id of vapp to reset
response<~Excon::Response>:
body<~Hash>:
# File lib/fog/terremark/requests/shared/power_reset.rb, line 23 def power_reset(vapp_id) request( :expects => 202, :method => 'POST', :parser => Fog::Parsers::Terremark::Shared::Task.new, :path => "vApp/#{vapp_id}/power/action/reset" ) end
Shutdown a vapp
vapp_id<~Integer> - Id of vapp to shutdown
Nothing
# File lib/fog/terremark/requests/shared/power_shutdown.rb, line 13 def power_shutdown(vapp_id) request( :expects => 204, :method => 'POST', :path => "vApp/#{vapp_id}/power/action/shutdown" ) end
# File lib/fog/terremark/models/shared/servers.rb, line 15 def servers(options = {}) Fog::Terremark::Shared::Servers.new(options.merge(:connection => self)) end
Generated with the Darkfish Rdoc Generator 2.