From 6722209249804774a1c68bc0498686bd696c6dc5 Mon Sep 17 00:00:00 2001 From: Nick Osborn Date: Tue, 8 Oct 2013 20:18:06 +0100 Subject: [PATCH] [vcloud_director] Implement get*_metadata_item requests. --- lib/fog/vcloud_director/compute.rb | 14 ++++++++-- ...get_catalog_item_metadata_item_metadata.rb | 26 +++++++++++++++++ .../get_catalog_metadata_item_metadata.rb | 26 +++++++++++++++++ .../get_disk_metadata_item_metadata.rb | 26 +++++++++++++++++ .../get_media_metadata_item_metadata.rb | 26 +++++++++++++++++ .../get_network_metadata_item_metadata.rb | 26 +++++++++++++++++ ...get_organization_metadata_item_metadata.rb | 28 +++++++++++++++++++ .../get_vapp_metadata_item_metadata.rb | 26 +++++++++++++++++ ...et_vapp_template_metadata_item_metadata.rb | 27 ++++++++++++++++++ .../compute/get_vdc_metadata_item_metadata.rb | 28 +++++++++++++++++++ ...ge_profile.rb => get_vdc_storage_class.rb} | 5 +++- ...a.rb => get_vdc_storage_class_metadata.rb} | 5 +++- ...dc_storage_class_metadata_item_metadata.rb | 26 +++++++++++++++++ 13 files changed, 285 insertions(+), 4 deletions(-) create mode 100644 lib/fog/vcloud_director/requests/compute/get_catalog_item_metadata_item_metadata.rb create mode 100644 lib/fog/vcloud_director/requests/compute/get_catalog_metadata_item_metadata.rb create mode 100644 lib/fog/vcloud_director/requests/compute/get_disk_metadata_item_metadata.rb create mode 100644 lib/fog/vcloud_director/requests/compute/get_media_metadata_item_metadata.rb create mode 100644 lib/fog/vcloud_director/requests/compute/get_network_metadata_item_metadata.rb create mode 100644 lib/fog/vcloud_director/requests/compute/get_organization_metadata_item_metadata.rb create mode 100644 lib/fog/vcloud_director/requests/compute/get_vapp_metadata_item_metadata.rb create mode 100644 lib/fog/vcloud_director/requests/compute/get_vapp_template_metadata_item_metadata.rb create mode 100644 lib/fog/vcloud_director/requests/compute/get_vdc_metadata_item_metadata.rb rename lib/fog/vcloud_director/requests/compute/{get_vdc_storage_profile.rb => get_vdc_storage_class.rb} (85%) rename lib/fog/vcloud_director/requests/compute/{get_vdc_storage_profile_metadata.rb => get_vdc_storage_class_metadata.rb} (81%) create mode 100644 lib/fog/vcloud_director/requests/compute/get_vdc_storage_class_metadata_item_metadata.rb diff --git a/lib/fog/vcloud_director/compute.rb b/lib/fog/vcloud_director/compute.rb index 3b5473b53..b49657730 100644 --- a/lib/fog/vcloud_director/compute.rb +++ b/lib/fog/vcloud_director/compute.rb @@ -82,12 +82,15 @@ module Fog request :get_catalog request :get_catalog_item request :get_catalog_item_metadata + request :get_catalog_item_metadata_item_metadata request :get_catalog_metadata + request :get_catalog_metadata_item_metadata request :get_catalogs_from_query request :get_cpu_rasd_item request :get_current_session request :get_disk request :get_disk_metadata + request :get_disk_metadata_item_metadata request :get_disk_owner request :get_disks_from_query request :get_disks_rasd_items_list @@ -97,6 +100,7 @@ module Fog request :get_lease_settings_section_vapp request :get_media request :get_media_metadata + request :get_media_metadata_item_metadata request :get_media_owner request :get_medias_from_query request :get_memory_rasd_item @@ -105,10 +109,12 @@ module Fog request :get_network_config_section_vapp request :get_network_connection_system_section_vapp request :get_network_metadata + request :get_network_metadata_item_metadata request :get_network_section_vapp request :get_operating_system_section request :get_organization request :get_organization_metadata + request :get_organization_metadata_item_metadata request :get_organizations request :get_product_sections_vapp request :get_request # this is used for manual testing @@ -122,17 +128,21 @@ module Fog request :get_task_list request :get_vapp request :get_vapp_metadata + request :get_vapp_metadata_item_metadata request :get_vapp_ovf_descriptor request :get_vapp_owner request :get_vapp_template request :get_vapp_template_metadata + request :get_vapp_template_metadata_item_metadata request :get_vapp_template_ovf_descriptor request :get_vapp_templates_from_query request :get_vapps_in_lease_from_query request :get_vdc request :get_vdc_metadata - request :get_vdc_storage_profile - request :get_vdc_storage_profile_metadata + request :get_vdc_metadata_item_metadata + request :get_vdc_storage_class + request :get_vdc_storage_class_metadata + request :get_vdc_storage_class_metadata_item_metadata request :get_vm request :get_vm_compliance_results request :get_vm_customization diff --git a/lib/fog/vcloud_director/requests/compute/get_catalog_item_metadata_item_metadata.rb b/lib/fog/vcloud_director/requests/compute/get_catalog_item_metadata_item_metadata.rb new file mode 100644 index 000000000..cb86c066d --- /dev/null +++ b/lib/fog/vcloud_director/requests/compute/get_catalog_item_metadata_item_metadata.rb @@ -0,0 +1,26 @@ +module Fog + module Compute + class VcloudDirector + class Real + # 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 http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-CatalogItemMetadataItem-metadata.html + # vCloud API Documentation + # @since vCloud API version 1.5 + 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 + end + end + end +end diff --git a/lib/fog/vcloud_director/requests/compute/get_catalog_metadata_item_metadata.rb b/lib/fog/vcloud_director/requests/compute/get_catalog_metadata_item_metadata.rb new file mode 100644 index 000000000..d080e89c0 --- /dev/null +++ b/lib/fog/vcloud_director/requests/compute/get_catalog_metadata_item_metadata.rb @@ -0,0 +1,26 @@ +module Fog + module Compute + class VcloudDirector + class Real + # 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 http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-CatalogMetadataItem-metadata.html + # vCloud API Documentation + # @since vCloud API version 1.5 + 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 + end + end + end +end diff --git a/lib/fog/vcloud_director/requests/compute/get_disk_metadata_item_metadata.rb b/lib/fog/vcloud_director/requests/compute/get_disk_metadata_item_metadata.rb new file mode 100644 index 000000000..78c779761 --- /dev/null +++ b/lib/fog/vcloud_director/requests/compute/get_disk_metadata_item_metadata.rb @@ -0,0 +1,26 @@ +module Fog + module Compute + class VcloudDirector + class Real + # 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 http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-DiskMetadataItem-metadata.html + # vCloud API Documentation + # @since vCloud API version 5.1 + 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 + end + end + end +end diff --git a/lib/fog/vcloud_director/requests/compute/get_media_metadata_item_metadata.rb b/lib/fog/vcloud_director/requests/compute/get_media_metadata_item_metadata.rb new file mode 100644 index 000000000..92cf25533 --- /dev/null +++ b/lib/fog/vcloud_director/requests/compute/get_media_metadata_item_metadata.rb @@ -0,0 +1,26 @@ +module Fog + module Compute + class VcloudDirector + class Real + # 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 http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-MediaMetadataItem-metadata.html + # vCloud API Documentation + # @since vCloud API version 1.5 + 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 + end + end + end +end diff --git a/lib/fog/vcloud_director/requests/compute/get_network_metadata_item_metadata.rb b/lib/fog/vcloud_director/requests/compute/get_network_metadata_item_metadata.rb new file mode 100644 index 000000000..ca63fbb33 --- /dev/null +++ b/lib/fog/vcloud_director/requests/compute/get_network_metadata_item_metadata.rb @@ -0,0 +1,26 @@ +module Fog + module Compute + class VcloudDirector + class Real + # 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 http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-NetworkMetadataItem-metadata.html + # vCloud API Documentation + # @since vCloud API version 1.5 + 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 + end + end + end +end diff --git a/lib/fog/vcloud_director/requests/compute/get_organization_metadata_item_metadata.rb b/lib/fog/vcloud_director/requests/compute/get_organization_metadata_item_metadata.rb new file mode 100644 index 000000000..68c64b3cf --- /dev/null +++ b/lib/fog/vcloud_director/requests/compute/get_organization_metadata_item_metadata.rb @@ -0,0 +1,28 @@ +module Fog + module Compute + class VcloudDirector + class Real + # 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 http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-OrganizationMetadataItem-metadata.html + # vCloud API Documentation + # @since vCloud API version 5.1 + 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 + end + end + end +end diff --git a/lib/fog/vcloud_director/requests/compute/get_vapp_metadata_item_metadata.rb b/lib/fog/vcloud_director/requests/compute/get_vapp_metadata_item_metadata.rb new file mode 100644 index 000000000..67295b981 --- /dev/null +++ b/lib/fog/vcloud_director/requests/compute/get_vapp_metadata_item_metadata.rb @@ -0,0 +1,26 @@ +module Fog + module Compute + class VcloudDirector + class Real + # 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 http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppMetadataItem-metadata.html + # vCloud API Documentation + # @since vCloud API version 1.5 + def 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 + end + end + end +end diff --git a/lib/fog/vcloud_director/requests/compute/get_vapp_template_metadata_item_metadata.rb b/lib/fog/vcloud_director/requests/compute/get_vapp_template_metadata_item_metadata.rb new file mode 100644 index 000000000..6290dd4a4 --- /dev/null +++ b/lib/fog/vcloud_director/requests/compute/get_vapp_template_metadata_item_metadata.rb @@ -0,0 +1,27 @@ +module Fog + module Compute + class VcloudDirector + class Real + # 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 http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppTemplateMetadataItem-metadata.html + # vCloud API Documentation + # @since vCloud API version 1.5 + 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 + end + end + end +end diff --git a/lib/fog/vcloud_director/requests/compute/get_vdc_metadata_item_metadata.rb b/lib/fog/vcloud_director/requests/compute/get_vdc_metadata_item_metadata.rb new file mode 100644 index 000000000..63ce60086 --- /dev/null +++ b/lib/fog/vcloud_director/requests/compute/get_vdc_metadata_item_metadata.rb @@ -0,0 +1,28 @@ +module Fog + module Compute + class VcloudDirector + class Real + # 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 http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VdcMetadataItem-metadata.html + # vCloud API Documentation + # @since vCloud API version 1.5 + 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 + end + end + end +end diff --git a/lib/fog/vcloud_director/requests/compute/get_vdc_storage_profile.rb b/lib/fog/vcloud_director/requests/compute/get_vdc_storage_class.rb similarity index 85% rename from lib/fog/vcloud_director/requests/compute/get_vdc_storage_profile.rb rename to lib/fog/vcloud_director/requests/compute/get_vdc_storage_class.rb index 015d844a4..8edb0c76e 100644 --- a/lib/fog/vcloud_director/requests/compute/get_vdc_storage_profile.rb +++ b/lib/fog/vcloud_director/requests/compute/get_vdc_storage_class.rb @@ -2,6 +2,9 @@ module Fog module Compute class VcloudDirector class Real + extend Fog::Deprecation + deprecate :get_vdc_storage_profile, :get_vdc_storage_class + # Returns storage class referred by the Id. All properties of the # storage classes are visible to vcloud user, except for VDC Storage # Class reference. @@ -11,7 +14,7 @@ module Fog # * body<~Hash>: # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VdcStorageClass.html # vCloud API Documentation - def get_vdc_storage_profile(id) + def get_vdc_storage_class(id) request( :expects => 200, :idempotent => true, diff --git a/lib/fog/vcloud_director/requests/compute/get_vdc_storage_profile_metadata.rb b/lib/fog/vcloud_director/requests/compute/get_vdc_storage_class_metadata.rb similarity index 81% rename from lib/fog/vcloud_director/requests/compute/get_vdc_storage_profile_metadata.rb rename to lib/fog/vcloud_director/requests/compute/get_vdc_storage_class_metadata.rb index 7d6e25fd9..617065709 100644 --- a/lib/fog/vcloud_director/requests/compute/get_vdc_storage_profile_metadata.rb +++ b/lib/fog/vcloud_director/requests/compute/get_vdc_storage_class_metadata.rb @@ -2,6 +2,9 @@ module Fog module Compute class VcloudDirector class Real + extend Fog::Deprecation + deprecate :get_vdc_storage_profile_metadata, :get_vdc_storage_class_metadata + # Retrieve metadata associated with the vDC storage profile. # # @param [String] id Object identifier of the vDC storage profile. @@ -9,7 +12,7 @@ module Fog # * body<~Hash>: # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VdcStorageClassMetadata.html # vCloud API Documentation - def get_vdc_storage_profile_metadata(id) + def get_vdc_storage_class_metadata(id) request( :expects => 200, :idempotent => true, diff --git a/lib/fog/vcloud_director/requests/compute/get_vdc_storage_class_metadata_item_metadata.rb b/lib/fog/vcloud_director/requests/compute/get_vdc_storage_class_metadata_item_metadata.rb new file mode 100644 index 000000000..3a056e5e8 --- /dev/null +++ b/lib/fog/vcloud_director/requests/compute/get_vdc_storage_class_metadata_item_metadata.rb @@ -0,0 +1,26 @@ +module Fog + module Compute + class VcloudDirector + class Real + # Retrieve metadata associated with the vDC storage profile. + # + # @param [String] id Object identifier of the vDC storage profile. + # @param [String] domain + # @param [String] key Key of the metadata. + # @return [Excon::Response] + # * body<~Hash>: + # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VdcStorageClassMetadataItem-metadata.html + # vCloud API Documentation + 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 + end + end + end +end