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/list_public_ips.rb,
lib/fog/azurerm/requests/network/create_public_ip.rb,
lib/fog/azurerm/requests/network/delete_public_ip.rb,
lib/fog/azurerm/requests/network/add_security_rules.rb,
lib/fog/azurerm/requests/network/check_for_public_ip.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/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_for_virtual_network.rb,
lib/fog/azurerm/requests/network/list_application_gateways.rb,
lib/fog/azurerm/requests/network/create_application_gateway.rb,
lib/fog/azurerm/requests/network/delete_application_gateway.rb,
lib/fog/azurerm/requests/network/get_network_security_group.rb,
lib/fog/azurerm/requests/network/get_traffic_manager_profile.rb,
lib/fog/azurerm/requests/network/attach_route_table_to_subnet.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_traffic_manager_profiles.rb,
lib/fog/azurerm/requests/network/add_subnets_in_virtual_network.rb,
lib/fog/azurerm/requests/network/create_traffic_manager_profile.rb,
lib/fog/azurerm/requests/network/delete_traffic_manager_profile.rb,
lib/fog/azurerm/requests/network/detach_route_table_from_subnet.rb,
lib/fog/azurerm/requests/network/create_traffic_manager_endpoint.rb,
lib/fog/azurerm/requests/network/delete_traffic_manager_endpoint.rb,
lib/fog/azurerm/requests/network/create_or_update_virtual_network.rb,
lib/fog/azurerm/requests/network/add_dns_servers_in_virtual_network.rb,
lib/fog/azurerm/requests/network/create_or_update_network_interface.rb,
lib/fog/azurerm/requests/network/remove_subnets_from_virtual_network.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/remove_dns_servers_from_virtual_network.rb,
lib/fog/azurerm/requests/network/detach_network_security_group_from_subnet.rb,
lib/fog/azurerm/requests/network/remove_address_prefixes_from_virtual_network.rb

Overview

Mock class for Network Request

Instance Method Summary collapse

Constructor Details

#initialize(_options = {}) ⇒ Mock



100
101
102
103
104
105
106
107
# File 'lib/fog/azurerm/network.rb', line 100

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
# File 'lib/fog/azurerm/requests/network/add_dns_servers_in_virtual_network.rb', line 32

def add_dns_servers_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_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
# File 'lib/fog/azurerm/requests/network/add_security_rules.rb', line 30

def add_security_rules(resource_group_name, security_group_name, security_rules)
  {
    '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'
      }
  }
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
# File 'lib/fog/azurerm/requests/network/add_subnets_in_virtual_network.rb', line 27

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

#attach_network_security_group_to_subnetObject



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

def attach_network_security_group_to_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'
  }
end

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



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
# File 'lib/fog/azurerm/requests/network/attach_resource_to_nic.rb', line 45

def attach_resource_to_nic(resource_group_name, nic_name, _resource_type, _resource_id)
  {
    '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'
      }
  }
end

#attach_route_table_to_subnetObject



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

def attach_route_table_to_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'
  }
end

#check_for_public_ip(resource_group, name) ⇒ Object



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

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

#check_for_virtual_network(resource_group, name) ⇒ Object



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

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

#create_application_gateway(_name, _location, _resource_group, _sku_name, _sku_tier, _sku_capacity, _gateway_ip_configurations, _ssl_certificates, _frontend_ip_configurations, _frontend_ports, _probes, _backend_address_pools, _backend_http_settings_list, _http_listeners, _url_path_maps, _request_routing_rules) ⇒ Object



366
367
# File 'lib/fog/azurerm/requests/network/create_application_gateway.rb', line 366

def create_application_gateway(_name, _location, _resource_group, _sku_name, _sku_tier, _sku_capacity, _gateway_ip_configurations, _ssl_certificates, _frontend_ip_configurations, _frontend_ports, _probes, _backend_address_pools, _backend_http_settings_list, _http_listeners, _url_path_maps, _request_routing_rules)
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



203
204
# File 'lib/fog/azurerm/requests/network/create_load_balancer.rb', line 203

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



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
# File 'lib/fog/azurerm/requests/network/create_or_update_virtual_network.rb', line 80

def create_or_update__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'
              ]
          },
        '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'
      }
  }
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



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
# File 'lib/fog/azurerm/requests/network/create_or_update_network_interface.rb', line 56

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)
  {
    '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'
      }
  }
end

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



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
167
168
169
170
# File 'lib/fog/azurerm/requests/network/create_or_update_network_security_group.rb', line 52

def create_or_update_network_security_group(resource_group_name, security_group_name, location, security_rules)
  {
    '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'
      }
  }
end

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



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

def create_public_ip(resource_group, name, location, public_ip_allocation_method)
  {
    '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'
      }
  }
end

#create_subnetObject



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/fog/azurerm/requests/network/create_subnet.rb', line 42

def create_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'
  }
end

#create_traffic_manager_endpoint(resource_group, name, traffic_manager_profile_name, type, target_resource_id, target, weight, priority, endpoint_location, min_child_endpoints) ⇒ Object



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

def create_traffic_manager_endpoint(resource_group, name, traffic_manager_profile_name, type,
                                    target_resource_id, target, weight, priority, endpoint_location,
                                    min_child_endpoints)
  response = {}
  properties = {}

  properties['weight'] = weight
  properties['priority'] = priority
  properties['targetResourceId'] = target_resource_id unless target_resource_id.nil?
  properties['target'] = target unless target.nil?
  properties['endpointLocation'] = endpoint_location unless endpoint_location.nil?
  properties['minChildEndpoints'] = min_child_endpoints unless min_child_endpoints.nil?

  response['id'] = "/subscriptions/######/resourceGroups/#{resource_group}/providers/Microsoft.Network/trafficManagerProfiles/#{traffic_manager_profile_name}/#{type}Endpoints/#{name}?api-version=2015-11-01"
  response['type'] = "Microsoft.Network/trafficManagerProfiles/#{type}Endpoints"
  response['properties'] = properties

  response
end

#create_traffic_manager_profile(resource_group, name, traffic_routing_method, relative_name, ttl, protocol, port, path) ⇒ Object



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
# File 'lib/fog/azurerm/requests/network/create_traffic_manager_profile.rb', line 59

def create_traffic_manager_profile(resource_group, name, traffic_routing_method, relative_name, ttl, protocol,
                                   port, path)
  {
    location: 'global',
    tags: {},
    id: "/subscriptions/####/resourceGroups/#{resource_group}/Microsoft.Network/trafficManagerProfiles/#{name}",
    name: name,
    type: 'Microsoft.Network/trafficManagerProfiles',
    properties: {
      profileStatus: 'Enabled',
      trafficRoutingMethod: traffic_routing_method,
      dnsConfig: {
        relativeName: relative_name,
        fqdn: 'myapp.trafficmanager.net',
        ttl: ttl
      },
      monitorConfig: {
        profileMonitorStatus: 'Online',
        protocol: protocol,
        port: port,
        path: path
      },

      endpoints: [{
        id: "/subscriptions/####/resourceGroups/#{resource_group}/Microsoft.Network/trafficManagerProfiles/#{name}/azureEndpoints/endpoint-name1",
        name: 'endpoint-name1',
        type: 'Microsoft.Network/trafficManagerProfiles/azureEndpoints',
        properties: {
          endpointStatus: 'Enabled',
          endpointMonitorStatus: 'Online',
          targetResourceId: "/subscriptions/####/resourceGroups/#{resource_group}/Microsoft.Network",
          target: 'myapp.azurewebsites.net',
          weight: 10,
          priority: 3,
          endpointLocation: 'centralus'
        }
      }, {
        id: "/subscriptions/####/resourceGroups/#{resource_group}/Microsoft.Network/trafficManagerProfiles/#{name}/externalEndpoints/endpoint-name2",
        name: 'endpoint-name2',
        type: 'Microsoft.Network/trafficManagerProfiles/externalEndpoints',
        properties: {
          endpointStatus: 'Enabled',
          endpointMonitorStatus: 'Online',
          target: 'myendpoint.contoso.com',
          weight: 10,
          priority: 5,
          endpointLocation: 'northeurope'
        }
      }, {
        id: "/subscriptions/####/resourceGroups/#{resource_group}/Microsoft.Network/trafficManagerProfiles/#{name}/nestedEndpoints/endpoint-name3",
        name: 'endpoint-name3',
        type: 'Microsoft.Network/trafficManagerProfiles/nestedEndpoints',
        properties: {
          endpointStatus: 'Enabled',
          endpointMonitorStatus: 'Online',
          targetResourceId: '####',
          weight: 10,
          priority: 1,
          endpointLocation: 'westeurope',
          minChildEndpoints: 1
        }
      }]
    }
  }
end

#delete_application_gateway(_resource_group, _name) ⇒ Object



22
23
# File 'lib/fog/azurerm/requests/network/delete_application_gateway.rb', line 22

def delete_application_gateway(_resource_group, _name)
end

#delete_load_balancer(_resource_group, _name) ⇒ Object



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

def delete_load_balancer(_resource_group, _name)
end

#delete_network_interface(resource_group, name) ⇒ Object



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

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



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

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_public_ip(resource_group, name) ⇒ Object



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

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) ⇒ Object



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

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_traffic_manager_endpoint(resource_group, name, _traffic_manager_profile_name, _type) ⇒ Object



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

def delete_traffic_manager_endpoint(resource_group, name, _traffic_manager_profile_name, _type)
  Fog::Logger.debug "Traffic Manager End Point #{name} from Resource group #{resource_group} deleted successfully."
  true
end

#delete_virtual_network(resource_group, name) ⇒ Object



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

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

#detach_network_security_group_from_subnetObject



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

def detach_network_security_group_from_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'
  }
end

#detach_resource_from_nic(resource_group_name, nic_name, _resource_type) ⇒ Object



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
# File 'lib/fog/azurerm/requests/network/detach_resource_from_nic.rb', line 37

def detach_resource_from_nic(resource_group_name, nic_name, _resource_type)
  {
    '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'
      }
  }
end

#detach_route_table_from_subnetObject



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

def detach_route_table_from_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'
  }
end

#get_network_interface(resource_group_name, nic_name) ⇒ Object



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 21

def get_network_interface(resource_group_name, nic_name)
  {
    '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'
      }
  }
end

#get_network_security_group(resource_group_name, security_group_name) ⇒ Object



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
# File 'lib/fog/azurerm/requests/network/get_network_security_group.rb', line 21

def get_network_security_group(resource_group_name, security_group_name)
  {
    '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'
      }
  }
end

#get_subnetObject



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

def get_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'
  }
end

#get_traffic_manager_profile(resource_group, traffic_manager_profile_name) ⇒ 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
# File 'lib/fog/azurerm/requests/network/get_traffic_manager_profile.rb', line 30

def get_traffic_manager_profile(resource_group, traffic_manager_profile_name)
  {
    location: 'global',
    tags: {},
    id: "/subscriptions/####/resourceGroups/#{resource_group}/Microsoft.Network/trafficManagerProfiles/#{traffic_manager_profile_name}",
    name: traffic_manager_profile_name,
    type: 'Microsoft.Network/trafficManagerProfiles',
    properties: {
      profileStatus: 'Enabled',
      trafficRoutingMethod: 'Performance',
      dnsConfig: {
        relativeName: 'myapp',
        fqdn: 'myapp.trafficmanager.net',
        ttl: 30
      },
      monitorConfig: {
        profileMonitorStatus: 'Online',
        protocol: 'http',
        port: 80,
        path: '/monitorpage.aspx'
      },
      endpoints: [{
        id: "/subscriptions/####/resourceGroups/#{resource_group}/Microsoft.Network/trafficManagerProfiles/#{traffic_manager_profile_name}/azureEndpoints/endpoint-name1",
        name: 'endpoint-name1',
        type: 'Microsoft.Network/trafficManagerProfiles/azureEndpoints',
        properties: {
          endpointStatus: 'Enabled',
          endpointMonitorStatus: 'Online',
          targetResourceId: "/subscriptions/####/resourceGroups/#{resource_group}/Microsoft.Network",
          target: 'myapp.azurewebsites.net',
          weight: 10,
          priority: 3,
          endpointLocation: 'centralus'
        }
      }, {
        id: "/subscriptions/####/resourceGroups/resource_group/Microsoft.Network/trafficManagerProfiles/#{traffic_manager_profile_name}/externalEndpoints/endpoint-name2",
        name: 'endpoint-name2',
        type: 'Microsoft.Network/trafficManagerProfiles/externalEndpoints',
        properties: {
          endpointStatus: 'Enabled',
          endpointMonitorStatus: 'Online',
          target: 'myendpoint.contoso.com',
          weight: 10,
          priority: 5,
          endpointLocation: 'northeurope'
        }
      }, {
        id: "/subscriptions/####/resourceGroups/#{resource_group}/Microsoft.Network/trafficManagerProfiles/#{traffic_manager_profile_name}/nestedEndpoints/endpoint-name3",
        name: 'endpoint-name3',
        type: 'Microsoft.Network/trafficManagerProfiles/nestedEndpoints',
        properties: {
          endpointStatus: 'Enabled',
          endpointMonitorStatus: 'Online',
          targetResourceId: "/subscriptions/####/resourceGroups/#{resource_group}/Microsoft.Network",
          weight: 10,
          priority: 1,
          endpointLocation: 'westeurope',
          minChildEndpoints: 1
        }
      }]
    }
  }
end

#get_virtual_networkObject



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
# File 'lib/fog/azurerm/requests/network/get_virtual_network.rb', line 28

def get_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'
              ]
          },
        '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

#list_application_gateways(_resource_group) ⇒ Object



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

def list_application_gateways(_resource_group)
  ag = Azure::ARM::Network::Models::ApplicationGateway.new
  ag.name = 'fogtestgateway'
  ag.location = 'East US'
  ag.properties = Azure::ARM::Network::Models::ApplicationGatewayPropertiesFormat.new
  [ag]
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_network_interfaces(resource_group) ⇒ Object



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
# File 'lib/fog/azurerm/requests/network/list_network_interfaces.rb', line 21

def list_network_interfaces(resource_group)
  [
    {
      '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'
        }
    }
  ]
end

#list_network_security_groups(resource_group) ⇒ Object



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
# File 'lib/fog/azurerm/requests/network/list_network_security_groups.rb', line 21

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_public_ips(resource_group) ⇒ Object



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

def list_public_ips(resource_group)
  [
    {
      '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'
        }
    }
  ]
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
# File 'lib/fog/azurerm/requests/network/list_subnets.rb', line 20

def list_subnets(resource_group, virtual_network_name)
  [
    {
      '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'
    }
  ]
end

#list_traffic_manager_profiles(resource_group) ⇒ 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
# File 'lib/fog/azurerm/requests/network/list_traffic_manager_profiles.rb', line 30

def list_traffic_manager_profiles(resource_group)
  [
    {
      location: 'global',
      tags: {},
      id: "/subscriptions/####/resourceGroups/#{resource_group}/Microsoft.Network/trafficManagerProfiles/testprofile",
      name: 'testprofile',
      type: 'Microsoft.Network/trafficManagerProfiles',
      properties: {
        profileStatus: 'Enabled',
        trafficRoutingMethod: 'Performance',
        dnsConfig: {
          relativeName: 'myapp',
          fqdn: 'myapp.trafficmanager.net',
          ttl: 30
        },
        monitorConfig: {
          profileMonitorStatus: 'Online',
          protocol: 'http',
          port: 80,
          path: '/monitorpage.aspx'
        },
        endpoints: [{
          id: "/subscriptions/####/resourceGroups/#{resource_group}/Microsoft.Network/trafficManagerProfiles/testprofile/azureEndpoints/endpoint-name1",
          name: 'endpoint-name1',
          type: 'Microsoft.Network/trafficManagerProfiles/azureEndpoints',
          properties: {
            endpointStatus: 'Enabled',
            endpointMonitorStatus: 'Online',
            targetResourceId: "/subscriptions/####/resourceGroups/#{resource_group}/Microsoft.Network",
            target: 'myapp.azurewebsites.net',
            weight: 10,
            priority: 3,
            endpointLocation: 'centralus'
          }
        }, {
          id: '/subscriptions/####/resourceGroups/resource_group/Microsoft.Network/trafficManagerProfiles/testprofile/externalEndpoints/endpoint-name2',
          name: 'endpoint-name2',
          type: 'Microsoft.Network/trafficManagerProfiles/externalEndpoints',
          properties: {
            endpointStatus: 'Enabled',
            endpointMonitorStatus: 'Online',
            target: 'myendpoint.contoso.com',
            weight: 10,
            priority: 5,
            endpointLocation: 'northeurope'
          }
        }, {
          id: "/subscriptions/####/resourceGroups/#{resource_group}/Microsoft.Network/trafficManagerProfiles/testprofile/nestedEndpoints/endpoint-name3",
          name: 'endpoint-name3',
          type: 'Microsoft.Network/trafficManagerProfiles/nestedEndpoints',
          properties: {
            endpointStatus: 'Enabled',
            endpointMonitorStatus: 'Online',
            targetResourceId: "/subscriptions/####/resourceGroups/#{resource_group}/Microsoft.Network",
            weight: 10,
            priority: 1,
            endpointLocation: 'westeurope',
            minChildEndpoints: 1
          }
        }]
      }
    }
  ]
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
# File 'lib/fog/azurerm/requests/network/list_virtual_networks.rb', line 20

def list_virtual_networks(resource_group)
  [
    {
      'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/virtualNetworks/testVnet",
      'name' => 'testVnet',
      'type' => 'Microsoft.Network/virtualNetworks',
      'location' => 'westus',
      'properties' =>
        {
          'addressSpace' =>
            {
              'addressPrefixes' =>
                [
                  '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'
        }
    }
  ]
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
# File 'lib/fog/azurerm/requests/network/remove_address_prefixes_from_virtual_network.rb', line 26

def remove_address_prefixes_from_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'
      }
  }
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
# File 'lib/fog/azurerm/requests/network/remove_dns_servers_from_virtual_network.rb', line 26

def remove_dns_servers_from_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'
      }
  }
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
# 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)
  {
    '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'
      }
  }
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
# File 'lib/fog/azurerm/requests/network/remove_subnets_from_virtual_network.rb', line 26

def remove_subnets_from_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'
      }
  }
end