Sha256: f1a7edb0e22d61d1d39c7c7c709893e1fc6001240ce6309c3c3a3021ee2cf004
Contents?: true
Size: 1.67 KB
Versions: 1
Compression:
Stored size: 1.67 KB
Contents
module Fog module Network class AzureRM # This class is giving implementation of create/save and # delete/destroy for virtual network. class VirtualNetwork < Fog::Model identity :name attribute :id attribute :location attribute :resource_group attribute :dns_list attribute :subnet_address_list attribute :network_address_list def self.parse(vnet) hash = {} hash['id'] = vnet['id'] hash['name'] = vnet['name'] hash['resource_group'] = vnet['id'].split('/')[4] hash['location'] = vnet['location'] hash['dns_list'] = vnet['properties']['dhcpOptions']['dnsServers'].join(',') unless vnet['properties']['dhcpOptions'].nil? hash['network_address_list'] = vnet['properties']['addressSpace']['addressPrefixes'].join(',') unless vnet['properties']['addressSpace']['addressPrefixes'].nil? subnet_address_list = [] vnet['properties']['subnets'].each do |subnet| subnet_address_list << subnet['properties']['addressPrefix'] end hash['subnet_address_list'] = subnet_address_list.join(',') hash end def save requires :name requires :location requires :resource_group vnet = service.create_virtual_network(resource_group, name, location, dns_list, subnet_address_list, network_address_list) merge_attributes(Fog::Network::AzureRM::VirtualNetwork.parse(vnet)) end def destroy service.delete_virtual_network(resource_group, name) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fog-azure-rm-0.0.3 | lib/fog/azurerm/models/network/virtual_network.rb |