Sha256: c276825b3c7b9732e548c7ab3e5555c9d7d00f37ff056bbb8665f8fa57daa063
Contents?: true
Size: 1.98 KB
Versions: 47
Compression:
Stored size: 1.98 KB
Contents
module Fog module Network class AzureRM # Real class for Network Request class Real def detach_route_table_from_subnet(resource_group, subnet_name, virtual_network_name, address_prefix, network_security_group_id) msg = "Detaching Route Table from Subnet: #{subnet_name}" Fog::Logger.debug msg subnet = get_subnet_object_for_detach_route_table(address_prefix, network_security_group_id) begin subnet = @network_client.subnets.create_or_update(resource_group, virtual_network_name, subnet_name, subnet) rescue MsRestAzure::AzureOperationError => e raise_azure_exception(e, msg) end Fog::Logger.debug 'Route Table detached successfully.' subnet end private def get_subnet_object_for_detach_route_table(address_prefix, network_security_group_id) subnet = Azure::ARM::Network::Models::Subnet.new network_security_group = Azure::ARM::Network::Models::NetworkSecurityGroup.new network_security_group.id = network_security_group_id subnet.address_prefix = address_prefix subnet.network_security_group = network_security_group unless network_security_group_id.nil? subnet.route_table = nil subnet end end # Mock class for Network Request class Mock def detach_route_table_from_subnet(*) subnet = { 'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-rg/providers/Microsoft.Network/virtualNetworks/fog-vnet/subnets/fog-subnet', 'properties' => { 'addressPrefix' => '10.1.0.0/24', 'provisioningState' => 'Succeeded' }, 'name' => 'fog-subnet' } subnet_mapper = Azure::ARM::Network::Models::Subnet.mapper @network_client.deserialize(subnet_mapper, subnet, 'result.body') end end end end end
Version data entries
47 entries across 47 versions & 4 rubygems