Class: Fog::Network::AzureRM::Mock

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

Mock class for Express Route Circuit Authorization Request

Instance Method Summary collapse

Constructor Details

#initialize(_options = {}) ⇒ Mock

Returns a new instance of Mock.



139
140
141
142
143
144
145
146
# File 'lib/fog/azurerm/network.rb', line 139

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

Instance Method Details

#add_address_prefixes_in_virtual_networkObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/fog/azurerm/requests/network/add_address_prefixes_in_virtual_network.rb', line 26

def add_address_prefixes_in_virtual_network(*)
  {
    'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-rg/providers/Microsoft.Network/virtualNetworks/fog-vnet',
    'name' => 'fog-vnet',
    'type' => 'Microsoft.Network/virtualNetworks',
    'location' => 'westus',
    'properties' =>
      {
        'addressSpace' =>
          {
            'addressPrefixes' =>
              [
                '10.1.0.0/16',
                '10.2.0.0/16'
              ]
          },
        'dhcpOptions' => {
          'dnsServers' => [
            '10.1.0.5',
            '10.1.0.6'
          ]
        },
        'subnets' =>
          [
            {
              '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'
            }
          ],
        'resourceGuid' => 'c573f8e2-d916-493f-8b25-a681c31269ef',
        'provisioningState' => 'Succeeded'
      }
  }
end

#add_dns_servers_in_virtual_networkObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/fog/azurerm/requests/network/add_dns_servers_in_virtual_network.rb', line 32

def add_dns_servers_in_virtual_network(*)
  virtual_network = {
    'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-rg/providers/Microsoft.Network/virtualNetworks/fog-vnet',
    'name' => 'fog-vnet',
    'type' => 'Microsoft.Network/virtualNetworks',
    'location' => 'westus',
    'properties' =>
      {
        'addressSpace' =>
          {
            'addressPrefixes' =>
              [
                '10.1.0.0/16',
                '10.2.0.0/16'
              ]
          },
        'dhcpOptions' => {
          'dnsServers' => [
            '10.1.0.5',
            '10.1.0.6'
          ]
        },
        'subnets' =>
          [
            {
              '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'
            }
          ],
        'resourceGuid' => 'c573f8e2-d916-493f-8b25-a681c31269ef',
        'provisioningState' => 'Succeeded'
      }
  }
  vnet_mapper = Azure::ARM::Network::Models::VirtualNetwork.mapper
  @network_client.deserialize(vnet_mapper, virtual_network, 'result.body')
end

#add_security_rules(resource_group_name, security_group_name, security_rules) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/fog/azurerm/requests/network/add_security_rules.rb', line 30

def add_security_rules(resource_group_name, security_group_name, security_rules)
  network_security_group = {
    'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{security_group_name}",
    'name' => security_group_name,
    'type' => 'Microsoft.Network/networkSecurityGroups',
    'location' => 'location',
    'properties' =>
      {
        'securityRules' => security_rules,
        'defaultSecurityRules' =>
          [
            {
              'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{security_group_name}/defaultSecurityRules/AllowVnetInBound",
              'properties' =>
                {
                  'protocol' => '*',
                  'sourceAddressPrefix' => 'VirtualNetwork',
                  'destinationAddressPrefix' => 'VirtualNetwork',
                  'access' => 'Allow',
                  'direction' => 'Inbound',
                  'description' => 'Allow inbound traffic from all VMs in VNET',
                  'sourcePortRange' => '*',
                  'destinationPortRange' => '*',
                  'priority' => 65_000,
                  'provisioningState' => 'Updating'
                },
              'name' => 'AllowVnetInBound'
            },
            {
              'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{security_group_name}/defaultSecurityRules/AllowAzureLoadBalancerInBound",
              'properties' =>
                {
                  'protocol' => '*',
                  'sourceAddressPrefix' => 'AzureLoadBalancer',
                  'destinationAddressPrefix' => '*',
                  'access' => 'Allow',
                  'direction' => 'Inbound',
                  'description' => 'Allow inbound traffic from azure load balancer',
                  'sourcePortRange' => '*',
                  'destinationPortRange' => '*',
                  'priority' => 65_001,
                  'provisioningState' => 'Updating'
                },
              'name' => 'AllowAzureLoadBalancerInBound'
            },
            {
              'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{security_group_name}/defaultSecurityRules/DenyAllInBound",
              'properties' =>
                {
                  'protocol' => '*',
                  'sourceAddressPrefix' => '*',
                  'destinationAddressPrefix' => '*',
                  'access' => 'Deny',
                  'direction' => 'Inbound',
                  'description' => 'Deny all inbound traffic',
                  'sourcePortRange' => '*',
                  'destinationPortRange' => '*',
                  'priority' => 65_500,
                  'provisioningState' => 'Updating'
                },
              'name' => 'DenyAllInBound'
            },
            {
              'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{security_group_name}/defaultSecurityRules/AllowVnetOutBound",
              'properties' =>
                {
                  'protocol' => '*',
                  'sourceAddressPrefix' => 'VirtualNetwork',
                  'destinationAddressPrefix' => 'VirtualNetwork',
                  'access' => 'Allow',
                  'direction' => 'Outbound',
                  'description' => 'Allow outbound traffic from all VMs to all VMs in VNET',
                  'sourcePortRange' => '*',
                  'destinationPortRange' => '*',
                  'priority' => 65_000,
                  'provisioningState' => 'Updating'
                },
              'name' => 'AllowVnetOutBound'
            },
            {
              'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{security_group_name}/defaultSecurityRules/AllowInternetOutBound",
              'properties' =>
                {
                  'protocol' => '*',
                  'sourceAddressPrefix' => '*',
                  'destinationAddressPrefix' => 'Internet',
                  'access' => 'Allow',
                  'direction' => 'Outbound',
                  'description' => 'Allow outbound traffic from all VMs to Internet',
                  'sourcePortRange' => '*',
                  'destinationPortRange' => '*',
                  'priority' => 65_001,
                  'provisioningState' => 'Updating'
                },
              'name' => 'AllowInternetOutBound'
            },
            {
              'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{security_group_name}/defaultSecurityRules/DenyAllOutBound",
              'properties' =>
                {
                  'protocol' => '*',
                  'sourceAddressPrefix' => '*',
                  'destinationAddressPrefix' => '*',
                  'access' => 'Deny',
                  'direction' => 'Outbound',
                  'description' => 'Deny all outbound traffic',
                  'sourcePortRange' => '*',
                  'destinationPortRange' => '*',
                  'priority' => 65_500,
                  'provisioningState' => 'Updating'
                },
              'name' => 'DenyAllOutBound'
            }
          ],
        'resourceGuid' => '9dca97e6-4789-4ebd-86e3-52b8b0da6cd4',
        'provisioningState' => 'Updating'
      }
  }
  nsg_mapper = Azure::ARM::Network::Models::NetworkSecurityGroup.mapper
  @network_client.deserialize(nsg_mapper, network_security_group, 'result.body')
end

#add_subnets_in_virtual_networkObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/fog/azurerm/requests/network/add_subnets_in_virtual_network.rb', line 27

def add_subnets_in_virtual_network(*)
  virtual_network = {
    'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-rg/providers/Microsoft.Network/virtualNetworks/fog-vnet',
    'name' => 'fog-vnet',
    'type' => 'Microsoft.Network/virtualNetworks',
    'location' => 'westus',
    'properties' =>
      {
        'addressSpace' =>
          {
            'addressPrefixes' =>
              [
                '10.1.0.0/16',
                '10.2.0.0/16'
              ]
          },
        'dhcpOptions' => {
          'dnsServers' => [
            '10.1.0.5',
            '10.1.0.6'
          ]
        },
        'subnets' =>
          [
            {
              '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'
            }
          ],
        'resourceGuid' => 'c573f8e2-d916-493f-8b25-a681c31269ef',
        'provisioningState' => 'Succeeded'
      }
  }
  vnet_mapper = Azure::ARM::Network::Models::VirtualNetwork.mapper
  @network_client.deserialize(vnet_mapper, virtual_network, 'result.body')
end

#attach_network_security_group_to_subnetObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/fog/azurerm/requests/network/attach_network_security_group_to_subnet.rb', line 38

def attach_network_security_group_to_subnet(*)
  subnet = {
    'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-rg/providers/Microsoft.Network/virtualNetworks/fog-vnet/subnets/fog-subnet',
    'properties' =>
      {
        'addressPrefix' => '10.1.0.0/24',
        'networkSecurityGroup' => {
          'id' => '/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/myNSG1'
        },
        'provisioningState' => 'Succeeded'
      },
    'name' => 'fog-subnet'
  }
  subnet_mapper = Azure::ARM::Network::Models::Subnet.mapper
  @network_client.deserialize(subnet_mapper, subnet, 'result.body')
end

#attach_resource_to_nic(resource_group_name, nic_name, _resource_type, _resource_id) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/fog/azurerm/requests/network/attach_resource_to_nic.rb', line 44

def attach_resource_to_nic(resource_group_name, nic_name, _resource_type, _resource_id)
  nic = {
    'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkInterfaces/#{nic_name}",
    'name' => nic_name,
    'type' => 'Microsoft.Network/networkInterfaces',
    'location' => location,
    'properties' =>
      {
        'ipConfigurations' =>
          [
            {
              'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkInterfaces/#{nic_name}/ipConfigurations/#{ip_configs_name}",
              'properties' =>
                {
                  'privateIPAddress' => '10.0.0.5',
                  'privateIPAllocationMethod' => prv_ip_alloc_method,
                  'subnet' =>
                    {
                      'id' => subnet_id
                    },
                  'publicIPAddress' =>
                    {
                      'id' => public_ip_address_id
                    },
                  'provisioningState' => 'Succeeded'
                },
              'name' => ip_configs_name
            }
          ],
        'dnsSettings' =>
          {
            'dnsServers' => [],
            'appliedDnsServers' => []
          },
        'enableIPForwarding' => false,
        'resourceGuid' => '2bff0fad-623b-4773-82b8-dc875f3aacd2',
        'provisioningState' => 'Succeeded'
      }
  }
  network_interface_mapper = Azure::ARM::Network::Models::NetworkInterface.mapper
  @network_client.deserialize(network_interface_mapper, nic, 'result.body')
end

#attach_route_table_to_subnetObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/fog/azurerm/requests/network/attach_route_table_to_subnet.rb', line 38

def attach_route_table_to_subnet(*)
  subnet = {
    'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-rg/providers/Microsoft.Network/virtualNetworks/fog-vnet/subnets/fog-subnet',
    'properties' =>
      {
        'addressPrefix' => '10.1.0.0/24',
        'routeTable' => {
          'id' => '/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/myRT1'
        },
        'provisioningState' => 'Succeeded'
      },
    'name' => 'fog-subnet'
  }
  subnet_mapper = Azure::ARM::Network::Models::Subnet.mapper
  @network_client.deserialize(subnet_mapper, subnet, 'result.body')
end

#check_express_route_cir_auth_existsObject



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

def check_express_route_cir_auth_exists(*)
  true
end

#check_express_route_circuit_existsObject



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

def check_express_route_circuit_exists(*)
  true
end

#check_load_balancer_existsObject



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

def check_load_balancer_exists(*)
  true
end

#check_local_net_gateway_existsObject



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

def check_local_net_gateway_exists(*)
  true
end

#check_net_sec_group_existsObject



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

def check_net_sec_group_exists(*)
  true
end

#check_net_sec_rule_existsObject



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

def check_net_sec_rule_exists(*)
  true
end

#check_network_interface_existsObject



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

def check_network_interface_exists(*)
  true
end

#check_public_ip_exists(resource_group, name) ⇒ Object



26
27
28
29
# File 'lib/fog/azurerm/requests/network/check_public_ip_exists.rb', line 26

def check_public_ip_exists(resource_group, name)
  Fog::Logger.debug "Public IP #{name} from Resource group #{resource_group} is available."
  true
end

#check_subnet_existsObject



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

def check_subnet_exists(*)
  true
end

#check_virtual_network_exists(resource_group, name) ⇒ Object



26
27
28
29
# File 'lib/fog/azurerm/requests/network/check_virtual_network_exists.rb', line 26

def check_virtual_network_exists(resource_group, name)
  Fog::Logger.debug "Virtual Network #{name} from Resource group #{resource_group} is available."
  true
end

#check_vnet_gateway_connection_existsObject



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

def check_vnet_gateway_connection_exists(*)
  true
end

#check_vnet_gateway_existsObject



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

def check_vnet_gateway_exists(*)
  true
end

#create_load_balancer(_name, _location, _resource_group, _frontend_ip_configuration_name, _subnet_id, _private_ip_address, _private_ip_allocation_method, _public_ip_address_id, _backend_address_pool_names, _load_balancing_rules, _probes, _inbound_nat_rules, _inbound_nat_pools) ⇒ Object



184
185
# File 'lib/fog/azurerm/requests/network/create_load_balancer.rb', line 184

def create_load_balancer(_name, _location, _resource_group, _frontend_ip_configuration_name, _subnet_id, _private_ip_address, _private_ip_allocation_method, _public_ip_address_id, _backend_address_pool_names, _load_balancing_rules, _probes, _inbound_nat_rules, _inbound_nat_pools)
end

#create_or_update__virtual_networkObject



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/fog/azurerm/requests/network/create_or_update_virtual_network.rb', line 76

def create_or_update__virtual_network(*)
  virtual_network = {
    'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-rg/providers/Microsoft.Network/virtualNetworks/fog-vnet',
    'name' => 'fog-vnet',
    'type' => 'Microsoft.Network/virtualNetworks',
    'location' => 'westus',
    'properties' =>
      {
        'addressSpace' =>
          {
            'addressPrefixes' =>
              %w(10.1.0.0/16 10.2.0.0/16)
          },
        'subnets' =>
          [
            {
              'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-rg/providers/Microsoft.Network/virtualNetworks/fog-vnet/subnets/fog-subnet',
              'properties' =>
                {
                  'addressPrefix' => [],
                  'provisioningState' => 'Succeeded'
                },
              'name' => "subnet_0_#{name}"
            }
          ],
        'resourceGuid' => 'c573f8e2-d916-493f-8b25-a681c31269ef',
        'provisioningState' => 'Succeeded'
      }
  }
  vnet_mapper = Azure::ARM::Network::Models::VirtualNetwork.mapper
  @network_client.deserialize(vnet_mapper, virtual_network, 'result.body')
end

#create_or_update_express_route_circuitObject



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/fog/azurerm/requests/network/create_or_update_express_route_circuit.rb', line 86

def create_or_update_express_route_circuit(*)
  {
    'name' => 'CircuitName',
    'location' => 'eastus',
    'tags' => {
      'key1' => 'value1',
      'key2' => 'value2'
    },
    'sku' => {
      'name' => 'Standard_MeteredData',
      'tier' => 'Standard',
      'family' => 'MeteredData'
    },
    'properties' => {
      'serviceProviderProperties' => {
        'serviceProviderName' => 'Telenor',
        'peeringLocation' => 'London',
        'bandwidthInMbps' => 100
      }
    }
  }
end

#create_or_update_express_route_circuit_authorizationObject



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/fog/azurerm/requests/network/create_or_update_express_route_circuit_authorization.rb', line 37

def create_or_update_express_route_circuit_authorization(*)
  authorization = {
    'name' => 'authorization-name',
    'properties' => {
      'authorizationKey' => 'authorization-key',
      'authorizationUseStatus' => 'Available'
    }
  }
  authorization_mapper = Azure::ARM::Network::Models::ExpressRouteCircuitAuthorization.mapper
  @network_client.deserialize(authorization_mapper, authorization, 'result.body')
end

#create_or_update_express_route_circuit_peeringObject



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/fog/azurerm/requests/network/create_or_update_express_route_circuit_peering.rb', line 55

def create_or_update_express_route_circuit_peering(*)
  {
    'name' => 'PeeringName',
    'properties' => {
      'peeringType' => 'MicrosoftPeering',
      'peerASN' => 100,
      'primaryPeerAddressPrefix' => '192.168.1.0/30',
      'secondaryPeerAddressPrefix' => '192.168.2.0/30',
      'vlanId' => 200,
      'microsoftPeeringConfig' => {
        'advertisedpublicprefixes' => [
          '11.2.3.4/30',
          '12.2.3.4/30'
        ],
        'advertisedPublicPrefixState' => 'NotConfigured',
        'customerAsn' => 200,
        'routingRegistryName' => '<name>'
      }
    }
  }
end

#create_or_update_network_interface(resource_group_name, name, location, subnet_id, public_ip_address_id, ip_configs_name, private_ip_allocation_method, private_ip_address) ⇒ Object



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/fog/azurerm/requests/network/create_or_update_network_interface.rb', line 81

def create_or_update_network_interface(resource_group_name, name, location, subnet_id, public_ip_address_id, ip_configs_name, private_ip_allocation_method, private_ip_address)
  nic = {
    'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkInterfaces/#{name}",
    'name' => name,
    'type' => 'Microsoft.Network/networkInterfaces',
    'location' => location,
    'properties' =>
      {
        'ipConfigurations' =>
          [
            {
              'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkInterfaces/#{name}/ipConfigurations/#{ip_configs_name}",
              'properties' =>
                {
                  'privateIPAddress' => private_ip_address,
                  'privateIPAllocationMethod' => private_ip_allocation_method,
                  'subnet' =>
                    {
                      'id' => subnet_id
                    },
                  'publicIPAddress' =>
                    {
                      'id' => public_ip_address_id
                    },
                  'provisioningState' => 'Succeeded'
                },
              'name' => ip_configs_name
            }
          ],
        'dnsSettings' =>
          {
            'dnsServers' => [],
            'appliedDnsServers' => []
          },
        'enableIPForwarding' => false,
        'resourceGuid' => '2bff0fad-623b-4773-82b8-dc875f3aacd2',
        'provisioningState' => 'Succeeded'
      }
  }
  network_interface_mapper = Azure::ARM::Network::Models::NetworkInterface.mapper
  @network_client.deserialize(network_interface_mapper, nic, 'result.body')
end

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



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
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/requests/network/create_or_update_network_security_group.rb', line 54

def create_or_update_network_security_group(resource_group_name, security_group_name, location, security_rules)
  network_security_group = {
    'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{security_group_name}",
    'name' => security_group_name,
    'type' => 'Microsoft.Network/networkSecurityGroups',
    'location' => location,
    'properties' =>
      {
        'securityRules' => security_rules,
        'defaultSecurityRules' =>
          [
            {
              'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{security_group_name}/defaultSecurityRules/AllowVnetInBound",
              'properties' =>
                {
                  'protocol' => '*',
                  'sourceAddressPrefix' => 'VirtualNetwork',
                  'destinationAddressPrefix' => 'VirtualNetwork',
                  'access' => 'Allow',
                  'direction' => 'Inbound',
                  'description' => 'Allow inbound traffic from all VMs in VNET',
                  'sourcePortRange' => '*',
                  'destinationPortRange' => '*',
                  'priority' => 65_000,
                  'provisioningState' => 'Updating'
                },
              'name' => 'AllowVnetInBound'
            },
            {
              'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{security_group_name}/defaultSecurityRules/AllowAzureLoadBalancerInBound",
              'properties' =>
                {
                  'protocol' => '*',
                  'sourceAddressPrefix' => 'AzureLoadBalancer',
                  'destinationAddressPrefix' => '*',
                  'access' => 'Allow',
                  'direction' => 'Inbound',
                  'description' => 'Allow inbound traffic from azure load balancer',
                  'sourcePortRange' => '*',
                  'destinationPortRange' => '*',
                  'priority' => 65_001,
                  'provisioningState' => 'Updating'
                },
              'name' => 'AllowAzureLoadBalancerInBound'
            },
            {
              'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{security_group_name}/defaultSecurityRules/DenyAllInBound",
              'properties' =>
                {
                  'protocol' => '*',
                  'sourceAddressPrefix' => '*',
                  'destinationAddressPrefix' => '*',
                  'access' => 'Deny',
                  'direction' => 'Inbound',
                  'description' => 'Deny all inbound traffic',
                  'sourcePortRange' => '*',
                  'destinationPortRange' => '*',
                  'priority' => 65_500,
                  'provisioningState' => 'Updating'
                },
              'name' => 'DenyAllInBound'
            },
            {
              'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{security_group_name}/defaultSecurityRules/AllowVnetOutBound",
              'properties' =>
                {
                  'protocol' => '*',
                  'sourceAddressPrefix' => 'VirtualNetwork',
                  'destinationAddressPrefix' => 'VirtualNetwork',
                  'access' => 'Allow',
                  'direction' => 'Outbound',
                  'description' => 'Allow outbound traffic from all VMs to all VMs in VNET',
                  'sourcePortRange' => '*',
                  'destinationPortRange' => '*',
                  'priority' => 65_000,
                  'provisioningState' => 'Updating'
                },
              'name' => 'AllowVnetOutBound'
            },
            {
              'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{security_group_name}/defaultSecurityRules/AllowInternetOutBound",
              'properties' =>
                {
                  'protocol' => '*',
                  'sourceAddressPrefix' => '*',
                  'destinationAddressPrefix' => 'Internet',
                  'access' => 'Allow',
                  'direction' => 'Outbound',
                  'description' => 'Allow outbound traffic from all VMs to Internet',
                  'sourcePortRange' => '*',
                  'destinationPortRange' => '*',
                  'priority' => 65_001,
                  'provisioningState' => 'Updating'
                },
              'name' => 'AllowInternetOutBound'
            },
            {
              'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{security_group_name}/defaultSecurityRules/DenyAllOutBound",
              'properties' =>
                {
                  'protocol' => '*',
                  'sourceAddressPrefix' => '*',
                  'destinationAddressPrefix' => '*',
                  'access' => 'Deny',
                  'direction' => 'Outbound',
                  'description' => 'Deny all outbound traffic',
                  'sourcePortRange' => '*',
                  'destinationPortRange' => '*',
                  'priority' => 65_500,
                  'provisioningState' => 'Updating'
                },
              'name' => 'DenyAllOutBound'
            }
          ],
        'resourceGuid' => '9dca97e6-4789-4ebd-86e3-52b8b0da6cd4',
        'provisioningState' => 'Updating'
      }
  }
  nsg_mapper = Azure::ARM::Network::Models::NetworkSecurityGroup.mapper
  @network_client.deserialize(nsg_mapper, network_security_group, 'result.body')
end

#create_or_update_network_security_ruleObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/fog/azurerm/requests/network/create_or_update_network_security_rule.rb', line 35

def create_or_update_network_security_rule(*)
  network_security_rule = '{
    "name":"myNsRule",
    "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/myNsg/securityRules/myNsRule",
    "etag":"W/\"00000000-0000-0000-0000-000000000000\"",
    "properties":{
      "provisioningState":"Succeeded",
      "description":"description-of-this-rule",
      "protocol": "*",
      "sourcePortRange":"source-port-range",
      "destinationPortRange":"destination-port-range",
      "sourceAddressPrefix":"*",
      "destinationAddressPrefix":"*",
      "access":"Allow",
      "priority":6500,
      "direction":"Inbound"
    }
  }'
  network_security_rule_mapper = Azure::ARM::Network::Models::SecurityRule.mapper
  @network_client.deserialize(network_security_rule_mapper, JSON.load(network_security_rule), 'result.body')
end

#create_or_update_virtual_network_gatewayObject



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/fog/azurerm/requests/network/create_or_update_local_network_gateway.rb', line 54

def create_or_update_virtual_network_gateway(*)
  local_network_gateway = {
    'id' => '/subscriptions/<Subscription_id>/resourceGroups/learn_fog/providers/Microsoft.Network/localNetworkGateways/testLocalNetworkGateway',
    'name' => 'testLocalNetworkGateway',
    'type' => 'Microsoft.Network/localNetworkGateways',
    'location' => 'eastus',
    'properties' =>
      {
        'local_network_address_space' => {
          'address_prefixes' => []
        },
        'gateway_ip_address' => '192.168.1.1',
        'bgp_settings' => {
          'asn' => 100,
          'bgp_peering_address' => '192.168.1.2',
          'peer_weight' => 3
        }
      }
  }
  local_network_gateway_mapper = Azure::ARM::Network::Models::LocalNetworkGateway.mapper
  @network_client.deserialize(local_network_gateway_mapper, local_network_gateway, 'result.body')
end

#create_or_update_virtual_network_gateway_connectionObject



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/fog/azurerm/requests/network/create_or_update_virtual_network_gateway_connection.rb', line 61

def create_or_update_virtual_network_gateway_connection(*)
  connection = {
    'name' => 'cn1',
    'location' => 'West US',
    'tags' => { 'key1' => 'value1' },
    'properties' => {
      'virtualNetworkGateway1' => {
        'name' => 'firstgateway'
      },
      'virtualNetworkGateway2' => {
        'name' => 'secondgateway'
      },
      'connectionType' => 'SiteToSite',
      'connectivityState' => 'Connected'
    }
  }
  connection_mapper = Azure::ARM::Network::Models::VirtualNetworkGatewayConnection.mapper
  @network_client.deserialize(connection_mapper, connection, 'result.body')
end

#create_public_ip(resource_group, name, location, public_ip_allocation_method) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/fog/azurerm/requests/network/create_or_update_public_ip.rb', line 40

def create_public_ip(resource_group, name, location, public_ip_allocation_method)
  public_ip = {
    'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/publicIPAddresses/#{name}",
    'name' => name,
    'type' => 'Microsoft.Network/publicIPAddresses',
    'location' => location,
    'properties' =>
      {
        'publicIPAllocationMethod' => public_ip_allocation_method,
        'ipAddress' => '13.91.253.67',
        'idleTimeoutInMinutes' => 4,
        'resourceGuid' => '767b1955-94de-433c-8e4a-ea0ad25e8d0c',
        'provisioningState' => 'Succeeded'
      }
  }
  public_ip_mapper = Azure::ARM::Network::Models::PublicIPAddress.mapper
  @network_client.deserialize(public_ip_mapper, public_ip, 'result.body')
end

#create_subnetObject



38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/fog/azurerm/requests/network/create_subnet.rb', line 38

def create_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

#delete_express_route_circuitObject



21
22
23
24
# File 'lib/fog/azurerm/requests/network/delete_express_route_circuit.rb', line 21

def delete_express_route_circuit(*)
  Fog::Logger.debug 'Express Route Circuit {circuit_name} from Resource group {resource_group_name} deleted successfully.'
  true
end

#delete_express_route_circuit_authorizationObject



22
23
24
25
# File 'lib/fog/azurerm/requests/network/delete_express_route_circuit_authorization.rb', line 22

def delete_express_route_circuit_authorization(*)
  Fog::Logger.debug 'Express Route Circuit Authorization {authorization_name} from Resource group {resource_group_name} deleted successfully.'
  true
end

#delete_express_route_circuit_peeringObject



21
22
23
24
# File 'lib/fog/azurerm/requests/network/delete_express_route_circuit_peering.rb', line 21

def delete_express_route_circuit_peering(*)
  Fog::Logger.debug 'Express Route Circuit Peering {peering_name} from Resource group {resource_group_name} deleted successfully.'
  true
end

#delete_load_balancer(_resource_group, _name) ⇒ Object



21
22
23
24
# File 'lib/fog/azurerm/requests/network/delete_load_balancer.rb', line 21

def delete_load_balancer(_resource_group, _name)
  Fog::Logger.debug "Load_Balancer #{name} Deleted Successfully."
  true
end

#delete_local_network_gatewayObject



22
23
24
25
# File 'lib/fog/azurerm/requests/network/delete_local_network_gateway.rb', line 22

def delete_local_network_gateway(*)
  Fog::Logger.debug 'Local Network Gateway testLocalNetworkGateway from Resource group learn_fog deleted successfully.'
  true
end

#delete_network_interface(resource_group, name) ⇒ Object



21
22
23
24
# File 'lib/fog/azurerm/requests/network/delete_network_interface.rb', line 21

def delete_network_interface(resource_group, name)
  Fog::Logger.debug "Network Interface #{name} from Resource group #{resource_group} deleted successfully."
  true
end

#delete_network_security_group(resource_group, name) ⇒ Object



23
24
25
26
# File 'lib/fog/azurerm/requests/network/delete_network_security_group.rb', line 23

def delete_network_security_group(resource_group, name)
  Fog::Logger.debug "Network Security Group #{name} from Resource group #{resource_group} deleted successfully."
  true
end

#delete_network_security_ruleObject



23
24
25
26
# File 'lib/fog/azurerm/requests/network/delete_network_security_rule.rb', line 23

def delete_network_security_rule(*)
  Fog::Logger.debug 'Network Security Rule test-security-rule from Resource group test-rg deleted successfully.'
  true
end

#delete_public_ip(resource_group, name) ⇒ Object



20
21
22
23
# File 'lib/fog/azurerm/requests/network/delete_public_ip.rb', line 20

def delete_public_ip(resource_group, name)
  Fog::Logger.debug "Public IP #{name} from Resource group #{resource_group} deleted successfully."
  true
end

#delete_subnet(resource_group, name, virtual_network_name) ⇒ Object



21
22
23
24
# File 'lib/fog/azurerm/requests/network/delete_subnet.rb', line 21

def delete_subnet(resource_group, name, virtual_network_name)
  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



21
22
23
24
# File 'lib/fog/azurerm/requests/network/delete_virtual_network.rb', line 21

def delete_virtual_network(resource_group, name)
  Fog::Logger.debug "Virtual Network #{name} from Resource group #{resource_group} deleted successfully."
  true
end

#delete_virtual_network_gateway(resource_group_name, virtual_network_gateway_name) ⇒ Object



21
22
23
24
# File 'lib/fog/azurerm/requests/network/delete_virtual_network_gateway.rb', line 21

def delete_virtual_network_gateway(resource_group_name, virtual_network_gateway_name)
  Fog::Logger.debug "Virtual Network Gateway #{virtual_network_gateway_name} from Resource group #{resource_group_name} deleted successfully."
  true
end

#delete_virtual_network_gateway_connectionObject



22
23
24
25
# File 'lib/fog/azurerm/requests/network/delete_virtual_network_gateway_connection.rb', line 22

def delete_virtual_network_gateway_connection(*)
  Fog::Logger.debug 'Virtual Network Gateway Connection deleted successfully.'
  true
end

#detach_network_security_group_from_subnetObject



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/fog/azurerm/requests/network/detach_network_security_group_from_subnet.rb', line 35

def detach_network_security_group_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

#detach_resource_from_nic(resource_group_name, nic_name, _resource_type) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/fog/azurerm/requests/network/detach_resource_from_nic.rb', line 36

def detach_resource_from_nic(resource_group_name, nic_name, _resource_type)
  nic = {
    'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkInterfaces/#{nic_name}",
    'name' => nic_name,
    'type' => 'Microsoft.Network/networkInterfaces',
    'location' => location,
    'properties' =>
      {
        'ipConfigurations' =>
          [
            {
              'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkInterfaces/#{nic_name}/ipConfigurations/#{ip_configs_name}",
              'properties' =>
                {
                  'privateIPAddress' => '10.0.0.5',
                  'privateIPAllocationMethod' => prv_ip_alloc_method,
                  'subnet' =>
                    {
                      'id' => subnet_id
                    },
                  'publicIPAddress' =>
                    {
                      'id' => public_ip_address_id
                    },
                  'provisioningState' => 'Succeeded'
                },
              'name' => ip_configs_name
            }
          ],
        'dnsSettings' =>
          {
            'dnsServers' => [],
            'appliedDnsServers' => []
          },
        'enableIPForwarding' => false,
        'resourceGuid' => '2bff0fad-623b-4773-82b8-dc875f3aacd2',
        'provisioningState' => 'Succeeded'
      }
  }
  network_interface_mapper = Azure::ARM::Network::Models::NetworkInterface.mapper
  @network_client.deserialize(network_interface_mapper, nic, 'result.body')
end

#detach_route_table_from_subnetObject



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/fog/azurerm/requests/network/detach_route_table_from_subnet.rb', line 35

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

#get_available_ipaddress_countObject



17
18
19
# File 'lib/fog/azurerm/requests/network/get_available_ipaddresses_count.rb', line 17

def get_available_ipaddress_count(*)
  65_531
end

#get_connection_shared_keyObject



19
20
21
# File 'lib/fog/azurerm/requests/network/get_connection_shared_key.rb', line 19

def get_connection_shared_key(*)
  Fog::Logger.debug 'Get the shared key of Connection successfully.'
end

#get_express_route_circuitObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/fog/azurerm/requests/network/get_express_route_circuit.rb', line 19

def get_express_route_circuit(*)
  {
    'name' => 'circuit_name',
    'id' => '/subscriptions/########-####-####-####-############/resourceGroup/resource_group_name/providers/Microsoft.Network/expressRouteCircuits/circuit_name',
    'etag' => 'W/\"00000000-0000-0000-0000-000000000000\"',
    'location' => 'eastus',
    'tags' => {
      'key1' => 'value1',
      'key2' => 'value2'
    },
    'sku' => {
      'name' => 'Standard_MeteredData',
      'tier' => 'Standard',
      'family' => 'MeteredData'
    },
    'properties' => {
      'provisioningState' => 'Succeeded',
      'circuitProvisioningState' => 'Enabled',
      'serviceProviderProvisioningState' => 'Provisioned',
      'serviceProviderProperties' => {
        'serviceProviderName' => 'Telenor',
        'peeringLocation' => 'London',
        'bandwidthInMbps' => 100
      }
    },
    'serviceKey' => '<unique service key for circuit>',
    'serviceProviderNotes' => '<notes set only by ServiceProvider>'
  }
end

#get_express_route_circuit_authorizationObject



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

def get_express_route_circuit_authorization(*)
  authorization = {
    'name' => 'authorization-name',
    'properties' => {
      'authorizationKey' => 'authorization-key',
      'authorizationUseStatus' => 'Available'
    }
  }
  authorization_mapper = Azure::ARM::Network::Models::ExpressRouteCircuitAuthorization.mapper
  @network_client.deserialize(authorization_mapper, authorization, 'result.body')
end

#get_express_route_circuit_peeringObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/fog/azurerm/requests/network/get_express_route_circuit_peering.rb', line 20

def get_express_route_circuit_peering(*)
  {
    'name' => 'peering_name',
    'id' => '/subscriptions/########-####-####-####-############/resourceGroups/resource_group_name/providers/Microsoft.Network/expressRouteCircuits/circuit_name/peerings/peering_name',
    'etag' => '',
    'properties' => {
      'provisioningState' => 'Succeeded',
      'peeringType' => 'MicrosoftPeering',
      'peerASN' => '',
      'primaryPeerAddressPrefix' => '',
      'secondaryPeerAddressPrefix' => '',
      'primaryAzurePort' => 22,
      'secondaryAzurePort' => 21,
      'state' => 'Enabled',
      'sharedKey' => '',
      'vlanId' => 100,
      'microsoftPeeringConfig' => {
        'advertisedpublicprefixes' => %w(prefix1 prefix2),
        'advertisedPublicPrefixState' => 'ValidationNeeded',
        'customerAsn' => '',
        'routingRegistryName' => ''
      }
    }
  }
end

#get_load_balancerObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/fog/azurerm/requests/network/get_load_balancer.rb', line 21

def get_load_balancer(*)
  response = '{
    "name":"mylb1",
    "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/mylb1",
    "location":"North US",
    "tags":{
      "key":"value"
    },
    "etag":"W/\"00000000-0000-0000-0000-000000000000\"",
    "properties":{
      "resourceGuid":"6ECBD4C1-0DC1-4D86-9F6E-4A58F83C9023",
      "provisioningState":"Succeeded",
      "frontendIPConfigurations":[
        {
          "name":"myip1",
          "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/mylb1/frontendIPConfigurations/myip1",
          "etag":"W/\"00000000-0000-0000-0000-000000000000\"",
          "properties":{
            "provisioningState":"Succeeded",
            "subnet":{
              "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/myvnet1/subnets/mysubnet1"
            },
            "privateIPAddress":"10.0.0.10",
            "privateIPAllocationMethod":"Static",
            "publicIPAddress":{
              "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/myip1"
            },
            "loadBalancingRules":[
              {
                "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/myLB1/loadBalancingRules/rule1"
              }
            ],
            "inboundNatRules":[
              {
                "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/myLB1/inboundNatRules/rule1"
              }
            ]
          }
        }
      ],
      "backendAddressPools":[
        {
          "name":"pool1",
          "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/mylb1/backendAddressPools/pool1",
          "etag":"W/\"00000000-0000-0000-0000-000000000000\"",
          "properties":{
            "provisioningState":"Succeeded",
            "backendIPConfigurations":[
              {
                "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/vm1nic1/ipConfigurations/ip1"
              }
            ],
            "loadBalancingRules":[
              {
                "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/myLB1/loadBalancingRules/rule1"
              }
            ]
          }
        }
      ],
      "loadBalancingRules":[
        {
          "name":"HTTP Traffic",
          "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/mylb1/loadBalancingRules/rule1",
          "etag":"W/\"00000000-0000-0000-0000-000000000000\"",
          "properties":{
            "provisioningState":"Succeeded",
            "frontendIPConfiguration":{
              "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/myLB1/frontendIPConfigurations/ip1"
            },
            "backendAddressPool":{
              "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/myLB1/backendAddressPool/pool1"
            },
            "protocol":"Tcp",
            "frontendPort":80,
            "backendPort":8080,
            "probe":{
              "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/myLB1/probes/probe1"
            },
            "enableFloatingIP":true,
            "idleTimeoutInMinutes":4,
            "loadDistribution":"Default"
          }
        }
      ],
      "probes":[
        {
          "name":"my probe 1",
          "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/myLB1/probes/my probe 1",
          "etag":"W/\"00000000-0000-0000-0000-000000000000\"",
          "properties":{
            "provisioningState":"Succeeded",
            "protocol":"Tcp",
            "port":8080,
            "requestPath":"myprobeapp1/myprobe1.svc",
            "intervalInSeconds":5,
            "numberOfProbes":16,
            "loadBalancingRules":[
              {
                "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/myLB1/loadBalancingRules/rule1"
              }
            ]
          }
        }
      ],
      "inboundNatRules":[
        {
          "name":"RDP Traffic",
          "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/myLB1/inboundNatRules/RDP Traffic",
          "etag":"W/\"00000000-0000-0000-0000-000000000000\"",
          "properties":{
            "provisioningState":"Succeeded",
            "frontendIPConfiguration":{
              "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/myLB1/frontendIPConfigurations/ip1"
            },
            "backendIPConfiguration":{
              "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/vm1nic1/ipConfigurations/ip1"
            },
            "protocol":"Tcp",
            "frontendPort":3389,
            "backendPort":3389
          }
        }
      ],
      "inboundNatPools":[
        {
          "name": "RDPForVMSS1",
          "id": "/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers /Microsoft.Network/loadBalancers/myLB1/inboundNatRules/RDPForVMSS1",
          "etag": "W/\"00000000-0000-0000-0000-000000000000\"",
          "properties": {
            "provisioningState": "Updating|Deleting|Failed|Succeeded",
            "frontendIPConfiguration": {
              "id": "/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/myLB1/frontendIPConfigurations/ip1"
            },
            "protocol": "Tcp",
            "frontendPortRangeStart": 50000,
            "frontendPortRangeEnd": 50500,
            "backendPort": 3389
          }
        }
      ]
    }
  }'
  load_balancer_mapper = Azure::ARM::Network::Models::LoadBalancer.mapper
  @network_client.deserialize(load_balancer_mapper, JSON.load(response), 'result.body')
end

#get_local_network_gatewayObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/fog/azurerm/requests/network/get_local_network_gateway.rb', line 22

def get_local_network_gateway(*)
  local_network_gateway = {
    'id' => '/subscriptions/<Subscription_id>/resourceGroups/learn_fog/providers/Microsoft.Network/localNetworkGateways/testLocalNetworkGateway',
    'name' => 'testLocalNetworkGateway',
    'type' => 'Microsoft.Network/localNetworkGateways',
    'location' => 'eastus',
    'properties' =>
      {
        'local_network_address_space' => {
          'address_prefixes' => []
        },
        'gateway_ip_address' => '192.168.1.1',
        'bgp_settings' => {
          'asn' => 100,
          'bgp_peering_address' => '192.168.1.2',
          'peer_weight' => 3
        }
      }
  }
  local_network_gateway_mapper = Azure::ARM::Network::Models::LocalNetworkGateway.mapper
  @network_client.deserialize(local_network_gateway_mapper, local_network_gateway, 'result.body')
end

#get_network_interface(resource_group_name, nic_name) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/fog/azurerm/requests/network/get_network_interface.rb', line 19

def get_network_interface(resource_group_name, nic_name)
  nic = {
    'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkInterfaces/#{nic_name}",
    'name' => nic_name,
    'type' => 'Microsoft.Network/networkInterfaces',
    'location' => 'westus',
    'properties' =>
      {
        'ipConfigurations' =>
          [
            {
              'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkInterfaces/test-NIC/ipConfigurations/ipconfig1",
              'properties' =>
                {
                  'privateIPAddress' => '10.2.0.4',
                  'privateIPAllocationMethod' => 'Dynamic',
                  'subnet' =>
                    {
                      'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/virtualNetworks/testVnet/subnets/fog-test-subnet"
                    },
                  'provisioningState' => 'Succeeded'
                },
              'name' => 'ipconfig1'
            }
          ],
        'dnsSettings' =>
          {
            'dnsServers' => [],
            'appliedDnsServers' => []
          },
        'enableIPForwarding' => false,
        'resourceGuid' => '51e01337-fb15-4b04-b9de-e91537c764fd',
        'provisioningState' => 'Succeeded'
      }
  }
  network_interface_mapper = Azure::ARM::Network::Models::NetworkInterface.mapper
  @network_client.deserialize(network_interface_mapper, nic, 'result.body')
end

#get_network_security_group(resource_group_name, security_group_name) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/fog/azurerm/requests/network/get_network_security_group.rb', line 23

def get_network_security_group(resource_group_name, security_group_name)
  network_security_group = {
    'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{security_group_name}",
    'name' => security_group_name,
    'type' => 'Microsoft.Network/networkSecurityGroups',
    'location' => 'westus',
    'properties' =>
      {
        'securityRules' =>
          [
            {
              'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{security_group_name}/securityRules/testRule",
              'properties' =>
                {
                  'protocol' => 'tcp',
                  'sourceAddressPrefix' => '0.0.0.0/0',
                  'destinationAddressPrefix' => '0.0.0.0/0',
                  'access' => 'Allow',
                  'direction' => 'Inbound',
                  'sourcePortRange' => '22',
                  'destinationPortRange' => '22',
                  'priority' => 100,
                  'provisioningState' => 'Succeeded'
                },
              'name' => 'testRule'
            }
          ],
        'defaultSecurityRules' =>
          [
            {
              'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{security_group_name}/defaultSecurityRules/AllowVnetInBound",
              'properties' =>
                {
                  'protocol' => '*',
                  'sourceAddressPrefix' => 'VirtualNetwork',
                  'destinationAddressPrefix' => 'VirtualNetwork',
                  'access' => 'Allow',
                  'direction' => 'Inbound',
                  'description' => 'Allow inbound traffic from all VMs in VNET',
                  'sourcePortRange' => '*',
                  'destinationPortRange' => '*',
                  'priority' => 65_000,
                  'provisioningState' => 'Succeeded'
                },
              'name' => 'AllowVnetInBound'
            },
            {
              'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{security_group_name}/defaultSecurityRules/AllowAzureLoadBalancerInBound",
              'properties' =>
                {
                  'protocol' => '*',
                  'sourceAddressPrefix' => 'AzureLoadBalancer',
                  'destinationAddressPrefix' => '*',
                  'access' => 'Allow',
                  'direction' => 'Inbound',
                  'description' => 'Allow inbound traffic from azure load balancer',
                  'sourcePortRange' => '*',
                  'destinationPortRange' => '*',
                  'priority' => 65_001,
                  'provisioningState' => 'Succeeded'
                },
              'name' => 'AllowAzureLoadBalancerInBound'
            },
            {
              'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{security_group_name}/defaultSecurityRules/DenyAllInBound",
              'properties' =>
                {
                  'protocol' => '*',
                  'sourceAddressPrefix' => '*',
                  'destinationAddressPrefix' => '*',
                  'access' => 'Deny',
                  'direction' => 'Inbound',
                  'description' => 'Deny all inbound traffic',
                  'sourcePortRange' => '*',
                  'destinationPortRange' => '*',
                  'priority' => 65_500,
                  'provisioningState' => 'Succeeded'
                },
              'name' => 'DenyAllInBound'
            },
            {
              'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{security_group_name}/defaultSecurityRules/AllowVnetOutBound",
              'properties' =>
                {
                  'protocol' => '*',
                  'sourceAddressPrefix' => 'VirtualNetwork',
                  'destinationAddressPrefix' => 'VirtualNetwork',
                  'access' => 'Allow',
                  'direction' => 'Outbound',
                  'description' => 'Allow outbound traffic from all VMs to all VMs in VNET',
                  'sourcePortRange' => '*',
                  'destinationPortRange' => '*',
                  'priority' => 65_000,
                  'provisioningState' => 'Succeeded'
                },
              'name' => 'AllowVnetOutBound'
            },
            {
              'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{security_group_name}/defaultSecurityRules/AllowInternetOutBound",
              'properties' =>
                {
                  'protocol' => '*',
                  'sourceAddressPrefix' => '*',
                  'destinationAddressPrefix' => 'Internet',
                  'access' => 'Allow',
                  'direction' => 'Outbound',
                  'description' => 'Allow outbound traffic from all VMs to Internet',
                  'sourcePortRange' => '*',
                  'destinationPortRange' => '*',
                  'priority' => 65_001,
                  'provisioningState' => 'Succeeded'
                },
              'name' => 'AllowInternetOutBound'
            },
            {
              'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{security_group_name}/defaultSecurityRules/DenyAllOutBound",
              'properties' =>
                {
                  'protocol' => '*',
                  'sourceAddressPrefix' => '*',
                  'destinationAddressPrefix' => '*',
                  'access' => 'Deny',
                  'direction' => 'Outbound',
                  'description' => 'Deny all outbound traffic',
                  'sourcePortRange' => '*',
                  'destinationPortRange' => '*',
                  'priority' => 65_500,
                  'provisioningState' => 'Succeeded'
                },
              'name' => 'DenyAllOutBound'
            }
          ],
        'resourceGuid' => '9dca97e6-4789-4ebd-86e3-52b8b0da6cd4',
        'provisioningState' => 'Succeeded'
      }
  }
  nsg_mapper = Azure::ARM::Network::Models::NetworkSecurityGroup.mapper
  @network_client.deserialize(nsg_mapper, network_security_group, 'result.body')
end

#get_network_security_ruleObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/fog/azurerm/requests/network/get_network_security_rule.rb', line 23

def get_network_security_rule(*)
  nsr = '{
      "name":"myNsRule",
      "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/myNsg/securityRules/myNsRule",
      "etag":"W/\"00000000-0000-0000-0000-000000000000\"",
      "properties":{
        "provisioningState":"Succeeded",
        "description":"description-of-this-rule",
        "protocol": "*",
        "sourcePortRange":"source-port-range",
        "destinationPortRange":"destination-port-range",
        "sourceAddressPrefix":"*",
        "destinationAddressPrefix":"*",
        "access":"Allow",
        "priority":6500,
        "direction":"Inbound"
      }
  }'
  nsr_mapper = Azure::ARM::Network::Models::SecurityRule.mapper
  @network_client.deserialize(nsr_mapper, JSON.load(nsr), 'result.body')
end

#get_public_ip(resource_group_name, public_ip_name) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/fog/azurerm/requests/network/get_public_ip.rb', line 20

def get_public_ip(resource_group_name, public_ip_name)
  public_ip = {
    'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/publicIPAddresses/#{public_ip_name}",
    'name' => public_ip_name,
    'type' => 'Microsoft.Network/publicIPAddresses',
    'location' => 'westus',
    'properties' =>
      {
        'publicIPAllocationMethod' => 'Dynamic',
        'ipAddress' => '13.91.253.67',
        'idleTimeoutInMinutes' => 4,
        'resourceGuid' => '767b1955-94de-433c-8e4a-ea0ad25e8d0c',
        'provisioningState' => 'Succeeded'
      }
  }
  public_ip_mapper = Azure::ARM::Network::Models::PublicIPAddress.mapper
  @network_client.deserialize(public_ip_mapper, public_ip, 'result.body')
end

#get_subnetObject



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/fog/azurerm/requests/network/get_subnet.rb', line 21

def get_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

#get_virtual_networkObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/fog/azurerm/requests/network/get_virtual_network.rb', line 27

def get_virtual_network(*)
  virtual_network = {
    'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-rg/providers/Microsoft.Network/virtualNetworks/fog-vnet',
    'name' => 'fog-vnet',
    'type' => 'Microsoft.Network/virtualNetworks',
    'location' => 'westus',
    'properties' =>
      {
        'addressSpace' =>
          {
            'addressPrefixes' =>
              %w(10.1.0.0/16 10.2.0.0/16)
          },
        'subnets' =>
          [
            {
              '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'
            }
          ],
        'resourceGuid' => 'c573f8e2-d916-493f-8b25-a681c31269ef',
        'provisioningState' => 'Succeeded'
      }
  }
  vnet_mapper = Azure::ARM::Network::Models::VirtualNetwork.mapper
  @network_client.deserialize(vnet_mapper, virtual_network, 'result.body')
end

#get_virtual_network_gatewayObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/fog/azurerm/requests/network/get_virtual_network_gateway.rb', line 21

def get_virtual_network_gateway(*)
  gateway = {
    'name' => 'myvirtualgateway1',
    'id' => '/subscriptions/<subscriptionId>/resourceGroups/<resourceGroupName>/providers/microsoft.network/virtualNetworkGateways/myvirtualgateway1',
    'location' => 'West US',
    'tags' => { 'key1' => 'value1' },
    'properties' => {
      'gatewayType' => 'DynamicRouting',
      'gatewaySize' => 'Default',
      'subnet' => {
        'id' => '/subscriptions/<subscriptionId>/resourceGroups/<resourceGroupName>/providers/microsoft.network/virtualNetworks/<virtualNetworkName>/subnets/subnet1'
      },
      'vipAddress' => '{vipAddress}',
      'bgpEnabled' => true,
      'vpnClientAddressPool' => ['{vpnClientAddressPoolPrefix}'],
      'defaultSites' => ['mysite1']
    }
  }
  gateway_mapper = Azure::ARM::Network::Models::VirtualNetworkGateway.mapper
  @network_client.deserialize(gateway_mapper, gateway, 'result.body')
end

#get_virtual_network_gateway_connectionObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/fog/azurerm/requests/network/get_virtual_network_gateway_connection.rb', line 22

def get_virtual_network_gateway_connection(*)
  connection = {
    'name' => 'cn1',
    'id' => '/subscriptions/{subscription-id}/resourceGroups/{resource_group_name}/providers/microsoft.network/connections/connection1',
    'location' => 'West US',
    'tags' => { 'key1' => 'value1' },
    'properties' => {
      'virtualNetworkGateway1' => {
        'name' => 'firstgateway',
        'id' => '/subscriptions/{subscription-id}/resourceGroups/{resource_group_name}/providers/microsoft.network/SiteToSite/firstgateway'
      },
      'virtualNetworkGateway2' => {
        'name' => 'secondgateway',
        'id' => '/subscriptions/{subscription-id}/resourceGroups/{resource_group_name}/providers/microsoft.network/SiteToSite/secondgateway'
      },
      'connectionType' => 'SiteToSite',
      'connectivityState' => 'Connected'
    }
  }
  connection_mapper = Azure::ARM::Network::Models::VirtualNetworkGatewayConnection.mapper
  @network_client.deserialize(connection_mapper, connection, 'result.body')
end

#list_express_route_circuit_authorizationsObject



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/fog/azurerm/requests/network/list_express_route_circuit_authorizations.rb', line 21

def list_express_route_circuit_authorizations(*)
  authorizations = [
    {
      'name' => 'authorization-name',
      'properties' => {
        'authorizationKey' => 'authorization-key',
        'authorizationUseStatus' => 'Available'
      }
    }
  ]
  authorization_mapper = Azure::ARM::Network::Models::ExpressRouteCircuitAuthorization.mapper
  @network_client.deserialize(authorization_mapper, authorizations, 'result.body')
end

#list_express_route_circuit_peeringsObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/fog/azurerm/requests/network/list_express_route_circuit_peerings.rb', line 20

def list_express_route_circuit_peerings(*)
  [
    {
      'name' => 'AzurePrivatePeering',
      'id' => '/subscriptions/########-####-####-####-############/resourceGroups/resource_group_name/providers/Microsoft.Network/expressRouteCircuits/circuit_name/peerings/Private',
      'etag' => 'W/\"cb87537e-fd92-48c7-905f-2efc95a47c8f\"',
      'properties' => {
        'provisioningState' => 'Succeeded',
        'peeringType' => 'AzurePrivatePeering',
        'azureASN' => 120,
        'peerASN' => 100,
        'primaryPeerAddressPrefix' => '192.168.1.0/30',
        'secondaryPeerAddressPrefix' => '192.168.2.0/30',
        'primaryAzurePort' => 'BRKAZUREIXP01-BN1-04GMR-CIS-1-PRIMARY',
        'secondaryAzurePort' => 'BRKAZUREIXP01-DM2-04GMR-CIS-1-SECONDARY',
        'state' => 'Enabled',
        'vlanId' => 200
      }
    }
  ]
end

#list_express_route_circuitsObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/fog/azurerm/requests/network/list_express_route_circuits.rb', line 19

def list_express_route_circuits(*)
  [
    {
      'name' => 'testCircuit',
      'id' => '/subscriptions/########-####-####-####-############/resourceGroup/resource_group_name/providers/Microsoft.Network/expressRouteCircuits/circuitName',
      'etag' => 'W/\"00000000-0000-0000-0000-000000000000\"',
      'location' => 'eastus',
      'tags' => {
        'key1' => 'value1',
        'key2' => 'value2'
      },
      'sku' => {
        'name' => 'Standard_MeteredData',
        'tier' => 'Standard',
        'family' => 'MeteredData'
      },
      'properties' => {
        'provisioningState' => 'Succeeded',
        'circuitProvisioningState' => 'Enabled',
        'serviceProviderProvisioningState' => 'Provisioned',
        'serviceProviderProperties' => {
          'serviceProviderName' => 'Telenor',
          'peeringLocation' => 'London',
          'bandwidthInMbps' => 100
        }
      },
      'serviceKey' => '<unique service key for circuit>',
      'serviceProviderNotes' => '<notes set only by ServiceProvider>'
    }
  ]
end

#list_express_route_service_providersObject



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

def list_express_route_service_providers
  [
    {
      'name' => 'Telenor',
      'peeringLocations' => %w(London Karachi),
      'bandwidthsOffered' => [
        {
          'offerName' => '100Mbps',
          'valueInMbps' => 100
        }
      ]
    }
  ]
end

#list_load_balancers(_resource_group) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/fog/azurerm/requests/network/list_load_balancers.rb', line 21

def list_load_balancers(_resource_group)
  lb = Azure::ARM::Network::Models::LoadBalancer.new
  lb.name = 'fogtestloadbalancer'
  lb.location = 'West US'
  lb.properties = Azure::ARM::Network::Models::LoadBalancerPropertiesFormat.new
  [lb]
end

#list_load_balancers_in_subscriptionObject



21
22
23
24
25
26
27
# File 'lib/fog/azurerm/requests/network/list_load_balancers_in_subscription.rb', line 21

def list_load_balancers_in_subscription
  lb = Azure::ARM::Network::Models::LoadBalancer.new
  lb.name = 'fogtestloadbalancer'
  lb.location = 'West US'
  lb.properties = Azure::ARM::Network::Models::LoadBalancerPropertiesFormat.new
  [lb]
end

#list_network_interfaces(resource_group) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/fog/azurerm/requests/network/list_network_interfaces.rb', line 20

def list_network_interfaces(resource_group)
  nic =
    {
      'value' =>
        [
          {
            'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/networkInterfaces/test-NIC",
            'name' => 'test-NIC',
            'type' => 'Microsoft.Network/networkInterfaces',
            'location' => 'westus',
            'properties' =>
              {
                'ipConfigurations' =>
                  [
                    {
                      'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/networkInterfaces/test-NIC/ipConfigurations/ipconfig1",
                      'properties' =>
                        {
                          'privateIPAddress' => '10.2.0.4',
                          'privateIPAllocationMethod' => 'Dynamic',
                          'subnet' =>
                             {
                               'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/virtualNetworks/testVnet/subnets/fog-test-subnet"
                             },
                          'provisioningState' => 'Succeeded'
                        },
                      'name' => 'ipconfig1'
                    }
                  ],
                'dnsSettings' =>
                  {
                    'dnsServers' => [],
                    'appliedDnsServers' => []
                  },
                'enableIPForwarding' => false,
                'resourceGuid' => '51e01337-fb15-4b04-b9de-e91537c764fd',
                'provisioningState' => 'Succeeded'
              }
          }
        ]
    }
  network_interface_mapper = Azure::ARM::Network::Models::NetworkInterfaceListResult.mapper
  @network_client.deserialize(network_interface_mapper, nic, 'result.body').value
end

#list_network_security_groups(resource_group) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/fog/azurerm/requests/network/list_network_security_groups.rb', line 23

def list_network_security_groups(resource_group)
  [
    {
      'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/networkSecurityGroups/testGroup",
      'name' => 'testGroup',
      'type' => 'Microsoft.Network/networkSecurityGroups',
      'location' => 'westus',
      'properties' =>
        {
          'securityRules' =>
            [
              {
                'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/networkSecurityGroups/testGroup/securityRules/testRule",
                'properties' =>
                  {
                    'protocol' => 'tcp',
                    'sourceAddressPrefix' => '0.0.0.0/0',
                    'destinationAddressPrefix' => '0.0.0.0/0',
                    'access' => 'Allow',
                    'direction' => 'Inbound',
                    'sourcePortRange' => '22',
                    'destinationPortRange' => '22',
                    'priority' => 100,
                    'provisioningState' => 'Succeeded'
                  },
                'name' => 'testRule'
              }
            ],
          'defaultSecurityRules' =>
            [
              {
                'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/networkSecurityGroups/testGroup/defaultSecurityRules/AllowVnetInBound",
                'properties' =>
                  {
                    'protocol' => '*',
                    'sourceAddressPrefix' => 'VirtualNetwork',
                    'destinationAddressPrefix' => 'VirtualNetwork',
                    'access' => 'Allow',
                    'direction' => 'Inbound',
                    'description' => 'Allow inbound traffic from all VMs in VNET',
                    'sourcePortRange' => '*',
                    'destinationPortRange' => '*',
                    'priority' => 65_000,
                    'provisioningState' => 'Succeeded'
                  },
                'name' => 'AllowVnetInBound'
              },
              {
                'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/networkSecurityGroups/testGroup/defaultSecurityRules/AllowAzureLoadBalancerInBound",
                'properties' =>
                  {
                    'protocol' => '*',
                    'sourceAddressPrefix' => 'AzureLoadBalancer',
                    'destinationAddressPrefix' => '*',
                    'access' => 'Allow',
                    'direction' => 'Inbound',
                    'description' => 'Allow inbound traffic from azure load balancer',
                    'sourcePortRange' => '*',
                    'destinationPortRange' => '*',
                    'priority' => 65_001,
                    'provisioningState' => 'Succeeded'
                  },
                'name' => 'AllowAzureLoadBalancerInBound'
              },
              {
                'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/networkSecurityGroups/testGroup/defaultSecurityRules/DenyAllInBound",
                'properties' =>
                  {
                    'protocol' => '*',
                    'sourceAddressPrefix' => '*',
                    'destinationAddressPrefix' => '*',
                    'access' => 'Deny',
                    'direction' => 'Inbound',
                    'description' => 'Deny all inbound traffic',
                    'sourcePortRange' => '*',
                    'destinationPortRange' => '*',
                    'priority' => 65_500,
                    'provisioningState' => 'Succeeded'
                  },
                'name' => 'DenyAllInBound'
              },
              {
                'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/networkSecurityGroups/testGroup/defaultSecurityRules/AllowVnetOutBound",
                'properties' =>
                  {
                    'protocol' => '*',
                    'sourceAddressPrefix' => 'VirtualNetwork',
                    'destinationAddressPrefix' => 'VirtualNetwork',
                    'access' => 'Allow',
                    'direction' => 'Outbound',
                    'description' => 'Allow outbound traffic from all VMs to all VMs in VNET',
                    'sourcePortRange' => '*',
                    'destinationPortRange' => '*',
                    'priority' => 65_000,
                    'provisioningState' => 'Succeeded'
                  },
                'name' => 'AllowVnetOutBound'
              },
              {
                'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/networkSecurityGroups/testGroup/defaultSecurityRules/AllowInternetOutBound",
                'properties' =>
                  {
                    'protocol' => '*',
                    'sourceAddressPrefix' => '*',
                    'destinationAddressPrefix' => 'Internet',
                    'access' => 'Allow',
                    'direction' => 'Outbound',
                    'description' => 'Allow outbound traffic from all VMs to Internet',
                    'sourcePortRange' => '*',
                    'destinationPortRange' => '*',
                    'priority' => 65_001,
                    'provisioningState' => 'Succeeded'
                  },
                'name' => 'AllowInternetOutBound'
              },
              {
                'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/networkSecurityGroups/testGroup/defaultSecurityRules/DenyAllOutBound",
                'properties' =>
                  {
                    'protocol' => '*',
                    'sourceAddressPrefix' => '*',
                    'destinationAddressPrefix' => '*',
                    'access' => 'Deny',
                    'direction' => 'Outbound',
                    'description' => 'Deny all outbound traffic',
                    'sourcePortRange' => '*',
                    'destinationPortRange' => '*',
                    'priority' => 65_500,
                    'provisioningState' => 'Succeeded'
                  },
                'name' => 'DenyAllOutBound'
              }
            ],
          'resourceGuid' => '9dca97e6-4789-4ebd-86e3-52b8b0da6cd4',
          'provisioningState' => 'Succeeded'
        }
    }
  ]
end

#list_network_security_rulesObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/fog/azurerm/requests/network/list_network_security_rules.rb', line 23

def list_network_security_rules(*)
  nsr_list = '{
    "value":[
      {
        "name":"myNsRule",
        "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/myNsg/securityRules/myNsRule",
        "etag":"W/\"00000000-0000-0000-0000-000000000000\"",
        "properties":{
          "provisioningState":"Succeeded",
          "description":"description-of-this-rule",
          "protocol": "*",
          "sourcePortRange":"source-port-range",
          "destinationPortRange":"destination-port-range",
          "sourceAddressPrefix":"*",
          "destinationAddressPrefix":"*",
          "access":"Allow",
          "priority":100,
          "direction":"Inbound"
        }
      }
  ]
  }'
  nsr_mapper = Azure::ARM::Network::Models::SecurityRuleListResult.mapper
  @network_client.deserialize(nsr_mapper, JSON.load(nsr_list), 'result.body')
end

#list_public_ips(resource_group) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/fog/azurerm/requests/network/list_public_ips.rb', line 20

def list_public_ips(resource_group)
  public_ip = {
    'value' =>
    [
      {
        'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/publicIPAddresses/test-PubIP",
        'name' => 'test-PubIP',
        'type' => 'Microsoft.Network/publicIPAddresses',
        'location' => 'westus',
        'properties' =>
          {
            'publicIPAllocationMethod' => 'Static',
            'ipAddress' => '13.93.203.153',
            'idleTimeoutInMinutes' => 4,
            'resourceGuid' => 'c78f0c95-d8b9-409b-897c-74260b686392',
            'provisioningState' => 'Succeeded'
          }
      }
    ]
  }
  public_ip_mapper = Azure::ARM::Network::Models::PublicIPAddressListResult.mapper
  @network_client.deserialize(public_ip_mapper, public_ip, 'result.body').value
end

#list_subnets(resource_group, virtual_network_name) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/fog/azurerm/requests/network/list_subnets.rb', line 20

def list_subnets(resource_group, virtual_network_name)
  subnet = {
    'value' => [
      {
        'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/virtualNetworks/#{virtual_network_name}/subnets/subnet_0_testVnet",
        'properties' =>
          {
            'addressPrefix' => '10.1.0.0/24',
            'provisioningState' => 'Succeeded'
          },
        'name' => 'subnet_0_testVnet'
      },
      {
        'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/virtualNetworks/#{virtual_network_name}/subnets/fog-test-subnet",
        'properties' =>
          {
            'addressPrefix' => '10.2.0.0/16',
            'ipConfigurations' =>
              [
                {
                  'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/networkInterfaces/test-NIC/ipConfigurations/ipconfig1"
                }
              ],
            'provisioningState' => 'Succeeded'
          },
        'name' => 'fog-test-subnet'
      }
    ]
  }
  subnet_mapper = Azure::ARM::Network::Models::SubnetListResult.mapper
  @network_client.deserialize(subnet_mapper, subnet, 'result.body').value
end

#list_virtual_network_gateway_connectionsObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/fog/azurerm/requests/network/list_virtual_network_gateway_connections.rb', line 21

def list_virtual_network_gateway_connections(*)
  connection = {
    'value' => [
      {
        'name' => 'cn1',
        'id' => '/subscriptions/{subscription-id}/resourceGroups/{resource_group_name}/providers/microsoft.network/connections/connection1',
        'location' => 'West US',
        'tags' => { 'key1' => 'value1' },
        'properties' => {
          'virtualNetworkGateway1' => {
            'name' => 'firstgateway',
            'id' => '/subscriptions/{subscription-id}/resourceGroups/{resource_group_name}/providers/microsoft.network/SiteToSite/firstgateway'
          },
          'virtualNetworkGateway2' => {
            'name' => 'secondgateway',
            'id' => '/subscriptions/{subscription-id}/resourceGroups/{resource_group_name}/providers/microsoft.network/SiteToSite/secondgateway'
          },
          'connectionType' => 'SiteToSite',
          'connectivityState' => 'Connected'
        }
      }
    ]
  }
  connection_mapper = Azure::ARM::Network::Models::VirtualNetworkGatewayConnectionListResult.mapper
  @network_client.deserialize(connection_mapper, connection, 'result.body').value
end

#list_virtual_network_gatewaysObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/fog/azurerm/requests/network/list_local_network_gateways.rb', line 21

def list_virtual_network_gateways(*)
  local_network_gateway = {
    'value' => [
      {
        'id' => '/subscriptions/<Subscription_id>/resourceGroups/learn_fog/providers/Microsoft.Network/localNetworkGateways/testLocalNetworkGateway',
        'name' => 'testLocalNetworkGateway',
        'type' => 'Microsoft.Network/localNetworkGateways',
        'location' => 'eastus',
        'properties' =>
          {
            'local_network_address_space' => {
              'address_prefixes' => []
            },
            'gateway_ip_address' => '192.168.1.1',
            'bgp_settings' => {
              'asn' => 100,
              'bgp_peering_address' => '192.168.1.2',
              'peer_weight' => 3
            }
          }
      }
    ]
  }
  local_network_gateway_mapper = Azure::ARM::Network::Models::LocalNetworkGatewayListResult.mapper
  @network_client.deserialize(local_network_gateway_mapper, local_network_gateway, 'result.body')
end

#list_virtual_networks(resource_group) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/fog/azurerm/requests/network/list_virtual_networks.rb', line 20

def list_virtual_networks(resource_group)
  virtual_network = {
    'value' => [
      {
        'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/virtualNetworks/testVnet",
        'name' => 'testVnet',
        'type' => 'Microsoft.Network/virtualNetworks',
        'location' => 'westus',
        'properties' =>
          {
            'addressSpace' =>
              {
                'addressPrefixes' =>
                  %w(10.1.0.0/16 10.2.0.0/16)
              },
            'subnets' =>
              [
                {
                  'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/virtualNetworks/testVnet/subnets/subnet_0_testVnet",
                  'properties' =>
                    {
                      'addressPrefix' => '10.1.0.0/24',
                      'provisioningState' => 'Succeeded'
                    },
                  'name' => 'subnet_0_testVnet'
                },
                {
                  'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/virtualNetworks/testVnet/subnets/fog-test-subnet",
                  'properties' =>
                    {
                      'addressPrefix' => '10.2.0.0/16',
                      'ipConfigurations' =>
                        [
                          {
                            'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/networkInterfaces/test-NIC/ipConfigurations/ipconfig1"
                          }
                        ],
                      'provisioningState' => 'Succeeded'
                    },
                  'name' => 'fog-test-subnet'
                }
              ],
            'resourceGuid' => 'c573f8e2-d916-493f-8b25-a681c31269ef',
            'provisioningState' => 'Succeeded'
          }
      }
    ]
  }
  vnet_mapper = Azure::ARM::Network::Models::VirtualNetworkListResult.mapper
  @network_client.deserialize(vnet_mapper, virtual_network, 'result.body').value
end

#list_virtual_networks_in_subscriptionObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/fog/azurerm/requests/network/list_virtual_networks_in_subscription.rb', line 20

def list_virtual_networks_in_subscription
  virtual_network = {
    'value' => [
      {
        'id' => '/subscriptions/########-####-####-####-############/resourceGroups/TestRG/providers/Microsoft.Network/virtualNetworks/testVnet',
        'name' => 'testVnet',
        'type' => 'Microsoft.Network/virtualNetworks',
        'location' => 'westus',
        'properties' =>
          {
            'addressSpace' =>
              {
                'addressPrefixes' =>
                  %w(10.1.0.0/16 10.2.0.0/16)
              },
            'subnets' =>
              [
                {
                  'id' => '/subscriptions/########-####-####-####-############/resourceGroups/TestRG/providers/Microsoft.Network/virtualNetworks/testVnet/subnets/subnet_0_testVnet',
                  'properties' =>
                    {
                      'addressPrefix' => '10.1.0.0/24',
                      'provisioningState' => 'Succeeded'
                    },
                  'name' => 'subnet_0_testVnet'
                },
                {
                  'id' => '/subscriptions/########-####-####-####-############/resourceGroups/TestRG/providers/Microsoft.Network/virtualNetworks/testVnet/subnets/fog-test-subnet',
                  'properties' =>
                    {
                      'addressPrefix' => '10.2.0.0/16',
                      'ipConfigurations' =>
                        [
                          {
                            'id' => '/subscriptions/########-####-####-####-############/resourceGroups/TestRG/providers/Microsoft.Network/networkInterfaces/test-NIC/ipConfigurations/ipconfig1'
                          }
                        ],
                      'provisioningState' => 'Succeeded'
                    },
                  'name' => 'fog-test-subnet'
                }
              ],
            'resourceGuid' => 'c573f8e2-d916-493f-8b25-a681c31269ef',
            'provisioningState' => 'Succeeded'
          }
      }
    ]
  }
  vnet_mapper = Azure::ARM::Network::Models::VirtualNetworkListResult.mapper
  @network_client.deserialize(vnet_mapper, virtual_network, 'result.body')
end

#remove_address_prefixes_from_virtual_networkObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/fog/azurerm/requests/network/remove_address_prefixes_from_virtual_network.rb', line 26

def remove_address_prefixes_from_virtual_network(*)
  virtual_network = {
    'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-rg/providers/Microsoft.Network/virtualNetworks/fog-vnet',
    'name' => 'fog-vnet',
    'type' => 'Microsoft.Network/virtualNetworks',
    'location' => 'westus',
    'properties' =>
      {
        'addressSpace' =>
          {
            'addressPrefixes' =>
              [
                '10.1.0.0/16'
              ]
          },
        'dhcpOptions' => {
          'dnsServers' => [
            '10.1.0.5',
            '10.1.0.6'
          ]
        },
        'subnets' =>
          [
            {
              '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'
            }
          ],
        'resourceGuid' => 'c573f8e2-d916-493f-8b25-a681c31269ef',
        'provisioningState' => 'Succeeded'
      }
  }
  vnet_mapper = Azure::ARM::Network::Models::VirtualNetwork.mapper
  @network_client.deserialize(vnet_mapper, virtual_network, 'result.body')
end

#remove_dns_servers_from_virtual_networkObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/fog/azurerm/requests/network/remove_dns_servers_from_virtual_network.rb', line 26

def remove_dns_servers_from_virtual_network(*)
  virtual_network = {
    'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-rg/providers/Microsoft.Network/virtualNetworks/fog-vnet',
    'name' => 'fog-vnet',
    'type' => 'Microsoft.Network/virtualNetworks',
    'location' => 'westus',
    'properties' =>
      {
        'addressSpace' =>
          {
            'addressPrefixes' =>
              [
                '10.1.0.0/16',
                '10.2.0.0/16'
              ]
          },
        'dhcpOptions' => {
          'dnsServers' => [
            '10.1.0.5'
          ]
        },
        'subnets' =>
          [
            {
              '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'
            }
          ],
        'resourceGuid' => 'c573f8e2-d916-493f-8b25-a681c31269ef',
        'provisioningState' => 'Succeeded'
      }
  }
  vnet_mapper = Azure::ARM::Network::Models::VirtualNetwork.mapper
  @network_client.deserialize(vnet_mapper, virtual_network, 'result.body')
end

#remove_security_rule(resource_group_name, security_group_name, _security_rule_name) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/fog/azurerm/requests/network/remove_security_rule.rb', line 33

def remove_security_rule(resource_group_name, security_group_name, _security_rule_name)
  network_security_group = {
    'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{name}",
    'name' => security_group_name,
    'type' => 'Microsoft.Network/networkSecurityGroups',
    'location' => 'location',
    'properties' =>
      {
        'securityRules' => [],
        'defaultSecurityRules' =>
          [
            {
              'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{security_group_name}/defaultSecurityRules/AllowVnetInBound",
              'properties' =>
                {
                  'protocol' => '*',
                  'sourceAddressPrefix' => 'VirtualNetwork',
                  'destinationAddressPrefix' => 'VirtualNetwork',
                  'access' => 'Allow',
                  'direction' => 'Inbound',
                  'description' => 'Allow inbound traffic from all VMs in VNET',
                  'sourcePortRange' => '*',
                  'destinationPortRange' => '*',
                  'priority' => 65_000,
                  'provisioningState' => 'Updating'
                },
              'name' => 'AllowVnetInBound'
            },
            {
              'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{security_group_name}/defaultSecurityRules/AllowAzureLoadBalancerInBound",
              'properties' =>
                {
                  'protocol' => '*',
                  'sourceAddressPrefix' => 'AzureLoadBalancer',
                  'destinationAddressPrefix' => '*',
                  'access' => 'Allow',
                  'direction' => 'Inbound',
                  'description' => 'Allow inbound traffic from azure load balancer',
                  'sourcePortRange' => '*',
                  'destinationPortRange' => '*',
                  'priority' => 65_001,
                  'provisioningState' => 'Updating'
                },
              'name' => 'AllowAzureLoadBalancerInBound'
            },
            {
              'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{security_group_name}/defaultSecurityRules/DenyAllInBound",
              'properties' =>
                {
                  'protocol' => '*',
                  'sourceAddressPrefix' => '*',
                  'destinationAddressPrefix' => '*',
                  'access' => 'Deny',
                  'direction' => 'Inbound',
                  'description' => 'Deny all inbound traffic',
                  'sourcePortRange' => '*',
                  'destinationPortRange' => '*',
                  'priority' => 65_500,
                  'provisioningState' => 'Updating'
                },
              'name' => 'DenyAllInBound'
            },
            {
              'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{security_group_name}/defaultSecurityRules/AllowVnetOutBound",
              'properties' =>
                {
                  'protocol' => '*',
                  'sourceAddressPrefix' => 'VirtualNetwork',
                  'destinationAddressPrefix' => 'VirtualNetwork',
                  'access' => 'Allow',
                  'direction' => 'Outbound',
                  'description' => 'Allow outbound traffic from all VMs to all VMs in VNET',
                  'sourcePortRange' => '*',
                  'destinationPortRange' => '*',
                  'priority' => 65_000,
                  'provisioningState' => 'Updating'
                },
              'name' => 'AllowVnetOutBound'
            },
            {
              'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{security_group_name}/defaultSecurityRules/AllowInternetOutBound",
              'properties' =>
                {
                  'protocol' => '*',
                  'sourceAddressPrefix' => '*',
                  'destinationAddressPrefix' => 'Internet',
                  'access' => 'Allow',
                  'direction' => 'Outbound',
                  'description' => 'Allow outbound traffic from all VMs to Internet',
                  'sourcePortRange' => '*',
                  'destinationPortRange' => '*',
                  'priority' => 65_001,
                  'provisioningState' => 'Updating'
                },
              'name' => 'AllowInternetOutBound'
            },
            {
              'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{security_group_name}/defaultSecurityRules/DenyAllOutBound",
              'properties' =>
                {
                  'protocol' => '*',
                  'sourceAddressPrefix' => '*',
                  'destinationAddressPrefix' => '*',
                  'access' => 'Deny',
                  'direction' => 'Outbound',
                  'description' => 'Deny all outbound traffic',
                  'sourcePortRange' => '*',
                  'destinationPortRange' => '*',
                  'priority' => 65_500,
                  'provisioningState' => 'Updating'
                },
              'name' => 'DenyAllOutBound'
            }
          ],
        'resourceGuid' => '9dca97e6-4789-4ebd-86e3-52b8b0da6cd4',
        'provisioningState' => 'Updating'
      }
  }
  nsg_mapper = Azure::ARM::Network::Models::NetworkSecurityGroup.mapper
  @network_client.deserialize(nsg_mapper, network_security_group, 'result.body')
end

#remove_subnets_from_virtual_networkObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/fog/azurerm/requests/network/remove_subnets_from_virtual_network.rb', line 26

def remove_subnets_from_virtual_network(*)
  virtual_network = {
    'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-rg/providers/Microsoft.Network/virtualNetworks/fog-vnet',
    'name' => 'fog-vnet',
    'type' => 'Microsoft.Network/virtualNetworks',
    'location' => 'westus',
    'properties' =>
      {
        'addressSpace' =>
          {
            'addressPrefixes' =>
              [
                '10.1.0.0/16',
                '10.2.0.0/16'
              ]
          },
        'dhcpOptions' => {
          'dnsServers' => [
            '10.1.0.5',
            '10.1.0.6'
          ]
        },
        'subnets' => [],
        'resourceGuid' => 'c573f8e2-d916-493f-8b25-a681c31269ef',
        'provisioningState' => 'Succeeded'
      }
  }
  vnet_mapper = Azure::ARM::Network::Models::VirtualNetwork.mapper
  @network_client.deserialize(vnet_mapper, virtual_network, 'result.body')
end

#reset_connection_shared_keyObject



29
30
31
32
# File 'lib/fog/azurerm/requests/network/reset_connection_shared_key.rb', line 29

def reset_connection_shared_key(*)
  Fog::Logger.debug 'Reset the shared key of Connection successfully.'
  true
end

#set_connection_shared_keyObject



29
30
31
32
# File 'lib/fog/azurerm/requests/network/set_connection_shared_key.rb', line 29

def set_connection_shared_key(*)
  Fog::Logger.debug 'Set the shared key of Connection successfully.'
  true
end