diff --git a/lib/fog/vcloudng/parsers/compute/get_catalog.rb b/lib/fog/vcloudng/parsers/compute/get_catalog.rb deleted file mode 100644 index cb4876b7b..000000000 --- a/lib/fog/vcloudng/parsers/compute/get_catalog.rb +++ /dev/null @@ -1,63 +0,0 @@ -# -# -# -# -# -# -# this is a description -# -# -# -# -# -# false -# - - -module Fog - module Parsers - module Compute - module Vcloudng - - - class GetCatalog < VcloudngParser - - def reset - @response = { 'CatalogItems' => [], 'Links' => [] } - end - - def start_element(name, attributes) - super - case name - when 'CatalogItem' - catalog_item = extract_attributes(attributes) - catalog_item["id"] = catalog_item["href"].split('/').last - @response['CatalogItems'] << catalog_item - when 'Catalog' - catalog = extract_attributes(attributes) - @response['name'] = catalog['name'] - @response['type'] = catalog['type'] - @response['href'] = catalog['href'] - @response['id'] = catalog['href'].split('/').last - when "Link" - link = extract_attributes(attributes) - @response["Links"] << link - end - end - - def end_element(name) - case name - when 'Description' - @response[name] = value - when 'IsPublished' - value_boolean = value == 'false' ? false : true - @response[name] = value_boolean - end - end - - end - - end - end - end -end diff --git a/lib/fog/vcloudng/parsers/compute/get_catalog_item.rb b/lib/fog/vcloudng/parsers/compute/get_catalog_item.rb deleted file mode 100644 index fd04df35c..000000000 --- a/lib/fog/vcloudng/parsers/compute/get_catalog_item.rb +++ /dev/null @@ -1,54 +0,0 @@ -# -# -# -# -# -# Red Hat Enterprise Linux 6 -# -# - - -module Fog - module Parsers - module Compute - module Vcloudng - - class GetCatalogItem < VcloudngParser - - def reset - @response = { 'Entity' => {}, 'Links' => [] } - end - - def start_element(name, attributes) - super - case name - when 'Entity' - entity_item = extract_attributes(attributes) - entity_item["id"] = entity_item["href"].split('/').last - @response['vapp_template_id'] = entity_item["id"] - @response['Entity'] = entity_item - when 'CatalogItem' - catalog_item = extract_attributes(attributes) - @response['name'] = catalog_item['name'] - @response['type'] = catalog_item['type'] - @response['href'] = catalog_item['href'] - @response['id'] = catalog_item['href'].split('/').last - when "Link" - link = extract_attributes(attributes) - @response["Links"] << link - end - end - - def end_element(name) - if name == 'Description' - @response[name] = value - end - end - - - end - - end - end - end -end diff --git a/lib/fog/vcloudng/parsers/compute/get_network.rb b/lib/fog/vcloudng/parsers/compute/get_network.rb deleted file mode 100644 index 8c581e088..000000000 --- a/lib/fog/vcloudng/parsers/compute/get_network.rb +++ /dev/null @@ -1,72 +0,0 @@ -# -# -# -# -# -# -# -# -# true -# 10.192.0.1 -# 255.255.252.0 -# 10.192.0.11 -# 10.192.0.12 -# dev.ad.mdsol.com -# -# -# 10.192.0.100 -# 10.192.3.254 -# -# -# -# bridged -# false -# -# - -module Fog - module Parsers - module Compute - module Vcloudng - - - - class GetNetwork < VcloudngParser - - def reset - @response = { - "Links" => [], "IpRanges" => [] - } - @ip_range = {} - end - - def start_element(name,attributes=[]) - super - case name - when "Link" - link = extract_attributes(attributes) - @response["Links"] << link - end - end - - def end_element(name) - case name - when "Gateway", "Netmask", "Dns1", "Dns2", "DnsSuffix", "FenceMode" - @response[name] = value - when "IsInherited", "RetainNetInfoAcrossDeployments" - @response[name] = value.to_bool - when "StartAddress", "EndAddress" - @ip_range[name] = value - if @ip_range.keys.size == 2 - @response["IpRanges"] << @ip_range - @ip_range = {} - end - end - end - - end - - end - end - end -end diff --git a/lib/fog/vcloudng/parsers/compute/get_organization.rb b/lib/fog/vcloudng/parsers/compute/get_organization.rb deleted file mode 100644 index 03766f3c7..000000000 --- a/lib/fog/vcloudng/parsers/compute/get_organization.rb +++ /dev/null @@ -1,131 +0,0 @@ -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# DevOps -# -# -# parsed -# -#{"OrgList"=> -# [{"type"=>"application/vnd.vmware.vcloud.org+xml", -# "name"=>"DevOps", -# "href"=> -# "https://example.com/api/org/c6a4c623-c158-41cf-a87a-dbc1637ad55a", -# "id"=>"c6a4c623-c158-41cf-a87a-dbc1637ad55a"}]} -#{"OrgList"=>[{"type"=>"application/vnd.vmware.vcloud.org+xml", "name"=>"DevOps", "href"=>"https://example.com/api/org/c6a4c623-c158-41cf-a87a-dbc1637ad55a", "id"=>"c6a4c623-c158-41cf-a87a-dbc1637ad55a"}]} -#>> pp vcloud.get_organization("c6a4c623-c158-41cf-a87a-dbc1637ad55a").body -#{"Links"=> -# [{"rel"=>"down", -# "type"=>"application/vnd.vmware.vcloud.vdc+xml", -# "name"=>"DevOps - VDC", -# "href"=> -# "https://example.com/api/vdc/9a06a16b-12c6-44dc-aee1-06aa52262ea3"}, -# {"rel"=>"down", -# "type"=>"application/vnd.vmware.vcloud.tasksList+xml", -# "href"=> -# "https://example.com/api/tasksList/c6a4c623-c158-41cf-a87a-dbc1637ad55a"}, -# {"rel"=>"down", -# "type"=>"application/vnd.vmware.vcloud.catalog+xml", -# "name"=>"Public VM Templates", -# "href"=> -# "https://example.com/api/catalog/4ee720e5-173a-41ac-824b-6f4908bac975"}, -# {"rel"=>"down", -# "type"=>"application/vnd.vmware.vcloud.controlAccess+xml", -# "href"=> -# "https://example.com/api/org/c6a4c623-c158-41cf-a87a-dbc1637ad55a/catalog/4ee720e5-173a-41ac-824b-6f4908bac975/controlAccess/"}, -# {"rel"=>"down", -# "type"=>"application/vnd.vmware.vcloud.catalog+xml", -# "name"=>"prueba", -# "href"=> -# "https://example.com/api/catalog/ea0c6acf-c9c0-46b7-b19f-4b2d3bf8aa33"}, -# {"rel"=>"down", -# "type"=>"application/vnd.vmware.vcloud.controlAccess+xml", -# "href"=> -# "https://example.com/api/org/c6a4c623-c158-41cf-a87a-dbc1637ad55a/catalog/ea0c6acf-c9c0-46b7-b19f-4b2d3bf8aa33/controlAccess/"}, -# {"rel"=>"controlAccess", -# "type"=>"application/vnd.vmware.vcloud.controlAccess+xml", -# "href"=> -# "https://example.com/api/org/c6a4c623-c158-41cf-a87a-dbc1637ad55a/catalog/ea0c6acf-c9c0-46b7-b19f-4b2d3bf8aa33/action/controlAccess"}, -# {"rel"=>"add", -# "type"=>"application/vnd.vmware.admin.catalog+xml", -# "href"=> -# "https://example.com/api/admin/org/c6a4c623-c158-41cf-a87a-dbc1637ad55a/catalogs"}, -# {"rel"=>"down", -# "type"=>"application/vnd.vmware.vcloud.orgNetwork+xml", -# "name"=>"DevOps - Dev Network Connection", -# "href"=> -# "https://example.com/api/network/d5f47bbf-de27-4cf5-aaaa-56772f2ccd17"}, -# {"rel"=>"down", -# "type"=>"application/vnd.vmware.vcloud.metadata+xml", -# "href"=> -# "https://example.com/api/org/c6a4c623-c158-41cf-a87a-dbc1637ad55a/metadata"}], -# "href"=> -# "https://example.com/api/org/c6a4c623-c158-41cf-a87a-dbc1637ad55a", -# "name"=>"DevOps", -# "Description"=>nil} - - -module Fog - module Parsers - module Compute - module Vcloudng - - - class GetOrganization < VcloudngParser - - def reset - @response = { 'Links' => [] } - end - - def start_element(name, attributes) - super - case name - when 'Link' - link = extract_attributes(attributes) - until attributes.empty? - if attributes.first.is_a?(Array) - attribute = attributes.shift - link[attribute.first] = attribute.last - else - link[attributes.shift] = attributes.shift - end - end - @response['Links'] << link - when 'Org' - org = extract_attributes(attributes) - until attributes.empty? - if attributes.first.is_a?(Array) - attribute = attributes.shift - org[attribute.first] = attribute.last - else - org[attributes.shift] = attributes.shift - end - end - @response['href'] = org['href'] - @response['id'] = org['href'].split('/').last - @response['name'] = org['name'] - end - end - - def end_element(name) - if name == 'Description' - @response[name] = value - end - end - - end - end - end - end -end \ No newline at end of file diff --git a/lib/fog/vcloudng/parsers/compute/get_organizations.rb b/lib/fog/vcloudng/parsers/compute/get_organizations.rb deleted file mode 100644 index a66626fdd..000000000 --- a/lib/fog/vcloudng/parsers/compute/get_organizations.rb +++ /dev/null @@ -1,41 +0,0 @@ -# -# -# -# -# -# -# parsed: -# {"OrgList"=> -# [{"type"=>"application/vnd.vmware.vcloud.org+xml", -# "name"=>"DevOps", -# "href"=> -# "https://example.com/api/org/c6a4c623-c158-41cf-a87a-dbc1637ad55a", -# "id"=>"c6a4c623-c158-41cf-a87a-dbc1637ad55a"}]} -# - -module Fog - module Parsers - module Compute - module Vcloudng - - - class GetOrganizations < VcloudngParser - - def reset - @response = { 'OrgList' => [] } - end - - def start_element(name, attributes) - super - if name == 'Org' - organization = extract_attributes(attributes) - organization['id'] = organization['href'].split('/').last - @response['OrgList'] << organization - end - end - - end - end - end - end -end diff --git a/lib/fog/vcloudng/parsers/compute/get_vapp.rb b/lib/fog/vcloudng/parsers/compute/get_vapp.rb deleted file mode 100644 index 914785e45..000000000 --- a/lib/fog/vcloudng/parsers/compute/get_vapp.rb +++ /dev/null @@ -1,68 +0,0 @@ -module Fog - module Parsers - module Compute - module Vcloudng - - - - class GetVapp < VcloudngParser - - def reset - @response = { 'Links' => [], 'VirtualHardware' => {}, 'OperatingSystem' => {} } - @in_operating_system = false - @resource_type = nil - end - - def start_element(name, attributes) - super - case name - when 'Link' - link = extract_attributes(attributes) - @response['Links'] << link - when 'OperatingSystemSection' - @in_operating_system = true - when 'VApp' - vapp = extract_attributes(attributes) - @response.merge!(vapp.reject {|key,value| !['href', 'name', 'size', 'status', 'type'].include?(key)}) - end - end - - def end_element(name) - case name - when 'IpAddress' - @response['IpAddress'] = value - when 'Description' - if @in_operating_system - @response['OperatingSystem'][name] = value - @in_operating_system = false - end - when 'ResourceType' - @resource_type = value - case value - when '3' - @get_cpu = true # cpu - when '4' # memory - @get_ram = true - when '17' # disks - @get_disks = true - end - when 'VirtualQuantity' - case @resource_type - when '3' - @response['VirtualHardware']['cpu'] = value - when '4' - @response['VirtualHardware']['ram'] = value - when '17' - @response['VirtualHardware']['disks'] ||= [] - @response['VirtualHardware']['disks'] << value - end - end - end - - end - - end - end - end -end - diff --git a/lib/fog/vcloudng/parsers/compute/get_vapp_template.rb b/lib/fog/vcloudng/parsers/compute/get_vapp_template.rb deleted file mode 100644 index 55beab136..000000000 --- a/lib/fog/vcloudng/parsers/compute/get_vapp_template.rb +++ /dev/null @@ -1,308 +0,0 @@ -# -# -# -# -# -# -# -# -# -# Windows Server 2008 R2 Web Edition -# -# -# -# -# -# -# -# Windows Server 2008 R2 Web Edition -# -# Specifies the available VM network connections -# 0 -# -# 0 -# false -# 00:50:56:98:77:23 -# NONE -# -# -# -# Specifies Guest OS Customization Settings -# true -# false -# 12af4ee1-04ad-4ae5-bab2-2d5db4296c85 -# false -# false -# false -# true -# false -# DEVWEB-001 -# -# DEVWEB -# -# -# -# The list of logical networks -# -# This is a special place-holder used for disconnected network interfaces. -# -# -# -# The configuration parameters for logical networks -# -# This is a special place-holder used for disconnected network interfaces. -# -# isolated -# -# false -# -# -# -# Lease settings section -# -# 7776000 -# 2013-09-11T15:53:20.900Z -# -# -# VApp template customization section -# true -# -# - -#module Boolean; end -#class TrueClass; include Boolean; end -#class FalseClass; include Boolean; end -# -#module Fog -# module Parsers -# module Compute -# module Vcloudng -# -# -# -# class GetVappTemplate < VcloudngParser -# -# -# -# def customization_section -# -# end -# -# def lease_settings_section -# -# end -# -# -# def network_section -# -# end -# -# -# def vm -# -# end -# -# def children -# { -# 'elements' => { 'Vm' => vm } -# } -# end -# -# def link -# { -# 'attributes' => { 'rel' => String, -# 'type' => String, -# 'href' => String -# } -# } -# end -# -# -# -# def owner -# { -# 'attributes' => { 'type' => String }, -# 'elements' => { 'user' => user } -# } -# end -# -# def user -# { -# 'elements' => { 'type' => String, -# 'name' => String, -# 'href' => String -# } -# } -# end -# -# def vapp_template -# { -# 'attributes' => { 'goldMaster' => Boolean, -# 'status' => Integer, -# 'name' => String, -# 'type' => String, -# 'href' => String -# }, -# 'elements' => { 'Link' => link, -# 'Description' => String, -# 'Owner' => owner, -# 'Children' => children, -# 'NetworkSection' => network_section, -# 'LeaseSettingsSection' => lease_settings_section, -# 'CustomizationSection' => customization_section -# } -# -# } -# end -# -# @schema = { 'VAppTemplate' => vapp_template } -# -# def reset -# @response = { 'Links' => [], 'Children' => [] } -# @current_path = [] -# end -# -# def start_element(name, attributes) -# super -# if is_an_attribute?(name) -# @last_element = name -# current = extract_attributes(attributes) -# else -# @current_path << name if @current_path.last != name -# -# end -# end -# -# def end_element(name) -# case name -# when @schema['elements'].keys? -# @schema['attributes'][name] == -# end -# end -# -# end -# -# end -# end -# end -#end - -module Fog - module Parsers - module Compute - module Vcloudng - - - - class GetVappTemplate < VcloudngParser - - def reset - @response = { 'Links' => [], 'Children' => [] } - @in_children = false - @in_network_connection_section = false - @in_guest_customization_section = false - @in_network_config = false - @vm = {} - @guest_customization_section = {} - @network_connection_section = {} - @network_connection = {} - end - - def start_element(name, attributes) - super - case name - when 'Link' - link = extract_attributes(attributes) - @response['Links'] << link - when 'User' - @response['Owner'] = extract_attributes(attributes) - when 'VAppTemplate' - vapp_template = extract_attributes(attributes) - @response['name'] = vapp_template['name'] - when 'Children' - @in_children = true - when 'vm' - vm_item = extract_attributes(attributes) - @vm['name'] = vm_item['name'] - @vm['goldMaster'] = vm_item['goldMaster'].to_bool - @vm['href'] = vm_item['href'] - @vm['id'] = vm_item['href'].split('/').last - when 'NetworkConnectionSection' - @in_network_connection_section = true - when 'NetworkConnection' - @in_network_connection = true - network_connection_items = extract_attributes(attributes) - @network_connection['network'] = network_connection_items['network'] - @network_connection['needsCustomization'] = network_connection_items['needsCustomization'].to_bool - when 'NetworkConfig' - @in_network_config = true - when 'GuestCustomizationSection' - guest_customization_item = extract_attributes(attributes) - @guest_customization_section["href"] = guest_customization_item["href"] - @guest_customization_section["required"] = guest_customization_item["required"].to_bool - @guest_customization_section["type"] = guest_customization_item["type"] - @in_guest_customization_section = true - end - end - - def end_element(name) - if @in_children - case name - when 'Description' - @vm['Description'] = value - when 'NetworkConnection' - @vm['NetworkConnectionSection'] ||= {} - @vm['NetworkConnectionSection']['NetworkConnection'] = @network_connection - @network_connection = {} - @in_network_connection = false - when 'NetworkConnectionSection' - @vm['NetworkConnectionSection'].merge!(@network_connection_section) - @network_connection_section = {} - @in_network_connection_section = false - when 'GuestCustomizationSection' - @vm['GuestCustomizationSection'] = @guest_customization_section - @guest_customization_section = {} - @in_guest_customization_section = false - when 'Vm' - @response['Children'] << @vm - @vm = {} - when 'Children' - @in_children = false - end - - if @in_network_connection_section - case name - when 'PrimaryNetworkConnectionIndex' - @network_connection_section['PrimaryNetworkConnectionIndex'] = value.to_i - when - @network_connection['NetworkConnectionIndex'] = value.to_i - when 'IsConnected' - @network_connection['IsConnected'] = value.to_bool - when 'MACAddress', 'IpAddressAllocationMode' - @network_connection[name] = value - end - end - - if @in_guest_customization_section - case name - when 'Enabled', 'ChangeSid', 'JoinDomainEnabled', 'UseOrgSettings', 'AdminPasswordEnabled', 'AdminPasswordAuto', 'ResetPasswordRequired' - @guest_customization_section[name] = value.to_bool - when 'ComputerName', 'VirtualMachineId' - @guest_customization_section[name] = value - end - end - else - case name - when 'Description' - @response['Description'] = value - end - end - end - - end - - end - end - end -end - diff --git a/lib/fog/vcloudng/parsers/compute/get_vdc.rb b/lib/fog/vcloudng/parsers/compute/get_vdc.rb deleted file mode 100644 index d0ab54326..000000000 --- a/lib/fog/vcloudng/parsers/compute/get_vdc.rb +++ /dev/null @@ -1,94 +0,0 @@ -module Fog - module Parsers - module Compute - module Vcloudng - - - class GetVdc < VcloudngParser - - def reset - @in_storage_capacity = false - @in_cpu = false - @in_memory = false - @in_instantiated_vms_quota = false - @in_deployed_vms_quota = false - @response = { - 'links' => [], - 'AvailableNetworks' => [], - 'ComputeCapacity' => { - 'Cpu' => {}, - 'DeployedVmsQuota' => {}, - 'InstantiatedVmsQuota' => {}, - 'Memory' => {} - }, - 'StorageCapacity' => {}, - 'ResourceEntities' => [] - } - end - - def start_element(name, attributes) - super - case name - when 'Cpu' - @in_cpu = true - when 'DeployedVmsQuota' - @in_deployed_vms_quota = true - when 'InstantiatedVmsQuota' - @in_instantiated_vms_quota = true - when 'Link' - link = extract_attributes(attributes) - @response['links'] << link - when 'Memory' - @in_memory = true - when 'Network' - network = extract_attributes(attributes) - @response['AvailableNetworks'] << network - when 'ResourceEntity' - resource_entity = extract_attributes(attributes) - @response['ResourceEntities'] << resource_entity - when 'StorageCapacity' - @in_storage_capacity = true - when 'Vdc' - vdc = extract_attributes(attributes) - @response['href'] = vdc['href'] - @response['id'] = vdc['href'].split('/').last - @response['name'] = vdc['name'] - @response['type'] = vdc['type'] - end - end - - def end_element(name) - case name - when 'Allocated', 'Limit', 'Units', 'Used' - if @in_cpu - @response['ComputeCapacity']['Cpu'][name] = value - elsif @in_deployed_vms_quota - @response['ComputeCapacity']['DeployedVmsQuota'][name] = value - elsif @in_instantiated_vms_quota - @response['ComputeCapacity']['InstantiatedVmsQuota'][name] = value - elsif @in_memory - @response['ComputeCapacity']['Memory'][name] = value - elsif @in_storage_capacity - @response['StorageCapacity'][name] = value - end - when 'Cpu' - @in_cpu = false - when 'DeployedVmsQuota' - @in_deployed_vms_quota = false - when 'InstantiatedVmsQuota' - @in_instantiated_vms_quota = false - when 'Memory' - @in_memory = false - when 'StorageCapacity' - @in_storage_capacity = false - when 'Type' - @response[name] = value - end - end - - end - - end - end - end -end