lib/fog/azurerm/models/network/virtual_network.rb in fog-azure-rm-0.3.3 vs lib/fog/azurerm/models/network/virtual_network.rb in fog-azure-rm-0.3.4
- old
+ new
@@ -9,19 +9,21 @@
attribute :location
attribute :resource_group
attribute :dns_servers
attribute :subnets
attribute :address_prefixes
+ attribute :tags
def self.parse(vnet)
hash = {}
hash['id'] = vnet.id
hash['name'] = vnet.name
hash['resource_group'] = get_resource_group_from_id(vnet.id)
hash['location'] = vnet.location
hash['dns_servers'] = vnet.dhcp_options.dns_servers unless vnet.dhcp_options.nil?
hash['address_prefixes'] = vnet.address_space.address_prefixes unless vnet.address_space.address_prefixes.nil?
+ hash['tags'] = vnet.tags
subnets = []
vnet.subnets.each do |subnet|
subnet_object = Fog::Network::AzureRM::Subnet.new
subnets.push(subnet_object.merge_attributes(Fog::Network::AzureRM::Subnet.parse(subnet)))
@@ -34,11 +36,11 @@
requires :name
requires :location
requires :resource_group
validate_subnets!(subnets) unless subnets.nil?
- virtual_network = service.create_or_update_virtual_network(resource_group, name, location, dns_servers, subnets, address_prefixes)
+ virtual_network = service.create_or_update_virtual_network(resource_group, name, location, dns_servers, subnets, address_prefixes, tags)
merge_attributes(Fog::Network::AzureRM::VirtualNetwork.parse(virtual_network))
end
def add_dns_servers(dns_servers_list)
virtual_network = service.add_dns_servers_in_virtual_network(resource_group, name, dns_servers_list)
@@ -73,10 +75,10 @@
def update(vnet_hash)
raise('Provided hash can not be empty.') if vnet_hash.empty? || vnet_hash.nil?
validate_update_attributes!(vnet_hash)
merge_attributes(vnet_hash)
- virtual_network = service.create_or_update_virtual_network(resource_group, name, location, dns_servers, subnets, address_prefixes)
+ virtual_network = service.create_or_update_virtual_network(resource_group, name, location, dns_servers, subnets, address_prefixes, tags)
merge_attributes(Fog::Network::AzureRM::VirtualNetwork.parse(virtual_network))
end
def destroy
service.delete_virtual_network(resource_group, name)