class Fog::Compute::VcloudDirector::Real
Attributes
Public Class Methods
# File lib/fog/vcloud_director/compute.rb, line 347 def initialize(options={}) @vcloud_director_password = options[:vcloud_director_password] @vcloud_director_username = options[:vcloud_director_username] @connection_options = options[:connection_options] || {} @connection_options[:omit_default_port] = Fog::Compute::VcloudDirector::Defaults::OMIT_DEFAULT_PORT unless @connection_options[:omit_default_port] @host = options[:vcloud_director_host] @path = options[:path] || Fog::Compute::VcloudDirector::Defaults::PATH @persistent = options[:persistent] || false @port = options[:port] || Fog::Compute::VcloudDirector::Defaults::PORT @scheme = options[:scheme] || Fog::Compute::VcloudDirector::Defaults::SCHEME @connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) @end_point = "#{@scheme}://#{@host}#{@path}/" @api_version = options[:vcloud_director_api_version] || Fog::Compute::VcloudDirector::Defaults::API_VERSION @show_progress = options[:vcloud_director_show_progress] @show_progress = $stdin.tty? if @show_progress.nil? @vcloud_token = options[:vcloud_token] end
Public Instance Methods
# File lib/fog/vcloud_director/compute.rb, line 452 def add_id_from_href!(data={}) data[:id] = data[:href].split('/').last end
Delete a catalog item.
@param [String] id Object
identifier of the catalog item. @return [Excon::Response]
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/DELETE-CatalogItem.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/delete_catalog_item.rb, line 12 def delete_catalog_item(id) request( :expects => 204, :method => 'DELETE', :path => "catalogItem/#{id}" ) end
Delete the specified key and its value from catalog item metadata.
@param [String] id Object
identifier of the catalog item. @param [String] key Key of the metadata item. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/DELETE-CatalogItemMetadataItem-metadata.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/delete_catalog_item_metadata_item_metadata.rb, line 14 def delete_catalog_item_metadata_item_metadata(id, key) request( :expects => 202, :method => 'DELETE', :parser => Fog::ToHashDocument.new, :path => "catalogItem/#{id}/metadata/#{URI.escape(key)}" ) end
Delete a disk.
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 disk. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/DELETE-Disk.html @since vCloud API version 5.1
# File lib/fog/vcloud_director/requests/compute/delete_disk.rb, line 16 def delete_disk(id) request( :expects => 202, :method => 'DELETE', :parser => Fog::ToHashDocument.new, :path => "disk/#{id}" ) end
Delete the specified key and its value from disk metadata.
@param [String] id Object
identifier of the disk. @param [String] key Key of the metadata item. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/DELETE-DiskMetadataItem-metadata.html @since vCloud API version 5.1
# File lib/fog/vcloud_director/requests/compute/delete_disk_metadata_item_metadata.rb, line 14 def delete_disk_metadata_item_metadata(id, key) request( :expects => 202, :method => 'DELETE', :parser => Fog::ToHashDocument.new, :path => "disk/#{id}/metadata/#{URI.escape(key)}" ) end
@return [Excon::Response]
# File lib/fog/vcloud_director/requests/compute/delete_logout.rb, line 8 def delete_logout request( :expects => 204, :method => 'DELETE', :path => 'session' ) end
Delete a media object.
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 media object. @return [Excon::Response]
* body<~Hash>: * :href<~String> - The URI of the entity. * :type<~String> - The MIME type of the entity. * :id<~String> - The entity identifier, expressed in URN format. The value of this attribute uniquely identifies the entity, persists for the life of the entity, and is never reused. * :operationKey<~String> - Optional unique identifier to support idempotent semantics for create and delete operations. * :name<~String> - The name of the entity. * :cancelRequested<~String> - Whether user has requested this processing to be canceled. * :endTime<~String> - The date and time that processing of the task was completed. May not be present if the task is still being executed. * :expiryTime<~String> - The date and time at which the task resource will be destroyed and no longer available for retrieval. May not be present if the task has not been executed or is still being executed. * :operation<~String> - A message describing the operation that is tracked by this task. * :operationName<~String> - The short name of the operation that is tracked by this task. * :serviceNamespace<~String> - Identifier of the service that created the task. * :startTime<~String> - The date and time the system started executing the task. May not be present if the task has not been executed yet. * :status<~String> - The execution status of the task. * :Link<~Array<Hash>>: * :Description<~String> - Optional description. * :Owner<~Hash> - Reference to the owner of the task. This is typically the object that the task is creating or updating. * :href<~String> - Contains the URI to the entity. * :name<~String> - Contains the name of the entity. * :type<~String> - Contains the type of the entity. * :Error<~Hash> - Represents error information from a failed task. * :majorErrorCode<~String> - The class of the error. Matches the HTTP status code. * :message<~String> - An one line, human-readable message describing the error that occurred. * :minorErrorCode<~String> - Resource-specific error code. * :stackTrace<~String> - The stack trace of the exception. * :vendorSpecificErrorCode<~String> - A vendor- or implementation-specific error code that can reference specific modules or source lines for diagnostic purposes. * :User<~Hash> - The user who started the task. * :href<~String> - Contains the URI to the entity. * :name<~String> - Contains the name of the entity. * :type<~String> - Contains the type of the entity. * :Organization<~Hash> - The organization to which the :User belongs. * :href<~String> - Contains the URI to the entity. * :name<~String> - Contains the name of the entity. * :type<~String> - Contains the type of the entity. * :Progress<~String> - Read-only indicator of task progress as an approximate percentage between 0 and 100. Not available for all tasks. * :Params * :Details<~String> - Detailed message about the task. Also contained by the :Owner entity when task status is preRunning.
@raise [Fog::Compute::VcloudDirector::Forbidden]
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/DELETE-Media.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/delete_media.rb, line 79 def delete_media(id) request( :expects => 202, :method => 'DELETE', :parser => Fog::ToHashDocument.new, :path => "media/#{id}" ) end
Delete the specified key and its value from media object metadata.
@param [String] id Object
identifier of the media object. @param [String] key Key of the metadata item. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/DELETE-MediaMetadataItem-metadata.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/delete_media_metadata_item_metadata.rb, line 14 def delete_media_metadata_item_metadata(id, key) request( :expects => 202, :method => 'DELETE', :parser => Fog::ToHashDocument.new, :path => "media/#{id}/metadata/#{URI.escape(key)}" ) end
Delete an OrgVdcNetwork
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 OrgVdcNetwork. @return [Excon::Response]
* body<~Hash>:
@raise [Fog::Compute::VcloudDirector::BadRequest]
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/DELETE-Network.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/delete_network.rb, line 18 def delete_network(id) request( :expects => 202, :method => 'DELETE', :parser => Fog::ToHashDocument.new, :path => "admin/network/#{id}" ) end
Deletes shadow VM.
This operation is asynchronous and returns a task that you can monitor to track the progress of the request.
@deprecated Since vCloud API version 5.1 this operation may be
removed in a future release.
@param [String] id Object
identifier of the vApp. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/DELETE-ShadowVm.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/delete_shadow_vm.rb, line 19 def delete_shadow_vm(id) request( :expects => 202, :method => 'DELETE', :parser => Fog::ToHashDocument.new, :path => "shadowVm/#{id}" ) end
Delete a vApp or VM.
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 vApp. @return [Excon::Response]
* body<~Hash>:
@raise [Fog::Compute::VcloudDirector::BadRequest]
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/DELETE-VApp.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/delete_vapp.rb, line 18 def delete_vapp(id) request( :expects => 202, :method => 'DELETE', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}" ) end
Delete the specified key and its value from vApp or VM metadata.
@param [String] id Object
identifier of the vApp or VM. @param [String] key Key of the metadata item. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/DELETE-VAppMetadataItem-metadata.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/delete_vapp_metadata_item_metadata.rb, line 19 def delete_vapp_metadata_item_metadata(id, key) request( :expects => 202, :method => 'DELETE', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/metadata/#{URI.escape(key)}" ) end
Delete a vApp template.
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 vApp template. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/DELETE-VAppTemplate.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/delete_vapp_template.rb, line 16 def delete_vapp_template(id) request( :expects => 202, :method => 'DELETE', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}" ) end
Delete the specified key and its value from vApp template or VM metadata.
@param [String] id Object
identifier of the vApp template or VM. @param [String] key Key of the metadata item. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/DELETE-VAppTemplateMetadataItem-metadata.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/delete_vapp_template_metadata_item_metadata.rb, line 15 def delete_vapp_template_metadata_item_metadata(id, key) request( :expects => 202, :method => 'DELETE', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}/metadata/#{URI.escape(key)}" ) end
@api private
# File lib/fog/vcloud_director/compute.rb, line 402 def do_request(params) headers = { 'Accept' => "application/*+xml;version=#{@api_version}", 'x-vcloud-authorization' => vcloud_token } if params[:path] if params[:override_path] == true path = params[:path] else path = "#{@path}/#{params[:path]}" end else path = "#{@path}" end @connection.request({ :body => params[:body], :expects => params[:expects], :headers => headers.merge!(params[:headers] || {}), :idempotent => params[:idempotent], :method => params[:method], :parser => params[:parser], :path => path, :query => params[:query] }) rescue Excon::Errors::HTTPStatusError => error raise case error when Excon::Errors::BadRequest then BadRequest.slurp(error); when Excon::Errors::Unauthorized then Unauthorized.slurp(error); when Excon::Errors::Forbidden then Forbidden.slurp(error); when Excon::Errors::Conflict then Conflict.slurp(error); else ServiceError.slurp(error) end end
Compensate for Fog::ToHashDocument shortcomings. @api private @param [Hash] hash @param [String,Symbol] key1 @param [String,Symbol] key2 @return [Hash]
# File lib/fog/vcloud_director/compute.rb, line 462 def ensure_list!(hash, key1, key2=nil) if key2.nil? hash[key1] ||= [] hash[key1] = [hash[key1]] if hash[key1].is_a?(Hash) else hash[key1] ||= {key2 => []} hash[key1] = {key2 => []} if hash[key1].empty? hash[key1][key2] = [hash[key1][key2]] if hash[key1][key2].is_a?(Hash) end hash end
Retrieve a list of IP addresses allocated to the network.
@param [String] id Object
identifier of the network. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-AllocatedIpAddresses.html @since vCloud API version 5.1
# File lib/fog/vcloud_director/requests/compute/get_allocated_ip_addresses.rb, line 13 def get_allocated_ip_addresses(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "network/#{id}/allocatedAddresses" ) end
Retrieve a catalog.
@param [String] id Object
identifier of the catalog. @return [Excon::Response]
* hash<~Hash>:
@raise [Fog::Compute::VcloudDirector::Forbidden]
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Catalog.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_catalog.rb, line 15 def get_catalog(id) response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "catalog/#{id}" ) ensure_list! response.body, :CatalogItems, :CatalogItem response end
Retrieve a catalog item.
@param [String] id Object
identifier of the catalog item. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-CatalogItem.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_catalog_item.rb, line 13 def get_catalog_item(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "catalogItem/#{id}" ) end
Retrieve all metadata associated with a catalog item.
@param [String] id Object
identifier of the catalog item. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-CatalogItemMetadata.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_catalog_item_metadata.rb, line 13 def get_catalog_item_metadata(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "catalogItem/#{id}/metadata" ) end
Retrieve the value of the specified key from catalog item metadata.
@param [String] id Object
identifier of the catalog item. @param [String] key Key of the metadata. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-CatalogItemMetadataItem-metadata.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_catalog_item_metadata_item_metadata.rb, line 14 def get_catalog_item_metadata_item_metadata(id, key) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "catalogItem/#{id}/metadata/#{URI.escape(key)})" ) end
Retrieve all catalog metadata.
@param [String] id Object
identifier of the catalog. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-CatalogMetadata.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_catalog_metadata.rb, line 13 def get_catalog_metadata(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "catalog/#{id}/metadata" ) end
Retrieve the value of the specified key from catalog metadata.
@param [String] id Object
identifier of the catalog. @param [String] key Key of the metadata. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-CatalogMetadataItem-metadata.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_catalog_metadata_item_metadata.rb, line 14 def get_catalog_metadata_item_metadata(id, key) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "catalog/#{id}/metadata/#{URI.escape(key)})" ) end
Retrieves a list of Catalogs
by using REST API general QueryHandler.
@param [Hash] options @option options [String] :sortAsc (Sorted by database ID) Sort
results by attribute-name in ascending order. attribute-name cannot include metadata.
@option options [String] :sortDesc (Sorted by database ID) Sort
results by attribute-name in descending order. attribute-name cannot include metadata.
@option options [Integer] :page (1) If the query results span
multiple pages, return this page.
@option options [Integer] :pageSize (25) Number of results per page,
to a maximum of 128
@option options [String] :format (records) One of the following
types: - *references* Returns a reference to each object, including its :name, :type, and :href attributes. - *records* Returns all database records for each object, with each record as an attribute. - *idrecords* Identical to the records format, except that object references are returned in :id format rather than :href format.
@option options [Array<String>] :fields (all static attribute names)
List of attribute names or metadata key names to return.
@option options [Integer] :offset (0) Integer value specifying the
first record to return. Record numbers < offset are not returned.
@option options [String] :filter (none) Filter expression. @return [Excon::Response]
* hash<~Hash>: * :href<~String> - The URI of the entity. * :type<~String> - The MIME type of the entity. * :name<~String> - Query name that generated this result set. * :page<~String> - Page of the result set that this container holds. The first page is page number 1. * :pageSize<~String> - Page size, as a number of records or references. * :total<~String> - Total number of records or references in the container. * :Link<~Array<Hash>>: * :href<~String> - Contains the URI to the entity. * :type<~String> - Contains the type of the entity. * :rel<~String> - Defines the relationship of the link to the object that contains it. * :CatalogRecord<~Array<Hash>>: * TODO * :firstPage<~Integer> - First page in the result set. * :previousPage<~Integer> - Previous page in the result set. * :nextPage<~Integer> - Next page in the result set. * :lastPage<~Integer> - Last page in the result set.
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-CatalogsFromQuery.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_catalogs_from_query.rb, line 56 def get_catalogs_from_query(options={}) query = [] query << "sortAsc=#{options[:sortAsc]}" if options[:sortAsc] query << "sortDesc=#{options[:sortDesc]}" if options[:sortDesc] query << "page=#{options[:page]}" if options[:page] query << "pageSize=#{options[:pageSize]}" if options[:pageSize] query << "format=#{options[:format]}" if options[:format] query << "fields=#{Array(options[:fields]).join(',')}" if options[:fields] query << "offset=#{options[:offset]}" if options[:offset] query << "filter=#{options[:filter]}" if options[:filter] response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => 'catalogs/query', :query => query.map {|q| URI.escape(q)}.join('&') ) ensure_list! response.body, :Link ensure_list! response.body, response.body[:type] == 'application/vnd.vmware.vcloud.query.references+xml' ? :CatalogReference : :CatalogRecord %w[firstPage previousPage nextPage lastPage].each do |rel| if link = response.body[:Link].find {|l| l[:rel] == rel} href = Nokogiri::XML.fragment(link[:href]) query = CGI.parse(URI.parse(href.text).query) response.body[rel.to_sym] = query['page'].first.to_i response.body[:pageSize] ||= query['pageSize'].first.to_i end end response end
Retrieve access control information for a catalog.
@param [String] id Object
identifier of the organization. @param [String] catalog_id Object
identifier of the catalog. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-ControlAccessParams-vApp.html @since vCloud API 0.9
# File lib/fog/vcloud_director/requests/compute/get_control_access_params_catalog.rb, line 14 def get_control_access_params_catalog(id, catalog_id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "org/#{id}/catalog/#{catalog_id}/controlAccess" ) end
Retrieve access control information for a vApp.
@param [String] id Object
identifier of the vApp. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-ControlAccessParams-vApp.html @since vCloud API 0.9
# File lib/fog/vcloud_director/requests/compute/get_control_access_params_vapp.rb, line 13 def get_control_access_params_vapp(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/controlAccess" ) end
Retrieve the RASD item that specifies CPU properties of a VM.
@param [String] id Object
identifier of the VM. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-CpuRasdItem.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_cpu_rasd_item.rb, line 16 def get_cpu_rasd_item(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/virtualHardwareSection/cpu" ) end
Retrieve a representation of the current session.
A Session object contains one or more URLs from which you can begin browsing, as well as links to the query service and entity resolver. The list of URLs in the Session object is based on the role and privileges of the authenticated user.
A Session object expires after a configurable interval of client inactivity.
@return [Excon::Response]
* body<~Hash>: * :href<~String> - The URI of the entity. * :type<~String> - The MIME type of the entity. * :org<~String> - The name of the user's organization. * :user<~String> - The name of the user that owns the session * :Link<~Array<Hash>]: * :href<~String> - Contains the URI to the linked entity. * :name<~String> - Contains the name of the linked entity. * :type<~String> - Contains the type of the linked entity. * :rel<~String> - Defines the relationship of the link to the object that contains it.
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-CurrentSession.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_current_session.rb, line 30 def get_current_session request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => 'session' ) end
Retrieve a disk.
@param [String] id Object
identifier of the disk. @return [Excon::Response]
* body<~Hash>: * :href<~String> - The URI of the disk. * :type<~String> - The MIME type of the disk. * :id<~String> - The disk identifier, expressed in URN format. * :name<~String> - The name of the disk. * :status<~String> - Creation status of the disk. * :busSubType<~String> - Disk bus sub type. * :busType<~String> - Disk bus type. * :size<~String> - Size of the disk. * :Description<~String> - Optional description. * :Tasks<~Hash> - A list of queued, running, or recently completed tasks associated with this disk. * :StorageProfile<~Hash> - Storage profile of the disk. * :Owner<~Hash> - Disk owner.
@raise [Fog::Compute::VcloudDirector::Forbidden]
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Disk.html @since vCloud API version 5.1
# File lib/fog/vcloud_director/requests/compute/get_disk.rb, line 28 def get_disk(id) response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "disk/#{id}" ) ensure_list! response.body, :Link ensure_list! response.body, :Tasks, :Task ensure_list! response.body, :Files, :File response end
Retrieve metadata associated with the disk.
@param [String] id Object
identifier of the disk. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-DiskMetadata.html @since vCloud API version 5.1
# File lib/fog/vcloud_director/requests/compute/get_disk_metadata.rb, line 13 def get_disk_metadata(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "disk/#{id}/metadata" ) end
Retrieve the value of the specified key from disk metadata.
@param [String] id Object
identifier of the disk. @param [String] key Key of the metadata. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-DiskMetadataItem-metadata.html @since vCloud API version 5.1
# File lib/fog/vcloud_director/requests/compute/get_disk_metadata_item_metadata.rb, line 14 def get_disk_metadata_item_metadata(id, key) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "disk/#{id}/metadata/#{URI.escape(key)})" ) end
Retrieve the owner of a disk.
@param [String] id Object
identifier of the disk. @return [Excon::Response]
* body<~Hash>: * :href<~String> - The URI of the disk. * :type<~String> - The MIME type of the disk. * :Link<~Hash>: * :href<~String> - * :type<~String> - * :rel<~String> - * :User<~Hash> - Reference to the user who is the owner of this disk. * :href<~String> - The URI of the user. * :name<~String> - The name of the user. * :type<~String> - The MIME type of the user.
@raise [Fog::Compute::VcloudDirector::Forbidden]
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-DiskOwner.html @since vCloud API version 5.1
# File lib/fog/vcloud_director/requests/compute/get_disk_owner.rb, line 26 def get_disk_owner(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "disk/#{id}/owner" ) end
Retrieves a disk list by using REST API general QueryHandler.
@param [Hash] options @option options [String] :sortAsc (Sorted by database ID) Sort
results by attribute-name in ascending order. attribute-name cannot include metadata.
@option options [String] :sortDesc (Sorted by database ID) Sort
results by attribute-name in descending order. attribute-name cannot include metadata.
@option options [Integer] :page (1) If the query results span
multiple pages, return this page.
@option options [Integer] :pageSize (25) Number of results per page,
to a maximum of 128
@option options [String] :format (records) One of the following
types: - *references* Returns a reference to each object, including its :name, :type, and :href attributes. - *records* Returns all database records for each object, with each record as an attribute. - *idrecords* Identical to the records format, except that object references are returned in :id format rather than :href format.
@option options [Array<String>] :fields (all static attribute names)
List of attribute names or metadata key names to return.
@option options [Integer] :offset (0) Integer value specifying the
first record to return. Record numbers < offset are not returned.
@option options [String] :filter (none) Filter expression. @return [Excon::Response]
* hash<~Hash>: * :href<~String> - The URI of the entity. * :type<~String> - The MIME type of the entity. * :name<~String> - Query name that generated this result set. * :page<~String> - Page of the result set that this container holds. The first page is page number 1. * :pageSize<~String> - Page size, as a number of records or references. * :total<~String> - Total number of records or references in the container. * :Link<~Array<Hash>>: * :href<~String> - Contains the URI to the entity. * :type<~String> - Contains the type of the entity. * :rel<~String> - Defines the relationship of the link to the object that contains it. * :DiskRecord<~Array<Hash>>: * TODO * :firstPage<~Integer> - First page in the result set. * :previousPage<~Integer> - Previous page in the result set. * :nextPage<~Integer> - Next page in the result set. * :lastPage<~Integer> - Last page in the result set.
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-DisksFromQuery.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_disks_from_query.rb, line 56 def get_disks_from_query(options={}) query = [] query << "sortAsc=#{options[:sortAsc]}" if options[:sortAsc] query << "sortDesc=#{options[:sortDesc]}" if options[:sortDesc] query << "page=#{options[:page]}" if options[:page] query << "pageSize=#{options[:pageSize]}" if options[:pageSize] query << "format=#{options[:format]}" if options[:format] query << "fields=#{Array(options[:fields]).join(',')}" if options[:fields] query << "offset=#{options[:offset]}" if options[:offset] query << "filter=#{options[:filter]}" if options[:filter] response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => 'disks/query', :query => query.map {|q| URI.escape(q)}.join('&') ) ensure_list! response.body, :Link ensure_list! response.body, response.body[:type] == 'application/vnd.vmware.vcloud.query.references+xml' ? :DiskReference : :DiskRecord %w[firstPage previousPage nextPage lastPage].each do |rel| if link = response.body[:Link].find {|l| l[:rel] == rel} href = Nokogiri::XML.fragment(link[:href]) query = CGI.parse(URI.parse(href.text).query) response.body[rel.to_sym] = query['page'].first.to_i response.body[:pageSize] ||= query['pageSize'].first.to_i end end response end
Retrieve all RASD items that specify hard disk and hard disk controller properties of a VM.
@param [String] id Object
identifier of the VM. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-DisksRasdItemsList.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_disks_rasd_items_list.rb, line 14 def get_disks_rasd_items_list(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/virtualHardwareSection/disks" ) end
Retrieve an edge gateway.
@param [String] id Object
identifier of the edge gateway. @return [Excon::Response]
* body<~Hash>:
@raise [Fog::Compute::VcloudDirector::Forbidden]
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-EdgeGateway.html @since vCloud API version 5.1
# File lib/fog/vcloud_director/requests/compute/get_edge_gateway.rb, line 15 def get_edge_gateway(id) response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "admin/edgeGateway/#{id}" ) ensure_list! response.body[:Configuration], :GatewayInterfaces, :GatewayInterface edge_gateway_service_configuration = response.body[:Configuration][:EdgeGatewayServiceConfiguration] ensure_list! edge_gateway_service_configuration[:FirewallService], :FirewallRule if edge_gateway_service_configuration[:FirewallService] ensure_list! edge_gateway_service_configuration[:NatService], :NatRule if edge_gateway_service_configuration[:NatService] if edge_gateway_service_configuration[:LoadBalancerService] ensure_list! edge_gateway_service_configuration[:LoadBalancerService], :Pool edge_gateway_service_configuration[:LoadBalancerService][:Pool].each do |pool| ensure_list! pool, :ServicePort ensure_list! pool, :Member pool[:Member].each do |member| ensure_list! member, :ServicePort end end ensure_list! edge_gateway_service_configuration[:LoadBalancerService], :VirtualServer edge_gateway_service_configuration[:LoadBalancerService][:VirtualServer].each do |virtual_server| ensure_list! virtual_server, :ServiceProfile end end response end
Redirects to the URL of an entity with the given VCD ID.
@param [String] id @return [Excon:Response]
* body<~Hash>: * :href<~String> - The URI of the entity. * :type<~String> - The MIME type of the entity. * :id<~String> - The entity identifier, expressed in URN format. The value of this attribute uniquely identifies the entity, persists for the life of the entity, and is never reused. * :name<~String> - The name of the entity. * :Link<~Array<Hash>]: * :href<~String> - Contains the URI to the linked entity. * :type<~String> - Contains the type of the linked entity. * :rel<~String> - Defines the relationship of the link to the object that contains it.
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Entity.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_entity.rb, line 24 def get_entity(id) response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "entity/#{id}" ) ensure_list! response.body, :Link response end
REST API General queries handler.
@param [String] type The type of the query. Type names are
case-sensitive. You can retrieve a summary list of all typed queries types accessible to the currently authenticated user by making a request with type=nil.
@param [Hash] options @option options [String] :sortAsc (Sorted by database ID) Sort
results by attribute-name in ascending order. attribute-name cannot include metadata.
@option options [String] :sortDesc (Sorted by database ID) Sort
results by attribute-name in descending order. attribute-name cannot include metadata.
@option options [Integer] :page (1) If the query results span
multiple pages, return this page.
@option options [Integer] :pageSize (25) Number of results per page,
to a maximum of 128
@option options [String] :format (records) One of the following
types: - *references* Returns a reference to each object, including its :name, :type, and :href attributes. - *records* Returns all database records for each object, with each record as an attribute. - *idrecords* Identical to the records format, except that object references are returned in :id format rather than :href format.
@option options [Array<String>] :fields (all static attribute names)
List of attribute names or metadata key names to return.
@option options [Integer] :offset (0) Integer value specifying the
first record to return. Record numbers < offset are not returned.
@option options [String] :filter (none) Filter expression. @return [Excon::Response] if type is specified.
* hash<~Hash>: * :href<~String> - The URI of the entity. * :type<~String> - The MIME type of the entity. * :name<~String> - Query name that generated this result set. * :page<~String> - Page of the result set that this container holds. The first page is page number 1. * :pageSize<~String> - Page size, as a number of records or references. * :total<~String> - Total number of records or references in the container. * :Link<~Array<Hash>>: * :href<~String> - Contains the URI to the entity. * :type<~String> - Contains the type of the entity. * :rel<~String> - Defines the relationship of the link to the object that contains it. * :Record<~Array<Hash>> - The name and content of this item varies according to the type and format of the query. * :firstPage<~Integer> - First page in the result set. * :previousPage<~Integer> - Previous page in the result set. * :nextPage<~Integer> - Next page in the result set. * :lastPage<~Integer> - Last page in the result set.
@return [Excon::Response] if type is nil.
* hash<~Hash>: * :href<~String> - The URI of the entity. * :type<~String> - The MIME type of the entity. * :Link<~Array<Hash>>: * :href<~String> - Contains the URI to the entity. * :name<~String> - Contains the name of the entity. * :type<~String> - Contains the type of the entity. * :rel<~String> - Defines the relationship of the link to the object that contains it.
@see pubs.vmware.com/vcd-55/topic/com.vmware.vcloud.api.reference.doc_55/doc/operations/GET-ExecuteQuery.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_execute_query.rb, line 70 def get_execute_query(type=nil, options={}) if type.nil? response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => 'query' ) else query = { :type => type, } query[:sortAsc] = options[:sortAsc] if options[:sortAsc] query[:sortDesc] = options[:sortDesc] if options[:sortDesc] query[:page] = options[:page] if options[:page] query[:pageSize] = options[:pageSize] if options[:pageSize] query[:format] = options[:format] if options[:format] query[:fields] = Array(options[:fields]).join(',') if options[:fields] query[:offset] = options[:offset] if options[:offset] query[:filter] = options[:filter] if options[:filter] response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => 'query', :query => query.map {|k, v| "#{k}=#{CGI.escape(v.to_s)}" }.join('&').gsub('%3D', '=').gsub('%3B', ';') ) ensure_list! response.body, :Link # TODO: figure out the right key (this isn't it) #ensure_list! response.body, # response.body[:type] == 'application/vnd.vmware.vcloud.query.references+xml' ? # "#{response.body[:name]}Reference".to_sym : # "#{response.body[:name]}Record".to_sym %w[firstPage previousPage nextPage lastPage].each do |rel| if link = response.body[:Link].find {|l| l[:rel] == rel} href = Nokogiri::XML.fragment(link[:href]) query = CGI.parse(URI.parse(href.text).query) response.body[rel.to_sym] = query['page'].first.to_i response.body[:pageSize] ||= query['pageSize'].first.to_i end end response end end
Retrieves a list of groups for organization the org admin belongs to by using REST API general QueryHandler.
@param [Hash] options @option options [String] :sortAsc (Sorted by database ID) Sort
results by attribute-name in ascending order. attribute-name cannot include metadata.
@option options [String] :sortDesc (Sorted by database ID) Sort
results by attribute-name in descending order. attribute-name cannot include metadata.
@option options [Integer] :page (1) If the query results span
multiple pages, return this page.
@option options [Integer] :pageSize (25) Number of results per page,
to a maximum of 128
@option options [String] :format (records) One of the following
types: - *references* Returns a reference to each object, including its :name, :type, and :href attributes. - *records* Returns all database records for each object, with each record as an attribute. - *idrecords* Identical to the records format, except that object references are returned in :id format rather than :href format.
@option options [Array<String>] :fields (all static attribute names)
List of attribute names or metadata key names to return.
@option options [Integer] :offset (0) Integer value specifying the
first record to return. Record numbers < offset are not returned.
@option options [String] :filter (none) Filter expression. @return [Excon::Response]
* hash<~Hash>: * :href<~String> - The URI of the entity. * :type<~String> - The MIME type of the entity. * :name<~String> - Query name that generated this result set. * :page<~String> - Page of the result set that this container holds. The first page is page number 1. * :pageSize<~String> - Page size, as a number of records or references. * :total<~String> - Total number of records or references in the container. * :Link<~Array<Hash>>: * :href<~String> - Contains the URI to the entity. * :type<~String> - Contains the type of the entity. * :rel<~String> - Defines the relationship of the link to the object that contains it. * :GroupRecord<~Array<Hash>>: * TODO * :firstPage<~Integer> - First page in the result set. * :previousPage<~Integer> - Previous page in the result set. * :nextPage<~Integer> - Next page in the result set. * :lastPage<~Integer> - Last page in the result set.
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-GroupsFromQuery.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_groups_from_query.rb, line 57 def get_groups_from_query(options={}) query = [] query << "sortAsc=#{options[:sortAsc]}" if options[:sortAsc] query << "sortDesc=#{options[:sortDesc]}" if options[:sortDesc] query << "page=#{options[:page]}" if options[:page] query << "pageSize=#{options[:pageSize]}" if options[:pageSize] query << "format=#{options[:format]}" if options[:format] query << "fields=#{Array(options[:fields]).join(',')}" if options[:fields] query << "offset=#{options[:offset]}" if options[:offset] query << "filter=#{options[:filter]}" if options[:filter] response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => 'admin/groups/query', :query => query.map {|q| URI.escape(q)}.join('&') ) ensure_list! response.body, :Link ensure_list! response.body, response.body[:type] == 'application/vnd.vmware.vcloud.query.references+xml' ? :GroupReference : :GroupRecord %w[firstPage previousPage nextPage lastPage].each do |rel| if link = response.body[:Link].find {|l| l[:rel] == rel} href = Nokogiri::XML.fragment(link[:href]) query = CGI.parse(URI.parse(href.text).query) response.body[rel.to_sym] = query['page'].first.to_i response.body[:pageSize] ||= query['pageSize'].first.to_i end end response end
Retrieves the guest customization section of a VM.
@param [String] id Object
identifier of the VM. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-GuestCustomizationSystemSection-vApp.html @since vCloud API version 1.0
# File lib/fog/vcloud_director/requests/compute/get_guest_customization_system_section_vapp.rb, line 13 def get_guest_customization_system_section_vapp(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/guestCustomizationSection" ) end
Retrieves the guest customization section of a VM.
@param [String] id Object
identifier of the VM. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-GuestCustomizationSystemSection-vAppTemplate.html @since vCloud API version 1.0
# File lib/fog/vcloud_director/requests/compute/get_guest_customization_system_section_vapp_template.rb, line 13 def get_guest_customization_system_section_vapp_template(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}/guestCustomizationSection" ) end
This is used for manual testing.
@api private
# File lib/fog/vcloud_director/requests/compute/get_href.rb, line 8 def get_href(href) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :override_path => true, :path => URI.parse(href).path ) end
Retrieves the lease settings section of a vApp.
@param [String] id Object
identifier of the vApp. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-LeaseSettingsSection-vApp.html @since vCloud API version 1.0
# File lib/fog/vcloud_director/requests/compute/get_lease_settings_section_vapp.rb, line 13 def get_lease_settings_section_vapp(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/leaseSettingsSection" ) end
Retrieves the lease settings section of a vApp template.
@param [String] id Object
identifier of the vApp template. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-LeaseSettingsSection-vAppTemplate.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_lease_settings_section_vapp_template.rb, line 13 def get_lease_settings_section_vapp_template(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}/leaseSettingsSection" ) end
Retrieve a media object.
@param [String] id Object
identifier of the media object. @return [Excon::Response]
* body<~Hash>:
@raise [Fog::Compute::VcloudDirector::Forbidden]
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Media.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_media.rb, line 15 def get_media(id) response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "media/#{id}" ) ensure_list! response.body, :Files, :File response end
Retrieve all RASD items that specify CD-ROM, DVD, and floppy disk device and controller properties of a VM.
@param [String] id Object
identifier of the VM. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-MediaDrivesRasdItemsList.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_media_drives_rasd_items_list.rb, line 14 def get_media_drives_rasd_items_list(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/virtualHardwareSection/media" ) end
Retrieve metadata associated with a media object.
@param [String] id Object
identifier of the media object @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-MediaMetadata.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_media_metadata.rb, line 13 def get_media_metadata(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "media/#{id}/metadata" ) end
Retrieve the value of the specified key from media object metadata.
@param [String] id Object
identifier of the media object. @param [String] key Key of the metadata. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-MediaMetadataItem-metadata.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_media_metadata_item_metadata.rb, line 14 def get_media_metadata_item_metadata(id, key) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "media/#{id}/metadata/#{URI.escape(key)})" ) end
Retrieve the owner of a media object.
@param [String] id Object
identifier of the media object. @return [Excon::Response]
* body<~Hash>: * :href<~String> - The URI of the media object. * :type<~String> - The MIME type of the media object. * :Link<~Hash>: * :href<~String> - * :type<~String> - * :rel<~String> - * :User<~Hash> - Reference to the user who is the owner of this media object. * :href<~String> - The URI of the user. * :name<~String> - The name of the user. * :type<~String> - The MIME type of the user.
@raise [Fog::Compute::VcloudDirector::Forbidden]
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-MediaOwner.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_media_owner.rb, line 26 def get_media_owner(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "media/#{id}/owner" ) end
Retrieves a media list by using REST API general QueryHandler.
@param [Hash] options @option options [String] :sortAsc (Sorted by database ID) Sort
results by attribute-name in ascending order. attribute-name cannot include metadata.
@option options [String] :sortDesc (Sorted by database ID) Sort
results by attribute-name in descending order. attribute-name cannot include metadata.
@option options [Integer] :page (1) If the query results span
multiple pages, return this page.
@option options [Integer] :pageSize (25) Number of results per page,
to a maximum of 128
@option options [String] :format (records) One of the following
types: - *references* Returns a reference to each object, including its :name, :type, and :href attributes. - *records* Returns all database records for each object, with each record as an attribute. - *idrecords* Identical to the records format, except that object references are returned in :id format rather than :href format.
@option options [Array<String>] :fields (all static attribute names)
List of attribute names or metadata key names to return.
@option options [Integer] :offset (0) Integer value specifying the
first record to return. Record numbers < offset are not returned.
@option options [String] :filter (none) Filter expression. @return [Excon::Response]
* hash<~Hash>: * :href<~String> - The URI of the entity. * :type<~String> - The MIME type of the entity. * :name<~String> - Query name that generated this result set. * :page<~String> - Page of the result set that this container holds. The first page is page number 1. * :pageSize<~String> - Page size, as a number of records or references. * :total<~String> - Total number of records or references in the container. * :Link<~Array<Hash>>: * :href<~String> - Contains the URI to the entity. * :type<~String> - Contains the type of the entity. * :rel<~String> - Defines the relationship of the link to the object that contains it. * :MediaRecord<~Array<Hash>>: * TODO * :firstPage<~Integer> - First page in the result set. * :previousPage<~Integer> - Previous page in the result set. * :nextPage<~Integer> - Next page in the result set. * :lastPage<~Integer> - Last page in the result set.
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-MediasFromQuery.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_medias_from_query.rb, line 56 def get_medias_from_query(options={}) query = [] query << "sortAsc=#{options[:sortAsc]}" if options[:sortAsc] query << "sortDesc=#{options[:sortDesc]}" if options[:sortDesc] query << "page=#{options[:page]}" if options[:page] query << "pageSize=#{options[:pageSize]}" if options[:pageSize] query << "format=#{options[:format]}" if options[:format] query << "fields=#{Array(options[:fields]).join(',')}" if options[:fields] query << "offset=#{options[:offset]}" if options[:offset] query << "filter=#{options[:filter]}" if options[:filter] response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => 'mediaList/query', :query => query.map {|q| URI.escape(q)}.join('&') ) ensure_list! response.body, :Link ensure_list! response.body, response.body[:type] == 'application/vnd.vmware.vcloud.query.references+xml' ? :MediaReference : :MediaRecord %w[firstPage previousPage nextPage lastPage].each do |rel| if link = response.body[:Link].find {|l| l[:rel] == rel} href = Nokogiri::XML.fragment(link[:href]) query = CGI.parse(URI.parse(href.text).query) response.body[rel.to_sym] = query['page'].first.to_i response.body[:pageSize] ||= query['pageSize'].first.to_i end end response end
Retrieve the RASD item that specifies memory properties of a VM.
@param [String] id Object
identifier of the VM. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-MemoryRasdItem.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_memory_rasd_item.rb, line 16 def get_memory_rasd_item(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/virtualHardwareSection/memory" ) end
Retrieve metadata associated with the vApp or VM.
@deprecated Use {#get_vapp_metadata} instead. @todo Log deprecation warning.
@param [String] id Object
identifier of the vApp or VM. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppMetadata.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_metadata.rb, line 16 def get_metadata(id) require 'fog/vcloud_director/parsers/compute/metadata' request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::Parsers::Compute::VcloudDirector::Metadata.new, :path => "vApp/#{id}/metadata/" ) end
Retrieve an organization network.
@deprecated Use {#get_network_complete} instead
@param [String] id Object
identifier of the network. @return [Excon::Response]
* body<~Hash>:
@raise [Fog::Compute::VcloudDirector::Forbidden]
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Network.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_network.rb, line 19 def get_network(id) Fog::Logger.deprecation("#{self} => #get_network is deprecated, use #get_network_complete instead [light_black](#{caller.first})[/]") request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::Parsers::Compute::VcloudDirector::Network.new, :path => "network/#{id}" ) end
Retrieve all RASD items that specify network card properties of a VM.
@param [String] id Object
identifier of the VM. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-NetworkCardsItemsList.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_network_cards_items_list.rb, line 13 def get_network_cards_items_list(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/virtualHardwareSection/networkCards" ) end
Retrieve an organization network.
@param [String] id Object
identifier of the network. @return [Excon::Response]
* body<~Hash>:
@raise [Fog::Compute::VcloudDirector::Forbidden]
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Network.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_network_complete.rb, line 15 def get_network_complete(id) response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "admin/network/#{id}" ) ensure_list! response.body[:Configuration][:IpScopes][:IpScope], :IpRanges, :IpRange response end
Retrieve the network config section of a vApp.
@param [String] id The object identifier of the vApp. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-NetworkConfigSection-vApp.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_network_config_section_vapp.rb, line 13 def get_network_config_section_vapp(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/networkConfigSection/" ) end
Retrieve the network config section of a vApp template.
@param [String] id The object identifier of the vApp template. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-NetworkConfigSection-vAppTemplate.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_network_config_section_vapp_template.rb, line 13 def get_network_config_section_vapp_template(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}/networkConfigSection/" ) end
Retrieve the network connection section of a VM.
@param [String] id The object identifier of the VM. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-NetworkConnectionSystemSection-vApp.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_network_connection_system_section_vapp.rb, line 13 def get_network_connection_system_section_vapp(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/networkConnectionSection/" ) end
Retrieve the network connection section of a VM.
@param [String] id The object identifier of the VM. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-NetworkConnectionSystemSection-vAppTemplate.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_network_connection_system_section_vapp_template.rb, line 13 def get_network_connection_system_section_vapp_template(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}/networkConnectionSection/" ) end
Retrieve metadata associated with the network.
@param [String] id Object
identifier of the network. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-NetworkMetadata.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_network_metadata.rb, line 13 def get_network_metadata(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "network/#{id}/metadata" ) end
Retrieve the value of the specified key from network metadata.
@param [String] id Object
identifier of the network. @param [String] key Key of the metadata. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-NetworkMetadataItem-metadata.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_network_metadata_item_metadata.rb, line 14 def get_network_metadata_item_metadata(id, key) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "admin/network/#{id}/metadata/#{URI.escape(key)})" ) end
Retrieve the network section of a vApp.
@param [String] id The object identifier of the vApp. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-NetworkSection-vApp.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_network_section_vapp.rb, line 13 def get_network_section_vapp(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/networkSection/" ) end
Retrieve the network section of a vApp template.
@param [String] id The object identifier of the vApp template. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-NetworkSection-vAppTemplate.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_network_section_vapp_template.rb, line 13 def get_network_section_vapp_template(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}/networkSection/" ) end
Retrieve the operating system section of a VM.
@param [String] id The object identifier of the VM. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-OperatingSystemSection.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_operating_system_section.rb, line 13 def get_operating_system_section(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/operatingSystemSection/" ) end
Retrieve settings for this organization.
Organization
settings are divided into categories. This request retrieves all categories of organization settings.
@param [String] id Object
identitifier of the organization. @return [Excon:Response]
* body<~Hash>: * :href<~String> - The URI of the entity. * :type<~String> - The MIME type of the entity. * :OrgGeneralSettings<~Hash>: * :VAppLeaseSettings<~Hash>: * :VAppTemplateLeaseSettings<~Hash>: * :OrgLdapSettings<~Hash>: * :OrgEmailSettings<~Hash>: * :OrgPasswordPolicySettings<~Hash>: * :OrgOperationLimitsSettings<~Hash>: * :OrgFederationSettings<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-OrgSettings.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_org_settings.rb, line 26 def get_org_settings(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "admin/org/#{id}/settings" ) end
List all gateways for this Org vDC.
@param [String] id Object
identifier of the vDC. @return [Excon::Response]
* body<~Hash>:
@raise [Fog::Compute::VcloudDirector::Forbidden]
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-OrgVdcGateways.html @since vCloud API version 5.1
# File lib/fog/vcloud_director/requests/compute/get_org_vdc_gateways.rb, line 18 def get_org_vdc_gateways(id) response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "admin/vdc/#{id}/edgeGateways" ) ensure_list! response.body, :EdgeGatewayRecord response end
Retrieve an organization.
@param [String] id The object identifier of the organization. @return [Excon:Response]
* body<~Hash>:
@raise [Fog::Compute::VcloudDirector::Forbidden]
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Organization.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_organization.rb, line 15 def get_organization(id) response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "org/#{id}" ) ensure_list! response.body, :Tasks, :Task response end
Retrieve metadata associated with the organization.
@param [String] id Object
identifier of the organization. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-OrganizationMetadata.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_organization_metadata.rb, line 13 def get_organization_metadata(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "org/#{id}/metadata" ) end
Retrieve the value of the specified key in the specified domain from organization metadata.
@param [String] id Object
identifier of the network. @param [String] domain @param [String] key Key of the metadata. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-OrganizationMetadataItem-metadata.html @since vCloud API version 5.1
# File lib/fog/vcloud_director/requests/compute/get_organization_metadata_item_metadata.rb, line 16 def get_organization_metadata_item_metadata(id, domain, key) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "admin/org/#{id}/metadata/#{URI.escape(domain)}/#{URI.escape(key)})" ) end
Retrieve a list of organizations accessible to you.
The system administrator has access to all organizations.
@return [Excon::Response]
* body<~Hash>: * :href<~String> - The URI of the entity. * :type<~String> - The MIME type of the entity. * :Org<~Array<Hash>]: * :href<~String> - Contains the URI to the linked entity. * :name<~String> - Contains the name of the linked entity. * :type<~String> - Contains the type of the linked entity.
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Organizations.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_organizations.rb, line 20 def get_organizations response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => 'org' ) ensure_list! response.body, :Org response end
Retrieves a list of organizations by using REST API general QueryHandler.
@param [Hash] options @option options [String] :sortAsc (Sorted by database ID) Sort
results by attribute-name in ascending order. attribute-name cannot include metadata.
@option options [String] :sortDesc (Sorted by database ID) Sort
results by attribute-name in descending order. attribute-name cannot include metadata.
@option options [Integer] :page (1) If the query results span
multiple pages, return this page.
@option options [Integer] :pageSize (25) Number of results per page,
to a maximum of 128
@option options [String] :format (records) One of the following
types: - *references* Returns a reference to each object, including its :name, :type, and :href attributes. - *records* Returns all database records for each object, with each record as an attribute. - *idrecords* Identical to the records format, except that object references are returned in :id format rather than :href format.
@option options [Array<String>] :fields (all static attribute names)
List of attribute names or metadata key names to return.
@option options [Integer] :offset (0) Integer value specifying the
first record to return. Record numbers < offset are not returned.
@option options [String] :filter (none) Filter expression. @return [Excon::Response]
* hash<~Hash>: * :href<~String> - The URI of the entity. * :type<~String> - The MIME type of the entity. * :name<~String> - Query name that generated this result set. * :page<~String> - Page of the result set that this container holds. The first page is page number 1. * :pageSize<~String> - Page size, as a number of records or references. * :total<~String> - Total number of records or references in the container. * :Link<~Array<Hash>>: * :href<~String> - Contains the URI to the entity. * :type<~String> - Contains the type of the entity. * :rel<~String> - Defines the relationship of the link to the object that contains it. * :OrganizationRecord<~Array<Hash>>: * TODO * :firstPage<~Integer> - First page in the result set. * :previousPage<~Integer> - Previous page in the result set. * :nextPage<~Integer> - Next page in the result set. * :lastPage<~Integer> - Last page in the result set.
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-OrganizationsFromQuery.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_organizations_from_query.rb, line 57 def get_organizations_from_query(options={}) query = [] query << "sortAsc=#{options[:sortAsc]}" if options[:sortAsc] query << "sortDesc=#{options[:sortDesc]}" if options[:sortDesc] query << "page=#{options[:page]}" if options[:page] query << "pageSize=#{options[:pageSize]}" if options[:pageSize] query << "format=#{options[:format]}" if options[:format] query << "fields=#{Array(options[:fields]).join(',')}" if options[:fields] query << "offset=#{options[:offset]}" if options[:offset] query << "filter=#{options[:filter]}" if options[:filter] response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => 'admin/orgs/query', :query => query.map {|q| URI.escape(q)}.join('&') ) ensure_list! response.body, :Link ensure_list! response.body, response.body[:type] == 'application/vnd.vmware.vcloud.query.references+xml' ? :OrganizationReference : :OrganizationRecord %w[firstPage previousPage nextPage lastPage].each do |rel| if link = response.body[:Link].find {|l| l[:rel] == rel} href = Nokogiri::XML.fragment(link[:href]) query = CGI.parse(URI.parse(href.text).query) response.body[rel.to_sym] = query['page'].first.to_i response.body[:pageSize] ||= query['pageSize'].first.to_i end end response end
Retrieve a list of ProductSection elements from a vApp or VM.
@param [String] id Object
identifier of the vApp or VM. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-ProductSections-vApp.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_product_sections_vapp.rb, line 13 def get_product_sections_vapp(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/productSections" ) end
Retrieve a list of ProductSection elements from a vApp template or VM.
@param [String] id Object
identifier of the vApp template or VM. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-ProductSections-vAppTemplate.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_product_sections_vapp_template.rb, line 14 def get_product_sections_vapp_template(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}/productSections" ) end
This is used for manual testing.
@api private
# File lib/fog/vcloud_director/requests/compute/get_request.rb, line 8 def get_request(uri) request( :expects => 200, :idempotent => true, :method => 'GET', :path => uri ) end
Retrieve the runtime info section of a VM.
@param [String] id Object
identifier of the VM. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-RuntimeInfoSectionType.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_runtime_info_section_type.rb, line 13 def get_runtime_info_section_type(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/runtimeInfoSection" ) end
Retrieve all RASD items that specify serial port properties of a VM.
@param [String] id Object
identifier of the VM. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-SerialPortsItemsList.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_serial_ports_items_list.rb, line 13 def get_serial_ports_items_list(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/virtualHardwareSection/serialPorts" ) end
Retrieve a shadow VM.
@param [String] id The object identifier of the shadow VM. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-ShadowVm.html
# File lib/fog/vcloud_director/requests/compute/get_shadow_vm.rb, line 12 def get_shadow_vm(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "shadowVm/#{id}" ) end
Retrieve SnapshotSection element for a vApp or VM.
@param [String] id Object
identifier of the vApp or VM. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-SnapshotSection.html @since vCloud API version 5.1
# File lib/fog/vcloud_director/requests/compute/get_snapshot_section.rb, line 13 def get_snapshot_section(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/snapshotSection" ) end
Retrieve the startup section of a vApp.
@param [String] id Object
identifier of the vApp. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-StartupSection.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_startup_section.rb, line 13 def get_startup_section(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/startupSection" ) end
List operating systems available for use on virtual machines owned by this organization.
@return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-SupportedSystemsInfo.html @since vCloud API version 5.1
# File lib/fog/vcloud_director/requests/compute/get_supported_systems_info.rb, line 13 def get_supported_systems_info request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => 'supportedSystemsInfo' ) end
List all supported versions.
@return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-55/topic/com.vmware.vcloud.api.reference.doc_55/doc/operations/GET-SupportedVersions.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_supported_versions.rb, line 12 def get_supported_versions @connection.request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "#{@path}/versions" ) end
Retrieve a task.
@param [String] id The object identifier of the task. @return [Excon::Response]
* body<~Hash>: * :href<~String> - The URI of the entity. * :type<~String> - The MIME type of the entity. * :id<~String> - The entity identifier, expressed in URN format. The value of this attribute uniquely identifies the entity, persists for the life of the entity, and is never reused. * :operationKey<~String> - Optional unique identifier to support idempotent semantics for create and delete operations. * :name<~String> - The name of the entity. * :cancelRequested<~String> - Whether user has requested this processing to be canceled. * :endTime<~String> - The date and time that processing of the task was completed. May not be present if the task is still being executed. * :expiryTime<~String> - The date and time at which the task resource will be destroyed and no longer available for retrieval. May not be present if the task has not been executed or is still being executed. * :operation<~String> - A message describing the operation that is tracked by this task. * :operationName<~String> - The short name of the operation that is tracked by this task. * :serviceNamespace<~String> - Identifier of the service that created the task. * :startTime<~String> - The date and time the system started executing the task. May not be present if the task has not been executed yet. * :status<~String> - The execution status of the task. * :Link<~Array<Hash>>: * :Description<~String> - Optional description. * :Owner<~Hash> - Reference to the owner of the task. This is typically the object that the task is creating or updating. * :href<~String> - Contains the URI to the entity. * :name<~String> - Contains the name of the entity. * :type<~String> - Contains the type of the entity. * :Error<~Hash> - Represents error information from a failed task. * :majorErrorCode<~String> - The class of the error. Matches the HTTP status code. * :message<~String> - An one line, human-readable message describing the error that occurred. * :minorErrorCode<~String> - Resource-specific error code. * :stackTrace<~String> - The stack trace of the exception. * :vendorSpecificErrorCode<~String> - A vendor- or implementation-specific error code that can reference specific modules or source lines for diagnostic purposes. * :User<~Hash> - The user who started the task. * :href<~String> - Contains the URI to the entity. * :name<~String> - Contains the name of the entity. * :type<~String> - Contains the type of the entity. * :Organization<~Hash> - The organization to which the :User belongs. * :href<~String> - Contains the URI to the entity. * :name<~String> - Contains the name of the entity. * :type<~String> - Contains the type of the entity. * :Progress<~String> - Read-only indicator of task progress as an approximate percentage between 0 and 100. Not available for all tasks. * :Params * :Details<~String> - Detailed message about the task. Also contained by the :Owner entity when task status is preRunning.
@raise [Fog::Compute::VcloudDirector::Forbidden]
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Task.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_task.rb, line 77 def get_task(id) response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "task/#{id}" ) # vCloud Director bug: Owner may be absent for some tasks, fix # targeted for 5.1.3 (due out at the beginning Q1 2014). # # We'd prefer that Owner is always present; if nothing else, this # let's the tests pass. response.body[:Owner] ||= {:href => '', :name => nil, :type => nil} response end
Retrieve a list of this organization's queued, running, or recently completed tasks.
@param [String] id Object
identifier of the organization. @return [Excon::Response]
* body<~Hash>: * :href<~String> - The URI of the entity. * :type<~String> - The MIME type of the entity. * :id<~String> - The entity identifier, expressed in URN format. The value of this attribute uniquely identifies the entity, persists for the life of the entity, and is never reused. * :name<~String> - The name of the entity. * :Task<~Array<Hash>>: * :href<~String> - The URI of the entity. * :type<~String> - The MIME type of the entity. * :id<~String> - The entity identifier, expressed in URN format. The value of this attribute uniquely identifies the entity, persists for the life of the entity, and is never reused. * :operationKey<~String> - Optional unique identifier to support idempotent semantics for create and delete operations. * :name<~String> - The name of the entity. * :cancelRequested<~String> - Whether user has requested this processing to be canceled. * :endTime<~String> - The date and time that processing of the task was completed. May not be present if the task is still being executed. * :expiryTime<~String> - The date and time at which the task resource will be destroyed and no longer available for retrieval. May not be present if the task has not been executed or is still being executed. * :operation<~String> - A message describing the operation that is tracked by this task. * :operationName<~String> - The short name of the operation that is tracked by this task. * :serviceNamespace<~String> - Identifier of the service that created the task. * :startTime<~String> - The date and time the system started executing the task. May not be present if the task has not been executed yet. * :status<~String> - The execution status of the task. * :Link<~Array<Hash>>: * :Description<~String> - Optional description. * :Owner<~Hash> - Reference to the owner of the task. This is typically the object that the task is creating or updating. * :href<~String> - Contains the URI to the entity. * :name<~String> - Contains the name of the entity. * :type<~String> - Contains the type of the entity. * :Error<~Hash> - Represents error information from a failed task. * :majorErrorCode<~String> - The class of the error. Matches the HTTP status code. * :message<~String> - An one line, human-readable message describing the error that occurred. * :minorErrorCode<~String> - Resource-specific error code. * :stackTrace<~String> - The stack trace of the exception. * :vendorSpecificErrorCode<~String> - A vendor- or implementation-specific error code that can reference specific modules or source lines for diagnostic purposes. * :User<~Hash> - The user who started the task. * :href<~String> - Contains the URI to the entity. * :name<~String> - Contains the name of the entity. * :type<~String> - Contains the type of the entity. * :Organization<~Hash> - The organization to which the :User belongs. * :href<~String> - Contains the URI to the entity. * :name<~String> - Contains the name of the entity. * :type<~String> - Contains the type of the entity. * :Progress<~String> - Read-only indicator of task progress as an approximate percentage between 0 and 100. Not available for all tasks. * :Params * :Details<~String> - Detailed message about the task. Also contained by the :Owner entity when task status is preRunning.
@raise [Fog::Compute::VcloudDirector::BadRequest] @raise [Fog::Compute::VcloudDirector::Forbidden]
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-TaskList.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_task_list.rb, line 90 def get_task_list(id) response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "tasksList/#{id}" ) ensure_list! response.body, :Task response end
Retrieve a vApp or VM.
@note This should probably be deprecated.
@param [String] id Object
identifier of the vApp or VM. @return [Excon::Response]
* body<~Hash>:
@see get_vapp
# File lib/fog/vcloud_director/requests/compute/get_template_vms.rb, line 16 def get_template_vms(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::Parsers::Compute::VcloudDirector::Vms.new, :path => "vAppTemplate/#{id}" ) end
Retrieves a thumbnail image of a VM console.
The content type of the response can be any of `image/png`, `image/gif`.
@param [String] id Object
identifier of the VM. @return [Excon::Response]
* body<~String> - the thumbnail image.
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Thumbnail.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_thumbnail.rb, line 16 def get_thumbnail(id) request( :expects => 200, :headers => {'Accept' => "image/*;version=#{@api_version}"}, :idempotent => true, :method => 'GET', :path => "vApp/#{id}/screen" ) end
Retrieves a list of users for organization the org admin belongs to by using REST API general QueryHandler.
@param [Hash] options @option options [String] :sortAsc (Sorted by database ID) Sort
results by attribute-name in ascending order. attribute-name cannot include metadata.
@option options [String] :sortDesc (Sorted by database ID) Sort
results by attribute-name in descending order. attribute-name cannot include metadata.
@option options [Integer] :page (1) If the query results span
multiple pages, return this page.
@option options [Integer] :pageSize (25) Number of results per page,
to a maximum of 128
@option options [String] :format (records) One of the following
types: - *references* Returns a reference to each object, including its :name, :type, and :href attributes. - *records* Returns all database records for each object, with each record as an attribute. - *idrecords* Identical to the records format, except that object references are returned in :id format rather than :href format.
@option options [Array<String>] :fields (all static attribute names)
List of attribute names or metadata key names to return.
@option options [Integer] :offset (0) Integer value specifying the
first record to return. Record numbers < offset are not returned.
@option options [String] :filter (none) Filter expression. @return [Excon::Response]
* hash<~Hash>: * :href<~String> - The URI of the entity. * :type<~String> - The MIME type of the entity. * :name<~String> - Query name that generated this result set. * :page<~String> - Page of the result set that this container holds. The first page is page number 1. * :pageSize<~String> - Page size, as a number of records or references. * :total<~String> - Total number of records or references in the container. * :Link<~Array<Hash>>: * :href<~String> - Contains the URI to the entity. * :type<~String> - Contains the type of the entity. * :rel<~String> - Defines the relationship of the link to the object that contains it. * :UserRecord<~Array<Hash>>: * TODO * :firstPage<~Integer> - First page in the result set. * :previousPage<~Integer> - Previous page in the result set. * :nextPage<~Integer> - Next page in the result set. * :lastPage<~Integer> - Last page in the result set.
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-UsersFromQuery-query.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_users_from_query.rb, line 57 def get_users_from_query(options={}) query = [] query << "sortAsc=#{options[:sortAsc]}" if options[:sortAsc] query << "sortDesc=#{options[:sortDesc]}" if options[:sortDesc] query << "page=#{options[:page]}" if options[:page] query << "pageSize=#{options[:pageSize]}" if options[:pageSize] query << "format=#{options[:format]}" if options[:format] query << "fields=#{Array(options[:fields]).join(',')}" if options[:fields] query << "offset=#{options[:offset]}" if options[:offset] query << "filter=#{options[:filter]}" if options[:filter] response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => 'admin/users/query', :query => query.map {|q| URI.escape(q)}.join('&') ) ensure_list! response.body, :Link ensure_list! response.body, response.body[:type] == 'application/vnd.vmware.vcloud.query.references+xml' ? :UserReference : :UserRecord %w[firstPage previousPage nextPage lastPage].each do |rel| if link = response.body[:Link].find {|l| l[:rel] == rel} href = Nokogiri::XML.fragment(link[:href]) query = CGI.parse(URI.parse(href.text).query) response.body[rel.to_sym] = query['page'].first.to_i response.body[:pageSize] ||= query['pageSize'].first.to_i end end response end
Retrieve a vApp or VM.
@param [String] id Object
identifier of the vApp or VM. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VApp.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_vapp.rb, line 13 def get_vapp(id) response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}" ) ensure_list! response.body, :Children, :Vm response end
Retrieve metadata associated with the vApp or VM.
@param [String] id Object
identifier of the vApp or VM. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppMetadata.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_vapp_metadata.rb, line 13 def get_vapp_metadata(id) response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/metadata/" ) ensure_list! response.body, :MetadataEntry response end
Retrieve the value of the specified key from vApp or VM metadata.
@param [String] id Object
identifier of the vApp or VM. @param [String] key Key of the metadata. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppMetadataItem-metadata.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_vapp_metadata_item_metadata.rb, line 14 def get_vapp_metadata_item_metadata(id, key) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/metadata/#{URI.escape(key)})" ) end
Retrieve the OVF descriptor of a vApp directly.
@param [String] id Object
identifier of the vApp. @return [Excon::Response]
* body<~String> - the OVF descriptor.
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppOvfDescriptor.html @since vCloud API version 5.1
# File lib/fog/vcloud_director/requests/compute/get_vapp_ovf_descriptor.rb, line 13 def get_vapp_ovf_descriptor(id) request( :expects => 200, :idempotent => true, :method => 'GET', :path => "vApp/#{id}/ovf" ) end
Retrieve the owner of a vApp.
@param [String] id Object
identifier of the vApp. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppOwner.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_vapp_owner.rb, line 13 def get_vapp_owner(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/owner" ) end
Retrieve a vApp template.
@param [String] id Object
identifier of the vApp template. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppTemplate.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_vapp_template.rb, line 13 def get_vapp_template(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}" ) end
Retrieves the customization section of a vApp template.
@param [String] id Object
identifier of the vApp template. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppTemplateCustomizationSystemSection.html @since vCloud API version 1.0
# File lib/fog/vcloud_director/requests/compute/get_vapp_template_customization_system_section.rb, line 13 def get_vapp_template_customization_system_section(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}/customizationSection" ) end
Retrieve metadata associated with the vApp template or VM.
@param [String] id Object
identifier of the vApp template or VM. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppTemplateMetadata.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_vapp_template_metadata.rb, line 13 def get_vapp_template_metadata(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}/metadata/" ) end
Retrieve the value of the specified key from vApp template or VM metadata.
@param [String] id Object
identifier of the vApp template or VM. @param [String] key Key of the metadata. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppTemplateMetadataItem-metadata.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_vapp_template_metadata_item_metadata.rb, line 15 def get_vapp_template_metadata_item_metadata(id, key) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}/metadata/#{URI.escape(key)})" ) end
Retrieve the OVF descriptor of a vApp template.
@param [String] id Object
identifier of the vAppTemplate. @return [Excon::Response]
* body<~String> - the OVF descriptor.
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppTemplateOvfDescriptor.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_vapp_template_ovf_descriptor.rb, line 13 def get_vapp_template_ovf_descriptor(id) request( :expects => 200, :idempotent => true, :method => 'GET', :path => "vAppTemplate/#{id}/ovf" ) end
Retrieve the owner of a vApp template.
@param [String] id Object
identifier of the vApp template. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppTemplateOwner.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_vapp_template_owner.rb, line 13 def get_vapp_template_owner(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}/owner" ) end
Retrieves a list of vAppTemplates using REST API general QueryHandler.
@param [Hash] options @option options [String] :sortAsc (Sorted by database ID) Sort
results by attribute-name in ascending order. attribute-name cannot include metadata.
@option options [String] :sortDesc (Sorted by database ID) Sort
results by attribute-name in descending order. attribute-name cannot include metadata.
@option options [Integer] :page (1) If the query results span
multiple pages, return this page.
@option options [Integer] :pageSize (25) Number of results per page,
to a maximum of 128
@option options [String] :format (records) One of the following
types: - *references* Returns a reference to each object, including its :name, :type, and :href attributes. - *records* Returns all database records for each object, with each record as an attribute. - *idrecords* Identical to the records format, except that object references are returned in :id format rather than :href format.
@option options [Array<String>] :fields (all static attribute names)
List of attribute names or metadata key names to return.
@option options [Integer] :offset (0) Integer value specifying the
first record to return. Record numbers < offset are not returned.
@option options [String] :filter (none) Filter expression. @return [Excon::Response]
* hash<~Hash>: * :href<~String> - The URI of the entity. * :type<~String> - The MIME type of the entity. * :name<~String> - Query name that generated this result set. * :page<~String> - Page of the result set that this container holds. The first page is page number 1. * :pageSize<~String> - Page size, as a number of records or references. * :total<~String> - Total number of records or references in the container. * :Link<~Array<Hash>>: * :href<~String> - Contains the URI to the entity. * :type<~String> - Contains the type of the entity. * :rel<~String> - Defines the relationship of the link to the object that contains it. * :VAppTemplateRecord<~Array<Hash>>: * TODO * :firstPage<~Integer> - First page in the result set. * :previousPage<~Integer> - Previous page in the result set. * :nextPage<~Integer> - Next page in the result set. * :lastPage<~Integer> - Last page in the result set.
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppTemplatesFromQuery.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_vapp_templates_from_query.rb, line 57 def get_vapp_templates_from_query(options={}) query = [] query << "sortAsc=#{options[:sortAsc]}" if options[:sortAsc] query << "sortDesc=#{options[:sortDesc]}" if options[:sortDesc] query << "page=#{options[:page]}" if options[:page] query << "pageSize=#{options[:pageSize]}" if options[:pageSize] query << "format=#{options[:format]}" if options[:format] query << "fields=#{Array(options[:fields]).join(',')}" if options[:fields] query << "offset=#{options[:offset]}" if options[:offset] query << "filter=#{options[:filter]}" if options[:filter] response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => 'vAppTemplates/query', :query => query.map {|q| URI.escape(q)}.join('&') ) ensure_list! response.body, :Link ensure_list! response.body, response.body[:type] == 'application/vnd.vmware.vcloud.query.references+xml' ? :VAppTemplateReference : :VAppTemplateRecord %w[firstPage previousPage nextPage lastPage].each do |rel| if link = response.body[:Link].find {|l| l[:rel] == rel} href = Nokogiri::XML.fragment(link[:href]) query = CGI.parse(URI.parse(href.text).query) response.body[rel.to_sym] = query['page'].first.to_i response.body[:pageSize] ||= query['pageSize'].first.to_i end end response end
Retrieves a list of vApps by using REST API general QueryHandler.
@param [Hash] options @option options [String] :sortAsc (Sorted by database ID) Sort
results by attribute-name in ascending order. attribute-name cannot include metadata.
@option options [String] :sortDesc (Sorted by database ID) Sort
results by attribute-name in descending order. attribute-name cannot include metadata.
@option options [Integer] :page (1) If the query results span
multiple pages, return this page.
@option options [Integer] :pageSize (25) Number of results per page,
to a maximum of 128
@option options [String] :format (records) One of the following
types: - *references* Returns a reference to each object, including its :name, :type, and :href attributes. - *records* Returns all database records for each object, with each record as an attribute. - *idrecords* Identical to the records format, except that object references are returned in :id format rather than :href format.
@option options [Array<String>] :fields (all static attribute names)
List of attribute names or metadata key names to return.
@option options [Integer] :offset (0) Integer value specifying the
first record to return. Record numbers < offset are not returned.
@option options [String] :filter (none) Filter expression. @return [Excon::Response]
* hash<~Hash>: * :href<~String> - The URI of the entity. * :type<~String> - The MIME type of the entity. * :name<~String> - Query name that generated this result set. * :page<~String> - Page of the result set that this container holds. The first page is page number 1. * :pageSize<~String> - Page size, as a number of records or references. * :total<~String> - Total number of records or references in the container. * :Link<~Array<Hash>>: * :href<~String> - Contains the URI to the entity. * :type<~String> - Contains the type of the entity. * :rel<~String> - Defines the relationship of the link to the object that contains it. * :VAppRecord<~Array<Hash>>: * TODO * :firstPage<~Integer> - First page in the result set. * :previousPage<~Integer> - Previous page in the result set. * :nextPage<~Integer> - Next page in the result set. * :lastPage<~Integer> - Last page in the result set.
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppsInLeaseFromQuery.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_vapps_in_lease_from_query.rb, line 56 def get_vapps_in_lease_from_query(options={}) query = [] query << "sortAsc=#{options[:sortAsc]}" if options[:sortAsc] query << "sortDesc=#{options[:sortDesc]}" if options[:sortDesc] query << "page=#{options[:page]}" if options[:page] query << "pageSize=#{options[:pageSize]}" if options[:pageSize] query << "format=#{options[:format]}" if options[:format] query << "fields=#{Array(options[:fields]).join(',')}" if options[:fields] query << "offset=#{options[:offset]}" if options[:offset] query << "filter=#{options[:filter]}" if options[:filter] response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => 'vApps/query', :query => query.map {|q| URI.escape(q)}.join('&') ) ensure_list! response.body, :Link ensure_list! response.body, response.body[:type] == 'application/vnd.vmware.vcloud.query.references+xml' ? :VAppReference : :VAppRecord %w[firstPage previousPage nextPage lastPage].each do |rel| if link = response.body[:Link].find {|l| l[:rel] == rel} href = Nokogiri::XML.fragment(link[:href]) query = CGI.parse(URI.parse(href.text).query) response.body[rel.to_sym] = query['page'].first.to_i response.body[:pageSize] ||= query['pageSize'].first.to_i end end response end
Retrieve an administrative view of a cloud.
The VCloud element provides access to cloud-wide namespace of objects that an administrator can view and, in most cases, modify.
@return [Excon:Response]
* body<~Hash>: * :href<~String> - The URI of the entity. * :type<~String> - The MIME type of the entity. * :name<~String> - The name of the entity. * :Description<~String> - Optional description. * :OrganizationReferences<Hash>: * :OrganizationReference<~Array<Hash>>: * :href<~String> - Contains the URI to the entity. * :name<~String> - Contains the name of the entity. * :type<~String> - Contains the type of the entity. * :ProviderVdcReferences<~Hash>: * :ProviderVdcReferences<~Array<Hash>>: * :RightReferences<~Hash>: * :RightReferences<~Array<Hash>>: * :RoleReferences<~Hash>: * :RoleReferences<~Array<Hash>>: * :Networks<~Hash>: * :Network<~Array<Hash>>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Vcloud.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_vcloud.rb, line 32 def get_vcloud response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => 'admin/' ) ensure_list! response.body, :OrganizationReferences, :OrganizationReference ensure_list! response.body, :ProviderVdcReferences, :ProviderVdcReference ensure_list! response.body, :RightReferences, :RightReference ensure_list! response.body, :RoleReferences, :RoleReference ensure_list! response.body, :Networks, :Network response end
Retrieve a vDC.
@param [String] id Object
identifier of the vDC. @return [Excon::Response]
* body<~Hash>:
@raise [Fog::Compute::VcloudDirector::Forbidden]
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Vdc.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_vdc.rb, line 15 def get_vdc(id) response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vdc/#{id}" ) ensure_list! response.body, :ResourceEntities, :ResourceEntity ensure_list! response.body, :AvailableNetworks, :Network ensure_list! response.body, :VdcStorageProfiles, :VdcStorageProfile response end
Retrieve metadata associated with a vDC.
@param [String] id Object
identifier of the vDC. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VdcMetadata.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_vdc_metadata.rb, line 13 def get_vdc_metadata(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vdc/#{id}/metadata/" ) end
Retrieve the value of the specified key from virtual datacenter metadata.
@param [String] id Object
identifier of the network. @param [String] domain @param [String] key Key of the metadata. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VdcMetadataItem-metadata.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_vdc_metadata_item_metadata.rb, line 16 def get_vdc_metadata_item_metadata(id, domain, key) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "admin/vdc/#{id}/metadata/#{URI.escape(key)})" ) end
Returns storage class referred by the Id. All properties of the storage classes are visible to vcloud user, except for VDC Storage
Class reference.
@param [String] id Object
identifier of the vDC storage profile. @return [Excon::Response]
* body<~Hash>: * :href<~String> - The URI of the entity. * :type<~String> - The MIME type of the entity. * :id<~String> - The entity identifier, expressed in URN format. The value of this attribute uniquely identifies the entity, persists for the life of the entity, and is never reused. * :name<~String> - The name of the entity. * :Description<~String> - Optional description. * :Enabled<~String> - True if this storage profile is enabled for use in the vDC. * :Units<~String> - Units used to define :Limit. * :Limit<~String> - Maximum number of :Units allocated for this storage profile. * :Default<~String> - True if this is default storage profile for this vDC. The default storage profile is used when an object that can specify a storage profile is created with no storage profile specified.
@raise [Fog::Compute::VcloudDirector::Forbidden]
# File lib/fog/vcloud_director/requests/compute/get_vdc_storage_class.rb, line 35 def get_vdc_storage_class(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vdcStorageProfile/#{id}" ) end
Retrieve metadata associated with the vDC storage profile.
@param [String] id Object
identifier of the vDC storage profile. @return [Excon::Response]
* body<~Hash>:
# File lib/fog/vcloud_director/requests/compute/get_vdc_storage_class_metadata.rb, line 15 def get_vdc_storage_class_metadata(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vdcStorageProfile/#{id}/metadata/" ) end
Retrieve metadata associated with the vDC storage profile.
@param [String] id Object
identifier of the vDC storage profile. @param [String] key Key of the metadata. @return [Excon::Response]
* body<~Hash>:
# File lib/fog/vcloud_director/requests/compute/get_vdc_storage_class_metadata_item_metadata.rb, line 13 def get_vdc_storage_class_metadata_item_metadata(id, key) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vdcStorageProfile/#{id}/metadata/#{URI.escape(key)})" ) end
Retrieves a list of vdcs in the organization.
@param [Hash] options @option options [String] :sortAsc (Sorted by database ID) Sort
results by attribute-name in ascending order. attribute-name cannot include metadata.
@option options [String] :sortDesc (Sorted by database ID) Sort
results by attribute-name in descending order. attribute-name cannot include metadata.
@option options [Integer] :page (1) If the query results span
multiple pages, return this page.
@option options [Integer] :pageSize (25) Number of results per page,
to a maximum of 128
@option options [String] :format (records) One of the following
types: - *references* Returns a reference to each object, including its :name, :type, and :href attributes. - *records* Returns all database records for each object, with each record as an attribute. - *idrecords* Identical to the records format, except that object references are returned in :id format rather than :href format.
@option options [Array<String>] :fields (all static attribute names)
List of attribute names or metadata key names to return.
@option options [Integer] :offset (0) Integer value specifying the
first record to return. Record numbers < offset are not returned.
@option options [String] :filter (none) Filter expression. @return [Excon::Response]
* hash<~Hash>: * :href<~String> - The URI of the entity. * :type<~String> - The MIME type of the entity. * :name<~String> - Query name that generated this result set. * :page<~String> - Page of the result set that this container holds. The first page is page number 1. * :pageSize<~String> - Page size, as a number of records or references. * :total<~String> - Total number of records or references in the container. * :Link<~Array<Hash>>: * :href<~String> - Contains the URI to the entity. * :type<~String> - Contains the type of the entity. * :rel<~String> - Defines the relationship of the link to the object that contains it. * :OrgVdcRecord<~Array<Hash>>: * TODO * :firstPage<~Integer> - First page in the result set. * :previousPage<~Integer> - Previous page in the result set. * :nextPage<~Integer> - Next page in the result set. * :lastPage<~Integer> - Last page in the result set.
@see pubs.vmware.com/vcd-55/topic/com.vmware.vcloud.api.reference.doc_55/doc/operations/GET-RightsFromQuery-query.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_vdcs_from_query.rb, line 56 def get_vdcs_from_query(options={}) query = [] query << "sortAsc=#{options[:sortAsc]}" if options[:sortAsc] query << "sortDesc=#{options[:sortDesc]}" if options[:sortDesc] query << "page=#{options[:page]}" if options[:page] query << "pageSize=#{options[:pageSize]}" if options[:pageSize] query << "format=#{options[:format]}" if options[:format] query << "fields=#{Array(options[:fields]).join(',')}" if options[:fields] query << "offset=#{options[:offset]}" if options[:offset] query << "filter=#{options[:filter]}" if options[:filter] response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => 'admin/vdcs/query', :query => query.map {|q| URI.escape(q)}.join('&') ) ensure_list! response.body, :Link ensure_list! response.body, response.body[:type] == 'application/vnd.vmware.vcloud.query.references+xml' ? :OrgVdcReference : :OrgVdcRecord %w[firstPage previousPage nextPage lastPage].each do |rel| if link = response.body[:Link].find {|l| l[:rel] == rel} href = Nokogiri::XML.fragment(link[:href]) query = CGI.parse(URI.parse(href.text).query) response.body[rel.to_sym] = query['page'].first.to_i response.body[:pageSize] ||= query['pageSize'].first.to_i end end response end
Retrieve the virtual hardware section of a VM.
This operation retrieves the entire VirtualHardwareSection of a VM. You can also retrieve many RASD item elements of a VirtualHardwareSection individually, or as groups of related items.
@param [String] id Object
identifier of the VM. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VirtualHardwareSection.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_virtual_hardware_section.rb, line 17 def get_virtual_hardware_section(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/virtualHardwareSection/" ) end
Retrieve a vApp or VM.
@note This should probably be deprecated.
@param [String] id Object
identifier of the vApp or VM. @return [Excon::Response]
* body<~Hash>:
@see get_vapp
# File lib/fog/vcloud_director/requests/compute/get_template_vm.rb, line 16 def get_vm(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::Parsers::Compute::VcloudDirector::Vm.new, :path => "vAppTemplate/#{id}" ) end
Gets capabilities for the VM identified by id.
@param [String] id Object
identifier of the VM. @return [Excon::Response]
* body<~Hash>: * :href<~String> - The URI of the entity. * :type<~String> - The MIME type of the entity. * :MemoryHotAddEnabled<~String> - True if the virtual machine supports addition of memory while powered on. * :CpuHotAddEnabled<~String> - True if the virtual machine supports addition of virtual CPUs while powered on.
# File lib/fog/vcloud_director/requests/compute/get_vm_capabilities.rb, line 18 def get_vm_capabilities(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/vmCapabilities" ) end
Retrieve the results of a compliance check.
@param [String] id Object
identifier of the VM. @return [Excon::Response]
* body<~Hash>:
# File lib/fog/vcloud_director/requests/compute/get_vm_compliance_results.rb, line 12 def get_vm_compliance_results(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/complianceResult" ) end
Retrieves the guest customization section of a VM.
@deprecated Use {#get_guest_customization_system_section_vapp}
instead.
@todo Log deprecation warning.
@param [String] id Object
identifier of the VM. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-GuestCustomizationSystemSection-vApp.html @since vCloud API version 1.0
# File lib/fog/vcloud_director/requests/compute/get_vm_customization.rb, line 19 def get_vm_customization(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::Parsers::Compute::VcloudDirector::VmCustomization.new, :path => "vApp/#{id}/guestCustomizationSection" ) end
Retrieve all RASD items that specify hard disk and hard disk controller properties of a VM.
@deprecated Use {#get_disks_rasd_items_list} instead. @todo Log deprecation warning.
@param [String] id @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-DisksRasdItemsList.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_vm_disks.rb, line 19 def get_vm_disks(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::Parsers::Compute::VcloudDirector::Disks.new, :path => "vApp/#{id}/virtualHardwareSection/disks" ) end
Retrieve the network connection section of a VM.
@deprecated Use {#get_network_connection_system_section_vapp}
instead.
@todo Log deprecation warning.
@param [String] id Object
identifier of the VM. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-NetworkConnectionSystemSection-vApp.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_vm_network.rb, line 19 def get_vm_network(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::Parsers::Compute::VcloudDirector::VmNetwork.new, :path => "vApp/#{id}/networkConnectionSection/" ) end
Retrieve a question being asked by a VM.
@param [String] id Object
identifier of the VM. @return [Excon::Response]
* body<~Hash>: * :href<~String> - The URI of the entity. * :type<~String> - The MIME type of the entity. * :Question<~String> - Question text. * :QuestionId<~String> - Question ID of this question. * Choices<~Array<Hash>>: * Id<~String> - Choice ID of the answer. * Text<~String> - Answer text.
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VmPendingQuestion.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/get_vm_pending_question.rb, line 20 def get_vm_pending_question(id) response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/question" ) ensure_list! response.body, :Choices response end
Retrieve a vApp or VM.
@note This should probably be deprecated.
@param [String] id Object
identifier of the vApp or VM. @return [Excon::Response]
* body<~Hash>:
@see get_vapp
# File lib/fog/vcloud_director/requests/compute/get_vms.rb, line 16 def get_vms(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::Parsers::Compute::VcloudDirector::Vms.new, :path => "vApp/#{id}" ) end
@see get_vms_in_lease_by_query
# File lib/fog/vcloud_director/requests/compute/get_vms_by_metadata.rb, line 8 def get_vms_by_metadata(key,value) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::Parsers::Compute::VcloudDirector::VmsByMetadata.new, :path => "vms/query?format=records&filter=metadata:#{key}==STRING:#{value}" ) end
Retrieve a list of all VMs attached to a disk.
@param [String] id Object
identifier of the disk. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VmsDisksAttachedTo.html @since vCloud API version 5.1
# File lib/fog/vcloud_director/requests/compute/get_vms_disk_attached_to.rb, line 13 def get_vms_disk_attached_to(id) response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "disk/#{id}/attachedVms" ) ensure_list! response.body, :VmReference response end
Retrieves a list of VMs in lease by using REST API general QueryHandler.
@param [Hash] options @option options [String] :sortAsc (Sorted by database ID) Sort
results by attribute-name in ascending order. attribute-name cannot include metadata.
@option options [String] :sortDesc (Sorted by database ID) Sort
results by attribute-name in descending order. attribute-name cannot include metadata.
@option options [Integer] :page (1) If the query results span
multiple pages, return this page.
@option options [Integer] :pageSize (25) Number of results per page,
to a maximum of 128
@option options [String] :format (records) One of the following
types: - *references* Returns a reference to each object, including its :name, :type, and :href attributes. - *records* Returns all database records for each object, with each record as an attribute. - *idrecords* Identical to the records format, except that object references are returned in :id format rather than :href format.
@option options [Array<String>] :fields (all static attribute names)
List of attribute names or metadata key names to return.
@option options [Integer] :offset (0) Integer value specifying the
first record to return. Record numbers < offset are not returned.
@option options [String] :filter (none) Filter expression. @return [Excon::Response]
* hash<~Hash>: * :href<~String> - The URI of the entity. * :type<~String> - The MIME type of the entity. * :name<~String> - Query name that generated this result set. * :page<~String> - Page of the result set that this container holds. The first page is page number 1. * :pageSize<~String> - Page size, as a number of records or references. * :total<~String> - Total number of records or references in the container. * :Link<~Array<Hash>>: * :href<~String> - Contains the URI to the entity. * :type<~String> - Contains the type of the entity. * :rel<~String> - Defines the relationship of the link to the object that contains it. * :VMRecord<~Array<Hash>>: * TODO * :firstPage<~Integer> - First page in the result set. * :previousPage<~Integer> - Previous page in the result set. * :nextPage<~Integer> - Next page in the result set. * :lastPage<~Integer> - Last page in the result set.
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VMsInLeaseFromQuery.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/get_vms_in_lease_from_query.rb, line 57 def get_vms_in_lease_from_query(options={}) query = [] query << "sortAsc=#{options[:sortAsc]}" if options[:sortAsc] query << "sortDesc=#{options[:sortDesc]}" if options[:sortDesc] query << "page=#{options[:page]}" if options[:page] query << "pageSize=#{options[:pageSize]}" if options[:pageSize] query << "format=#{options[:format]}" if options[:format] query << "fields=#{Array(options[:fields]).join(',')}" if options[:fields] query << "offset=#{options[:offset]}" if options[:offset] query << "filter=#{options[:filter]}" if options[:filter] response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => 'vms/query', :query => query.map {|q| URI.escape(q)}.join('&') ) ensure_list! response.body, :Link ensure_list! response.body, response.body[:type] == 'application/vnd.vmware.vcloud.query.references+xml' ? :VMReference : :VMRecord %w[firstPage previousPage nextPage lastPage].each do |rel| if link = response.body[:Link].find {|l| l[:rel] == rel} href = Nokogiri::XML.fragment(link[:href]) query = CGI.parse(URI.parse(href.text).query) response.body[rel.to_sym] = query['page'].first.to_i response.body[:pageSize] ||= query['pageSize'].first.to_i end end response end
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 pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-InstantiateVAppTemplate.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/instantiate_vapp_template.rb, line 21 def instantiate_vapp_template(vapp_name, template_id, options={}) params = populate_uris(options.merge(:vapp_name => vapp_name, :template_id => template_id)) # @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'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vdc/#{params[:vdc_id]}/action/instantiateVAppTemplate" ) end
# File lib/fog/vcloud_director/compute.rb, line 442 def make_task_object(task_response) task_response[:id] = task_response[:href].split('/').last tasks.new(task_response) end
# File lib/fog/vcloud_director/compute.rb, line 370 def org_name login if @org_name.nil? @org_name end
Retrieve a screen ticket that you can use with the VMRC browser plug-in to gain access to the console of a running VM.
@param [String] id Object
identifier of the VM. @return [Excon::Response]
* body<~Hash>:
@raise [Fog::Compute::VcloudDirector::Conflict]
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-AcquireTicket.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/post_acquire_ticket.rb, line 16 def post_acquire_ticket(id) request( :expects => 200, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/screen/action/acquireTicket" ) end
Answer a question being asked by a VM.
@param [String] id Object
identifier of the VM. @param [Integer] choice_id Choice ID of this answer. @param [String] question_id Question ID of the question. @return [Excon::Response]
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-AnswerVmPendingQuestion.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/post_answer_vm_pending_question.rb, line 14 def post_answer_pending_vm_question(id, choice_id, question_id) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5' } VmAnswerQuestion(attrs) { ChoiceId choice_id QuestionId question_id } end.to_xml request( :body => body, :expects => 204, # this might be wrong :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.vmPendingAnswer+xml'}, :method => 'POST', :path => "vApp/#{id}/quesiton/action/answer" ) end
Attach a disk to a VM.
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] disk_id Object
identifier of the disk. @param [Hash] options @option options [Integer] :BusNumber Bus number on which to place the
disk controller. If empty or missing, the system assigns a bus number and a unit number on that bus.
@option options [Integer] :BusNumber Unit number (slot) on the bus
specified by :BusNumber. Ignored if :BusNumber is empty or missing.
@return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-AttachDisk.html @since vCloud API version 5.1
# File lib/fog/vcloud_director/requests/compute/post_attach_disk.rb, line 23 def post_attach_disk(id, disk_id, options={}) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5' } DiskAttachOrDetachParams(attrs) { Disk(:href => "#{end_point}disk/#{disk_id}") if options.key?(:BusNumber) BusNumber options[:BusNumber] end if options.key?(:UnitNumber) BusNumber options[:UnitNumber] end } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.diskAttachOrDetachParams+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/disk/action/attach" ) end
Cancel a task.
@param [String] id Object
identifier of the task. @return [Excon::Response]
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-CancelTask.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/post_cancel_task.rb, line 15 def post_cancel_task(id) request( :expects => 204, :method => 'POST', :path => "task/#{id}/action/cancel" ) end
Create a vApp template from a vApp.
The response includes a Task
element. You can monitor the task to to track the creation of the vApp template.
@param [String] vdc_id Object
identifier of the vDC. @param [String] name Name of the vApp template. @param [String] source_id Object
identifier of the vApp to capture. @param [Hash] options @option options [String] :Description Optional description. @option options [Hash] :LeaseSettingsSection
* :StorageLeaseInSeconds<~Integer> - Storage lease in seconds.
@option options [Hash] :CustomizationSection
* :goldMaster<~Boolean> - True if this template is a gold master. * :CustomizeOnInstantiate<~Boolean> - True if instantiating this template applies customization settings. Otherwise, instantiation creates an identical copy.
@return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-CaptureVApp.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/post_capture_vapp.rb, line 27 def post_capture_vapp(vdc_id, name, source_id, options={}) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', 'xmlns:ovf' => 'http://schemas.dmtf.org/ovf/envelope/1', :name => name } CaptureVAppParams(attrs) { if options.key?(:Description) Description options[:Description] end Source(:href => "#{end_point}vApp/#{source_id}") if section = options[:LeaseSettingsSection] LeaseSettingsSection { self['ovf'].Info 'Lease settings section' if section.key?(:StorageLeaseInSeconds) StorageLeaseInSeconds section[:StorageLeaseInSeconds] end } end if section = options[:CustomizationSection] attrs = {} attrs[:goldMaster] = section[:goldMaster] if section.key?(:goldMaster) CustomizationSection(attrs) { self['ovf'].Info 'VApp template customization section' CustomizeOnInstantiate section[:CustomizeOnInstantiate] } end } end.to_xml request( :body => body, :expects => 201, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.captureVAppParams+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vdc/#{vdc_id}/action/captureVApp" ) end
Perform storage profile compliance check on a VM.
This operation is asynchronous and return a task. When the task completes, the compliance check on the VM has been completed and the results can be retrieved.
@param [String] id Object
identifier of the VM. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-CheckVmCompliance.html @since vCloud API version 5.1
# File lib/fog/vcloud_director/requests/compute/post_check_vm_compliance.rb, line 17 def post_check_vm_compliance(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/action/checkCompliance" ) end
Create a copy of a media object.
The response includes a Task
element. You can monitor the task to to track the creation of the vApp template.
@param [String] vdc_id Object
identifier of the vDC. @param [String] source_id Object
identifier of the source media
object.
@param [Hash] options @option options [String] :Description Optional description. @option options [Boolean] :IsSourceDelete A value of true deletes the
Source object after successful completion of the copy operation. Defaults to false if empty or missing.
@return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-CloneMedia.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/post_clone_media.rb, line 23 def post_clone_media(vdc_id, source_id, options={}) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5' } CloneMediaParams(attrs) { if options.key?(:Description) Description options[:Description] end Source(:href => "#{end_point}media/#{source_id}") if options.key?(:IsSourceDelete) IsSourceDelete options[:IsSourceDelete] end } end.to_xml response = request( :body => body, :expects => 201, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.cloneMediaParams+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vdc/#{vdc_id}/action/cloneMedia" ) ensure_list! response.body, :Files, :File response end
Create a copy of a vApp.
The response includes a Task
element. You can monitor the task to to track the creation of the vApp template.
@param [String] vdc_id Object
identifier of the vDC. @param [String] name Name of the new vApp. @param [String] source_id Object
identifier of the source vApp. @param [Hash] options @option options [Boolean] :deploy True if the vApp should be deployed
at instantiation. Defaults to true.
@option options [Boolean] :powerOn True if the vApp should be
powered-on at instantiation. Defaults to true.
@option options [String] :Description Optional description. @option options [Hash] :InstantiationParams Instantiation parameters
for the composed vApp.
@option options [Boolean] :IsSourceDelete Set to true to delete the
source object after the operation completes.
@return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-CloneVApp.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/post_clone_vapp.rb, line 28 def post_clone_vapp(vdc_id, name, source_id, options={}) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', :name => name } attrs[:deploy] = options[:deploy] if options.key?(:deploy) attrs[:powerOn] = options[:powerOn] if options.key?(:powerOn) CloneVAppParams(attrs) { if options.key?(:Description) Description options[:Description] end InstantiationParams { # TODO } Source(:href => "#{end_point}vApp/#{source_id}") if options.key?(:IsSourceDelete) IsSourceDelete options[:IsSourceDelete] end } end.to_xml request( :body => body, :expects => 201, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.cloneVAppParams+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vdc/#{vdc_id}/action/cloneVApp" ) end
Create a copy of a vApp template.
The response includes a Task
element. You can monitor the task to to track the creation of the vApp template.
@param [String] vdc_id Object
identifier of the vDC. @param [String] name Name of the new vApp template. @param [String] source_id Object
identifier of the source vApp
template.
@param [Hash] options @option options [String] :Description Optional description. @option options [Boolean] :IsSourceDelete Set to true to delete the
source object after the operation completes.
@return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-CloneVAppTemplate.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/post_clone_vapp_template.rb, line 23 def post_clone_vapp_template(vdc_id, name, source_id, options={}) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', :name => name } CloneVAppTemplateParams(attrs) { if options.key?(:Description) Description options[:Description] end Source(:href => "#{end_point}vAppTemplate/#{source_id}") if options.key?(:IsSourceDelete) IsSourceDelete options[:IsSourceDelete] end } end.to_xml request( :body => body, :expects => 201, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vdc/#{vdc_id}/action/cloneVAppTemplate" ) end
Compose a vApp from existing virtual machines.
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 vdc. @param [Hash] options @option options [Boolean] :powerOn Used to specify whether to power
on vApp on deployment, if not set default value is true.
@option options [Boolean] :deploy Used to specify whether to deploy
the vApp, if not set default value is true.
@option options [String] :name Used to identify the vApp. @option options [String] :networkName Used to conect the vApp and VMs to a VDC network, which has to exist beforehand. @option options [String] :networkHref Used to conect the vApp and VMs to a VDC network, which has to exist beforehand. @option options [String] :fenceMode Used to configure the network Mode (briged, isolated). @option options [String] :source_vms Array with VMs to be used to compose the vApp, each containing - :name, :href, :isGuestCustomizationEnabled, :computer_name and :ipAllocationMode (e.g. 'DHCP'). @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-ComposeVApp.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/post_compose_vapp.rb, line 30 def post_compose_vapp(id, options={}) body = Fog::Generators::Compute::VcloudDirector::ComposeVapp.new(options).generate_xml request( :body => body, :expects => 201, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.composeVAppParams+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vdc/#{id}/action/composeVApp" ) end
Configure edge gateway services like firewall, nat and load balancer.
The response includes a Task
element. You can monitor the task to track the configuration of edge gateway services.
@param [String] id Object
identifier of the edge gateway. @param [Hash] configuration @configuration firewall_service [Hash] - configurations for firewall service. @configuration nat_service [Hash] - configurations for NAT network service. @configuration load_balancer_service [Hash] - configurations for load balancer service @return [Excon::Response]
* body<~Hash>:
vCloud API Documentaion
@since vCloud API version 5.1
# File lib/fog/vcloud_director/requests/compute/post_configure_edge_gateway_services.rb, line 22 def post_configure_edge_gateway_services(id, configuration) body = Fog::Generators::Compute::VcloudDirector::EdgeGatewayServiceConfiguration.new(configuration).generate_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.admin.edgeGatewayServiceConfiguration+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "admin/edgeGateway/#{id}/action/configureServices" ) end
Consolidate VM snapshots.
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. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-ConsolidateVm-vApp.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/post_consolidate_vm_vapp.rb, line 16 def post_consolidate_vm_vapp(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/action/consolidate" ) end
Consolidate VM snapshots.
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. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-ConsolidateVm-vAppTemplate.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/post_consolidate_vm_vapp_template.rb, line 16 def post_consolidate_vm_vapp_template(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}/action/consolidate" ) end
Add an item to a catalog.
@param [String] id Object
identifier of the catalog. @param [String] name The name of the entity. @param [Hash] entity A reference to a VAppTemplate or Media
object.
* href<~String> - Contains the URI to the entity.
@param [Hash] options @option options [String] :operationKey Optional unique identifier to
support idempotent semantics for create and delete operations.
@option options [String] :Description Optional description. @return [Excon::Response]
* body<~Hash>:
@raise Fog::Compute::VcloudDirector::DuplicateName
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-CreateCatalogItem.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/post_create_catalog_item.rb, line 22 def post_create_catalog_item(id, name, entity, options={}) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', :name => name, } attrs[:operationKey] = options[:operationKey] if options.key?(:operationKey) CatalogItem(attrs) { if options.key?(:Description) Description options[:Description] end Entity(entity) } end.to_xml begin request( :body => body, :expects => 201, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.catalogItem+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "catalog/#{id}/catalogItems" ) rescue Fog::Compute::VcloudDirector::BadRequest => e if e.minor_error_code == 'DUPLICATE_NAME' raise Fog::Compute::VcloudDirector::DuplicateName.new(e.message) end raise end end
Create an Org vDC network.
This operation is asynchronous and returns a task that you can monitor to track the progress of the request.
Produce media type(s): application/vnd.vmware.vcloud.orgVdcNetwork+xml Output type: OrgVdcNetworkType
@param [String] vdc_id Object
identifier of the vDC @param [String] name The name of the entity. @param [Hash] options @option options [String] :Description Optional description. @option options [Hash] :Configuration Network
configuration. @option options [Hash] :EdgeGateway EdgeGateway that connects this
Org vDC network. Applicable only for routed networks.
@option options [Hash] :ServiceConfig Specifies the service
configuration for an isolated Org vDC networks.
@option options [Boolean] :IsShared True if this network is shared
to multiple Org vDCs. * :Configuration<~Hash>: NetworkConfigurationType * :IpScopes<~Hash>: * :IpScope<~Hash>: * :IsInherited<~Boolean>: ? * :Gateway<~String>: IP address of gw * :Netmask<~String>: Subnet mask of network * :Dns1<~String>: Primary DNS server. * :Dns2<~String>: Secondary DNS server. * :DnsSuffix<~String>: DNS suffix. * :IsEnabled<~String>: Indicates if subnet is enabled or not. Default value is True. * :IpRanges<~Array>: IP ranges used for static pool allocation in the network. Array of Hashes of: * :StartAddress - start IP in range * :EndAddress - end IP in range * :EdgeGateway<~Hash>: EdgeGateway that connects this Org vDC network. Applicable only for routed networks. * :ServiceConfig<~Hash>: Specifies the service configuration for an isolated network
@return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-CreateOrgVdcNetwork.html @since vCloud API version 5.1
# File lib/fog/vcloud_director/requests/compute/post_create_org_vdc_network.rb, line 53 def post_create_org_vdc_network(vdc_id, name, options={}) body = Fog::Generators::Compute::VcloudDirector::OrgVdcNetwork.new(options.merge(:name => name)).generate_xml request( :body => body, :expects => 201, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.orgVdcNetwork+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "admin/vdc/#{vdc_id}/networks" ) end
# File lib/fog/vcloud_director/requests/compute/post_create_snapshot.rb, line 6 def post_create_snapshot(id, options={}) body = Fog::Generators::Compute::VcloudDirector::CreateSnapshot.new(options).generate_xml request( :body => body, :expects => 202, :headers => { 'Content-Type' => 'application/vnd.vmware.vcloud.createSnapshotParams+xml' }, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/action/createSnapshot" ) end
Deploy a vApp or VM.
Deployment allocates all resources for the vApp and the virtual machines it contains.
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 vApp. @param [Hash] options @option options [Integer] :deploymentLeaseSeconds Lease in seconds
for deployment. A value of 0 is replaced by the organization default deploymentLeaseSeconds value.
@option options [Boolean] :forceCustomization Used to specify whether
to force customization on deployment, if not set default value is false.
@option options [Boolean] :powerOn Used to specify whether to power
on vApp on deployment, if not set default value is true.
@return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-DeployVApp.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/post_deploy_vapp.rb, line 28 def post_deploy_vapp(id, options={}) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5' } attrs[:deploymentLeaseSeconds] = options[:deploymentLeaseSeconds] if options.key?(:deploymentLeaseSeconds) attrs[:forceCustomization] = options[:forceCustomization] if options.key?(:forceCustomization) attrs[:powerOn] = options[:powerOn] if options.key?(:powerOn) DeployVAppParams(attrs) end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.deployVAppParams+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/action/deploy" ) end
Detach a disk from a VM.
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] disk_id Object
identifier of the disk. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-DetachDisk.html @since vCloud API version 5.1
# File lib/fog/vcloud_director/requests/compute/post_detach_disk.rb, line 17 def post_detach_disk(id, disk_id) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5' } DiskAttachOrDetachParams(attrs) { Disk(:href => "#{end_point}disk/#{disk_id}") } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.diskAttachOrDetachParams+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/disk/action/detach" ) end
Hide hardware-assisted CPU virtualization from guest OS.
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. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-DisableNestedHv.html @since vCloud API version 5.1
# File lib/fog/vcloud_director/requests/compute/post_disable_nested_hv.rb, line 16 def post_disable_nested_hv(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/action/disableNestedHypervisor" ) end
Disable a vApp template for download.
@param [String] id Object
identifier of the VM. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-DisableVAppTemplateDownload.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/post_disable_vapp_template_download.rb, line 13 def post_disable_vapp_template_download(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}/action/disableDownload" ) end
Discard suspended state of a vApp or VM.
Discarding the suspended state of a vApp discards the suspended state of all VMs it contains.
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 vApp or VM. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-DiscardVAppState.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/post_discard_vapp_state.rb, line 19 def post_discard_vapp_state(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/action/discardSuspendedState" ) end
Eject virtual media.
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] media_id Object
identifier of the media object. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-EjectCdRom.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/post_eject_cd_rom.rb, line 17 def post_eject_cd_rom(id, media_id) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5' } MediaInsertOrEjectParams(attrs) { Media(:href => "#{end_point}media/#{media_id}") } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/media/action/ejectMedia" ) end
Expose hardware-assisted CPU virtualization to guest OS.
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. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-EnableNestedHv.html @since vCloud API version 5.1
# File lib/fog/vcloud_director/requests/compute/post_enable_nested_hv.rb, line 16 def post_enable_nested_hv(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/action/enableNestedHypervisor" ) end
Enable a vApp template for download.
@param [String] id Object
identifier of the VM. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-EnableVAppTemplateDownload.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/post_enable_vapp_template_download.rb, line 13 def post_enable_vapp_template_download(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}/action/enableDownload" ) end
Place the vApp in maintenance mode.
When a vApp is in maintenance mode, it is read-only to users. Only a system administrator can modify it. User-initiated tasks that are running when the vApp enters maintenance mode continue to run.
@param [String] id Object
identifier of the vApp. @return [Excon::Response]
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-EnterMaintenanceMode.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/post_enter_maintenance_mode.rb, line 16 def post_enter_maintenance_mode(id) request( :expects => 204, :method => 'POST', :path => "vApp/#{id}/action/enterMaintenanceMode" ) end
Take the vApp out of maintenance mode.
@param [String] id Object
identifier of the vApp. @return [Excon::Response]
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-ExitMaintenanceMode.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/post_exit_maintenance_mode.rb, line 12 def post_exit_maintenance_mode(id) request( :expects => 204, :method => 'POST', :path => "vApp/#{id}/action/exitMaintenanceMode" ) end
Insert virtual media.
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] media_id Object
identifier of the media object. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-InsertCdRom.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/post_insert_cd_rom.rb, line 17 def post_insert_cd_rom(id, media_id) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5' } MediaInsertOrEjectParams(attrs) { Media(:href => "#{end_point}media/#{media_id}") } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/media/action/insertMedia" ) end
Install VMware Tools on a running VM.
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. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-InstallVMwareTools.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/post_install_vmware_tools.rb, line 16 def post_install_vmware_tools(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/action/installVMwareTools" ) end
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.
@note This may not work at all or may work only under certain
circumstances.
@param [String] id Object
identifier of the vDC. @param [String] vapp_template_id Object
identifier of the vApp
template.
@param [String] name @param [Hash] options @option options [Boolean] :deploy True if the vApp should be deployed
at instantiation. Defaults to true.
@option options [Boolean] :powerOn True if the vApp should be
powered-on at instantiation. Defaults to true.
@option options [String] :Description Optional description. @option options [Hash] :InstantiationParams Instantiation parameters
for the composed vApp. * :LeaseSettingsSection<~Hasn>: * :DeploymentLeaseTimeInSeconds<~Integer> - Deployment lease in seconds. * :StorageLeaseTimeInSeconds<~Integer> - Storage lease in seconds. * :DeploymentLeaseExpiration<~Integer> - Expiration date/time of deployment lease. * :StorageLeaseExpiration<~Integer> - Expiration date/time of storage lease. * :NetworkConfigSection<~Hash>: * :NetworkConfig<~Hash>: * :networkName<~String> - The name of the vApp network. * :Configuration<~Hash>: * :ParentNetwork<~Hash>: * :href<~String> - * :FenceMode<~String> - Isolation type of the network.
@option options [Boolean] :IsSourceDelete Set to true to delete the
source object after the operation completes.
@option options [Boolean] :AllEULAsAccepted True confirms acceptance
of all EULAs in a vApp template.
@return [Excon::Response]
* body<~Hash>:
@raise Fog::Compute::VcloudDirector::DuplicateName
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-InstantiateVAppTemplate.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/post_instantiate_vapp_template.rb, line 52 def post_instantiate_vapp_template(id, vapp_template_id, name, options={}) body = Nokogiri::XML::Builder.new do attrs = { 'xmlns' => 'http://www.vmware.com/vcloud/v1.5', 'xmlns:ovf' => 'http://schemas.dmtf.org/ovf/envelope/1', :name => name } attrs[:deploy] = options[:deploy] if options.key?(:deploy) attrs[:powerOn] = options[:powerOn] if options.key?(:powerOn) InstantiateVAppTemplateParams(attrs) { if options.key?(:Description) Description options[:Description] end if instantiation_params = options[:InstantiationParams] InstantiationParams { if section = instantiation_params[:LeaseSettingsSection] LeaseSettingsSection { self['ovf'].Info 'Lease settings section' if section.key?(:DeploymentLeaseInSeconds) DeploymentLeaseInSeconds section[:DeploymentLeaseInSeconds] end if section.key?(:StorageLeaseInSeconds) StorageLeaseInSeconds section[:StorageLeaseInSeconds] end if section.key?(:DeploymentLeaseExpiration) DeploymentLeaseExpiration section[:DeploymentLeaseExpiration].strftime('%Y-%m-%dT%H:%M:%S%z') end if section.key?(:StorageLeaseExpiration) StorageLeaseExpiration section[:StorageLeaseExpiration].strftime('%Y-%m-%dT%H:%M:%S%z') end } end if section = instantiation_params[:NetworkConfigSection] NetworkConfigSection { self['ovf'].Info 'Configuration parameters for logical networks' if network_configs = section[:NetworkConfig] network_configs = [network_configs] if network_configs.is_a?(Hash) network_configs.each do |network_config| NetworkConfig(:networkName => network_config[:networkName]) { if configuration = network_config[:Configuration] Configuration { ParentNetwork(configuration[:ParentNetwork]) FenceMode configuration[:FenceMode] } end } end end } end } end Source(:href => "#{end_point}vAppTemplate/#{vapp_template_id}") if options.key?(:IsSourceDelete) IsSourceDelete options[:IsSourceDelete] end if options.key?(:AllEULAsAccepted) AllEULAsAccepted options[:AllEULAsAccepted] end } end.to_xml begin request( :body => body, :expects => 201, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vdc/#{id}/action/instantiateVAppTemplate" ) rescue Fog::Compute::VcloudDirector::BadRequest => e if e.minor_error_code == 'DUPLICATE_NAME' raise Fog::Compute::VcloudDirector::DuplicateName.new(e.message) end raise end end
Log in and create a Session object.
@return [Excon::Response]
* body<~Hash>: * :href<~String> - The URI of the entity. * :type<~String> - The MIME type of the entity. * :org<~String> - The name of the user's organization. * :user<~String> - The name of the user that owns the session * :Link<~Array<Hash>]: * :href<~String> - Contains the URI to the linked entity. * :name<~String> - Contains the name of the linked entity. * :type<~String> - Contains the type of the linked entity. * :rel<~String> - Defines the relationship of the link to the object that contains it.
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-Login-sessions.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/post_login_session.rb, line 22 def post_login_session headers = { 'Accept' => "application/*+xml;version=#{@api_version}", 'Authorization' => "Basic #{Base64.encode64("#{@vcloud_director_username}:#{@vcloud_director_password}").delete("\r\n")}" } @connection.request( :expects => 200, :headers => headers, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "#{@path}/sessions" ) end
Power off a vApp or VM.
If used on a vApp, powers off all VMs in the vApp. If used on a VM, powers off the VM. This operation is available only for a vApp or VM that is powered on.
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 vApp or VM. @return [Excon::Response]
* body<~Hash>:
@raise [Fog::Compute::VcloudDirector::BadRequest]
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-PowerOffVApp.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/post_power_off_vapp.rb, line 25 def post_power_off_vapp(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/power/action/powerOff" ) end
 Power on a vApp or VM.
If used on a vApp, powers on all VMs in the vApp. If used on a VM, powers on the VM. This operation is available only for a vApp or VM that is powered off. 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 vApp or VM. @return [Excon::Response] * body<~Hash>: @raise [Fog::Compute::VcloudDirector::BadRequest] @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-PowerOnVApp.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/post_power_on_vapp.rb, line 25 def post_power_on_vapp(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/power/action/powerOn" ) end
Reboot a vApp or VM.
If used on a vApp, reboots all VMs in the vApp. If used on a VM, reboots the VM. This operation is available only for a vApp or VM that is powered on.
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 vApp or VM. @return [Excon::Response]
* body<~Hash>:
@raise [Fog::Compute::VcloudDirector::BadRequest]
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-RebootVApp.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/post_reboot_vapp.rb, line 22 def post_reboot_vapp(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/power/action/reboot" ) end
# File lib/fog/vcloud_director/requests/compute/post_recompose_vapp.rb, line 6 def post_recompose_vapp(id, options={}) body = Fog::Generators::Compute::VcloudDirector::RecomposeVapp.new(options).generate_xml request( :body => body, :expects => 202, :headers => { 'Content-Type' => 'application/vnd.vmware.vcloud.recomposeVAppParams+xml' }, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/action/recomposeVApp" ) end
Updates VM configuration.
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 [Hash] options
@option options [String] :name Change the VM's name [required]. @option options [String] :description VM description @option options [Integer] :cpu Number of CPUs @option options [Integer] :memory Memory in MB
@return [Excon::Response]
* body<~Hash>: * :Tasks<~Hash>: * :Task<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-ReconfigureVm.html @since vCloud API version 5.1
# File lib/fog/vcloud_director/requests/compute/post_reconfigure_vm.rb, line 26 def post_reconfigure_vm(id, options={}) body = Nokogiri::XML::Builder.new do |xml| attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', 'xmlns:ovf' => 'http://schemas.dmtf.org/ovf/envelope/1', 'xmlns:rasd' => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData', :name => options[:name] } xml.Vm(attrs) do xml.Description options[:description] if options[:description] virtual_hardware_section(xml, options) end end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.vm+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/action/reconfigureVm" ) end
Removes all user created snapshots for a vApp or virtual machine.
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 vApp or virtual machine. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-RemoveAllSnapshots.html @since vCloud API version 5.1
# File lib/fog/vcloud_director/requests/compute/post_remove_all_snapshots.rb, line 16 def post_remove_all_snapshots(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/action/removeAllSnapshots" ) end
Reset a vApp or VM.
If used on a vApp, resets all VMs in the vApp. If used on a VM, resets the VM. This operation is available only for a vApp or VM that is powered on.
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 vApp or VM. @return [Excon::Response]
* body<~Hash>:
@raise [Fog::Compute::VcloudDirector::BadRequest]
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-ResetVApp.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/post_reset_vapp.rb, line 22 def post_reset_vapp(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/power/action/reset" ) end
Reverts a vApp or virtual machine to the current snapshot, if any.
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 vApp or virtual machine. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-RevertSnapshot.html @since vCloud API version 5.1
# File lib/fog/vcloud_director/requests/compute/post_revert_snapshot.rb, line 16 def post_revert_snapshot(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/action/revertToCurrentSnapshot" ) end
Shut down a vApp or VM.
If used on a vApp, shuts down all VMs in the vApp. If used on a VM, shuts down the VM. This operation is available only for a vApp or VM that is powered on.
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 vApp or VM. @return [Excon::Response]
* body<~Hash>:
@raise [Fog::Compute::VcloudDirector::BadRequest]
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-ShutdownVApp.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/post_shutdown_vapp.rb, line 22 def post_shutdown_vapp(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/power/action/shutdown" ) end
Suspend a vApp or VM.
If used on a vApp, suspends all VMs in the vApp. If used on a VM, suspends the VM. This operation is available only for a vApp or VM that is powered on.
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 vApp or VM. @return [Excon::Response]
* body<~Hash>:
@raise [Fog::Compute::VcloudDirector::BadRequest]
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-SuspendVApp.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/post_suspend_vapp.rb, line 22 def post_suspend_vapp(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/power/action/suspend" ) end
Undeploy a vApp/VM.
Undeployment deallocates all resources used by the vApp and the VMs it contains.
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 vApp. @param [Hash] options @option options [String] :UndeployPowerAction The specified action is
applied to all virtual machines in the vApp. All values other than default ignore actions, order, and delay specified in the StartupSection. One of: - powerOff (Power off the virtual machines. This is the default action if this attribute is missing or empty) - suspend (Suspend the virtual machines) - shutdown (Shut down the virtual machines) - force (Attempt to power off the virtual machines. Failures in undeploying the virtual machine or associated networks are ignored. All references to the vApp and its virtual machines are removed from the database) - default (Use the actions, order, and delay specified in the StartupSection).
@return [Excon::Response]
* body<~Hash>:
@raise [Fog::Compute::VcloudDirector::BadRequest]
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-UndeployVApp.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/post_undeploy_vapp.rb, line 36 def post_undeploy_vapp(id, options={}) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5' } UndeployVAppParams(attrs) { if options[:UndeployPowerAction] UndeployPowerAction options[:UndeployPowerAction] end } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.undeployVAppParams+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/action/undeploy" ) end
Merge the metadata provided in the request with existing catalog item metadata.
@param [String] id Object
identifier of the catalog item. @param [Hash{String=>Boolean,DateTime,Fixnum,String}] metadata @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-UpdateCatalogItemMetadata.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/post_update_catalog_item_metadata.rb, line 14 def post_update_catalog_item_metadata(id, metadata={}) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance' } Metadata(attrs) { metadata.each do |key, value| MetadataEntry { Key key if api_version.to_f < 5.1 Value value else type = case value when TrueClass, FalseClass then 'MetadataBooleanValue'; when DateTime then 'MetadataDateTimeValue'; when Fixnum then 'MetadataNumberValue'; else 'MetadataStringValue' end TypedValue('xsi:type' => type) { Value value } end } end } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.metadata+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "catalogItem/#{id}/metadata/" ) end
Merge the metadata provided in the request with existing metadata.
@param [String] id Object
identifier of the disk. @param [Hash{String=>Boolean,DateTime,Fixnum,String}] metadata @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-UpdateDiskMetadata.html @since vCloud API version 5.1
# File lib/fog/vcloud_director/requests/compute/post_update_disk_metadata.rb, line 14 def post_update_disk_metadata(id, metadata={}) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance' } Metadata(attrs) { metadata.each do |key, value| MetadataEntry { Key key if api_version.to_f < 5.1 Value value else type = case value when TrueClass, FalseClass then 'MetadataBooleanValue'; when DateTime then 'MetadataDateTimeValue'; when Fixnum then 'MetadataNumberValue'; else 'MetadataStringValue' end TypedValue('xsi:type' => type) { Value value } end } end } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.metadata+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "disk/#{id}/metadata/" ) end
Merge the metadata provided in the request with existing metadata.
@param [String] id Object
identifier of the media object. @param [Hash{String=>Boolean,DateTime,Fixnum,String}] metadata @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-UpdateMediaMetadata.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/post_update_media_metadata.rb, line 14 def post_update_media_metadata(id, metadata={}) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance' } Metadata(attrs) { metadata.each do |key, value| MetadataEntry { Key key if api_version.to_f < 5.1 Value value else type = case value when TrueClass, FalseClass then 'MetadataBooleanValue'; when DateTime then 'MetadataDateTimeValue'; when Fixnum then 'MetadataNumberValue'; else 'MetadataStringValue' end TypedValue('xsi:type' => type) { Value value } end } end } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.metadata+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "media/#{id}/metadata/" ) end
Merge the metadata provided in the request with existing metadata.
@param [String] id Object
identifier of the vApp or VM. @param [Hash{String=>Boolean,DateTime,Fixnum,String}] metadata @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-UpdateVAppMetadata.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/post_update_vapp_metadata.rb, line 14 def post_update_vapp_metadata(id, metadata={}) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance' } Metadata(attrs) { metadata.each do |key, value| MetadataEntry { Key key if api_version.to_f < 5.1 Value value else type = case value when TrueClass, FalseClass then 'MetadataBooleanValue'; when DateTime then 'MetadataDateTimeValue'; when Fixnum then 'MetadataNumberValue'; else 'MetadataStringValue' end TypedValue('xsi:type' => type) { Value value } end } end } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.metadata+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/metadata/" ) end
Merge the metadata provided in the request with existing metadata.
@param [String] id Object
identifier of the vApp template. @param [Hash{String=>Boolean,DateTime,Fixnum,String}] metadata @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-UpdateVAppTemplateMetadata.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/post_update_vapp_template_metadata.rb, line 14 def post_update_vapp_template_metadata(id, metadata={}) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance' } Metadata(attrs) { metadata.each do |key, value| MetadataEntry { Key key if api_version.to_f < 5.1 Value value else type = case value when TrueClass, FalseClass then 'MetadataBooleanValue'; when DateTime then 'MetadataDateTimeValue'; when Fixnum then 'MetadataNumberValue'; else 'MetadataStringValue' end TypedValue('xsi:type' => type) { Value value } end } end } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.metadata+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vAppTemplate/#{id}/metadata/" ) end
Upgrade the virtual hardware version of a VM to the highest supported virtual hardware version of the vDC that contains it.
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. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-UpgradeHwVersion.html @since vCloud API version 5.1
# File lib/fog/vcloud_director/requests/compute/post_upgrade_hw_version.rb, line 17 def post_upgrade_hw_version(id) request( :expects => 202, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/action/upgradeHardwareVersion" ) end
Create a disk.
@param [String] id Object
identifier of the vDC. @param [String] name The name of the disk. @param [Integer] size Size of the disk. For modify operation this is
required only for the XSD validation it could not be changed.
@param [Hash] options @option options [String] :operationKey Optional unique identifier to
support idempotent semantics for create and delete operations.
@option options [Integer] :busSubType Disk
bus sub type. @option options [Integer] :busType Disk
bus type. @option options [String] :Description Optional description. @return [Excon::Response]
* body<~Hash>: * :href<~String> - The URI of the disk. * :type<~String> - The MIME type of the disk. * :id<~String> - The disk identifier, expressed in URN format. * :operationKey<~String> - Optional unique identifier to support idempotent semantics for create and delete operations. * :name<~String> - The name of the disk. * :status<~String> - Creation status of the disk. * :busSubType<~String> - Disk bus sub type. * :busType<~String> - Disk bus type. * :size<~String> - Size of the disk. * :Link: * :Description<~String> - Optional description. * :Tasks<~Hash>: * :StorageProfile<~Hash> - Storage profile of the disk. * :href<~String> - Contains the URI to the entity. * :name<~String> - Contains the name of the entity. * :type<~String> - Contains the type of the entity. * :Owner<~Hash> - Disk owner. * :type<~String> - The MIME type of the entity. * :User<~Hash> - Reference to the user who is the owner of this disk. * :href<~String> - Contains the URI to the entity. * :name<~String> - Contains the name of the entity. * :type<~String> - Contains the type of the entity.
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-CreateDisk.html @since vCloud API version 5.1
# File lib/fog/vcloud_director/requests/compute/post_upload_disk.rb, line 46 def post_upload_disk(id, name, size, options={}) body = Nokogiri::XML::Builder.new do DiskCreateParams(:xmlns => 'http://www.vmware.com/vcloud/v1.5') { attrs = { :name => name, :size => size } attrs[:operationKey] = options[:operationKey] if options.key?(:operationKey) attrs[:busSubType] = options[:busSubType] if options.key?(:busSubType) attrs[:busType] = options[:busType] if options.key?(:busType) Disk(attrs) { if options.key?(:Description) Description options[:Description] end if options.key?(:StorageProfile) attrs = { :href => options[:StorageProfile][:href] } StorageProfile(attrs) end } } end.to_xml request( :body => body, :expects => 201, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.diskCreateParams+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vdc/#{id}/disk" ) end
Upload a media image.
The response includes an upload link for the media image.
@param [String] vdc_id Object
identifier of the vDC. @param [String] name The name of the media image. @param [String] image_type Media
image type. One of: iso, floppy. @param [Integer] size Size of the media file, in bytes. @param [Hash] options @option options [String] :operationKey Optional unique identifier to
support idempotent semantics for create and delete operations.
@option options [String] :Description Optional description. @return [Excon::Response]
* body<~Hash>:
@raise [Fog::Compute::VcloudDirector::BadRequest] @raise [Fog::Compute::VcloudDirector::Forbidden]
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-UploadMedia.html @since vCloud API version 0.9 @todo Support vDC Storage
Profiles.
# File lib/fog/vcloud_director/requests/compute/post_upload_media.rb, line 26 def post_upload_media(vdc_id, name, image_type, size, options={}) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', :name => name, :imageType => image_type, :size => size } attrs[:operationKey] = options[:operationKey] if options.key?(:operationKey) Media(attrs) { if options.key?(:Description) Description options[:Description] end } end.to_xml response = request( :body => body, :expects => 201, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.media+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vdc/#{vdc_id}/media" ) ensure_list! response.body, :Files, :File response end
Upload an OVF package to create a vApp template
The response includes an upload link for the OVF descriptor.
@param [String] vdc_id Object
identifier of the vDC. @param [String] name The name of the vApp template. @param [Hash] options @option options [Boolean] :manifestRequired True if an OVF manifest
is included in the upload. Default value is false.
@option options [String] :Description Optional description. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-UploadVAppTemplate.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/post_upload_vapp_template.rb, line 20 def post_upload_vapp_template(vdc_id, name, options={}) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', :name => name } attrs[:manifestRequired] = options[:manifestRequired] if options.key?(:manifestRequired) UploadVAppTemplateParams(attrs) { if options.key?(:Description) Description options[:Description] end } end.to_xml request( :body => body, :expects => 201, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.uploadVAppTemplateParams+xml'}, :method => 'POST', :parser => Fog::ToHashDocument.new, :path => "vdc/#{vdc_id}/action/uploadVAppTemplate" ) end
# File lib/fog/vcloud_director/compute.rb, line 436 def process_task(response_body) task = make_task_object(response_body) wait_and_raise_unless_success(task) true end
Set the metadata value for the specified key to the value provided, overwriting any existing value.
@param [String] id Object
identifier of the catalog item. @param [String] key Key of the metadata item. @param [Boolean,DateTime,Fixnum,String] value Value of the metadata
item.
@return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/PUT-CatalogItemMetadataItem-metadata.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/put_catalog_item_metadata_item_metadata.rb, line 17 def put_catalog_item_metadata_item_metadata(id, key, value) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance' } MetadataValue(attrs) { if api_version.to_f < 5.1 Value value else type = case value when TrueClass, FalseClass then 'MetadataBooleanValue'; when DateTime then 'MetadataDateTimeValue'; when Fixnum then 'MetadataNumberValue'; else 'MetadataStringValue' end TypedValue('xsi:type' => type) { Value value } end } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.metadata.value+xml'}, :method => 'PUT', :parser => Fog::ToHashDocument.new, :path => "catalogItem/#{id}/metadata/#{URI.escape(key)}" ) end
Update the network config section of a vApp.
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/PUT-NetworkConfigSection-vApp.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/put_config_network_section_vapp.rb, line 11 def put_config_network_section_vapp(id, options={}) body = Fog::Generators::Compute::VcloudDirector::NetworkConfigSection.new(options).generate_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.networkConfigSection+xml'}, :method => 'PUT', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/networkConfigSection" ) end
Update the RASD item that specifies CPU properties of a VM.
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 [Integer] num_cpus @return [Excon:Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/PUT-Cpu.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/put_cpu.rb, line 20 def put_cpu(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="#{end_point}vApp/#{id}/virtualHardwareSection/cpu" ns12:type="application/vnd.vmware.vcloud.rasdItem+xml" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 #{end_point}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"> <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits> <rasd:Description>Number of Virtual CPUs</rasd:Description> <rasd:ElementName>#{num_cpus} virtual CPU(s)</rasd:ElementName> <rasd:InstanceID>4</rasd:InstanceID> <rasd:Reservation>0</rasd:Reservation> <rasd:ResourceType>3</rasd:ResourceType> <rasd:VirtualQuantity>#{num_cpus}</rasd:VirtualQuantity> <rasd:Weight>0</rasd:Weight> <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="#{end_point}vApp/#{id}/virtualHardwareSection/cpu"/> </Item> EOF request( :body => data, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.rasdItem+xml'}, :method => 'PUT', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/virtualHardwareSection/cpu" ) end
Set the value for the specified metadata key to the value provided, overwriting any existing value.
@param [String] id Object
identifier of the disk. @param [String] key Key of the metadata item. @param [Boolean,DateTime,Fixnum,String] value Value of the metadata
item.
@return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/PUT-DiskMetadataItem-metadata.html @since vCloud API version 5.1
# File lib/fog/vcloud_director/requests/compute/put_disk_metadata_item_metadata.rb, line 17 def put_disk_metadata_item_metadata(id, key, value) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance' } MetadataValue(attrs) { type = case value when TrueClass, FalseClass then 'MetadataBooleanValue'; when DateTime then 'MetadataDateTimeValue'; when Fixnum then 'MetadataNumberValue'; else 'MetadataStringValue' end TypedValue('xsi:type' => type) { Value value } } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.metadata.value+xml'}, :method => 'PUT', :parser => Fog::ToHashDocument.new, :path => "disk/#{id}/metadata/#{URI.escape(key)}" ) end
Update all RASD items that specify hard disk and hard disk controller properties of a VM.
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 [Array] disks
* disks is the body of #get_vm_disks
@return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/PUT-Disks.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/put_disks.rb, line 24 def put_disks(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'}, :method => 'PUT', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/virtualHardwareSection/disks" ) end
Updates the guest customization section of a VM.
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 [Hash] options @option options [Boolean] :Enabled True if guest customization is
enabled.
@option options [Boolean] :ChangeSid True if customization can change
the Windows SID of this virtual machine.
@option options [Boolean] :JoinDomainEnabled True if this virtual
machine can join a Windows Domain.
@option options [Boolean] :UseOrgSettings True if customization
should use organization settings (OrgGuestPersonalizationSettings) when joining a Windows Domain.
@option options [String] :DomainName The name of the Windows Domain
to join.
@option options [String] :DomainUserName User name to specify when
joining a Windows Domain.
@option options [String] :DomainUserPassword Password to use with
:DomainUserName.
@option options [String] :MachineObjectOU The name of the Windows
Domain Organizational Unit (OU) in which the computer account for this virtual machine will be created.
@option options [Boolean] :AdminPassword_enabled True if guest
customization can modify administrator password settings for this virtual machine.
@option options [Boolean] :AdminPassword_auto True if the
administrator password for this virtual machine should be automatically generated.
@option options [String] :AdminPassword True if the administrator
password for this virtual machine should be set to this string. (:AdminPasswordAuto must be false.)
@option options [Boolean] :ResetPasswordRequired True if the
administrator password for this virtual machine must be reset after first use.
@option customization [String] :CustomizationScript Script to run on
guest customization. The entire script must appear in this element.
@option customization [String] :ComputerName Computer name to assign
to this virtual machine.
@return [Excon::Response]
* body<~Hash>: * :Tasks<~Hash>: * :Task<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/PUT-GuestCustomizationSection-vApp.html @since vCloud API version 1.0
# File lib/fog/vcloud_director/requests/compute/put_guest_customization_section_vapp.rb, line 56 def put_guest_customization_section_vapp(id, options={}) options = options.dup # Mutate options to new format. deprecated = { :enabled => :Enabled, :change_sid => :ChangeSid, :join_domain_enabled => :JoinDomainEnabled, :use_org_settings => :UseOrgSettings, :admin_password => :AdminPassword, :admin_password_enabled => :AdminPasswordEnabled, :admin_password_auto => :AdminPasswordAuto, :reset_password_required => :ResetPasswordRequired, :customization_script => :CustomizationScript, :computer_name => :ComputerName } deprecated.each do |from, to| options[to] = options.delete(from) if options.key?(from) end body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', 'xmlns:ovf' => 'http://schemas.dmtf.org/ovf/envelope/1' } GuestCustomizationSection(attrs) { self['ovf'].Info 'Specifies Guest OS Customization Settings' if options.key?(:Enabled) Enabled options[:Enabled] end if options.key?(:ChangeSid) ChangeSid options[:ChangeSid] end if options.key?(:JoinDomainEnabled) JoinDomainEnabled options[:JoinDomainEnabled] end if options.key?(:UseOrgSettings) UseOrgSettings options[:UseOrgSettings] end if options.key?(:DomainName) DomainName options[:DomainName] end if options.key?(:DomainUser) DomainUser options[:DomainUser] end if options.key?(:DomainUserPassword) DomainUserPassword options[:DomainUserPassword] end if options.key?(:MachineObjectOU) MachineObjectOU options[:MachineObjectOU] end if options.key?(:AdminPasswordEnabled) AdminPasswordEnabled options[:AdminPasswordEnabled] end if options.key?(:AdminPasswordAuto) AdminPasswordAuto options[:AdminPasswordAuto] end # Don't add AdminPassword if AdminPasswordAuto is true if options.key?(:AdminPassword) and !options[:AdminPasswordAuto] AdminPassword options[:AdminPassword] end if options.key?(:ResetPasswordRequired) ResetPasswordRequired options[:ResetPasswordRequired] end if options.key?(:CustomizationScript) CustomizationScript options[:CustomizationScript] end if options.key?(:ComputerName) ComputerName options[:ComputerName] end } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.guestCustomizationSection+xml'}, :method => 'PUT', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/guestCustomizationSection" ) end
Set the value for the specified metadata key to the value provided, overwriting any existing value.
@param [String] id Object
identifier of the media object. @param [String] key Key of the metadata item. @param [Boolean,DateTime,Fixnum,String] value Value of the metadata
item.
@return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/PUT-MediaMetadataItem-metadata.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/put_media_metadata_item_metadata.rb, line 17 def put_media_metadata_item_metadata(id, key, value) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance' } MetadataValue(attrs) { if api_version.to_f < 5.1 Value value else type = case value when TrueClass, FalseClass then 'MetadataBooleanValue'; when DateTime then 'MetadataDateTimeValue'; when Fixnum then 'MetadataNumberValue'; else 'MetadataStringValue' end TypedValue('xsi:type' => type) { Value value } end } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.metadata.value+xml'}, :method => 'PUT', :parser => Fog::ToHashDocument.new, :path => "media/#{id}/metadata/#{URI.escape(key)}" ) end
Update the RASD item that specifies memory properties of a VM.
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 [Integer] memory Memory size in Megabytes. @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/PUT-Memory.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/put_memory.rb, line 20 def put_memory(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="#{end_point}vApp/#{id}/virtualHardwareSection/memory" ns12:type="application/vnd.vmware.vcloud.rasdItem+xml" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 #{end_point}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"> <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits> <rasd:Description>Memory Size</rasd:Description> <rasd:ElementName>#{memory} MB of memory</rasd:ElementName> <rasd:InstanceID>5</rasd:InstanceID> <rasd:Reservation>0</rasd:Reservation> <rasd:ResourceType>4</rasd:ResourceType> <rasd:VirtualQuantity>#{memory}</rasd:VirtualQuantity> <rasd:Weight>0</rasd:Weight> <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="#{end_point}vApp/#{id}/virtualHardwareSection/memory"/> </Item> EOF request( :body => data, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.rasdItem+xml'}, :method => 'PUT', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/virtualHardwareSection/memory" ) end
deprecated Use {#put_vapp_metadata_item_metadata} instead.
# File lib/fog/vcloud_director/requests/compute/put_metadata_value.rb, line 6 def put_metadata_value(vm_id, metadata_key, metadata_value) Fog::Logger.deprecation("#{self} => ##{put_metadata_value} is deprecated, use ##{put_vapp_metadata_item_metadata} instead [light_black](#{caller.first})[/]") body=" <MetadataValue xmlns=\"http://www.vmware.com/vcloud/v1.5\"> <Value>#{metadata_value}</Value> </MetadataValue>" request( :body => body, :expects => 202, :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)}" ) end
Update an Org vDC network.
This operation is asynchronous and returns a task that you can monitor to track the progress of the request.
Produce media type(s): application/vnd.vmware.vcloud.orgVdcNetwork+xml Output type: TaskType
@param [String] id Object
identifier of the network @param [String] name The name of the entity. @param [Hash] options @option options [String] :Description Optional description. @option options [Hash] :Configuration Network
configuration. @option options [Hash] :EdgeGateway EdgeGateway that connects this
Org vDC network. Applicable only for routed networks.
@option options [Hash] :ServiceConfig Specifies the service
configuration for an isolated Org vDC networks.
@option options [Boolean] :IsShared True if this network is shared
to multiple Org vDCs. * :Configuration<~Hash>: NetworkConfigurationType * :IpScopes<~Hash>: * :IpScope<~Hash>: * :IsInherited<~Boolean>: ? * :Gateway<~String>: IP address of gw * :Netmask<~String>: Subnet mask of network * :Dns1<~String>: Primary DNS server. * :Dns2<~String>: Secondary DNS server. * :DnsSuffix<~String>: DNS suffix. * :IsEnabled<~String>: Indicates if subnet is enabled or not. Default value is True. * :IpRanges<~Array>: IP ranges used for static pool allocation in the network. Array of Hashes of: * :StartAddress - start IP in range * :EndAddress - end IP in range * :EdgeGateway<~Hash>: EdgeGateway that connects this Org vDC network. Applicable only for routed networks. * :ServiceConfig<~Hash>: Specifies the service configuration for an isolated network
@return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/POST-CreateOrgVdcNetwork.html @since vCloud API version 5.1
# File lib/fog/vcloud_director/requests/compute/put_network.rb, line 53 def put_network(id, name, options={}) body = Fog::Generators::Compute::VcloudDirector::OrgVdcNetwork.new(options.merge(:name => name)).generate_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.orgVdcNetwork+xml'}, :method => 'PUT', :parser => Fog::ToHashDocument.new, :path => "admin/network/#{id}" ) end
Update the network connection section of a VM.
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 [Hash] options Container for the network connections of this
virtual machine.
@option options [Integer] :PrimaryNetworkConnectionIndex (0)
Virtual slot number associated with the NIC that should be considered this virtual machine's primary network connection. Defaults to slot 0.
@option options [Array<Hash>] :NetworkConnection
* :needsCustomization<~Boolean> - True if this NIC needs customization. * :network<~String> - Name of the network to which this NIC is connected. * :NetworkConnectionIndex<~Integer> - Virtual slot number associated with this NIC. First slot number is 0. * :IpAddress<~String> - IP address assigned to this NIC. * :IsConnected<~Boolean> - If the virtual machine is undeployed, this value specifies whether the NIC should be connected upon deployment. If the virtual machine is deployed, this value reports the current status of this NIC's connection, and can be updated to change that connection status. * :MACAddress<~String> - MAC address associated with the NIC. * :IpAddressAllocationMode<~String> - IP address allocation mode for this connection. One of: - POOL (A static IP address is allocated automatically from a pool of addresses.) - DHCP (The IP address is obtained from a DHCP service.) - MANUAL (The IP address is assigned manually in the :IpAddress element.) - NONE (No IP addressing mode specified.)
@return [Excon::Response]
* body<~Hash>: * :Tasks<~Hash>: * :Task<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/PUT-NetworkConnectionSystemSection-vApp.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/put_network_connection_system_section_vapp.rb, line 49 def put_network_connection_system_section_vapp(id, options={}) options = options.dup # Mutate options to new format. deprecated = { :needs_customization => :needsCustomization, :network => :network, :network_connection_index => :NetworkConnectionIndex, :ip_address => :IpAddress, :is_connected => :IsConnected, :mac_address => :MACAddress, :ip_address_allocation_mode => :IpAddressAllocationMode } option = options.delete(:primary_network_connection_index) options[:PrimaryNetworkConnectionIndex] ||= option unless option.nil? unless options.key?(:NetworkConnection) deprecated.each do |from, to| if options.key?(from) options[:NetworkConnection] ||= [{}] options[:NetworkConnection].first[to] = options.delete(from) end end end options[:NetworkConnection] = [options[:NetworkConnection]] if options[:NetworkConnection].is_a?(Hash) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', 'xmlns:ovf' => 'http://schemas.dmtf.org/ovf/envelope/1' } NetworkConnectionSection(attrs) { self[:ovf].Info 'Specifies the available VM network connections' if options.key?(:PrimaryNetworkConnectionIndex) PrimaryNetworkConnectionIndex options[:PrimaryNetworkConnectionIndex] end if network_connection = options[:NetworkConnection] network_connection.each do |nic| attrs = { :network => nic[:network] } if nic.key?(:needsCustomization) attrs[:needsCustomization] = nic[:needsCustomization] end NetworkConnection(attrs) { NetworkConnectionIndex nic[:NetworkConnectionIndex] if nic.key?(:IpAddress) IpAddress nic[:IpAddress] end IsConnected nic[:IsConnected] if nic.key?(:MACAddress) MACAddress nic[:MACAddress] end IpAddressAllocationMode nic[:IpAddressAllocationMode] } end end } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.networkConnectionSection+xml'}, :method => 'PUT', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/networkConnectionSection/" ) end
Set the value for the specified metadata key to the value provided, overwriting any existing value.
@param [String] id Object
identifier of the vApp @param [Array] sections List of sections hashes @return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.doc_51/GUID-E13A5613-8A41-46E3-889B-8E1EAF10ABBE.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/put_product_sections.rb, line 15 def put_product_sections(id, sections) xml = '<ProductSectionList xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1">' xml += '<ovf:ProductSection>' xml += '<ovf:Info>Global vApp Custom Properties</ovf:Info>' xml += '<ovf:Category>Global</ovf:Category>' sections.each do |section| section[:user_configurable] ||= true section[:type] ||= "string" section[:password] ||= false xml += "<ovf:Property ovf:userConfigurable='#{section[:user_configurable]}' ovf:type='#{section[:type]}' ovf:password='#{section[:password]}' ovf:key='#{section[:id]}' ovf:value='#{section[:value]}'>" xml += "<ovf:Label>#{section[:id]}</ovf:Label>" xml += "</ovf:Property>" end xml += '</ovf:ProductSection>' xml += "</ProductSectionList>" request( :body => xml, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.productSections+xml'}, :method => 'PUT', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/productSections" ) end
Set the value for the specified metadata key to the value provided, overwriting any existing value.
@param [String] id Object
identifier of the vApp or VM. @param [String] key Key of the metadata item. @param [Boolean,DateTime,Fixnum,String] value Value of the metadata
item.
@return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/PUT-VAppMetadataItem-metadata.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/put_vapp_metadata_item_metadata.rb, line 17 def put_vapp_metadata_item_metadata(id, key, value) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance' } MetadataValue(attrs) { if api_version.to_f < 5.1 Value value else type = case value when TrueClass, FalseClass then 'MetadataBooleanValue'; when DateTime then 'MetadataDateTimeValue'; when Fixnum then 'MetadataNumberValue'; else 'MetadataStringValue' end TypedValue('xsi:type' => type) { Value value } end } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.metadata.value+xml'}, :method => 'PUT', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/metadata/#{URI.escape(key)}" ) end
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 vApp. @param [String] name of the vApp. @param [Hash] options
* :Description<~String>: - description to be assigned (optional)
@return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-55/topic/com.vmware.vcloud.api.reference.doc_55/doc/operations/PUT-VAppNameAndDescription.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/put_vapp_name_and_description.rb, line 22 def put_vapp_name_and_description(id, name, options={}) body = Fog::Generators::Compute::VcloudDirector::Vapp.new(name, options).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
Set the value for the specified metadata key to the value provided, overwriting any existing value.
@param [String] id Object
identifier of the vApp template. @param [String] key Key of the metadata item. @param [Boolean,DateTime,Fixnum,String] value Value of the metadata
item.
@return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/PUT-VAppTemplateMetadataItem-metadata.html @since vCloud API version 1.5
# File lib/fog/vcloud_director/requests/compute/put_vapp_template_metadata_item_metadata.rb, line 17 def put_vapp_template_metadata_item_metadata(id, key, value) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance' } MetadataValue(attrs) { if api_version.to_f < 5.1 Value value else type = case value when TrueClass, FalseClass then 'MetadataBooleanValue'; when DateTime then 'MetadataDateTimeValue'; when Fixnum then 'MetadataNumberValue'; else 'MetadataStringValue' end TypedValue('xsi:type' => type) { Value value } end } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.metadata.value+xml'}, :method => 'PUT', :parser => Fog::ToHashDocument.new, :path => "vappTemplate/#{id}/metadata/#{URI.escape(key)}" ) end
Update the name, description and storage profile for VM.
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 [Hash] options
* :Description<~String>: - description to be assigned. * :StorageProfile<~Hash>: - storage profile to be assigned. * :name<~String> * :href<~String>
@return [Excon::Response]
* body<~Hash>:
@see pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/PUT-Vm.html @since vCloud API version 0.9
# File lib/fog/vcloud_director/requests/compute/put_vm.rb, line 24 def put_vm(id, name, options) body = Fog::Generators::Compute::VcloudDirector::Vm.new(options.merge(:name => name)).generate_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.vm+xml'}, :method => 'PUT', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}" ) end
Update VM's capabilities.
@param [String] id Object
identifier of the VM. @param [Hash] options @option options [Boolean] :MemoryHotAddEnabled True if the virtual
machine supports addition of memory while powered on.
@option options [Boolean] :CpuHotAddEnabled True if the virtual
machine supports addition of virtual CPUs while powered on.
@return [Excon::Response]
* body<~Hash>:
# File lib/fog/vcloud_director/requests/compute/put_vm_capabilities.rb, line 17 def put_vm_capabilities(id, options={}) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5' } VmCapabilities(attrs) { if options.key?(:MemoryHotAddEnabled) MemoryHotAddEnabled options[:MemoryHotAddEnabled] end if options.key?(:CpuHotAddEnabled) MemoryHotAddEnabled options[:CpuHotAddEnabled] end } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.vmCapabilitiesSection+xml'}, :method => 'PUT', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/vmCapabilities" ) end
# File lib/fog/vcloud_director/compute.rb, line 380 def reload @connection.reset end
# File lib/fog/vcloud_director/compute.rb, line 384 def request(params) begin do_request(params) rescue EOFError # This error can occur if Vcloud receives a request from a network # it deems to be unauthorized; no HTTP response is sent, but the # connection is sent a signal to terminate early. raise( MalformedResponse, "Connection unexpectedly terminated by vcloud" ) # this is to know if Excon::Errors::Unauthorized really happens #rescue Excon::Errors::Unauthorized # login # do_request(params) end end
@deprecated Use {#post_undeploy_vapp} instead.
# File lib/fog/vcloud_director/requests/compute/post_undeploy_vapp.rb, line 59 def undeploy(id) Fog::Logger.deprecation("#{self} => ##{undeploy} is deprecated, use ##{post_undeploy_vapp} instead [light_black](#{caller.first})[/]") post_undeploy_vapp(id, :UndeployPowerAction => 'shutdown') end
# File lib/fog/vcloud_director/compute.rb, line 375 def user_name login if @user_name.nil? @user_name end
# File lib/fog/vcloud_director/compute.rb, line 365 def vcloud_token login if @vcloud_token.nil? @vcloud_token end
# File lib/fog/vcloud_director/compute.rb, line 447 def wait_and_raise_unless_success(task) task.wait_for { non_running? } raise TaskError.new "status: #{task.status}, error: #{task.error}" unless task.success? end
Private Instance Methods
# File lib/fog/vcloud_director/compute.rb, line 503 def check_session_matches_credentials(session_org, session_user) fog_credential_org = @vcloud_director_username.split('@').last fog_credential_user = @vcloud_director_username.split('@')[0...-1].join('@') if session_org != fog_credential_org raise Fog::Errors::Error.new "FOG_CREDENTIAL specified is for vCloud organisation '#{fog_credential_org}' but " + "your current session is for '#{session_org}'. You should generate a new FOG_VCLOUD_TOKEN." end if session_user != fog_credential_user raise Fog::Errors::Error.new "FOG_CREDENTIAL specified is for user '#{fog_credential_user}' but " + "your current session is for '#{session_user}'. You should generate a new FOG_VCLOUD_TOKEN." end end
# File lib/fog/vcloud_director/requests/compute/post_reconfigure_vm.rb, line 62 def cpu_section(xml, cpu) xml['ovf'].Item do xml['rasd'].AllocationUnits 'hertz * 10 ^ 6' xml['rasd'].InstanceID 5 xml['rasd'].ResourceType 3 xml['rasd'].VirtualQuantity cpu.to_i end end
# File lib/fog/vcloud_director/requests/compute/instantiate_vapp_template.rb, line 97 def endpoint end_point end
# File lib/fog/vcloud_director/requests/compute/instantiate_vapp_template.rb, line 47 def generate_instantiate_vapp_template_request(options ={}) #overriding some params so they work with new standardised generator options[:InstantiationParams] = { :NetworkConfig => [{ :networkName => options[:network_name], :networkHref => options[:network_uri], :fenceMode => 'bridged' }] } unless options[:InstantiationParams] || !options[:network_uri] options[:name] = options.delete(:vapp_name) if options[:vapp_name] options[:Description] = options.delete(:description) unless options[:Description] if options[:vms_config] then options[:source_vms] = options.delete(:vms_config) options[:source_vms].each_with_index {|vm, i|options[:source_vms][i][:StorageProfileHref] = options[:source_vms][i].delete(:storage_profile_href) } end options[:Source] = options.delete(:template_uri) if options[:template_uri] Fog::Generators::Compute::VcloudDirector::InstantiateVappTemplateParams.new(options).generate_xml end
# File lib/fog/vcloud_director/compute.rb, line 476 def login @vcloud_token ||= ENV['FOG_VCLOUD_TOKEN'] if @vcloud_token response = get_current_session session_org = response.body[:org] session_user = response.body[:user] check_session_matches_credentials(session_org, session_user) else response = post_login_session x_vcloud_authorization = response.headers.keys.find do |key| key.downcase == 'x-vcloud-authorization' end @vcloud_token = response.headers[x_vcloud_authorization] end @org_name = response.body[:org] @user_name = response.body[:user] end
@note This isn't needed.
# File lib/fog/vcloud_director/compute.rb, line 497 def logout delete_logout @vcloud_token = nil @org_name = nil end
# File lib/fog/vcloud_director/requests/compute/post_reconfigure_vm.rb, line 71 def memory_section(xml, memory) xml['ovf'].Item do xml['rasd'].AllocationUnits 'byte * 2^20' xml['rasd'].InstanceID 6 xml['rasd'].ResourceType 4 xml['rasd'].VirtualQuantity memory.to_i end end
# File lib/fog/vcloud_director/requests/compute/instantiate_vapp_template.rb, line 89 def network_end_point(network_id = nil) end_point + ( network_id ? "network/#{network_id}" : "network" ) end
# File lib/fog/vcloud_director/requests/compute/instantiate_vapp_template.rb, line 39 def populate_uris(options = {}) options[:vdc_id] || raise("vdc_id option is required") options[:vdc_uri] = vdc_end_point(options[:vdc_id]) options[:network_uri] = network_end_point(options[:network_id]) if options[:network_id] options[:template_uri] = vapp_template_end_point(options[:template_id]) || raise("template_id option is required") options end
# File lib/fog/vcloud_director/requests/compute/instantiate_vapp_template.rb, line 93 def vapp_template_end_point(vapp_template_id = nil) end_point + ( vapp_template_id ? "vAppTemplate/#{vapp_template_id}" : "vAppTemplate" ) end
# File lib/fog/vcloud_director/requests/compute/instantiate_vapp_template.rb, line 85 def vdc_end_point(vdc_id = nil) end_point + ( vdc_id ? "vdc/#{vdc_id}" : "vdc" ) end
# File lib/fog/vcloud_director/requests/compute/post_reconfigure_vm.rb, line 53 def virtual_hardware_section(xml, options) return unless options[:cpu] or options[:memory] xml['ovf'].VirtualHardwareSection do xml['ovf'].Info 'Virtual Hardware Requirements' cpu_section(xml, options[:cpu]) if options[:cpu] memory_section(xml, options[:memory]) if options[:memory] end end
# File lib/fog/vcloud_director/requests/compute/instantiate_vapp_template.rb, line 76 def xmlns { 'xmlns' => "http://www.vmware.com/vcloud/v1.5", "xmlns:ovf" => "http://schemas.dmtf.org/ovf/envelope/1", "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance", "xmlns:xsd" => "http://www.w3.org/2001/XMLSchema" } end