Class: Fog::Network::AzureRM::Real

Inherits:
Object
  • Object
show all
Defined in:
lib/fog/azurerm/network.rb,
lib/fog/azurerm/requests/network/get_subnet.rb,
lib/fog/azurerm/requests/network/list_subnets.rb,
lib/fog/azurerm/requests/network/create_subnet.rb,
lib/fog/azurerm/requests/network/delete_subnet.rb,
lib/fog/azurerm/requests/network/get_public_ip.rb,
lib/fog/azurerm/requests/network/list_public_ips.rb,
lib/fog/azurerm/requests/network/delete_public_ip.rb,
lib/fog/azurerm/requests/network/get_load_balancer.rb,
lib/fog/azurerm/requests/network/add_security_rules.rb,
lib/fog/azurerm/requests/network/check_subnet_exists.rb,
lib/fog/azurerm/requests/network/get_virtual_network.rb,
lib/fog/azurerm/requests/network/list_load_balancers.rb,
lib/fog/azurerm/requests/network/create_load_balancer.rb,
lib/fog/azurerm/requests/network/delete_load_balancer.rb,
lib/fog/azurerm/requests/network/remove_security_rule.rb,
lib/fog/azurerm/requests/network/get_network_interface.rb,
lib/fog/azurerm/requests/network/list_virtual_networks.rb,
lib/fog/azurerm/requests/network/attach_resource_to_nic.rb,
lib/fog/azurerm/requests/network/check_public_ip_exists.rb,
lib/fog/azurerm/requests/network/delete_virtual_network.rb,
lib/fog/azurerm/requests/network/list_network_interfaces.rb,
lib/fog/azurerm/requests/network/delete_network_interface.rb,
lib/fog/azurerm/requests/network/detach_resource_from_nic.rb,
lib/fog/azurerm/requests/network/check_net_sec_rule_exists.rb,
lib/fog/azurerm/requests/network/check_vnet_gateway_exists.rb,
lib/fog/azurerm/requests/network/get_connection_shared_key.rb,
lib/fog/azurerm/requests/network/get_express_route_circuit.rb,
lib/fog/azurerm/requests/network/get_local_network_gateway.rb,
lib/fog/azurerm/requests/network/get_network_security_rule.rb,
lib/fog/azurerm/requests/network/set_connection_shared_key.rb,
lib/fog/azurerm/requests/network/check_load_balancer_exists.rb,
lib/fog/azurerm/requests/network/check_net_sec_group_exists.rb,
lib/fog/azurerm/requests/network/create_or_update_public_ip.rb,
lib/fog/azurerm/requests/network/get_network_security_group.rb,
lib/fog/azurerm/requests/network/get_virtual_network_gateway.rb,
lib/fog/azurerm/requests/network/list_express_route_circuits.rb,
lib/fog/azurerm/requests/network/list_local_network_gateways.rb,
lib/fog/azurerm/requests/network/list_network_security_rules.rb,
lib/fog/azurerm/requests/network/reset_connection_shared_key.rb,
lib/fog/azurerm/requests/network/attach_route_table_to_subnet.rb,
lib/fog/azurerm/requests/network/check_virtual_network_exists.rb,
lib/fog/azurerm/requests/network/delete_express_route_circuit.rb,
lib/fog/azurerm/requests/network/delete_local_network_gateway.rb,
lib/fog/azurerm/requests/network/delete_network_security_rule.rb,
lib/fog/azurerm/requests/network/list_network_security_groups.rb,
lib/fog/azurerm/requests/network/delete_network_security_group.rb,
lib/fog/azurerm/requests/network/list_virtual_network_gateways.rb,
lib/fog/azurerm/requests/network/add_subnets_in_virtual_network.rb,
lib/fog/azurerm/requests/network/check_local_net_gateway_exists.rb,
lib/fog/azurerm/requests/network/check_network_interface_exists.rb,
lib/fog/azurerm/requests/network/delete_virtual_network_gateway.rb,
lib/fog/azurerm/requests/network/detach_route_table_from_subnet.rb,
lib/fog/azurerm/requests/network/get_available_ipaddresses_count.rb,
lib/fog/azurerm/requests/network/create_or_update_virtual_network.rb,
lib/fog/azurerm/requests/network/get_express_route_circuit_peering.rb,
lib/fog/azurerm/requests/network/add_dns_servers_in_virtual_network.rb,
lib/fog/azurerm/requests/network/check_express_route_circuit_exists.rb,
lib/fog/azurerm/requests/network/create_or_update_network_interface.rb,
lib/fog/azurerm/requests/network/check_express_route_cir_auth_exists.rb,
lib/fog/azurerm/requests/network/list_express_route_circuit_peerings.rb,
lib/fog/azurerm/requests/network/list_load_balancers_in_subscription.rb,
lib/fog/azurerm/requests/network/remove_subnets_from_virtual_network.rb,
lib/fog/azurerm/requests/network/check_vnet_gateway_connection_exists.rb,
lib/fog/azurerm/requests/network/delete_express_route_circuit_peering.rb,
lib/fog/azurerm/requests/network/list_express_route_service_providers.rb,
lib/fog/azurerm/requests/network/list_virtual_networks_in_subscription.rb,
lib/fog/azurerm/requests/network/create_or_update_express_route_circuit.rb,
lib/fog/azurerm/requests/network/create_or_update_local_network_gateway.rb,
lib/fog/azurerm/requests/network/create_or_update_network_security_rule.rb,
lib/fog/azurerm/requests/network/get_virtual_network_gateway_connection.rb,
lib/fog/azurerm/requests/network/add_address_prefixes_in_virtual_network.rb,
lib/fog/azurerm/requests/network/attach_network_security_group_to_subnet.rb,
lib/fog/azurerm/requests/network/create_or_update_network_security_group.rb,
lib/fog/azurerm/requests/network/get_express_route_circuit_authorization.rb,
lib/fog/azurerm/requests/network/remove_dns_servers_from_virtual_network.rb,
lib/fog/azurerm/requests/network/create_or_update_virtual_network_gateway.rb,
lib/fog/azurerm/requests/network/list_virtual_network_gateway_connections.rb,
lib/fog/azurerm/requests/network/delete_virtual_network_gateway_connection.rb,
lib/fog/azurerm/requests/network/detach_network_security_group_from_subnet.rb,
lib/fog/azurerm/requests/network/list_express_route_circuit_authorizations.rb,
lib/fog/azurerm/requests/network/delete_express_route_circuit_authorization.rb,
lib/fog/azurerm/requests/network/remove_address_prefixes_from_virtual_network.rb,
lib/fog/azurerm/requests/network/create_or_update_express_route_circuit_peering.rb,
lib/fog/azurerm/requests/network/create_or_update_virtual_network_gateway_connection.rb,
lib/fog/azurerm/requests/network/create_or_update_express_route_circuit_authorization.rb

Overview

Real class for Express Route Circuit Authorization Request

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Real

Returns a new instance of Real.



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/fog/azurerm/network.rb', line 151

def initialize(options)
  begin
    require 'azure_mgmt_network'
    require 'yaml'
  rescue LoadError => e
    retry if require('rubygems')
    raise e.message
  end

  options[:environment] = 'AzureCloud' if options[:environment].nil?

  credentials = Fog::Credentials::AzureRM.get_credentials(options[:tenant_id], options[:client_id], options[:client_secret], options[:environment])
  telemetry = "fog-azure-rm/#{Fog::AzureRM::VERSION}"
  @network_client = ::Azure::ARM::Network::NetworkManagementClient.new(credentials, resource_manager_endpoint_url(options[:environment]))
  @network_client.subscription_id = options[:subscription_id]
  @network_client.add_user_agent_information(telemetry)
  @tenant_id = options[:tenant_id]
  @client_id = options[:client_id]
  @client_secret = options[:client_secret]
  @subscription_id = options[:subscription_id]
  @environment = options[:environment]
  current_directory = File.dirname(__FILE__)
  @logger_messages = YAML.load_file("#{current_directory}/utilities/logger_messages.yml")
end

Instance Method Details

#add_address_prefixes_in_virtual_network(resource_group_name, virtual_network_name, address_prefixes) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/fog/azurerm/requests/network/add_address_prefixes_in_virtual_network.rb', line 6

def add_address_prefixes_in_virtual_network(resource_group_name, virtual_network_name, address_prefixes)
  Fog::Logger.debug "Adding Address Prefixes: #{address_prefixes.join(', ')} in Virtual Network: #{virtual_network_name}"
  virtual_network = get_virtual_network_object_for_add_address_prefixes!(resource_group_name, virtual_network_name, address_prefixes)
  virtual_network = create_or_update_vnet(resource_group_name, virtual_network_name, virtual_network)
  Fog::Logger.debug "Address Prefixes: #{address_prefixes.join(', ')} added successfully."
  virtual_network
end

#add_dns_servers_in_virtual_network(resource_group_name, virtual_network_name, dns_servers) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/fog/azurerm/requests/network/add_dns_servers_in_virtual_network.rb', line 6

def add_dns_servers_in_virtual_network(resource_group_name, virtual_network_name, dns_servers)
  Fog::Logger.debug "Adding DNS Servers: #{dns_servers.join(', ')} in Virtual Network: #{virtual_network_name}"
  virtual_network = get_virtual_network_object_for_add_dns!(resource_group_name, virtual_network_name, dns_servers)
  virtual_network = create_or_update_vnet(resource_group_name, virtual_network_name, virtual_network)
  Fog::Logger.debug "DNS Servers: #{dns_servers.join(', ')} added successfully."
  virtual_network
end

#add_security_rules(resource_group_name, security_group_name, security_rules) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fog/azurerm/requests/network/add_security_rules.rb', line 6

def add_security_rules(resource_group_name, security_group_name, security_rules)
  msg = "Updating security rules in Network Security Group #{security_group_name}."
  Fog::Logger.debug msg

  nsg = @network_client.network_security_groups.get(resource_group_name, security_group_name)
  security_rules_objects = get_security_rule_objects(security_rules)

  security_rules_objects.each do |security_rule|
    nsg.security_rules.push(security_rule)
  end

  begin
    nsg = @network_client.network_security_groups.begin_create_or_update(resource_group_name, security_group_name, nsg)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end

  Fog::Logger.debug "Security Rules updated in Network Security Group #{security_group_name} successfully!"
  nsg
end

#add_subnets_in_virtual_network(resource_group_name, virtual_network_name, subnets) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/fog/azurerm/requests/network/add_subnets_in_virtual_network.rb', line 6

def add_subnets_in_virtual_network(resource_group_name, virtual_network_name, subnets)
  Fog::Logger.debug "Adding Subnets: in Virtual Network: #{virtual_network_name}"
  virtual_network = get_virtual_network_object_for_subnets!(resource_group_name, virtual_network_name, subnets)
  virtual_network = create_or_update_vnet(resource_group_name, virtual_network_name, virtual_network)
  Fog::Logger.debug 'Subnets added successfully.'
  virtual_network
end

#attach_network_security_group_to_subnet(resource_group, subnet_name, virtual_network_name, address_prefix, route_table_id, network_security_group_id) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/fog/azurerm/requests/network/attach_network_security_group_to_subnet.rb', line 6

def attach_network_security_group_to_subnet(resource_group, subnet_name, virtual_network_name, address_prefix, route_table_id, network_security_group_id)
  msg = "Attaching Network Security Group with Subnet: #{subnet_name}"
  Fog::Logger.debug msg
  subnet = get_subnet_object_for_attach_network_security_group(address_prefix, network_security_group_id, route_table_id)
  begin
    subnet_obj = @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 'Network Security Group attached to Subnet #{subnet_name} successfully.'
  subnet_obj
end

#attach_resource_to_nic(resource_group_name, nic_name, resource_type, resource_id) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/fog/azurerm/requests/network/attach_resource_to_nic.rb', line 6

def attach_resource_to_nic(resource_group_name, nic_name, resource_type, resource_id)
  msg = "Updating #{resource_type} in Network Interface #{nic_name}"
  Fog::Logger.debug msg
  begin
    nic = get_network_interface_with_attached_resource(nic_name, resource_group_name, resource_id, resource_type)
    network_interface = @network_client.network_interfaces.create_or_update(resource_group_name, nic_name, nic)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  Fog::Logger.debug "#{resource_type} updated in Network Interface #{nic_name} successfully!"
  network_interface
end

#attach_route_table_to_subnet(resource_group, subnet_name, virtual_network_name, address_prefix, network_security_group_id, route_table_id) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/fog/azurerm/requests/network/attach_route_table_to_subnet.rb', line 6

def attach_route_table_to_subnet(resource_group, subnet_name, virtual_network_name, address_prefix, network_security_group_id, route_table_id)
  msg = "Attaching Route Table to Subnet: #{subnet_name}"
  Fog::Logger.debug msg
  subnet = get_subnet_object_for_attach_route_table(address_prefix, network_security_group_id, route_table_id)
  begin
    subnet_obj = @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 attached to Subnet #{subnet_name} successfully.'
  subnet_obj
end

#check_express_route_cir_auth_exists(resource_group_name, circuit_name, authorization_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fog/azurerm/requests/network/check_express_route_cir_auth_exists.rb', line 6

def check_express_route_cir_auth_exists(resource_group_name, circuit_name, authorization_name)
  msg = "Checking Express Route Circuit Authorization #{authorization_name}"
  Fog::Logger.debug msg
  begin
    @network_client.express_route_circuit_authorizations.get(resource_group_name, circuit_name, authorization_name)
    Fog::Logger.debug "Express Route Circuit Authorization #{authorization_name} exists."
    true
  rescue MsRestAzure::AzureOperationError => e
    if resource_not_found?(e)
      Fog::Logger.debug "Express Route Circuit Authorization #{authorization_name} doesn't exist."
      false
    else
      raise_azure_exception(e, msg)
    end
  end
end

#check_express_route_circuit_exists(resource_group_name, circuit_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fog/azurerm/requests/network/check_express_route_circuit_exists.rb', line 6

def check_express_route_circuit_exists(resource_group_name, circuit_name)
  msg = "Checking Express Route Circuit #{circuit_name}"
  Fog::Logger.debug msg
  begin
    @network_client.express_route_circuits.get(resource_group_name, circuit_name)
    Fog::Logger.debug "Express Route Circuit #{circuit_name} exists."
    true
  rescue MsRestAzure::AzureOperationError => e
    if resource_not_found?(e)
      Fog::Logger.debug "Express Route Circuit #{circuit_name} doesn't exist."
      false
    else
      raise_azure_exception(e, msg)
    end
  end
end

#check_load_balancer_exists(resource_group_name, load_balancer_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fog/azurerm/requests/network/check_load_balancer_exists.rb', line 6

def check_load_balancer_exists(resource_group_name, load_balancer_name)
  msg = "Checking Load Balancer #{load_balancer_name}"
  Fog::Logger.debug msg
  begin
    @network_client.load_balancers.get(resource_group_name, load_balancer_name)
    Fog::Logger.debug "Load Balancer #{load_balancer_name} exists."
    true
  rescue MsRestAzure::AzureOperationError => e
    if resource_not_found?(e)
      Fog::Logger.debug "Load Balancer #{load_balancer_name} doesn't exist."
      false
    else
      raise_azure_exception(e, msg)
    end
  end
end

#check_local_net_gateway_exists(resource_group_name, local_network_gateway_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fog/azurerm/requests/network/check_local_net_gateway_exists.rb', line 6

def check_local_net_gateway_exists(resource_group_name, local_network_gateway_name)
  msg = "Checking Local Network Gateway #{local_network_gateway_name}"
  Fog::Logger.debug msg
  begin
    @network_client.local_network_gateways.get(resource_group_name, local_network_gateway_name)
    Fog::Logger.debug "Local Network Gateway #{local_network_gateway_name} exists."
    true
  rescue MsRestAzure::AzureOperationError => e
    if resource_not_found?(e)
      Fog::Logger.debug "Local Network Gateway #{local_network_gateway_name} doesn't exist."
      false
    else
      raise_azure_exception(e, msg)
    end
  end
end

#check_net_sec_group_exists(resource_group_name, security_group_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fog/azurerm/requests/network/check_net_sec_group_exists.rb', line 6

def check_net_sec_group_exists(resource_group_name, security_group_name)
  msg = "Checking Network Security Group #{security_group_name}"
  Fog::Logger.debug msg
  begin
    @network_client.network_security_groups.get(resource_group_name, security_group_name)
    Fog::Logger.debug "Network Security Group #{security_group_name} exists."
    true
  rescue MsRestAzure::AzureOperationError => e
    if resource_not_found?(e)
      Fog::Logger.debug "Network Security Group #{security_group_name} doesn't exist."
      false
    else
      raise_azure_exception(e, msg)
    end
  end
end

#check_net_sec_rule_exists(resource_group_name, network_security_group_name, security_rule_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fog/azurerm/requests/network/check_net_sec_rule_exists.rb', line 6

def check_net_sec_rule_exists(resource_group_name, network_security_group_name, security_rule_name)
  msg = "Checking Network Security Rule #{security_rule_name}"
  Fog::Logger.debug msg
  begin
    @network_client.security_rules.get(resource_group_name, network_security_group_name, security_rule_name)
    Fog::Logger.debug "Network Security Rule #{security_rule_name} exists."
    true
  rescue MsRestAzure::AzureOperationError => e
    if resource_not_found?(e)
      Fog::Logger.debug "Network Security Rule #{security_rule_name} doesn't exist."
      false
    else
      raise_azure_exception(e, msg)
    end
  end
end

#check_network_interface_exists(resource_group_name, nic_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fog/azurerm/requests/network/check_network_interface_exists.rb', line 6

def check_network_interface_exists(resource_group_name, nic_name)
  msg = "Checking Network Interface #{nic_name}"
  Fog::Logger.debug msg
  begin
    @network_client.network_interfaces.get(resource_group_name, nic_name)
    Fog::Logger.debug "Network Interface #{nic_name} exists."
    true
  rescue MsRestAzure::AzureOperationError => e
    if resource_not_found?(e)
      Fog::Logger.debug "Network Interface #{nic_name} doesn't exist."
      false
    else
      raise_azure_exception(e, msg)
    end
  end
end

#check_public_ip_exists(resource_group, name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fog/azurerm/requests/network/check_public_ip_exists.rb', line 6

def check_public_ip_exists(resource_group, name)
  msg = "Checking Public IP #{name}"
  Fog::Logger.debug msg
  begin
    @network_client.public_ipaddresses.get(resource_group, name)
    Fog::Logger.debug "Public IP #{name} exists."
    true
  rescue MsRestAzure::AzureOperationError => e
    if resource_not_found?(e)
      Fog::Logger.debug "Public IP #{name} doesn't exist."
      false
    else
      raise_azure_exception(e, msg)
    end
  end
end

#check_subnet_exists(resource_group, virtual_network_name, subnet_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fog/azurerm/requests/network/check_subnet_exists.rb', line 6

def check_subnet_exists(resource_group, virtual_network_name, subnet_name)
  msg = "Checking Subnet #{subnet_name}"
  Fog::Logger.debug msg
  begin
    @network_client.subnets.get(resource_group, virtual_network_name, subnet_name)
    Fog::Logger.debug "Subnet #{subnet_name} exists."
    true
  rescue MsRestAzure::AzureOperationError => e
    if resource_not_found?(e)
      Fog::Logger.debug "Subnet #{subnet_name} doesn't exist."
      false
    else
      raise_azure_exception(e, msg)
    end
  end
end

#check_virtual_network_exists(resource_group, name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fog/azurerm/requests/network/check_virtual_network_exists.rb', line 6

def check_virtual_network_exists(resource_group, name)
  msg = "Checking Virtual Network #{name}"
  Fog::Logger.debug msg
  begin
    @network_client.virtual_networks.get(resource_group, name)
    Fog::Logger.debug "Virtual Network #{name} exists."
    true
  rescue MsRestAzure::AzureOperationError => e
    if resource_not_found?(e)
      Fog::Logger.debug "Virtual Network #{name} doesn't exist."
      false
    else
      raise_azure_exception(e, msg)
    end
  end
end

#check_vnet_gateway_connection_exists(resource_group_name, gateway_connection_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fog/azurerm/requests/network/check_vnet_gateway_connection_exists.rb', line 6

def check_vnet_gateway_connection_exists(resource_group_name, gateway_connection_name)
  msg = "Checking Virtual Network Gateway Connection #{gateway_connection_name}"
  Fog::Logger.debug msg
  begin
    @network_client.virtual_network_gateway_connections.get(resource_group_name, gateway_connection_name)
    Fog::Logger.debug "Virtual Network Gateway Connection #{gateway_connection_name} exists."
    true
  rescue MsRestAzure::AzureOperationError => e
    if resource_not_found?(e)
      Fog::Logger.debug "Virtual Network Gateway Connection #{gateway_connection_name} doesn't exist."
      false
    else
      raise_azure_exception(e, msg)
    end
  end
end

#check_vnet_gateway_exists(resource_group_name, network_gateway_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fog/azurerm/requests/network/check_vnet_gateway_exists.rb', line 6

def check_vnet_gateway_exists(resource_group_name, network_gateway_name)
  msg = "Checking Virtual Network Gateway #{network_gateway_name}"
  Fog::Logger.debug msg
  begin
    @network_client.virtual_network_gateways.get(resource_group_name, network_gateway_name)
    Fog::Logger.debug "Virtual Network Gateway #{network_gateway_name} exists."
    true
  rescue MsRestAzure::AzureOperationError => e
    if resource_not_found?(e)
      Fog::Logger.debug "Virtual Network Gateway #{network_gateway_name} doesn't exist."
      false
    else
      raise_azure_exception(e, msg)
    end
  end
end

#create_load_balancer(name, location, resource_group, frontend_ip_configurations, backend_address_pool_names, load_balancing_rules, probes, inbound_nat_rules, inbound_nat_pools, tags) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/fog/azurerm/requests/network/create_load_balancer.rb', line 6

def create_load_balancer(name, location, resource_group, frontend_ip_configurations, backend_address_pool_names, load_balancing_rules, probes, inbound_nat_rules, inbound_nat_pools, tags)
  msg = "Creating Load-Balancer: #{name}"
  Fog::Logger.debug msg
  load_balancer = define_load_balancer(name, location, frontend_ip_configurations, backend_address_pool_names, load_balancing_rules, probes, inbound_nat_rules, inbound_nat_pools, tags)
  begin
    load_balancer = @network_client.load_balancers.create_or_update(resource_group, name, load_balancer)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  Fog::Logger.debug "Load-Balancer #{name} created successfully."
  load_balancer
end

#create_or_update_express_route_circuit(circuit_parameters) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/fog/azurerm/requests/network/create_or_update_express_route_circuit.rb', line 6

def create_or_update_express_route_circuit(circuit_parameters)
  msg = "Creating/updating Express Route Circuit #{circuit_parameters[:circuit_name]} in Resource Group: #{circuit_parameters[:resource_group_name]}."
  Fog::Logger.debug msg
  circuit = get_express_route_circuit_object(circuit_parameters)
  begin
    circuit = @network_client.express_route_circuits.create_or_update(circuit_parameters[:resource_group_name], circuit_parameters[:circuit_name], circuit)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  Fog::Logger.debug "Express Route Circuit #{circuit_parameters[:circuit_name]} created/updated successfully."
  circuit
end

#create_or_update_express_route_circuit_authorization(circuit_authorization_params) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fog/azurerm/requests/network/create_or_update_express_route_circuit_authorization.rb', line 6

def create_or_update_express_route_circuit_authorization(circuit_authorization_params)
  msg = @logger_messages['network']['express_route_circuit_authentication']['message']['create']
        .gsub('NAME', circuit_authorization_params[:authorization_name])
        .gsub('RESOURCE_GROUP', circuit_authorization_params[:resource_group])
  Fog::Logger.debug msg
  circuit_authorization = get_circuit_authorization_object(circuit_authorization_params)
  begin
    authorization = @network_client.express_route_circuit_authorizations.create_or_update(circuit_authorization_params[:resource_group], circuit_authorization_params[:circuit_name], circuit_authorization_params[:authorization_name], circuit_authorization)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  Fog::Logger.debug "Express Route Circuit Authorization #{circuit_authorization_params[:authorization_name]} created/updated successfully."
  authorization
end

#create_or_update_express_route_circuit_peering(circuit_peering_params) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/fog/azurerm/requests/network/create_or_update_express_route_circuit_peering.rb', line 6

def create_or_update_express_route_circuit_peering(circuit_peering_params)
  msg = "Exception creating/updating Express Route Circuit Peering #{circuit_peering_params[:peering_name]} in Resource Group: #{circuit_peering_params[:resource_group_name]}."
  Fog::Logger.debug msg
  circuit_peering = get_circuit_peering_object(circuit_peering_params)
  begin
    peering = @network_client.express_route_circuit_peerings.create_or_update(circuit_peering_params[:resource_group_name], circuit_peering_params[:circuit_name], circuit_peering_params[:peering_name], circuit_peering)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  Fog::Logger.debug "Express Route Circuit Peering #{circuit_peering_params[:peering_name]} created/updated successfully."
  peering
end

#create_or_update_local_network_gateway(local_network_gateway_params) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fog/azurerm/requests/network/create_or_update_local_network_gateway.rb', line 6

def create_or_update_local_network_gateway(local_network_gateway_params)
  msg = @logger_messages['network']['local_network_gateway']['message']['create']
        .gsub('NAME', local_network_gateway_params[:name])
        .gsub('RESOURCE_GROUP', local_network_gateway_params[:resource_group])
  Fog::Logger.debug msg
  local_network_gateway = get_local_network_gateway_object(local_network_gateway_params)
  begin
    local_network_gateway = @network_client.local_network_gateways.create_or_update(local_network_gateway_params[:resource_group], local_network_gateway.name, local_network_gateway)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  Fog::Logger.debug "Local Network Gateway #{local_network_gateway_params[:name]} created/updated successfully."
  local_network_gateway
end

#create_or_update_network_interface(resource_group_name, name, location, subnet_id, public_ip_address_id, network_security_group_id, ip_config_name, private_ip_allocation_method, private_ip_address, load_balancer_backend_address_pools_ids, load_balancer_inbound_nat_rules_ids, tags, enable_accelerated_networking = false, async = false) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/fog/azurerm/requests/network/create_or_update_network_interface.rb', line 7

def create_or_update_network_interface(resource_group_name, name, location, subnet_id, public_ip_address_id, network_security_group_id, ip_config_name, private_ip_allocation_method, private_ip_address, load_balancer_backend_address_pools_ids, load_balancer_inbound_nat_rules_ids, tags, enable_accelerated_networking = false, async = false)
  msg = "Creating/Updating Network Interface Card: #{name}"
  Fog::Logger.debug msg
  network_interface = get_network_interface_object(name, location, subnet_id, public_ip_address_id, network_security_group_id, ip_config_name, private_ip_allocation_method, private_ip_address, load_balancer_backend_address_pools_ids, load_balancer_inbound_nat_rules_ids, tags, enable_accelerated_networking)
  begin
    nic_response = if async
                     @network_client.network_interfaces.create_or_update_async(resource_group_name, name, network_interface)
                   else
                     @network_client.network_interfaces.create_or_update(resource_group_name, name, network_interface)
                   end
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  Fog::Logger.debug "Network Interface #{name} created/updated successfully." unless async
  nic_response
end

#create_or_update_network_security_group(resource_group_name, security_group_name, location, security_rules, tags) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/fog/azurerm/requests/network/create_or_update_network_security_group.rb', line 6

def create_or_update_network_security_group(resource_group_name, security_group_name, location, security_rules, tags)
  msg = "Creating/Updating Network Security Group #{security_group_name} in Resource Group #{resource_group_name}."
  Fog::Logger.debug msg

  security_group = get_security_group_object(security_rules, location, tags)

  begin
    security_group = @network_client.network_security_groups.begin_create_or_update(resource_group_name, security_group_name, security_group)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end

  Fog::Logger.debug "Network Security Group #{security_group_name} Created/Updated Successfully!"
  security_group
end

#create_or_update_network_security_rule(security_rule) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/fog/azurerm/requests/network/create_or_update_network_security_rule.rb', line 6

def create_or_update_network_security_rule(security_rule)
  msg = "Creating/Updating Network Security Rule #{security_rule[:name]} in Resource Group #{security_rule[:resource_group]}."
  Fog::Logger.debug msg
  security_rule_params = get_security_rule_params(security_rule)
  begin
    security_rule_obj = @network_client.security_rules.create_or_update(security_rule[:resource_group], security_rule[:network_security_group_name], security_rule[:name], security_rule_params)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  Fog::Logger.debug "Network Security Rule #{security_rule[:name]} Created/Updated Successfully!"
  security_rule_obj
end

#create_or_update_public_ip(resource_group, name, location, public_ip_allocation_method, idle_timeout_in_minutes, domain_name_label, tags) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/fog/azurerm/requests/network/create_or_update_public_ip.rb', line 6

def create_or_update_public_ip(resource_group, name, location, public_ip_allocation_method, idle_timeout_in_minutes, domain_name_label, tags)
  msg = "Creating/Updating PublicIP #{name} in Resource Group #{resource_group}."
  Fog::Logger.debug msg
  public_ip = get_public_ip_object(name, location, public_ip_allocation_method, idle_timeout_in_minutes, domain_name_label, tags)
  begin
    public_ip_obj = @network_client.public_ipaddresses.create_or_update(resource_group, name, public_ip)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  Fog::Logger.debug "PublicIP #{name} Created Successfully!"
  public_ip_obj
end

#create_or_update_virtual_network(resource_group_name, virtual_network_name, location, dns_servers, subnets, address_prefixes, tags) ⇒ Object



6
7
8
9
# File 'lib/fog/azurerm/requests/network/create_or_update_virtual_network.rb', line 6

def create_or_update_virtual_network(resource_group_name, virtual_network_name, location, dns_servers, subnets, address_prefixes, tags)
  virtual_network = define_vnet_object(location, address_prefixes, dns_servers, subnets, tags)
  create_or_update_vnet(resource_group_name, virtual_network_name, virtual_network)
end

#create_or_update_virtual_network_gateway(virtual_network_params) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/fog/azurerm/requests/network/create_or_update_virtual_network_gateway.rb', line 7

def create_or_update_virtual_network_gateway(virtual_network_params)
  msg = "Creating/Updating Virtual Network Gateway: #{virtual_network_params[:name]} in Resource Group: #{virtual_network_params[:resource_group_name]}."
  Fog::Logger.debug msg
  network_gateway = get_network_gateway_object(virtual_network_params)
  begin
    virtual_network_gateway = @network_client.virtual_network_gateways.create_or_update(virtual_network_params[:resource_group_name], virtual_network_params[:name], network_gateway)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  Fog::Logger.debug "Virtual Network Gateway #{virtual_network_params[:name]} created/updated successfully."
  virtual_network_gateway
end

#create_or_update_virtual_network_gateway_connection(gateway_connection_params) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/fog/azurerm/requests/network/create_or_update_virtual_network_gateway_connection.rb', line 7

def create_or_update_virtual_network_gateway_connection(gateway_connection_params)
  msg = @logger_messages['network']['virtual_network_gateway_connection']['message']['create']
        .gsub('NAME', gateway_connection_params[:name])
        .gsub('RESOURCE_GROUP', gateway_connection_params[:resource_group_name])
  Fog::Logger.debug msg
  gateway_connection = get_network_gateway_connection_object(gateway_connection_params)
  begin
    network_gateway_connection = @network_client.virtual_network_gateway_connections.create_or_update(gateway_connection_params[:resource_group_name], gateway_connection_params[:name], gateway_connection)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  Fog::Logger.debug "Virtual Network Gateway Connection #{gateway_connection_params[:name]} created/updated successfully."
  network_gateway_connection
end

#create_subnet(resource_group, subnet_name, virtual_network_name, address_prefix, network_security_group_id, route_table_id) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/fog/azurerm/requests/network/create_subnet.rb', line 6

def create_subnet(resource_group, subnet_name, virtual_network_name, address_prefix, network_security_group_id, route_table_id)
  msg = "Creating Subnet: #{subnet_name}"
  Fog::Logger.debug msg
  subnet = get_subnet_object(address_prefix, network_security_group_id, route_table_id)
  begin
    subnet_obj = @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 "Subnet #{subnet_name} created successfully."
  subnet_obj
end

#delete_express_route_circuit(resource_group_name, circuit_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fog/azurerm/requests/network/delete_express_route_circuit.rb', line 6

def delete_express_route_circuit(resource_group_name, circuit_name)
  msg = "Deleting Express Route Circuit #{circuit_name} from Resource Group #{resource_group_name}."
  Fog::Logger.debug msg
  begin
    @network_client.express_route_circuits.delete(resource_group_name, circuit_name)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  Fog::Logger.debug "Express Route Circuit #{circuit_name} Deleted Successfully."
  true
end

#delete_express_route_circuit_authorization(resource_group_name, circuit_name, authorization_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/fog/azurerm/requests/network/delete_express_route_circuit_authorization.rb', line 6

def delete_express_route_circuit_authorization(resource_group_name, circuit_name, authorization_name)
  msg = @logger_messages['network']['express_route_circuit_authentication']['message']['delete']
        .gsub('NAME', authorization_name).gsub('RESOURCE_GROUP', resource_group_name)
  Fog::Logger.debug msg
  begin
    @network_client.express_route_circuit_authorizations.delete(resource_group_name, circuit_name, authorization_name)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  Fog::Logger.debug "Express Route Circuit Authorization #{authorization_name} Deleted Successfully."
  true
end

#delete_express_route_circuit_peering(resource_group_name, peering_name, circuit_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fog/azurerm/requests/network/delete_express_route_circuit_peering.rb', line 6

def delete_express_route_circuit_peering(resource_group_name, peering_name, circuit_name)
  msg = "Deleting Express Route Circuit Peering #{peering_name} from Resource Group #{resource_group_name}."
  Fog::Logger.debug msg
  begin
    @network_client.express_route_circuit_peerings.delete(resource_group_name, circuit_name, peering_name)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  Fog::Logger.debug "Express Route Circuit Peering #{peering_name} Deleted Successfully."
  true
end

#delete_load_balancer(resource_group, name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fog/azurerm/requests/network/delete_load_balancer.rb', line 6

def delete_load_balancer(resource_group, name)
  msg = "Deleting Load_Balancer #{name} from Resource Group #{resource_group}"
  Fog::Logger.debug msg
  begin
    @network_client.load_balancers.delete(resource_group, name)
  rescue  MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  Fog::Logger.debug "Load_Balancer #{name} Deleted Successfully."
  true
end

#delete_local_network_gateway(resource_group_name, local_network_gateway_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/fog/azurerm/requests/network/delete_local_network_gateway.rb', line 6

def delete_local_network_gateway(resource_group_name, local_network_gateway_name)
  msg = @logger_messages['network']['local_network_gateway']['message']['delete']
        .gsub('NAME', local_network_gateway_name).gsub('RESOURCE_GROUP', resource_group_name)
  Fog::Logger.debug msg
  begin
    @network_client.local_network_gateways.delete(resource_group_name, local_network_gateway_name)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  Fog::Logger.debug "Local Network Gateway #{local_network_gateway_name} from Resource group #{resource_group_name} deleted successfully."
  true
end

#delete_network_interface(resource_group, name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fog/azurerm/requests/network/delete_network_interface.rb', line 6

def delete_network_interface(resource_group, name)
  msg = "Deleting NetworkInterface #{name} from Resource Group #{resource_group}"
  Fog::Logger.debug msg
  begin
    @network_client.network_interfaces.delete(resource_group, name)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  Fog::Logger.debug "NetworkInterface #{name} Deleted Successfully."
  true
end

#delete_network_security_group(resource_group, name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/fog/azurerm/requests/network/delete_network_security_group.rb', line 6

def delete_network_security_group(resource_group, name)
  msg = "Deleting Network Security Group: #{name}"
  Fog::Logger.debug msg

  begin
    @network_client.network_security_groups.delete(resource_group, name)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end

  Fog::Logger.debug "Network Security Group #{name} deleted successfully."
  true
end

#delete_network_security_rule(resource_group, network_security_group_name, security_rule_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/fog/azurerm/requests/network/delete_network_security_rule.rb', line 6

def delete_network_security_rule(resource_group, network_security_group_name, security_rule_name)
  msg = "Deleting Network Security Rule #{security_rule_name} in Security Group #{network_security_group_name}"
  Fog::Logger.debug msg

  begin
    @network_client.security_rules.delete(resource_group, network_security_group_name, security_rule_name)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end

  Fog::Logger.debug "Network Security Rule #{security_rule_name} deleted successfully."
  true
end

#delete_public_ip(resource_group, name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/fog/azurerm/requests/network/delete_public_ip.rb', line 6

def delete_public_ip(resource_group, name)
  Fog::Logger.debug "Deleting PublicIP #{name} from Resource Group #{resource_group}."
  begin
    @network_client.public_ipaddresses.delete(resource_group, name)
  rescue  MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, "Deleting PublicIP #{name} from Resource Group #{resource_group}")
  end
  Fog::Logger.debug "PublicIP #{name} Deleted Successfully."
  true
end

#delete_subnet(resource_group, name, virtual_network_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fog/azurerm/requests/network/delete_subnet.rb', line 6

def delete_subnet(resource_group, name, virtual_network_name)
  msg = "Deleting Subnet: #{name}"
  Fog::Logger.debug msg
  begin
    @network_client.subnets.delete(resource_group, virtual_network_name, name)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  Fog::Logger.debug "Subnet #{name} of Virtual Network #{virtual_network_name} from Resource group #{resource_group} deleted successfully."
  true
end

#delete_virtual_network(resource_group, name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fog/azurerm/requests/network/delete_virtual_network.rb', line 6

def delete_virtual_network(resource_group, name)
  msg = "Deleting Virtual Network: #{name}"
  Fog::Logger.debug msg
  begin
    @network_client.virtual_networks.delete(resource_group, name)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  Fog::Logger.debug "Virtual Network #{name} deleted successfully."
  true
end

#delete_virtual_network_gateway(resource_group_name, virtual_network_gateway_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fog/azurerm/requests/network/delete_virtual_network_gateway.rb', line 6

def delete_virtual_network_gateway(resource_group_name, virtual_network_gateway_name)
  msg = "Deleting Virtual Network Gateway #{virtual_network_gateway_name} from Resource Group #{resource_group_name}."
  Fog::Logger.debug msg
  begin
    @network_client.virtual_network_gateways.delete(resource_group_name, virtual_network_gateway_name)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  Fog::Logger.debug "Virtual Network Gateway #{virtual_network_gateway_name} Deleted Successfully."
  true
end

#delete_virtual_network_gateway_connection(resource_group_name, gateway_connection_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/fog/azurerm/requests/network/delete_virtual_network_gateway_connection.rb', line 6

def delete_virtual_network_gateway_connection(resource_group_name, gateway_connection_name)
  msg = @logger_messages['network']['virtual_network_gateway_connection']['message']['delete']
        .gsub('NAME', gateway_connection_name).gsub('RESOURCE_GROUP', resource_group_name)
  Fog::Logger.debug msg
  begin
    @network_client.virtual_network_gateway_connections.delete(resource_group_name, gateway_connection_name)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  Fog::Logger.debug "Virtual Network Gateway Connection #{gateway_connection_name} Deleted Successfully."
  true
end

#detach_network_security_group_from_subnet(resource_group, subnet_name, virtual_network_name, address_prefix, route_table_id) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/fog/azurerm/requests/network/detach_network_security_group_from_subnet.rb', line 6

def detach_network_security_group_from_subnet(resource_group, subnet_name, virtual_network_name, address_prefix, route_table_id)
  msg = "Detaching Network Security Group from Subnet: #{subnet_name}"
  Fog::Logger.debug msg
  subnet = get_subnet_object_for_detach_network_security_group(address_prefix, route_table_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 'Network Security Group detached successfully.'
  subnet
end

#detach_resource_from_nic(resource_group_name, nic_name, resource_type) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/fog/azurerm/requests/network/detach_resource_from_nic.rb', line 6

def detach_resource_from_nic(resource_group_name, nic_name, resource_type)
  msg = "Removing #{resource_type} from Network Interface #{nic_name}"
  Fog::Logger.debug msg
  begin
    nic = get_network_interface_with_detached_resource(nic_name, resource_group_name, resource_type)

    nic_obj = @network_client.network_interfaces.create_or_update(resource_group_name, nic_name, nic)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  Fog::Logger.debug "#{resource_type} deleted from Network Interface #{nic_name} successfully!"
  nic_obj
end

#detach_route_table_from_subnet(resource_group, subnet_name, virtual_network_name, address_prefix, network_security_group_id) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/fog/azurerm/requests/network/detach_route_table_from_subnet.rb', line 6

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

#get_available_ipaddresses_count(subnet_name, address_prefix, ip_configurations_ids, express_route_enabled) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/fog/azurerm/requests/network/get_available_ipaddresses_count.rb', line 6

def get_available_ipaddresses_count(subnet_name, address_prefix, ip_configurations_ids, express_route_enabled)
  Fog::Logger.debug "Getting free IP Address count of Subnet #{subnet_name}"
  total_ipaddresses = (2**(32 - address_prefix.split('/').last.to_i)) - 2
  total_ipaddresses -= 3 if express_route_enabled
  used_ip_address = ip_configurations_ids.nil? ? 0 : ip_configurations_ids.count
  total_ipaddresses - used_ip_address
end

#get_connection_shared_key(resource_group_name, connection_shared_key_name) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/fog/azurerm/requests/network/get_connection_shared_key.rb', line 6

def get_connection_shared_key(resource_group_name, connection_shared_key_name)
  msg = "Getting the shared key of Connection #{connection_shared_key_name} from Resource Group #{resource_group_name}."
  Fog::Logger.debug msg
  begin
    @network_client.virtual_network_gateway_connections.get_shared_key(resource_group_name, connection_shared_key_name).value
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
end

#get_express_route_circuit(resource_group_name, circuit_name) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/fog/azurerm/requests/network/get_express_route_circuit.rb', line 6

def get_express_route_circuit(resource_group_name, circuit_name)
  msg = "Getting Express Route Circuit#{circuit_name} from Resource Group #{resource_group_name}."
  Fog::Logger.debug msg
  begin
    @network_client.express_route_circuits.get(resource_group_name, circuit_name)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
end

#get_express_route_circuit_authorization(resource_group_name, circuit_name, authorization_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fog/azurerm/requests/network/get_express_route_circuit_authorization.rb', line 6

def get_express_route_circuit_authorization(resource_group_name, circuit_name, authorization_name)
  msg = @logger_messages['network']['express_route_circuit_authentication']['message']['get']
        .gsub('NAME', authorization_name).gsub('RESOURCE_GROUP', resource_group_name)
  Fog::Logger.debug msg
  begin
    circuit_authorization = @network_client.express_route_circuit_authorizations.get(resource_group_name, circuit_name, authorization_name)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  circuit_authorization
end

#get_express_route_circuit_peering(resource_group_name, peering_name, circuit_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/fog/azurerm/requests/network/get_express_route_circuit_peering.rb', line 6

def get_express_route_circuit_peering(resource_group_name, peering_name, circuit_name)
  msg = "Getting Express Route Circuit Peering #{peering_name} from Resource Group #{resource_group_name}."
  Fog::Logger.debug msg
  begin
    circuit_peering = @network_client.express_route_circuit_peerings.get(resource_group_name, circuit_name, peering_name)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  circuit_peering
end

#get_load_balancer(resource_group_name, load_balancer_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fog/azurerm/requests/network/get_load_balancer.rb', line 6

def get_load_balancer(resource_group_name, load_balancer_name)
  msg = "Getting Load-Balancer: #{load_balancer_name} in Resource Group: #{resource_group_name}"
  Fog::Logger.debug msg
  begin
    load_balancer = @network_client.load_balancers.get(resource_group_name, load_balancer_name)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  Fog::Logger.debug "Getting Load Balancer #{load_balancer_name} Successfully."
  load_balancer
end

#get_local_network_gateway(resource_group_name, local_network_gateway_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/fog/azurerm/requests/network/get_local_network_gateway.rb', line 6

def get_local_network_gateway(resource_group_name, local_network_gateway_name)
  msg = @logger_messages['network']['local_network_gateway']['message']['get']
        .gsub('NAME', local_network_gateway_name).gsub('RESOURCE_GROUP', resource_group_name)
  Fog::Logger.debug msg
  begin
    local_network_gateway = @network_client.local_network_gateways.get(resource_group_name, local_network_gateway_name)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  Fog::Logger.debug "Local Network Gateway #{local_network_gateway_name} retrieved successfully."
  local_network_gateway
end

#get_network_interface(resource_group_name, nic_name) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/fog/azurerm/requests/network/get_network_interface.rb', line 6

def get_network_interface(resource_group_name, nic_name)
  msg = "Getting Network Interface#{nic_name} from Resource Group #{resource_group_name}"
  Fog::Logger.debug msg
  begin
    @network_client.network_interfaces.get(resource_group_name, nic_name)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
end

#get_network_security_group(resource_group_name, security_group_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/fog/azurerm/requests/network/get_network_security_group.rb', line 6

def get_network_security_group(resource_group_name, security_group_name)
  msg = "Getting Network Security Group #{security_group_name} from Resource Group #{resource_group_name}."
  Fog::Logger.debug msg

  begin
    security_group = @network_client.network_security_groups.get(resource_group_name, security_group_name)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end

  Fog::Logger.debug "Network Security Group #{security_group_name} retrieved successfully."
  security_group
end

#get_network_security_rule(resource_group_name, network_security_group_name, security_rule_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/fog/azurerm/requests/network/get_network_security_rule.rb', line 6

def get_network_security_rule(resource_group_name, network_security_group_name, security_rule_name)
  msg = "Getting Network Security Rule #{security_rule_name} from Resource Group #{resource_group_name}."
  Fog::Logger.debug msg

  begin
    security_rule = @network_client.security_rules.get(resource_group_name, network_security_group_name, security_rule_name)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end

  Fog::Logger.debug "Network Security Rule #{security_rule_name} retrieved successfully."
  security_rule
end

#get_public_ip(resource_group_name, public_ip_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/fog/azurerm/requests/network/get_public_ip.rb', line 6

def get_public_ip(resource_group_name, public_ip_name)
  Fog::Logger.debug "Getting Public IP #{public_ip_name} from Resource Group #{resource_group_name}"
  begin
    public_ip = @network_client.public_ipaddresses.get(resource_group_name, public_ip_name)
    Fog::Logger.debug "Public IP #{public_ip_name} retrieved successfully"
    public_ip
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, "Getting Public IP #{public_ip_name} from Resource Group #{resource_group_name}")
  end
end

#get_security_rule_params(security_rule_hash) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/fog/azurerm/requests/network/create_or_update_network_security_rule.rb', line 19

def get_security_rule_params(security_rule_hash)
  security_rule = Azure::ARM::Network::Models::SecurityRule.new
  security_rule.protocol = security_rule_hash[:protocol]
  security_rule.source_port_range = security_rule_hash[:source_port_range]
  security_rule.destination_port_range = security_rule_hash[:destination_port_range]
  security_rule.source_address_prefix = security_rule_hash[:source_address_prefix]
  security_rule.destination_address_prefix = security_rule_hash[:destination_address_prefix]
  security_rule.access = security_rule_hash[:access]
  security_rule.priority = security_rule_hash[:priority]
  security_rule.direction = security_rule_hash[:direction]
  security_rule
end

#get_subnet(resource_group, virtual_network_name, subnet_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fog/azurerm/requests/network/get_subnet.rb', line 6

def get_subnet(resource_group, virtual_network_name, subnet_name)
  msg = "Getting Subnet: #{subnet_name}."
  Fog::Logger.debug msg
  begin
    subnet = @network_client.subnets.get(resource_group, virtual_network_name, subnet_name)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  Fog::Logger.debug "Subnet #{subnet_name} retrieved successfully."
  subnet
end

#get_virtual_network(resource_group_name, virtual_network_name) ⇒ Object



6
7
8
# File 'lib/fog/azurerm/requests/network/get_virtual_network.rb', line 6

def get_virtual_network(resource_group_name, virtual_network_name)
  get_vnet(resource_group_name, virtual_network_name)
end

#get_virtual_network_gateway(resource_group_name, network_gateway_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fog/azurerm/requests/network/get_virtual_network_gateway.rb', line 6

def get_virtual_network_gateway(resource_group_name, network_gateway_name)
  msg = "Getting Virtual Network Gateway #{network_gateway_name} from Resource Group #{resource_group_name}."
  Fog::Logger.debug msg
  begin
    network_gateway = @network_client.virtual_network_gateways.get(resource_group_name, network_gateway_name)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  Fog::Logger.debug "Virtual Network Gateway #{network_gateway_name} retrieved successfully."
  network_gateway
end

#get_virtual_network_gateway_connection(resource_group_name, gateway_connection_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/fog/azurerm/requests/network/get_virtual_network_gateway_connection.rb', line 6

def get_virtual_network_gateway_connection(resource_group_name, gateway_connection_name)
  msg = @logger_messages['network']['virtual_network_gateway_connection']['message']['get']
        .gsub('NAME', gateway_connection_name).gsub('RESOURCE_GROUP', resource_group_name)
  Fog::Logger.debug msg
  begin
    gateway_connection = @network_client.virtual_network_gateway_connections.get(resource_group_name, gateway_connection_name)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  Fog::Logger.debug "Virtual Network Gateway Connection #{gateway_connection_name} retrieved successfully."
  gateway_connection
end

#list_express_route_circuit_authorizations(resource_group_name, circuit_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fog/azurerm/requests/network/list_express_route_circuit_authorizations.rb', line 6

def list_express_route_circuit_authorizations(resource_group_name, circuit_name)
  msg = @logger_messages['network']['express_route_circuit_authentication']['message']['list']
        .gsub('RESOURCE_GROUP', resource_group_name)
  Fog::Logger.debug msg
  begin
    circuit_authorizations = @network_client.express_route_circuit_authorizations.list(resource_group_name, circuit_name)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  circuit_authorizations
end

#list_express_route_circuit_peerings(resource_group_name, circuit_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/fog/azurerm/requests/network/list_express_route_circuit_peerings.rb', line 6

def list_express_route_circuit_peerings(resource_group_name, circuit_name)
  msg = "Getting list of Express Route Circuit Peerings from Resource Group #{resource_group_name}."
  Fog::Logger.debug msg
  begin
    circuit_peerings = @network_client.express_route_circuit_peerings.list(resource_group_name, circuit_name)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  circuit_peerings
end

#list_express_route_circuits(resource_group_name) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/fog/azurerm/requests/network/list_express_route_circuits.rb', line 6

def list_express_route_circuits(resource_group_name)
  msg = "Getting list of Express Route Circuits from Resource Group #{resource_group_name}."
  Fog::Logger.debug msg
  begin
    @network_client.express_route_circuits.list(resource_group_name)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
end

#list_express_route_service_providersObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/fog/azurerm/requests/network/list_express_route_service_providers.rb', line 6

def list_express_route_service_providers
  msg = 'Getting list of Express Route Service Providers.'
  Fog::Logger.debug msg
  begin
    service_providers = @network_client.express_route_service_providers.list
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  service_providers
end

#list_load_balancers(resource_group) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fog/azurerm/requests/network/list_load_balancers.rb', line 6

def list_load_balancers(resource_group)
  msg = "Getting list of Load-Balancers from Resource Group #{resource_group}"
  Fog::Logger.debug msg
  begin
    load_balancers = @network_client.load_balancers.list_as_lazy(resource_group)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  Fog::Logger.debug "Successfully retrieved load balancers from Resource Group #{resource_group}"
  load_balancers.value
end

#list_load_balancers_in_subscriptionObject



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fog/azurerm/requests/network/list_load_balancers_in_subscription.rb', line 6

def list_load_balancers_in_subscription
  msg = 'Getting list of Load-Balancers in subscription'
  Fog::Logger.debug msg
  begin
    load_balancers = @network_client.load_balancers.list_all
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  Fog::Logger.debug 'Successfully retrieved load balancers in subscription'
  load_balancers
end

#list_local_network_gateways(resource_group_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fog/azurerm/requests/network/list_local_network_gateways.rb', line 6

def list_local_network_gateways(resource_group_name)
  msg = @logger_messages['network']['local_network_gateway']['message']['list']
        .gsub('RESOURCE_GROUP', resource_group_name)
  Fog::Logger.debug msg
  begin
    local_network_gateways = @network_client.local_network_gateways.list_as_lazy(resource_group_name)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  local_network_gateways.value
end

#list_network_interfaces(resource_group) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/fog/azurerm/requests/network/list_network_interfaces.rb', line 6

def list_network_interfaces(resource_group)
  msg = "Getting list of NetworkInterfaces from Resource Group #{resource_group}."
  Fog::Logger.debug msg
  begin
    network_interfaces = @network_client.network_interfaces.list_as_lazy(resource_group)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  network_interfaces.value
end

#list_network_security_groups(resource_group) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/fog/azurerm/requests/network/list_network_security_groups.rb', line 6

def list_network_security_groups(resource_group)
  msg = "Getting list of Network Security Groups from Resource Group #{resource_group}."
  Fog::Logger.debug msg

  begin
    nsg_list_result = @network_client.network_security_groups.list(resource_group)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end

  Fog::Logger.debug "Network Security Groups list retrieved successfully from Resource Group #{resource_group}."
  nsg_list_result
end

#list_network_security_rules(resource_group, network_security_group_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/fog/azurerm/requests/network/list_network_security_rules.rb', line 6

def list_network_security_rules(resource_group, network_security_group_name)
  msg = "Getting list of Network Security Rule in Security Group #{network_security_group_name} from Resource Group #{resource_group}."
  Fog::Logger.debug msg

  begin
    nsr_list_result = @network_client.security_rules.list_as_lazy(resource_group, network_security_group_name)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end

  Fog::Logger.debug "Network Security Rules list retrieved successfully from Resource Group #{resource_group}."
  nsr_list_result.value
end

#list_public_ips(resource_group) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/fog/azurerm/requests/network/list_public_ips.rb', line 6

def list_public_ips(resource_group)
  Fog::Logger.debug "Getting list of PublicIPs from Resource Group #{resource_group}."
  begin
    public_ips = @network_client.public_ipaddresses.list_as_lazy(resource_group)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, "Getting list of PublicIPs from Resource Group #{resource_group}")
  end
  Fog::Logger.debug 'Public IP listed successfully'
  public_ips.value
end

#list_subnets(resource_group, virtual_network_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/fog/azurerm/requests/network/list_subnets.rb', line 6

def list_subnets(resource_group, virtual_network_name)
  msg = "Listing Subnets int Resource Group #{resource_group}"
  Fog::Logger.debug msg
  begin
    subnets = @network_client.subnets.list_as_lazy(resource_group, virtual_network_name)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  subnets.value
end

#list_virtual_network_gateway_connections(resource_group_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fog/azurerm/requests/network/list_virtual_network_gateway_connections.rb', line 6

def list_virtual_network_gateway_connections(resource_group_name)
  msg = @logger_messages['network']['virtual_network_gateway_connection']['message']['list']
        .gsub('RESOURCE_GROUP', resource_group_name)
  Fog::Logger.debug msg
  begin
    gateway_connections = @network_client.virtual_network_gateway_connections.list_as_lazy(resource_group_name)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  gateway_connections.value
end

#list_virtual_network_gateways(resource_group) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/fog/azurerm/requests/network/list_virtual_network_gateways.rb', line 6

def list_virtual_network_gateways(resource_group)
  msg = "Getting list of Virtual Network Gateway from Resource Group #{resource_group}."
  Fog::Logger.debug msg
  begin
    network_gateways = @network_client.virtual_network_gateways.list_as_lazy(resource_group)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  network_gateways.value
end

#list_virtual_networks(resource_group) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/fog/azurerm/requests/network/list_virtual_networks.rb', line 6

def list_virtual_networks(resource_group)
  msg = "Listing Virtual Networks in Resource Group #{resource_group}"
  Fog::Logger.debug msg
  begin
    virtual_networks = @network_client.virtual_networks.list_as_lazy(resource_group)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  virtual_networks.value
end

#list_virtual_networks_in_subscriptionObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/fog/azurerm/requests/network/list_virtual_networks_in_subscription.rb', line 6

def list_virtual_networks_in_subscription
  msg = 'Listing Virtual Networks in a subscription'
  Fog::Logger.debug msg
  begin
    virtual_networks = @network_client.virtual_networks.list_all
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  virtual_networks
end

#remove_address_prefixes_from_virtual_network(resource_group_name, virtual_network_name, address_prefixes) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/fog/azurerm/requests/network/remove_address_prefixes_from_virtual_network.rb', line 6

def remove_address_prefixes_from_virtual_network(resource_group_name, virtual_network_name, address_prefixes)
  Fog::Logger.debug "Removing Address Prefixes: #{address_prefixes.join(', ')} from Virtual Network: #{virtual_network_name}"
  virtual_network = get_virtual_network_object_for_remove_address_prefixes!(resource_group_name, virtual_network_name, address_prefixes)
  virtual_network = create_or_update_vnet(resource_group_name, virtual_network_name, virtual_network)
  Fog::Logger.debug "Address Prefixes: #{address_prefixes.join(', ')} removed successfully."
  virtual_network
end

#remove_dns_servers_from_virtual_network(resource_group_name, virtual_network_name, dns_servers) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/fog/azurerm/requests/network/remove_dns_servers_from_virtual_network.rb', line 6

def remove_dns_servers_from_virtual_network(resource_group_name, virtual_network_name, dns_servers)
  Fog::Logger.debug "Removing DNS Servers: #{dns_servers.join(', ')} from Virtual Network: #{virtual_network_name}"
  virtual_network = get_virtual_network_object_for_remove_dns_servers!(resource_group_name, virtual_network_name, dns_servers)
  virtual_network = create_or_update_vnet(resource_group_name, virtual_network_name, virtual_network)
  Fog::Logger.debug "DNS Servers: #{dns_servers.join(', ')} removed successfully."
  virtual_network
end

#remove_security_rule(resource_group_name, security_group_name, security_rule_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/fog/azurerm/requests/network/remove_security_rule.rb', line 6

def remove_security_rule(resource_group_name, security_group_name, security_rule_name)
  msg = "Deleting security rule #{security_rule_name} from Network Security Group #{security_group_name}."
  Fog::Logger.debug msg

  nsg = @network_client.network_security_groups.get(resource_group_name, security_group_name)
  updated_security_rule_list = remove_security_rule_from_list(nsg.security_rules, security_rule_name)
  nsg.security_rules = updated_security_rule_list

  begin
    nsg = @network_client.network_security_groups.begin_create_or_update(resource_group_name, security_group_name, nsg)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end

  Fog::Logger.debug "Security Rule #{security_rule_name} deleted from Network Security Group #{security_group_name} successfully!"
  nsg
end

#remove_security_rule_from_list(security_rule_list, rule_name) ⇒ Object



24
25
26
27
28
# File 'lib/fog/azurerm/requests/network/remove_security_rule.rb', line 24

def remove_security_rule_from_list(security_rule_list, rule_name)
  unless security_rule_list.nil?
    return security_rule_list.select { |sr| sr.name != rule_name }
  end
end

#remove_subnets_from_virtual_network(resource_group_name, virtual_network_name, subnet_names) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/fog/azurerm/requests/network/remove_subnets_from_virtual_network.rb', line 6

def remove_subnets_from_virtual_network(resource_group_name, virtual_network_name, subnet_names)
  Fog::Logger.debug "Removing Subnets:#{subnet_names.join(', ')} from Virtual Network: #{virtual_network_name}"
  virtual_network = get_virtual_network_object_for_remove_subnets!(resource_group_name, virtual_network_name, subnet_names)
  result = create_or_update_vnet(resource_group_name, virtual_network_name, virtual_network)
  Fog::Logger.debug "Subnets:#{subnet_names.join(', ')} removed successfully."
  result
end

#reset_connection_shared_key(resource_group_name, virtual_network_gateway_connection_name, shared_key_length) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fog/azurerm/requests/network/reset_connection_shared_key.rb', line 6

def reset_connection_shared_key(resource_group_name, virtual_network_gateway_connection_name, shared_key_length)
  msg = "Resetting the shared key of Connection #{virtual_network_gateway_connection_name} from Resource Group #{resource_group_name}."
  Fog::Logger.debug msg
  shared_key = get_reset_shared_key_object(shared_key_length)
  begin
    @network_client.virtual_network_gateway_connections.reset_shared_key(resource_group_name, virtual_network_gateway_connection_name, shared_key)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  true
end

#set_connection_shared_key(resource_group_name, virtual_network_gateway_connection_name, shared_key_value) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fog/azurerm/requests/network/set_connection_shared_key.rb', line 6

def set_connection_shared_key(resource_group_name, virtual_network_gateway_connection_name, shared_key_value)
  msg = "Setting the shared key of Connection #{virtual_network_gateway_connection_name} from Resource Group #{resource_group_name}."
  Fog::Logger.debug msg
  shared_key = get_shared_key_object(shared_key_value)
  begin
    @network_client.virtual_network_gateway_connections.set_shared_key(resource_group_name, virtual_network_gateway_connection_name, shared_key)
  rescue MsRestAzure::AzureOperationError => e
    raise_azure_exception(e, msg)
  end
  true
end