mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
vApp rename via put_vapp_name_and_description
This commit is contained in:
parent
11ef105dce
commit
1e92536eaf
3 changed files with 67 additions and 0 deletions
|
@ -244,6 +244,7 @@ module Fog
|
|||
request :put_metadata_value # deprecated
|
||||
request :put_network_connection_system_section_vapp
|
||||
request :put_vapp_metadata_item_metadata
|
||||
request :put_vapp_name_and_description
|
||||
request :put_vapp_template_metadata_item_metadata
|
||||
request :put_vm
|
||||
request :put_vm_capabilities
|
||||
|
|
30
lib/fog/vcloud_director/generators/compute/vapp.rb
Normal file
30
lib/fog/vcloud_director/generators/compute/vapp.rb
Normal file
|
@ -0,0 +1,30 @@
|
|||
module Fog
|
||||
module Generators
|
||||
module Compute
|
||||
module VcloudDirector
|
||||
|
||||
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/types/VmType.html
|
||||
class Vapp
|
||||
attr_reader :name, :description
|
||||
|
||||
def initialize(name, description=nil)
|
||||
@name = name
|
||||
@description = description
|
||||
end
|
||||
|
||||
def generate_xml
|
||||
attrs = @attrs
|
||||
Nokogiri::XML::Builder.new do
|
||||
VApp('xmlns' => 'http://www.vmware.com/vcloud/v1.5',
|
||||
'name' => name
|
||||
) {
|
||||
Description description unless description.nil?
|
||||
}
|
||||
end.to_xml
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,36 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class VcloudDirector
|
||||
class Real
|
||||
|
||||
require 'fog/vcloud_director/generators/compute/vapp'
|
||||
|
||||
# Modify the name or description of a vApp.
|
||||
#
|
||||
# This operation is asynchronous and returns a task that you can monitor
|
||||
# to track the progress of the request.
|
||||
#
|
||||
#
|
||||
# @param [String] id Object identifier of the VM.
|
||||
# @param [String] name of the VM.
|
||||
# @param [String] description to be assigned.
|
||||
# @return [Excon::Response]
|
||||
# * body<~Hash>:
|
||||
#
|
||||
# @see http://pubs.vmware.com/vcd-55/topic/com.vmware.vcloud.api.reference.doc_55/doc/operations/PUT-VAppNameAndDescription.html
|
||||
# @since vCloud API version 0.9
|
||||
def put_vapp_name_and_description(id, name, description=nil)
|
||||
body = Fog::Generators::Compute::VcloudDirector::Vapp.new(name, description).generate_xml
|
||||
request(
|
||||
:body => body,
|
||||
:expects => 202,
|
||||
:headers => {'Content-Type' => 'application/vnd.vmware.vcloud.vApp+xml'},
|
||||
:method => 'PUT',
|
||||
:parser => Fog::ToHashDocument.new,
|
||||
:path => "vApp/#{id}"
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue