1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[vcloud_director] Set :idempotent on GET requests

This commit is contained in:
Nick Osborn 2013-09-29 18:57:18 +01:00
parent 94e7a322e0
commit c9678268be
36 changed files with 152 additions and 91 deletions

View file

@ -12,6 +12,7 @@ module Fog
# * body<~Hash>:
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppMetadataItem-metadata.html
# vCloud API Documentation
# @since vCloud API version 1.5
def delete_metadata(vm_id, metadata_key)
request(
:expects => 202,

View file

@ -12,6 +12,7 @@ module Fog
# * body<~Hash>:
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/DELETE-VApp.html
# vCloud API Documentation
# @since vCloud API version 0.9
def delete_vapp(vapp_id)
request(
:expects => 202,

View file

@ -9,12 +9,14 @@ module Fog
# * hash<~Hash>:
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Catalog.html
# vCloud API Documentation
# @since vCloud API version 0.9
def get_catalog(catalog_id)
request(
:expects => 200,
:method => 'GET',
:parser => Fog::ToHashDocument.new,
:path => "catalog/#{catalog_id}"
:expects => 200,
:idempotent => true,
:method => 'GET',
:parser => Fog::ToHashDocument.new,
:path => "catalog/#{catalog_id}"
)
end
end

View file

@ -9,12 +9,14 @@ module Fog
# * body<~Hash>:
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Catalog.html
# vCloud API Documentation
# @since vCloud API version 0.9
def get_catalog_item(catalog_item_id)
request(
:expects => 200,
:method => 'GET',
:parser => Fog::ToHashDocument.new,
:path => "catalogItem/#{catalog_item_id}"
:expects => 200,
:idempotent => true,
:method => 'GET',
:parser => Fog::ToHashDocument.new,
:path => "catalogItem/#{catalog_item_id}"
)
end
end

View file

@ -8,6 +8,7 @@ module Fog
def get_href(href)
request(
:expects => 200,
:idempotent => true,
:method => 'GET',
:parser => Fog::ToHashDocument.new,
:override_path => true,

View file

@ -9,14 +9,16 @@ module Fog
# * body<~Hash>:
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppMetadata.html
# vCloud API Documentation
# @since vCloud API version 1.5
def get_metadata(vm_id)
require 'fog/vcloud_director/parsers/compute/metadata'
request(
:expects => 200,
:method => 'GET',
:parser => Fog::Parsers::Compute::VcloudDirector::Metadata.new,
:path => "vApp/#{vm_id}/metadata/"
:expects => 200,
:idempotent => true,
:method => 'GET',
:parser => Fog::Parsers::Compute::VcloudDirector::Metadata.new,
:path => "vApp/#{vm_id}/metadata/"
)
end
end

View file

@ -11,12 +11,14 @@ module Fog
# * body<~Hash>:
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Network.html
# vCloud API Documentation
# @since vCloud API version 0.9
def get_network(network_id)
request(
:expects => 200,
:method => 'GET',
:parser => Fog::Parsers::Compute::VcloudDirector::Network.new,
:path => "network/#{network_id}"
:expects => 200,
:idempotent => true,
:method => 'GET',
:parser => Fog::Parsers::Compute::VcloudDirector::Network.new,
:path => "network/#{network_id}"
)
end
end

View file

@ -9,12 +9,14 @@ module Fog
# * body<~Hash>:
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Organization.html
# vCloud API Documentation
# @since vCloud API version 0.9
def get_organization(org_id)
request({
:expects => 200,
:method => 'GET',
:parser => Fog::ToHashDocument.new,
:path => "org/#{org_id}"
:expects => 200,
:idempotent => true,
:method => 'GET',
:parser => Fog::ToHashDocument.new,
:path => "org/#{org_id}"
})
end
end

View file

@ -10,12 +10,14 @@ module Fog
# * body<~Hash>:
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Organizations.html
# vCloud API Documentation
# @since vCloud API version 0.9
def get_organizations
request({
:expects => 200,
:method => 'GET',
:parser => Fog::ToHashDocument.new,
:path => 'org'
:expects => 200,
:idempotent => true,
:method => 'GET',
:parser => Fog::ToHashDocument.new,
:path => 'org'
})
end
end

View file

@ -7,9 +7,10 @@ module Fog
# @api private
def get_request(uri)
request(
:expects => 200,
:method => 'GET',
:path => uri
:expects => 200,
:idempotent => true,
:method => 'GET',
:path => uri
)
end
end

View file

@ -6,8 +6,8 @@ module Fog
#
# @return [Excon::Response]
# * body<~Hash>:
# @see http://pubs.vmware.com/vcd-55/topic/com.vmware.vcloud.api.reference.doc_55/doc/operations/GET-SupportedVersions.html
# vCloud API Documentation (5.5)
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-SupportedSystemsInfo.html
# vCloud API Documentation
def get_supported_versions
@connection.request(
:expects => 200,

View file

@ -9,12 +9,14 @@ module Fog
# * body<~Hash>:
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Task.html
# vCloud API Documentation
# @since vCloud API version 0.9
def get_task(task_id)
request(
:expects => 200,
:method => 'GET',
:parser => Fog::ToHashDocument.new,
:path => "task/#{task_id}"
:expects => 200,
:idempotent => true,
:method => 'GET',
:parser => Fog::ToHashDocument.new,
:path => "task/#{task_id}"
)
end
end

View file

@ -10,6 +10,7 @@ module Fog
# * body<~Hash>:
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-TaskList.html
# vCloud API Documentation
# @since vCloud API version 0.9
def get_tasks_list(org_id)
request(
:expects => 200,

View file

@ -9,12 +9,14 @@ module Fog
# * body<~Hash>:
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VApp.html
# vCloud API Documentation
# @since vCloud API version 0.9
def get_vapp(vapp_id)
request(
:expects => 200,
:method => 'GET',
:parser => Fog::ToHashDocument.new,
:path => "vApp/#{vapp_id}"
:expects => 200,
:idempotent => true,
:method => 'GET',
:parser => Fog::ToHashDocument.new,
:path => "vApp/#{vapp_id}"
)
end
end

View file

@ -9,12 +9,14 @@ module Fog
# * body<~Hash>:
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppTemplate.html
# vCloud API Documentation
# @since vCloud API version 0.9
def get_vapp_template(vapp_template_id)
request(
:expects => 200,
:method => 'GET',
:parser => Fog::ToHashDocument.new,
:path => "vAppTemplate/#{vapp_template_id}"
:expects => 200,
:idempotent => true,
:method => 'GET',
:parser => Fog::ToHashDocument.new,
:path => "vAppTemplate/#{vapp_template_id}"
)
end
end

View file

@ -9,12 +9,14 @@ module Fog
# * body<~Hash>:
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Vdc.html
# vCloud API Documentation
# @since vCloud API version 0.9
def get_vdc(vdc_id)
request(
:expects => 200,
:method => 'GET',
:parser => Fog::ToHashDocument.new,
:path => "vdc/#{vdc_id}"
:expects => 200,
:idempotent => true,
:method => 'GET',
:parser => Fog::ToHashDocument.new,
:path => "vdc/#{vdc_id}"
)
end
end

View file

@ -12,10 +12,11 @@ module Fog
# @see #get_vapp
def get_vm(vm_id)
request(
:expects => 200,
:method => 'GET',
:parser => Fog::Parsers::Compute::VcloudDirector::Vm.new,
:path => "vApp/#{vm_id}"
:expects => 200,
:idempotent => true,
:method => 'GET',
:parser => Fog::Parsers::Compute::VcloudDirector::Vm.new,
:path => "vApp/#{vm_id}"
)
end
end

View file

@ -9,12 +9,14 @@ module Fog
# * body<~Hash>:
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-CpuRasdItem.html
# vCloud API Documentation
# @since vCloud API version 0.9
def get_vm_cpu(vm_id)
request(
:expects => 200,
:method => 'GET',
:parser => Fog::ToHashDocument.new,
:path => "vApp/#{vm_id}/virtualHardwareSection/cpu"
:expects => 200,
:idempotent => true,
:method => 'GET',
:parser => Fog::ToHashDocument.new,
:path => "vApp/#{vm_id}/virtualHardwareSection/cpu"
)
end
end

View file

@ -11,12 +11,14 @@ module Fog
# * body<~Hash>:
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-GuestCustomizationSystemSection-vApp.html
# vCloud API Documentation
# @since vCloud API version 1.0
def get_vm_customization(vm_id)
request(
:expects => 200,
:method => 'GET',
:parser => Fog::Parsers::Compute::VcloudDirector::VmCustomization.new,
:path => "vApp/#{vm_id}/guestCustomizationSection"
:expects => 200,
:idempotent => true,
:method => 'GET',
:parser => Fog::Parsers::Compute::VcloudDirector::VmCustomization.new,
:path => "vApp/#{vm_id}/guestCustomizationSection"
)
end
end

View file

@ -12,12 +12,14 @@ module Fog
# * body<~Hash>:
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-DisksRasdItemsList.html
# vCloud API Documentation
# @since vCloud API version 0.9
def get_vm_disks(vm_id)
request(
:expects => 200,
:method => 'GET',
:parser => Fog::Parsers::Compute::VcloudDirector::Disks.new,
:path => "vApp/#{vm_id}/virtualHardwareSection/disks"
:expects => 200,
:idempotent => true,
:method => 'GET',
:parser => Fog::Parsers::Compute::VcloudDirector::Disks.new,
:path => "vApp/#{vm_id}/virtualHardwareSection/disks"
)
end
end

View file

@ -9,12 +9,14 @@ module Fog
# * body<~Hash>:
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-MemoryRasdItem.html
# vCloud API Documentation
# @since vCloud API version 0.9
def get_vm_memory(vm_id)
request(
:expects => 200,
:method => 'GET',
:parser => Fog::ToHashDocument.new,
:path => "vApp/#{vm_id}/virtualHardwareSection/memory"
:expects => 200,
:idempotent => true,
:method => 'GET',
:parser => Fog::ToHashDocument.new,
:path => "vApp/#{vm_id}/virtualHardwareSection/memory"
)
end
end

View file

@ -11,12 +11,14 @@ module Fog
# * body<~Hash>:
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-NetworkConnectionSystemSection-vApp.html
# vCloud API Documentation
# @since vCloud API version 0.9
def get_vm_network(vm_id)
request(
:expects => 200,
:method => 'GET',
:parser => Fog::Parsers::Compute::VcloudDirector::VmNetwork.new,
:path => "vApp/#{vm_id}/networkConnectionSection/"
:expects => 200,
:idempotent => true,
:method => 'GET',
:parser => Fog::Parsers::Compute::VcloudDirector::VmNetwork.new,
:path => "vApp/#{vm_id}/networkConnectionSection/"
)
end
end

View file

@ -12,10 +12,11 @@ module Fog
# @see #get_vapp
def get_vms(vapp_id)
request(
:expects => 200,
:method => 'GET',
:parser => Fog::Parsers::Compute::VcloudDirector::Vms.new,
:path => "vApp/#{vapp_id}"
:expects => 200,
:idempotent => true,
:method => 'GET',
:parser => Fog::Parsers::Compute::VcloudDirector::Vms.new,
:path => "vApp/#{vapp_id}"
)
end
end

View file

@ -2,15 +2,15 @@ module Fog
module Compute
class VcloudDirector
class Real
require 'fog/vcloud_director/parsers/compute/vms_by_metadata'
def get_vms_by_metadata(key,value)
request(
:expects => 200,
:method => 'GET',
:parser => Fog::Parsers::Compute::VcloudDirector::VmsByMetadata.new,
:path => "vms/query?format=records&filter=metadata:#{key}==STRING:#{value}"
:expects => 200,
:idempotent => true,
:method => 'GET',
:parser => Fog::Parsers::Compute::VcloudDirector::VmsByMetadata.new,
:path => "vms/query?format=records&filter=metadata:#{key}==STRING:#{value}"
)
end

View file

@ -2,18 +2,31 @@ module Fog
module Compute
class VcloudDirector
class Real
# @todo Move all the logic to a generator.
def instantiate_vapp_template(vapp_name, template_id, options = {})
# Create a vApp from a vApp template.
#
# The response includes a Task element. You can monitor the task to to
# track the creation of the vApp.
#
# @param [String] vapp_name
# @param [String] template_id
# @param [Hash] options
# @return [Excon::Response]
# * body<~Hash>:
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-InstantiateVAppTemplate.html
# vCloud API Documentaion
# @since vCloud API version 0.9
# @todo Replace with #post_instantiate_vapp_template
def instantiate_vapp_template(vapp_name, template_id, options={})
params = populate_uris(options.merge(:vapp_name => vapp_name, :template_id => template_id))
validate_uris(params)
# @todo Move all the logic to a generator.
data = generate_instantiate_vapp_template_request(params)
request(
:body => data,
:expects => 201,
:headers => { 'Content-Type' => 'application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml' },
:headers => {'Content-Type' => 'application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml'},
:method => 'POST',
:parser => Fog::ToHashDocument.new,
:path => "vdc/#{params[:vdc_id]}/action/instantiateVAppTemplate"
@ -22,7 +35,7 @@ module Fog
private
def validate_uris(options ={})
def validate_uris(options={})
[:vdc_uri, :network_uri].each do |opt_uri|
result = default_organization_body[:Link].detect {|org| org[:href] == options[opt_uri]}
raise("#{opt_uri}: #{options[opt_uri]} not found") unless result

View file

@ -9,6 +9,7 @@ module Fog
# * body<~Hash>:
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-CancelTask.html
# vCloud API Documentation
# @since vCloud API version 1.5
def post_task_cancel(task_id)
request(
:expects => 204,

View file

@ -14,6 +14,7 @@ module Fog
# * body<~Hash>:
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-UndeployVApp.html
# vCloud API Documentation
# @since vCloud API version 0.9
def undeploy(vapp_id)
body = <<EOF
<UndeployVAppParams xmlns="http://www.vmware.com/vcloud/v1.5">
@ -24,9 +25,9 @@ EOF
request(
:body => body,
:expects => 202,
:headers => {'Content-Type' => 'application/vnd.vmware.vcloud.undeployVAppParams+xml' },
:method => 'POST',
:parser => Fog::ToHashDocument.new,
:headers => {'Content-Type' => 'application/vnd.vmware.vcloud.undeployVAppParams+xml' },
:path => "vApp/#{vapp_id}/action/undeploy"
)
end

View file

@ -12,6 +12,7 @@ module Fog
# * body<~Hash>:
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-UpdateVAppMetadata.html
# vCloud API Documentation
# @since vCloud API version 1.5
def post_vm_metadata(vm_id, metadata={})
metadata_klass = case api_version
when '5.1' ; Fog::Generators::Compute::VcloudDirector::MetadataV51
@ -23,7 +24,7 @@ module Fog
request(
:body => data.generate_xml,
:expects => 202,
:headers => { 'Content-Type' => "application/vnd.vmware.vcloud.metadata+xml" },
:headers => {'Content-Type' => "application/vnd.vmware.vcloud.metadata+xml"},
:method => 'POST',
:parser => Fog::ToHashDocument.new,
:path => "vApp/#{vm_id}/metadata/"

View file

@ -16,6 +16,7 @@ module Fog
# * body<~Hash>:
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-PowerOffVApp.html
# vCloud API Documentation
# @since vCloud API version 0.9
def post_vm_poweroff(vm_id)
request(
:expects => 202,

View file

@ -16,6 +16,7 @@ module Fog
# * body<~Hash>:
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-PowerOnVApp.html
# vCloud Director API
# @since vCloud API version 0.9
def post_vm_poweron(vm_id)
request(
:expects => 202,

View file

@ -12,6 +12,7 @@ module Fog
# * body<~Hash>:
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/PUT-VAppMetadataItem-metadata.html
# vCloud API Documentation
# @since vCloud API version 1.5
def put_metadata_value(vm_id, metadata_key, metadata_value)
body="
<MetadataValue xmlns=\"http://www.vmware.com/vcloud/v1.5\">
@ -21,7 +22,7 @@ module Fog
request(
:body => body,
:expects => 202,
:headers => { 'Content-Type' => "application/vnd.vmware.vcloud.metadata.value+xml" },
:headers => {'Content-Type' => "application/vnd.vmware.vcloud.metadata.value+xml"},
:method => 'PUT',
:parser => Fog::ToHashDocument.new,
:path => "vApp/#{vm_id}/metadata/#{URI.escape(metadata_key)}"

View file

@ -13,6 +13,7 @@ module Fog
# * body<~Hash>:
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/PUT-Cpu.html
# vCloud API Documentation
# @since vCloud API version 0.9
def put_vm_cpu(vm_id, num_cpus)
data = <<EOF
<Item xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns12="http://www.vmware.com/vcloud/v1.5" ns12:href="#{endpoint}vApp/#{vm_id}/virtualHardwareSection/cpu" ns12:type="application/vnd.vmware.vcloud.rasdItem+xml" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://10.194.1.65/api/v1.5/schema/master.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd">
@ -31,7 +32,7 @@ EOF
request(
:body => data,
:expects => 202,
:headers => { 'Content-Type' => 'application/vnd.vmware.vcloud.rasdItem+xml' },
:headers => {'Content-Type' => 'application/vnd.vmware.vcloud.rasdItem+xml'},
:method => 'PUT',
:parser => Fog::ToHashDocument.new,
:path => "vApp/#{vm_id}/virtualHardwareSection/cpu"

View file

@ -42,13 +42,14 @@ module Fog
# * body<~Hash>:
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/PUT-GuestCustomizationSection-vApp.html
# vCloud API Documentation
# @since vCloud API version 1.0
def put_vm_customization(vm_id, customization={})
data = Fog::Generators::Compute::VcloudDirector::Customization.new(customization)
request(
:body => data.generate_xml,
:expects => 202,
:headers => { 'Content-Type' => 'application/vnd.vmware.vcloud.guestCustomizationSection+xml' },
:headers => {'Content-Type' => 'application/vnd.vmware.vcloud.guestCustomizationSection+xml'},
:method => 'PUT',
:parser => Fog::ToHashDocument.new,
:path => "vApp/#{vm_id}/guestCustomizationSection"

View file

@ -17,13 +17,14 @@ module Fog
# * body<~Hash>:
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/PUT-Disks.html
# vCloud API Documentation
# @since vCloud API version 0.9
def put_vm_disks(vm_id, disks=[])
data = Fog::Generators::Compute::VcloudDirector::Disks.new(disks)
request(
:body => data.generate_xml,
:expects => 202,
:headers => { 'Content-Type' => 'application/vnd.vmware.vcloud.rasdItemsList+xml' },
:headers => {'Content-Type' => 'application/vnd.vmware.vcloud.rasdItemsList+xml'},
:method => 'PUT',
:parser => Fog::ToHashDocument.new,
:path => "vApp/#{vm_id}/virtualHardwareSection/disks"

View file

@ -13,6 +13,7 @@ module Fog
# * body<~Hash>:
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/PUT-Memory.html
# vCloud API Documentation
# @since vCloud API version 0.9
def put_vm_memory(vm_id, memory)
data = <<EOF
<Item xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns12="http://www.vmware.com/vcloud/v1.5" ns12:href="#{endpoint}vApp/#{vm_id}/virtualHardwareSection/memory" ns12:type="application/vnd.vmware.vcloud.rasdItem+xml" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://10.194.1.65/api/v1.5/schema/master.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd">
@ -31,7 +32,7 @@ EOF
request(
:body => data,
:expects => 202,
:headers => { 'Content-Type' => 'application/vnd.vmware.vcloud.rasdItem+xml' },
:headers => {'Content-Type' => 'application/vnd.vmware.vcloud.rasdItem+xml'},
:method => 'PUT',
:parser => Fog::ToHashDocument.new,
:path => "vApp/#{vm_id}/virtualHardwareSection/memory"

View file

@ -41,13 +41,14 @@ module Fog
# * body<~Hash>:
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/PUT-NetworkConnectionSystemSection-vApp.html
# vCloud API Documentation
# @since vCloud API version 0.9
def put_vm_network(vm_id, network={})
data = Fog::Generators::Compute::VcloudDirector::VmNetwork.new(network)
request(
:body => data.generate_xml,
:expects => 202,
:headers => { 'Content-Type' => 'application/vnd.vmware.vcloud.networkConnectionSection+xml' },
:headers => {'Content-Type' => 'application/vnd.vmware.vcloud.networkConnectionSection+xml'},
:method => 'PUT',
:parser => Fog::ToHashDocument.new,
:path => "vApp/#{vm_id}/networkConnectionSection/"