lib/azure/virtual_network_management/serialization.rb in azure-0.6.4 vs lib/azure/virtual_network_management/serialization.rb in azure-0.7.0.pre

- old
+ new

@@ -15,10 +15,11 @@ require 'azure/virtual_network_management/virtual_network' module Azure module VirtualNetworkManagement module Serialization + extend Azure::Core::Utility def self.virtual_network_from_xml(network_xml) virtual_networks = [] virtual_network_services_xml = network_xml.css( 'VirtualNetworkSites VirtualNetworkSite' ) @@ -35,10 +36,14 @@ ) virtual_network.affinity_group = xml_content( virtual_network_service_xml, 'AffinityGroup' ) + virtual_network.location = xml_content( + virtual_network_service_xml, + 'Location' + ) virtual_network.state = xml_content( virtual_network_service_xml, 'State' ) address_prefixes = virtual_network_service_xml.css( @@ -68,11 +73,11 @@ end virtual_networks.compact end def self.virtual_network_to_xml(vnet_name, - affinity_group, + location, address_spaces, options = {}) options[:dns] ||= {} options[:subnet] ||= {} options[:subnet].each do |subnet| @@ -102,18 +107,20 @@ others = { subnet: vnet.subnets, dns: vnet.dns_servers } virtual_network_site(xml, vnet.name, + vnet.location, vnet.affinity_group, vnet.address_space, others) end end virtual_network_site(xml, vnet_name, - affinity_group, + location, + nil, address_spaces, options) end end end @@ -123,16 +130,18 @@ private def self.virtual_network_site(xml, vnet_name, + location, affinity_group, address_spaces, options) xml.VirtualNetworkSite( 'name' => vnet_name, - 'AffinityGroup' => affinity_group + 'AffinityGroup' => affinity_group, + 'Location' => location ) do xml.DnsServersRef do options[:dns].each do |dns| xml.DnsServerRef('name' => dns[:name]) end @@ -157,11 +166,9 @@ end end end def self.dns_server_to_xml(xml, dns_servers, new_dns_servers) - dns_names = [] - dns_list = {} dns_list.merge!(merge_dns(new_dns_servers)) dns_list.merge!(merge_dns(dns_servers)) dns_list.each do |name, ip_address|