mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[vcloud_director] Improve support for query service.
This commit is contained in:
parent
bec102f797
commit
ca4561e990
21 changed files with 673 additions and 59 deletions
|
@ -105,6 +105,7 @@ module Fog
|
||||||
request :get_disks_rasd_items_list
|
request :get_disks_rasd_items_list
|
||||||
request :get_edge_gateway
|
request :get_edge_gateway
|
||||||
request :get_entity
|
request :get_entity
|
||||||
|
request :get_groups_from_query
|
||||||
request :get_guest_customization_system_section_vapp
|
request :get_guest_customization_system_section_vapp
|
||||||
request :get_guest_customization_system_section_vapp_template
|
request :get_guest_customization_system_section_vapp_template
|
||||||
request :get_href # this is used for manual testing
|
request :get_href # this is used for manual testing
|
||||||
|
@ -134,6 +135,7 @@ module Fog
|
||||||
request :get_organization_metadata
|
request :get_organization_metadata
|
||||||
request :get_organization_metadata_item_metadata
|
request :get_organization_metadata_item_metadata
|
||||||
request :get_organizations
|
request :get_organizations
|
||||||
|
request :get_organizations_from_query
|
||||||
request :get_product_sections_vapp
|
request :get_product_sections_vapp
|
||||||
request :get_product_sections_vapp_template
|
request :get_product_sections_vapp_template
|
||||||
request :get_request # this is used for manual testing
|
request :get_request # this is used for manual testing
|
||||||
|
@ -147,6 +149,7 @@ module Fog
|
||||||
request :get_task
|
request :get_task
|
||||||
request :get_task_list
|
request :get_task_list
|
||||||
request :get_thumbnail
|
request :get_thumbnail
|
||||||
|
request :get_users_from_query
|
||||||
request :get_vapp
|
request :get_vapp
|
||||||
request :get_vapp_metadata
|
request :get_vapp_metadata
|
||||||
request :get_vapp_metadata_item_metadata
|
request :get_vapp_metadata_item_metadata
|
||||||
|
@ -166,6 +169,7 @@ module Fog
|
||||||
request :get_vdc_storage_class
|
request :get_vdc_storage_class
|
||||||
request :get_vdc_storage_class_metadata
|
request :get_vdc_storage_class_metadata
|
||||||
request :get_vdc_storage_class_metadata_item_metadata
|
request :get_vdc_storage_class_metadata_item_metadata
|
||||||
|
request :get_vdcs_from_query
|
||||||
request :get_virtual_hardware_section
|
request :get_virtual_hardware_section
|
||||||
request :get_vm
|
request :get_vm
|
||||||
request :get_vm_capabilities
|
request :get_vm_capabilities
|
||||||
|
@ -378,7 +382,8 @@ module Fog
|
||||||
:idempotent => params[:idempotent],
|
:idempotent => params[:idempotent],
|
||||||
:method => params[:method],
|
:method => params[:method],
|
||||||
:parser => params[:parser],
|
:parser => params[:parser],
|
||||||
:path => path
|
:path => path,
|
||||||
|
:query => params[:query]
|
||||||
})
|
})
|
||||||
rescue => e
|
rescue => e
|
||||||
raise e unless e.class.to_s =~ /^Excon::Errors/
|
raise e unless e.class.to_s =~ /^Excon::Errors/
|
||||||
|
|
|
@ -2,24 +2,69 @@ module Fog
|
||||||
module Compute
|
module Compute
|
||||||
class VcloudDirector
|
class VcloudDirector
|
||||||
class Real
|
class Real
|
||||||
# Retrieves a list of Catalogs by using REST API general QueryHandler;
|
# Retrieves a list of Catalogs by using REST API general QueryHandler.
|
||||||
# If filter is provided it will be applied to the corresponding result
|
|
||||||
# set. Format determines the elements representation - references or
|
|
||||||
# records. Default format is references.
|
|
||||||
#
|
#
|
||||||
|
# @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 [Integer] :offset (0) Integer value specifying the
|
||||||
|
# first record to return. Record numbers < offset are not returned.
|
||||||
# @return [Excon::Response]
|
# @return [Excon::Response]
|
||||||
# * hash<~Hash>:
|
# * 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.
|
||||||
|
# * :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 http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-CatalogsFromQuery.html
|
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-CatalogsFromQuery.html
|
||||||
# @since vCloud API version 1.5
|
# @since vCloud API version 1.5
|
||||||
def get_catalogs_from_query
|
def get_catalogs_from_query(options={})
|
||||||
request(
|
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[:offset] = options[:offset] if options[:offset]
|
||||||
|
|
||||||
|
response = request(
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
:idempotent => true,
|
:idempotent => true,
|
||||||
:method => 'GET',
|
:method => 'GET',
|
||||||
:parser => Fog::ToHashDocument.new,
|
:parser => Fog::ToHashDocument.new,
|
||||||
:path => 'catalogs/query'
|
:path => 'catalogs/query',
|
||||||
|
:query => query
|
||||||
)
|
)
|
||||||
|
response.body[:CatalogRecord] = [response.body[:CatalogRecord]] if response.body[:CatalogRecord].is_a?(Hash)
|
||||||
|
|
||||||
|
%w[firstPage previousPage nextPage lastPage].each do |rel|
|
||||||
|
if link = response.body[:Link].detect {|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
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,24 +2,69 @@ module Fog
|
||||||
module Compute
|
module Compute
|
||||||
class VcloudDirector
|
class VcloudDirector
|
||||||
class Real
|
class Real
|
||||||
# Retrieves a disk list by using REST API general QueryHandler; If
|
# Retrieves a disk list by using REST API general QueryHandler.
|
||||||
# filter is provided it will be applied to the corresponding result
|
|
||||||
# set. Format determines the elements representation - references or
|
|
||||||
# records. Default format is references.
|
|
||||||
#
|
#
|
||||||
|
# @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 [Integer] :offset (0) Integer value specifying the
|
||||||
|
# first record to return. Record numbers < offset are not returned.
|
||||||
# @return [Excon::Response]
|
# @return [Excon::Response]
|
||||||
# * hash<~Hash>:
|
# * 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.
|
||||||
|
# * :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 http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-DisksFromQuery.html
|
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-DisksFromQuery.html
|
||||||
# @since vCloud API version 1.5
|
# @since vCloud API version 1.5
|
||||||
def get_disks_from_query
|
def get_disks_from_query(options={})
|
||||||
request(
|
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[:offset] = options[:offset] if options[:offset]
|
||||||
|
|
||||||
|
response = request(
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
:idempotent => true,
|
:idempotent => true,
|
||||||
:method => 'GET',
|
:method => 'GET',
|
||||||
:parser => Fog::ToHashDocument.new,
|
:parser => Fog::ToHashDocument.new,
|
||||||
:path => 'disks/query'
|
:path => 'disks/query',
|
||||||
|
:query => query
|
||||||
)
|
)
|
||||||
|
response.body[:DiskRecord] = [response.body[:DiskRecord]] if response.body[:DiskRecord].is_a?(Hash)
|
||||||
|
|
||||||
|
%w[firstPage previousPage nextPage lastPage].each do |rel|
|
||||||
|
if link = response.body[:Link].detect {|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
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
module Fog
|
||||||
|
module Compute
|
||||||
|
class VcloudDirector
|
||||||
|
class Real
|
||||||
|
# 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 [Integer] :offset (0) Integer value specifying the
|
||||||
|
# first record to return. Record numbers < offset are not returned.
|
||||||
|
# @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.
|
||||||
|
# * :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 http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-GroupsFromQuery.html
|
||||||
|
# @since vCloud API version 1.5
|
||||||
|
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[:offset] = options[:offset] if options[:offset]
|
||||||
|
|
||||||
|
response = request(
|
||||||
|
:expects => 200,
|
||||||
|
:idempotent => true,
|
||||||
|
:method => 'GET',
|
||||||
|
:parser => Fog::ToHashDocument.new,
|
||||||
|
:path => 'admin/groups/query',
|
||||||
|
:query => query
|
||||||
|
)
|
||||||
|
response.body[:GroupRecord] = [response.body[:GroupRecord]] if response.body[:GroupRecord].is_a?(Hash)
|
||||||
|
|
||||||
|
%w[firstPage previousPage nextPage lastPage].each do |rel|
|
||||||
|
if link = response.body[:Link].detect {|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
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -2,24 +2,69 @@ module Fog
|
||||||
module Compute
|
module Compute
|
||||||
class VcloudDirector
|
class VcloudDirector
|
||||||
class Real
|
class Real
|
||||||
# Retrieves a media list by using REST API general QueryHandler; If
|
# Retrieves a media list by using REST API general QueryHandler.
|
||||||
# filter is provided it will be applied to the corresponding result
|
|
||||||
# set. Format determines the elements representation - references or
|
|
||||||
# records. Default format is references.
|
|
||||||
#
|
#
|
||||||
|
# @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 [Integer] :offset (0) Integer value specifying the
|
||||||
|
# first record to return. Record numbers < offset are not returned.
|
||||||
# @return [Excon::Response]
|
# @return [Excon::Response]
|
||||||
# * hash<~Hash>:
|
# * 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.
|
||||||
|
# * :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 http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-MediasFromQuery.html
|
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-MediasFromQuery.html
|
||||||
# @since vCloud API version 1.5
|
# @since vCloud API version 1.5
|
||||||
def get_medias_from_query
|
def get_medias_from_query(options={})
|
||||||
request(
|
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[:offset] = options[:offset] if options[:offset]
|
||||||
|
|
||||||
|
response = request(
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
:idempotent => true,
|
:idempotent => true,
|
||||||
:method => 'GET',
|
:method => 'GET',
|
||||||
:parser => Fog::ToHashDocument.new,
|
:parser => Fog::ToHashDocument.new,
|
||||||
:path => 'mediaList/query'
|
:path => 'mediaList/query',
|
||||||
|
:query => query
|
||||||
)
|
)
|
||||||
|
response.body[:MediaRecord] = [response.body[:MediaRecord]] if response.body[:MediaRecord].is_a?(Hash)
|
||||||
|
|
||||||
|
%w[firstPage previousPage nextPage lastPage].each do |rel|
|
||||||
|
if link = response.body[:Link].detect {|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
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
module Fog
|
||||||
|
module Compute
|
||||||
|
class VcloudDirector
|
||||||
|
class Real
|
||||||
|
# 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 [Integer] :offset (0) Integer value specifying the
|
||||||
|
# first record to return. Record numbers < offset are not returned.
|
||||||
|
# @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.
|
||||||
|
# * :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 http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-OrganizationsFromQuery.html
|
||||||
|
# @since vCloud API version 1.5
|
||||||
|
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[:offset] = options[:offset] if options[:offset]
|
||||||
|
|
||||||
|
response = request(
|
||||||
|
:expects => 200,
|
||||||
|
:idempotent => true,
|
||||||
|
:method => 'GET',
|
||||||
|
:parser => Fog::ToHashDocument.new,
|
||||||
|
:path => 'admin/orgs/query',
|
||||||
|
:query => query
|
||||||
|
)
|
||||||
|
response.body[:OrganizationRecord] = [response.body[:OrganizationRecord]] if response.body[:OrganizationRecord].is_a?(Hash)
|
||||||
|
|
||||||
|
%w[firstPage previousPage nextPage lastPage].each do |rel|
|
||||||
|
if link = response.body[:Link].detect {|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
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,73 @@
|
||||||
|
module Fog
|
||||||
|
module Compute
|
||||||
|
class VcloudDirector
|
||||||
|
class Real
|
||||||
|
# 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 [Integer] :offset (0) Integer value specifying the
|
||||||
|
# first record to return. Record numbers < offset are not returned.
|
||||||
|
# @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.
|
||||||
|
# * :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 http://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
|
||||||
|
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[:offset] = options[:offset] if options[:offset]
|
||||||
|
|
||||||
|
response = request(
|
||||||
|
:expects => 200,
|
||||||
|
:idempotent => true,
|
||||||
|
:method => 'GET',
|
||||||
|
:parser => Fog::ToHashDocument.new,
|
||||||
|
:path => 'admin/users/query',
|
||||||
|
:query => query
|
||||||
|
)
|
||||||
|
response.body[:UserRecord] = [response.body[:UserRecord]] if response.body[:UserRecord].is_a?(Hash)
|
||||||
|
|
||||||
|
%w[firstPage previousPage nextPage lastPage].each do |rel|
|
||||||
|
if link = response.body[:Link].detect {|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
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -3,23 +3,69 @@ module Fog
|
||||||
class VcloudDirector
|
class VcloudDirector
|
||||||
class Real
|
class Real
|
||||||
# Retrieves a list of vAppTemplates using REST API general
|
# Retrieves a list of vAppTemplates using REST API general
|
||||||
# QueryHandler; If filter is provided it will be applied to the
|
# QueryHandler.
|
||||||
# corresponding result set. Format determines the elements
|
|
||||||
# representation - references or records. Default format is references.
|
|
||||||
#
|
#
|
||||||
|
# @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 [Integer] :offset (0) Integer value specifying the
|
||||||
|
# first record to return. Record numbers < offset are not returned.
|
||||||
# @return [Excon::Response]
|
# @return [Excon::Response]
|
||||||
# * hash<~Hash>:
|
# * 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.
|
||||||
|
# * :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 http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppTemplatesFromQuery.html
|
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppTemplatesFromQuery.html
|
||||||
# @since vCloud API version 1.5
|
# @since vCloud API version 1.5
|
||||||
def get_vapp_templates_from_query
|
def get_vapp_templates_from_query(options={})
|
||||||
request(
|
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[:offset] = options[:offset] if options[:offset]
|
||||||
|
|
||||||
|
response = request(
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
:idempotent => true,
|
:idempotent => true,
|
||||||
:method => 'GET',
|
:method => 'GET',
|
||||||
:parser => Fog::ToHashDocument.new,
|
:parser => Fog::ToHashDocument.new,
|
||||||
:path => 'vAppTemplates/query'
|
:path => 'vAppTemplates/query',
|
||||||
|
:query => query
|
||||||
)
|
)
|
||||||
|
response.body[:VAppTemplateRecord] = [response.body[:VAppTemplateRecord]] if response.body[:VAppTemplateRecord].is_a?(Hash)
|
||||||
|
|
||||||
|
%w[firstPage previousPage nextPage lastPage].each do |rel|
|
||||||
|
if link = response.body[:Link].detect {|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
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,24 +2,69 @@ module Fog
|
||||||
module Compute
|
module Compute
|
||||||
class VcloudDirector
|
class VcloudDirector
|
||||||
class Real
|
class Real
|
||||||
# Retrieves a list of vApps by using REST API general QueryHandler; If
|
# Retrieves a list of vApps by using REST API general QueryHandler.
|
||||||
# filter is provided it will be applied to the corresponding result
|
|
||||||
# set. Format determines the elements representation - references or
|
|
||||||
# records. Default format is references.
|
|
||||||
#
|
#
|
||||||
|
# @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 [Integer] :offset (0) Integer value specifying the
|
||||||
|
# first record to return. Record numbers < offset are not returned.
|
||||||
# @return [Excon::Response]
|
# @return [Excon::Response]
|
||||||
# * hash<~Hash>:
|
# * 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.
|
||||||
|
# * :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 http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppsInLeaseFromQuery.html
|
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppsInLeaseFromQuery.html
|
||||||
# @since vCloud API version 1.5
|
# @since vCloud API version 1.5
|
||||||
def get_vapps_in_lease_from_query
|
def get_vapps_in_lease_from_query(options={})
|
||||||
request(
|
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[:offset] = options[:offset] if options[:offset]
|
||||||
|
|
||||||
|
response = request(
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
:idempotent => true,
|
:idempotent => true,
|
||||||
:method => 'GET',
|
:method => 'GET',
|
||||||
:parser => Fog::ToHashDocument.new,
|
:parser => Fog::ToHashDocument.new,
|
||||||
:path => 'vApps/query'
|
:path => 'vApps/query',
|
||||||
|
:query => query
|
||||||
)
|
)
|
||||||
|
response.body[:VAppRecord] = [response.body[:VAppRecord]] if response.body[:VAppRecord].is_a?(Hash)
|
||||||
|
|
||||||
|
%w[firstPage previousPage nextPage lastPage].each do |rel|
|
||||||
|
if link = response.body[:Link].detect {|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
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
module Fog
|
||||||
|
module Compute
|
||||||
|
class VcloudDirector
|
||||||
|
class Real
|
||||||
|
# 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 [Integer] :offset (0) Integer value specifying the
|
||||||
|
# first record to return. Record numbers < offset are not returned.
|
||||||
|
# @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.
|
||||||
|
# * :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 http://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
|
||||||
|
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[:offset] = options[:offset] if options[:offset]
|
||||||
|
|
||||||
|
response = request(
|
||||||
|
:expects => 200,
|
||||||
|
:idempotent => true,
|
||||||
|
:method => 'GET',
|
||||||
|
:parser => Fog::ToHashDocument.new,
|
||||||
|
:path => 'admin/vdcs/query',
|
||||||
|
:query => query
|
||||||
|
)
|
||||||
|
response.body[:OrgVdcRecord] = [response.body[:OrgVdcRecord]] if response.body[:OrgVdcRecord].is_a?(Hash)
|
||||||
|
|
||||||
|
%w[firstPage previousPage nextPage lastPage].each do |rel|
|
||||||
|
if link = response.body[:Link].detect {|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
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -3,23 +3,69 @@ module Fog
|
||||||
class VcloudDirector
|
class VcloudDirector
|
||||||
class Real
|
class Real
|
||||||
# Retrieves a list of VMs in lease by using REST API general
|
# Retrieves a list of VMs in lease by using REST API general
|
||||||
# QueryHandler; If filter is provided it will be applied to the
|
# QueryHandler.
|
||||||
# corresponding result set. Format determines the elements
|
|
||||||
# representation - references or records. Default format is references.
|
|
||||||
#
|
#
|
||||||
|
# @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 [Integer] :offset (0) Integer value specifying the
|
||||||
|
# first record to return. Record numbers < offset are not returned.
|
||||||
# @return [Excon::Response]
|
# @return [Excon::Response]
|
||||||
# * hash<~Hash>:
|
# * 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.
|
||||||
|
# * :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 http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VMsInLeaseFromQuery.html
|
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VMsInLeaseFromQuery.html
|
||||||
# @since vCloud API version 1.5
|
# @since vCloud API version 1.5
|
||||||
def get_vms_in_lease_from_query
|
def get_vms_in_lease_from_query(options={})
|
||||||
request(
|
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[:offset] = options[:offset] if options[:offset]
|
||||||
|
|
||||||
|
response = request(
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
:idempotent => true,
|
:idempotent => true,
|
||||||
:method => 'GET',
|
:method => 'GET',
|
||||||
:parser => Fog::ToHashDocument.new,
|
:parser => Fog::ToHashDocument.new,
|
||||||
:path => 'vms/query'
|
:path => 'vms/query',
|
||||||
|
:query => query
|
||||||
)
|
)
|
||||||
|
response.body[:VMRecord] = [response.body[:VMRecord]] if response.body[:VMRecord].is_a?(Hash)
|
||||||
|
|
||||||
|
%w[firstPage previousPage nextPage lastPage].each do |rel|
|
||||||
|
if link = response.body[:Link].detect {|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
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -22,9 +22,9 @@ Shindo.tests('Compute::VcloudDirector | catalog requests', ['vclouddirector']) d
|
||||||
@service.get_control_access_params_catalog(@org[:href].split('/').last, @catalog_id).body
|
@service.get_control_access_params_catalog(@org[:href].split('/').last, @catalog_id).body
|
||||||
end
|
end
|
||||||
|
|
||||||
tests('#get_catalogs_from_query').returns(Hash) do
|
tests('#get_catalogs_from_query').data_matches_schema(VcloudDirector::Compute::Schema::CONTAINER_TYPE) do
|
||||||
pending if Fog.mocking?
|
pending if Fog.mocking?
|
||||||
@service.get_catalogs_from_query.body.class
|
@service.get_catalogs_from_query.body
|
||||||
end
|
end
|
||||||
|
|
||||||
tests('Retrieve non-existent Catalog').raises(Excon::Errors::Forbidden) do
|
tests('Retrieve non-existent Catalog').raises(Excon::Errors::Forbidden) do
|
||||||
|
|
15
tests/vcloud_director/requests/compute/disk_tests.rb
Normal file
15
tests/vcloud_director/requests/compute/disk_tests.rb
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
Shindo.tests('Compute::VcloudDirector | disk requests', ['vclouddirector']) do
|
||||||
|
|
||||||
|
@service = Fog::Compute::VcloudDirector.new
|
||||||
|
|
||||||
|
tests('#get_disks_from_query').data_matches_schema(VcloudDirector::Compute::Schema::CONTAINER_TYPE) do
|
||||||
|
pending if Fog.mocking?
|
||||||
|
@service.get_disks_from_query.body
|
||||||
|
end
|
||||||
|
|
||||||
|
tests('Retrieve non-existent Disk').raises(Excon::Errors::Forbidden) do
|
||||||
|
pending if Fog.mocking?
|
||||||
|
@service.get_disk('00000000-0000-0000-0000-000000000000')
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
10
tests/vcloud_director/requests/compute/groups_tests.rb
Normal file
10
tests/vcloud_director/requests/compute/groups_tests.rb
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
Shindo.tests('Compute::VcloudDirector | groups requests', ['vclouddirector']) do
|
||||||
|
|
||||||
|
@service = Fog::Compute::VcloudDirector.new
|
||||||
|
|
||||||
|
tests('#get_groups_from_query').data_matches_schema(VcloudDirector::Compute::Schema::CONTAINER_TYPE) do
|
||||||
|
pending if Fog.mocking?
|
||||||
|
@service.get_groups_from_query.body
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -153,9 +153,9 @@ Shindo.tests('Compute::VcloudDirector | media requests', ['vclouddirector']) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
tests('#get_medias_from_query').returns(Hash) do
|
tests('#get_medias_from_query').data_matches_schema(VcloudDirector::Compute::Schema::CONTAINER_TYPE) do
|
||||||
pending if Fog.mocking?
|
pending if Fog.mocking?
|
||||||
@service.get_medias_from_query.body.class
|
@service.get_medias_from_query.body
|
||||||
end
|
end
|
||||||
|
|
||||||
tests('Upload to non-existent vDC').raises(Excon::Errors::Forbidden) do
|
tests('Upload to non-existent vDC').raises(Excon::Errors::Forbidden) do
|
||||||
|
|
|
@ -17,6 +17,11 @@ Shindo.tests('Compute::VcloudDirector | organization requests', ['vclouddirector
|
||||||
@service.get_organization_metadata(@org_uuid).body
|
@service.get_organization_metadata(@org_uuid).body
|
||||||
end
|
end
|
||||||
|
|
||||||
|
tests('#get_organizations_from_query').data_matches_schema(VcloudDirector::Compute::Schema::CONTAINER_TYPE) do
|
||||||
|
pending if Fog.mocking?
|
||||||
|
@service.get_organizations_from_query.body
|
||||||
|
end
|
||||||
|
|
||||||
tests('retrieve non-existent Org').raises(Excon::Errors::Forbidden) do
|
tests('retrieve non-existent Org').raises(Excon::Errors::Forbidden) do
|
||||||
@service.get_organization('00000000-0000-0000-0000-000000000000')
|
@service.get_organization('00000000-0000-0000-0000-000000000000')
|
||||||
end
|
end
|
||||||
|
|
|
@ -84,6 +84,14 @@ class VcloudDirector
|
||||||
:File => FILE_TYPE
|
:File => FILE_TYPE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Container for query result sets.
|
||||||
|
CONTAINER_TYPE = RESOURCE_TYPE.merge({
|
||||||
|
:name => String,
|
||||||
|
:page => String,
|
||||||
|
:pageSize => String,
|
||||||
|
:total => String
|
||||||
|
})
|
||||||
|
|
||||||
# Represents an asynchronous operation in vCloud Director.
|
# Represents an asynchronous operation in vCloud Director.
|
||||||
TASK_TYPE = ENTITY_TYPE.merge({
|
TASK_TYPE = ENTITY_TYPE.merge({
|
||||||
:cancelRequested => Fog::Nullable::String,
|
:cancelRequested => Fog::Nullable::String,
|
||||||
|
@ -348,18 +356,11 @@ class VcloudDirector
|
||||||
|
|
||||||
# Container for query results in records format.
|
# Container for query results in records format.
|
||||||
# Combine with QUERY_RESULT_RECORD_TYPE subtypes to validate query results
|
# Combine with QUERY_RESULT_RECORD_TYPE subtypes to validate query results
|
||||||
QUERY_RESULT_RECORDS_TYPE = {
|
QUERY_RESULT_RECORDS_TYPE = CONTAINER_TYPE
|
||||||
:href => Fog::Nullable::String,
|
|
||||||
:type => Fog::Nullable::String,
|
|
||||||
:name => Fog::Nullable::String,
|
|
||||||
:page => Fog::Nullable::String,
|
|
||||||
:pageSize => Fog::Nullable::String,
|
|
||||||
:total => Fog::Nullable::String,
|
|
||||||
}
|
|
||||||
|
|
||||||
# Base type for a single record from query result in records format.
|
# Base type for a single record from query result in records format.
|
||||||
# Subtypes define more specific elements.
|
# Subtypes define more specific elements.
|
||||||
QUERY_RESULT_RECORD_TYPE = {
|
QUERY_RESULT_RECORD_TYPE = {
|
||||||
:href => String,
|
:href => String,
|
||||||
:id => Fog::Nullable::String,
|
:id => Fog::Nullable::String,
|
||||||
:type => Fog::Nullable::String
|
:type => Fog::Nullable::String
|
||||||
|
|
10
tests/vcloud_director/requests/compute/users_tests.rb
Normal file
10
tests/vcloud_director/requests/compute/users_tests.rb
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
Shindo.tests('Compute::VcloudDirector | users requests', ['vclouddirector']) do
|
||||||
|
|
||||||
|
@service = Fog::Compute::VcloudDirector.new
|
||||||
|
|
||||||
|
tests('#get_users_from_query').data_matches_schema(VcloudDirector::Compute::Schema::CONTAINER_TYPE) do
|
||||||
|
pending if Fog.mocking?
|
||||||
|
@service.get_users_from_query.body
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -65,9 +65,9 @@ Shindo.tests('Compute::VcloudDirector | vapp requests', ['vclouddirector']) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
tests('#get_vapps_in_lease_from_query').returns(Hash) do
|
tests('#get_vapps_in_lease_from_query').data_matches_schema(VcloudDirector::Compute::Schema::CONTAINER_TYPE) do
|
||||||
pending if Fog.mocking?
|
pending if Fog.mocking?
|
||||||
@service.get_vapps_in_lease_from_query.body.class
|
@service.get_vapps_in_lease_from_query.body
|
||||||
end
|
end
|
||||||
|
|
||||||
tests('Retrieve non-existent vApp').raises(Excon::Errors::Forbidden) do
|
tests('Retrieve non-existent vApp').raises(Excon::Errors::Forbidden) do
|
||||||
|
|
|
@ -17,7 +17,12 @@ Shindo.tests('Compute::VcloudDirector | vdc requests', ['vclouddirector']) do
|
||||||
|
|
||||||
tests('#get_vdc_metadata').data_matches_schema(VcloudDirector::Compute::Schema::METADATA_TYPE) do
|
tests('#get_vdc_metadata').data_matches_schema(VcloudDirector::Compute::Schema::METADATA_TYPE) do
|
||||||
pending if Fog.mocking?
|
pending if Fog.mocking?
|
||||||
@service.get_vdc_metadata(@vdc_id)
|
@service.get_vdc_metadata(@vdc_id).body
|
||||||
|
end
|
||||||
|
|
||||||
|
tests('#get_vdcs_from_query').data_matches_schema(VcloudDirector::Compute::Schema::CONTAINER_TYPE) do
|
||||||
|
pending if Fog.mocking?
|
||||||
|
@service.get_vdcs_from_query.body
|
||||||
end
|
end
|
||||||
|
|
||||||
tests('Retrieve non-existent vDC').raises(Excon::Errors::Forbidden) do
|
tests('Retrieve non-existent vDC').raises(Excon::Errors::Forbidden) do
|
||||||
|
|
|
@ -100,9 +100,9 @@ Shindo.tests('Compute::VcloudDirector | vm requests', ['vclouddirector']) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
tests('#get_vms_in_lease_from_query').returns(Hash) do
|
tests('#get_vms_in_lease_from_query').data_matches_schema(VcloudDirector::Compute::Schema::CONTAINER_TYPE) do
|
||||||
pending if Fog.mocking?
|
pending if Fog.mocking?
|
||||||
@service.get_vms_in_lease_from_query.body.class
|
@service.get_vms_in_lease_from_query.body
|
||||||
end
|
end
|
||||||
|
|
||||||
#tests('Retrieve non-existent vApp').raises(Excon::Errors::Forbidden) do
|
#tests('Retrieve non-existent vApp').raises(Excon::Errors::Forbidden) do
|
||||||
|
|
Loading…
Reference in a new issue