fog-azure-rm 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -0
  3. data/.travis.yml +13 -8
  4. data/CHANGELOG.md +23 -10
  5. data/CONTRIBUTORS.md +2 -0
  6. data/lib/fog/azurerm/application_gateway.rb +4 -3
  7. data/lib/fog/azurerm/compute.rb +0 -1
  8. data/lib/fog/azurerm/dns.rb +0 -3
  9. data/lib/fog/azurerm/docs/application_gateway.md +72 -2
  10. data/lib/fog/azurerm/docs/compute.md +8 -5
  11. data/lib/fog/azurerm/docs/network.md +185 -6
  12. data/lib/fog/azurerm/docs/resources.md +2 -2
  13. data/lib/fog/azurerm/docs/storage.md +2 -2
  14. data/lib/fog/azurerm/docs/traffic_manager.md +23 -0
  15. data/lib/fog/azurerm/models/application_gateway/gateway.rb +180 -22
  16. data/lib/fog/azurerm/models/application_gateway/gateways.rb +4 -2
  17. data/lib/fog/azurerm/models/application_gateway/ip_configuration.rb +7 -2
  18. data/lib/fog/azurerm/models/compute/server.rb +5 -2
  19. data/lib/fog/azurerm/models/compute/servers.rb +4 -8
  20. data/lib/fog/azurerm/models/network/express_route_circuit_authorization.rb +58 -0
  21. data/lib/fog/azurerm/models/network/express_route_circuit_authorizations.rb +31 -0
  22. data/lib/fog/azurerm/models/network/load_balancers.rb +4 -2
  23. data/lib/fog/azurerm/models/network/local_network_gateway.rb +68 -0
  24. data/lib/fog/azurerm/models/network/local_network_gateways.rb +29 -0
  25. data/lib/fog/azurerm/models/network/public_ip.rb +16 -1
  26. data/lib/fog/azurerm/models/network/virtual_network_gateway_connection.rb +93 -0
  27. data/lib/fog/azurerm/models/network/virtual_network_gateway_connections.rb +29 -0
  28. data/lib/fog/azurerm/models/network/virtual_network_gateways.rb +1 -1
  29. data/lib/fog/azurerm/models/resources/deployments.rb +4 -2
  30. data/lib/fog/azurerm/models/resources/resource_groups.rb +4 -2
  31. data/lib/fog/azurerm/models/storage/storage_accounts.rb +4 -2
  32. data/lib/fog/azurerm/models/traffic_manager/traffic_manager_end_point.rb +23 -6
  33. data/lib/fog/azurerm/models/traffic_manager/traffic_manager_profile.rb +29 -3
  34. data/lib/fog/azurerm/network.rb +23 -3
  35. data/lib/fog/azurerm/requests/application_gateway/{create_application_gateway.rb → create_or_update_application_gateway.rb} +23 -63
  36. data/lib/fog/azurerm/requests/application_gateway/get_application_gateway.rb +159 -0
  37. data/lib/fog/azurerm/requests/application_gateway/update_sku_attributes.rb +28 -0
  38. data/lib/fog/azurerm/requests/application_gateway/update_subnet_id_in_gateway_ip_configuration.rb +29 -0
  39. data/lib/fog/azurerm/requests/compute/create_virtual_machine.rb +31 -20
  40. data/lib/fog/azurerm/requests/compute/get_virtual_machine.rb +1 -1
  41. data/lib/fog/azurerm/requests/network/create_or_update_express_route_circuit.rb +1 -1
  42. data/lib/fog/azurerm/requests/network/create_or_update_express_route_circuit_authorization.rb +49 -0
  43. data/lib/fog/azurerm/requests/network/create_or_update_local_network_gateway.rb +78 -0
  44. data/lib/fog/azurerm/requests/network/{create_public_ip.rb → create_or_update_public_ip.rb} +22 -8
  45. data/lib/fog/azurerm/requests/network/create_or_update_virtual_network_gateway_connection.rb +81 -0
  46. data/lib/fog/azurerm/requests/network/delete_express_route_circuit_authorization.rb +28 -0
  47. data/lib/fog/azurerm/requests/network/delete_local_network_gateway.rb +28 -0
  48. data/lib/fog/azurerm/requests/network/delete_virtual_network_gateway_connection.rb +28 -0
  49. data/lib/fog/azurerm/requests/network/get_connection_shared_key.rb +25 -0
  50. data/lib/fog/azurerm/requests/network/get_express_route_circuit_authorization.rb +34 -0
  51. data/lib/fog/azurerm/requests/network/get_load_balancer.rb +169 -0
  52. data/lib/fog/azurerm/requests/network/get_local_network_gateway.rb +46 -0
  53. data/lib/fog/azurerm/requests/network/get_virtual_network_gateway_connection.rb +46 -0
  54. data/lib/fog/azurerm/requests/network/list_express_route_circuit_authorizations.rb +36 -0
  55. data/lib/fog/azurerm/requests/network/list_local_network_gateways.rb +49 -0
  56. data/lib/fog/azurerm/requests/network/list_virtual_network_gateway_connections.rb +49 -0
  57. data/lib/fog/azurerm/requests/network/reset_connection_shared_key.rb +36 -0
  58. data/lib/fog/azurerm/requests/network/set_connection_shared_key.rb +36 -0
  59. data/lib/fog/azurerm/requests/resources/create_deployment.rb +5 -4
  60. data/lib/fog/azurerm/requests/resources/create_resource_group.rb +5 -4
  61. data/lib/fog/azurerm/requests/resources/delete_deployment.rb +5 -4
  62. data/lib/fog/azurerm/requests/resources/delete_resource_group.rb +5 -4
  63. data/lib/fog/azurerm/requests/resources/delete_resource_tag.rb +6 -4
  64. data/lib/fog/azurerm/requests/resources/get_deployment.rb +81 -0
  65. data/lib/fog/azurerm/requests/resources/get_resource_group.rb +47 -0
  66. data/lib/fog/azurerm/requests/resources/list_deployments.rb +5 -4
  67. data/lib/fog/azurerm/requests/resources/list_resource_groups.rb +6 -5
  68. data/lib/fog/azurerm/requests/resources/list_tagged_resources.rb +5 -4
  69. data/lib/fog/azurerm/requests/resources/tag_resource.rb +6 -4
  70. data/lib/fog/azurerm/requests/storage/get_storage_account.rb +36 -0
  71. data/lib/fog/azurerm/requests/traffic_manager/{create_traffic_manager_endpoint.rb → create_or_update_traffic_manager_endpoint.rb} +2 -2
  72. data/lib/fog/azurerm/requests/traffic_manager/{create_traffic_manager_profile.rb → create_or_update_traffic_manager_profile.rb} +6 -6
  73. data/lib/fog/azurerm/requests/traffic_manager/list_traffic_manager_profiles.rb +1 -1
  74. data/lib/fog/azurerm/resources.rb +2 -3
  75. data/lib/fog/azurerm/storage.rb +1 -1
  76. data/lib/fog/azurerm/traffic_manager.rb +2 -3
  77. data/lib/fog/azurerm/utilities/general.rb +5 -0
  78. data/lib/fog/azurerm/version.rb +1 -1
  79. data/lib/fog/azurerm.rb +34 -32
  80. data/test/api_stub/models/application_gateway/gateway.rb +29 -0
  81. data/test/api_stub/models/network/express_route_circuit_authorization.rb +22 -0
  82. data/test/api_stub/models/network/local_network_gateway.rb +31 -0
  83. data/test/api_stub/models/network/virtual_network_gateway_connection.rb +31 -0
  84. data/test/api_stub/requests/application_gateway/gateway.rb +30 -0
  85. data/test/api_stub/requests/compute/virtual_machine.rb +129 -2
  86. data/test/api_stub/requests/network/express_route_circuit_authorization.rb +31 -0
  87. data/test/api_stub/requests/network/local_network_gateway.rb +62 -0
  88. data/test/api_stub/requests/network/virtual_network_gateway_connection.rb +68 -0
  89. data/test/api_stub/requests/traffic_manager/traffic_manager_profile.rb +13 -0
  90. data/test/api_stub.rb +97 -48
  91. data/test/integration/Virtual_network_gateway_connection.rb +212 -0
  92. data/test/integration/application_gateway.rb +125 -54
  93. data/test/integration/deployment.rb +1 -1
  94. data/test/integration/express_route_circuit.rb +43 -4
  95. data/test/integration/external_load_balancer.rb +4 -4
  96. data/test/integration/internal_load_balancer.rb +4 -4
  97. data/test/integration/local_network_gateway.rb +76 -0
  98. data/test/integration/public_ip.rb +7 -0
  99. data/test/integration/server.rb +5 -4
  100. data/test/integration/storage_account.rb +5 -5
  101. data/test/integration/traffic_manager.rb +21 -0
  102. data/test/integration/virtual_network_gateway.rb +51 -22
  103. data/test/models/application_gateway/test_gateway.rb +56 -1
  104. data/test/models/application_gateway/test_gateways.rb +5 -5
  105. data/test/models/compute/test_servers.rb +6 -14
  106. data/test/models/network/test_express_route_circuit_authorization.rb +50 -0
  107. data/test/models/network/test_express_route_circuit_authorizations.rb +43 -0
  108. data/test/models/network/test_load_balancers.rb +6 -6
  109. data/test/models/network/test_local_network_gateway.rb +53 -0
  110. data/test/models/network/test_local_network_gateways.rb +42 -0
  111. data/test/models/network/test_public_ip.rb +16 -12
  112. data/test/models/network/test_virtual_network_gateway_connection.rb +59 -0
  113. data/test/models/network/test_virtual_network_gateway_connections.rb +42 -0
  114. data/test/models/resources/test_deployments.rb +5 -5
  115. data/test/models/resources/test_resource_groups.rb +5 -5
  116. data/test/models/storage/test_storage_accounts.rb +3 -3
  117. data/test/models/traffic_manager/test_traffic_manager_end_point.rb +1 -1
  118. data/test/models/traffic_manager/test_traffic_manager_profile.rb +11 -4
  119. data/test/requests/application_gateway/test_create_or_update_application_gateway.rb +35 -0
  120. data/test/requests/application_gateway/test_get_application_gateway.rb +24 -0
  121. data/test/requests/compute/test_create_virtual_machine.rb +17 -2
  122. data/test/requests/network/test_create_express_route_circuit_authorization.rb +35 -0
  123. data/test/requests/network/test_create_or_update_local_network_gateway.rb +36 -0
  124. data/test/requests/network/test_create_public_ip.rb +3 -3
  125. data/test/requests/network/test_create_virtual_network_gateway_connection.rb +36 -0
  126. data/test/requests/network/test_delete_express_route_circuit_authorization.rb +23 -0
  127. data/test/requests/network/test_delete_local_network_gateway.rb +23 -0
  128. data/test/requests/network/test_delete_virtual_network_gateway.rb +2 -2
  129. data/test/requests/network/test_delete_virtual_network_gateway_connection.rb +23 -0
  130. data/test/requests/network/test_get_connection_shared_key.rb +24 -0
  131. data/test/requests/network/test_get_express_route_circuit_authorization.rb +24 -0
  132. data/test/requests/network/test_get_load_balancer.rb +24 -0
  133. data/test/requests/network/test_get_local_network_gateway.rb +24 -0
  134. data/test/requests/network/test_get_virtual_network_gateway_connection.rb +24 -0
  135. data/test/requests/network/test_list_express_route_circuit_authorizations.rb +24 -0
  136. data/test/requests/network/test_list_local_network_gateways.rb +24 -0
  137. data/test/requests/network/test_list_virtual_network_gateway_connections.rb +24 -0
  138. data/test/requests/network/test_reset_connection_shared_key.rb +23 -0
  139. data/test/requests/network/test_set_connection_shared_key.rb +23 -0
  140. data/test/requests/network/test_update_public_ip.rb +34 -0
  141. data/test/requests/resources/test_create_deployment.rb +1 -1
  142. data/test/requests/resources/test_create_resource_group.rb +1 -1
  143. data/test/requests/resources/test_delete_deployment.rb +1 -1
  144. data/test/requests/resources/test_delete_resource_group.rb +1 -1
  145. data/test/requests/resources/test_delete_resource_tag.rb +1 -1
  146. data/test/requests/resources/test_get_deployment.rb +24 -0
  147. data/test/requests/resources/test_get_resource_group.rb +24 -0
  148. data/test/requests/resources/test_list_deployments.rb +1 -1
  149. data/test/requests/resources/test_list_resource_groups.rb +1 -1
  150. data/test/requests/resources/test_list_tagged_resources.rb +1 -1
  151. data/test/requests/resources/test_tag_resource.rb +1 -1
  152. data/test/requests/storage/test_get_storage_account.rb +25 -0
  153. data/test/requests/traffic_manager/test_create_traffic_manager_endpoint.rb +2 -2
  154. data/test/requests/traffic_manager/test_create_traffic_manager_profile.rb +3 -3
  155. data/test/requests/traffic_manager/test_update_traffic_manager_endpoint.rb +27 -0
  156. data/test/requests/traffic_manager/test_update_traffic_manager_profile.rb +27 -0
  157. data/test/test_helper.rb +52 -0
  158. metadata +73 -9
  159. data/lib/fog/azurerm/core.rb +0 -14
  160. data/test/requests/application_gateway/test_create_application_gateway.rb +0 -51
@@ -3,7 +3,7 @@ module ApiStub
3
3
  module Compute
4
4
  # Mock class for Virtual Machine Requests
5
5
  class VirtualMachine
6
- def self.linux_virtual_machine_hash
6
+ def self.linux_virtual_machine_params
7
7
  {
8
8
  resource_group: 'fog-test-rg',
9
9
  name: 'fog-test-server',
@@ -27,7 +27,7 @@ module ApiStub
27
27
  }
28
28
  end
29
29
 
30
- def self.windows_virtual_machine_hash
30
+ def self.windows_virtual_machine_params
31
31
  {
32
32
  resource_group: 'fog-test-rg',
33
33
  name: 'fog-test-server',
@@ -51,6 +51,56 @@ module ApiStub
51
51
  }
52
52
  end
53
53
 
54
+ def self.linux_virtual_machine_with_custom_data_params
55
+ {
56
+ resource_group: 'fog-test-rg',
57
+ name: 'fog-test-server',
58
+ location: 'westus',
59
+ vm_size: 'Basic_A0',
60
+ storage_account_name: 'fogstrg',
61
+ username: 'fog',
62
+ password: 'fog',
63
+ disable_password_authentication: false,
64
+ ssh_key_path: '/home',
65
+ ssh_key_data: 'key',
66
+ network_interface_card_id: 'nic-id',
67
+ availability_set_id: 'as-id',
68
+ publisher: 'Canonical',
69
+ offer: 'UbuntuServer',
70
+ sku: '14.04.2-LTS',
71
+ version: 'latest',
72
+ platform: 'Linux',
73
+ provision_vm_agent: nil,
74
+ enable_automatic_updates: nil,
75
+ custom_data: 'echo customData'
76
+ }
77
+ end
78
+
79
+ def self.windows_virtual_machine_with_custom_data_params
80
+ {
81
+ resource_group: 'fog-test-rg',
82
+ name: 'fog-test-server',
83
+ location: 'westus',
84
+ vm_size: 'Basic_A0',
85
+ storage_account_name: 'fogstrg',
86
+ username: 'fog',
87
+ password: 'fog',
88
+ disable_password_authentication: nil,
89
+ ssh_key_path: '/home',
90
+ ssh_key_data: 'key',
91
+ network_interface_card_id: 'nic-id',
92
+ availability_set_id: 'as-id',
93
+ publisher: 'MicrosoftWindowsServerEssentials',
94
+ offer: 'WindowsServerEssentials',
95
+ sku: 'WindowsServerEssentials',
96
+ version: 'latest',
97
+ platform: 'Windows',
98
+ provision_vm_agent: true,
99
+ enable_automatic_updates: true,
100
+ custom_data: 'echo customData'
101
+ }
102
+ end
103
+
54
104
  def self.create_virtual_machine_response(compute_client)
55
105
  body = '{
56
106
  "id":"/subscriptions/{subscription-id}/resourceGroups/fog-test-rg/providers/Microsoft.Compute/virtualMachines/fog-test-server",
@@ -128,6 +178,83 @@ module ApiStub
128
178
  compute_client.deserialize(vm_mapper, JSON.load(body), 'result.body')
129
179
  end
130
180
 
181
+ def self.create_virtual_machine_with_custom_data_response(compute_client)
182
+ body = '{
183
+ "id":"/subscriptions/{subscription-id}/resourceGroups/fog-test-rg/providers/Microsoft.Compute/virtualMachines/fog-test-server",
184
+ "name":"fog-test-server",
185
+ "type":"Microsoft.Compute/virtualMachines",
186
+ "location":"westus",
187
+ "tags": {
188
+ "department":"finance"
189
+ },
190
+ "properties": {
191
+ "availabilitySet": {
192
+ "id":"/subscriptions/{subscription-id}/resourceGroups/myresourcegroup1/providers/Microsoft.Compute/availabilitySets/myav1"
193
+ },
194
+ "hardwareProfile": {
195
+ "vmSize":"Standard_A0"
196
+ },
197
+ "storageProfile": {
198
+ "imageReference": {
199
+ "publisher":"MicrosoftWindowsServerEssentials",
200
+ "offer":"WindowsServerEssentials",
201
+ "sku":"WindowsServerEssentials",
202
+ "version":"latest"
203
+ },
204
+ "osDisk": {
205
+ "name":"myosdisk1",
206
+ "vhd": {
207
+ "uri":"http://mystorage1.blob.core.windows.net/vhds/myosdisk1.vhd"
208
+ },
209
+ "caching":"ReadWrite",
210
+ "createOption":"FromImage"
211
+ },
212
+ "dataDisks": [ {
213
+ "name":"mydatadisk1",
214
+ "diskSizeGB":"1",
215
+ "lun": 0,
216
+ "vhd": {
217
+ "uri" : "http://mystorage1.blob.core.windows.net/vhds/mydatadisk1.vhd"
218
+ },
219
+ "createOption":"Empty"
220
+ } ]
221
+ },
222
+ "osProfile": {
223
+ "computerName":"fog-test-server",
224
+ "adminUsername":"fog",
225
+ "adminPassword":"fog",
226
+ "customData":"ZWNobyBjdXN0b21EYXRh",
227
+ "windowsConfiguration": {
228
+ "provisionVMAgent":true,
229
+ "winRM": {
230
+ "listeners": [ {
231
+ "protocol": "https",
232
+ "certificateUrl": "url-to-certificate"
233
+ } ]
234
+ },
235
+ "enableAutomaticUpdates":true
236
+ },
237
+ "secrets":[ {
238
+ "sourceVault": {
239
+ "id": "/subscriptions/{subscription-id}/resourceGroups/myresourcegroup1/providers/Microsoft.KeyVault/vaults/myvault1"
240
+ },
241
+ "vaultCertificates": [ {
242
+ "certificateUrl": "https://myvault1.vault.azure.net/secrets/{secretName}/{secretVersion}",
243
+ "certificateStore": "{certificateStoreName}"
244
+ } ]
245
+ } ]
246
+ },
247
+ "networkProfile": {
248
+ "networkInterfaces": [ {
249
+ "id":"/subscriptions/{subscription-id}/resourceGroups/myresourceGroup1/providers /Microsoft.Network/networkInterfaces/mynic1"
250
+ } ]
251
+ }
252
+ }
253
+ }'
254
+ vm_mapper = Azure::ARM::Compute::Models::VirtualMachine.mapper
255
+ compute_client.deserialize(vm_mapper, JSON.load(body), 'result.body')
256
+ end
257
+
131
258
  def self.detach_data_disk_from_vm_response(compute_client)
132
259
  body = '{
133
260
  "id":"/subscriptions/{subscription-id}/resourceGroups/fog-test-rg/providers/Microsoft.Compute/virtualMachines/fog-test-server",
@@ -0,0 +1,31 @@
1
+ module ApiStub
2
+ module Requests
3
+ module Network
4
+ # Mock class for Express Route Circuit Authorization Requests
5
+ class ExpressRouteCircuitAuthorization
6
+ def self.create_express_route_circuit_authorization_response(network_client)
7
+ authorization = '{
8
+ "name": "MicrosoftAuthorization",
9
+ "id": "/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}",
10
+ "properties": {
11
+ "authorizationKey" : "authorization-key",
12
+ "authorizationUseStatus" : "Available"
13
+ }
14
+ }'
15
+ circuit_auth_mapper = Azure::ARM::Network::Models::ExpressRouteCircuitAuthorization.mapper
16
+ network_client.deserialize(circuit_auth_mapper, JSON.load(authorization), 'result.body')
17
+ end
18
+
19
+ def self.auth_hash
20
+ {
21
+ resource_group: 'rg-name',
22
+ name: 'auth-unique-name',
23
+ circuit_name: 'circuit-name',
24
+ authorization_status: 'Available',
25
+ authorization_name: 'authorization-name'
26
+ }
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,62 @@
1
+ module ApiStub
2
+ module Requests
3
+ module Network
4
+ # Mock class for Local Network Gateway Requests
5
+ class LocalNetworkGateway
6
+ def self.create_local_network_gateway_response(network_client)
7
+ local_network_gateway = {
8
+ 'id' => '/subscriptions/<Subscription_id>/resourceGroups/learn_fog/providers/Microsoft.Network/localNetworkGateways/testLocalNetworkGateway',
9
+ 'name' => 'testLocalNetworkGateway',
10
+ 'type' => 'Microsoft.Network/localNetworkGateways',
11
+ 'location' => 'eastus',
12
+ 'properties' =>
13
+ {
14
+ 'local_network_address_space' => {
15
+ 'address_prefixes' => []
16
+ },
17
+ 'gateway_ip_address' => '192.168.1.1',
18
+ 'bgp_settings' => {
19
+ 'asn' => 100,
20
+ 'bgp_peering_address' => '192.168.1.2',
21
+ 'peer_weight' => 3
22
+ }
23
+ }
24
+ }
25
+ local_network_gateway_mapper = Azure::ARM::Network::Models::LocalNetworkGateway.mapper
26
+ network_client.deserialize(local_network_gateway_mapper, local_network_gateway, 'result.body')
27
+ end
28
+
29
+ def self.delete_local_network_gateway_response
30
+ MsRestAzure::AzureOperationResponse.new(MsRest::HttpOperationRequest.new('', '', ''), Faraday::Response.new)
31
+ end
32
+
33
+ def self.list_local_network_gateway_response(network_client)
34
+ local_network_gateway = {
35
+ 'value' => [
36
+ {
37
+ 'id' => '/subscriptions/<Subscription_id>/resourceGroups/learn_fog/providers/Microsoft.Network/localNetworkGateways/testLocalNetworkGateway',
38
+ 'name' => 'testLocalNetworkGateway',
39
+ 'type' => 'Microsoft.Network/localNetworkGateways',
40
+ 'location' => 'eastus',
41
+ 'properties' =>
42
+ {
43
+ 'local_network_address_space' => {
44
+ 'address_prefixes' => []
45
+ },
46
+ 'gateway_ip_address' => '192.168.1.1',
47
+ 'bgp_settings' => {
48
+ 'asn' => 100,
49
+ 'bgp_peering_address' => '192.168.1.2',
50
+ 'peer_weight' => 3
51
+ }
52
+ }
53
+ }
54
+ ]
55
+ }
56
+ local_network_gateway_mapper = Azure::ARM::Network::Models::LocalNetworkGatewayListResult.mapper
57
+ network_client.deserialize(local_network_gateway_mapper, local_network_gateway, 'result.body')
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,68 @@
1
+ module ApiStub
2
+ module Requests
3
+ module Network
4
+ # Mock class for Virtual Network Gateway Connection Requests
5
+ class VirtualNetworkGatewayConnection
6
+ def self.create_virtual_network_gateway_connection_response(network_client)
7
+ gateway_connection = '{
8
+ "name": "cn1",
9
+ "id": "/subscriptions/{subscription-id}/resourceGroups/{resource_group_name}/providers/microsoft.network/connections/connection1",
10
+ "location": "West US",
11
+ "tags": { "key1": "value1" },
12
+ "properties": {
13
+ "virtualNetworkGateway1": {
14
+ "name": "firstgateway",
15
+ "id": "/subscriptions/{subscription-id}/resourceGroups/{resource_group_name}/providers/microsoft.network/SiteToSite/firstgateway"
16
+ },
17
+ "virtualNetworkGateway2": {
18
+ "name": "secondgateway",
19
+ "id": "/subscriptions/{subscription-id}/resourceGroups/{resource_group_name}/providers/microsoft.network/SiteToSite/secondgateway"
20
+ },
21
+ "connectionType": "SiteToSite",
22
+ "connectivityState": "Connected"
23
+ }
24
+ }'
25
+ connection_mapper = Azure::ARM::Network::Models::VirtualNetworkGatewayConnection.mapper
26
+ network_client.deserialize(connection_mapper, JSON.load(gateway_connection), 'result.body')
27
+ end
28
+
29
+ def self.list_virtual_network_gateway_connection_response(network_client)
30
+ gateway_connection = '{
31
+ "value": [
32
+ {
33
+ "name": "cn1",
34
+ "id": "/subscriptions/{subscription-id}/resourceGroups/{resource_group_name}/providers/microsoft.network/connections/connection1",
35
+ "location": "West US",
36
+ "tags": { "key1": "value1" },
37
+ "properties": {
38
+ "virtualNetworkGateway1": {
39
+ "name": "firstgateway",
40
+ "id": "/subscriptions/{subscription-id}/resourceGroups/{resource_group_name}/providers/microsoft.network/SiteToSite/firstgateway"
41
+ },
42
+ "virtualNetworkGateway2": {
43
+ "name": "secondgateway",
44
+ "id": "/subscriptions/{subscription-id}/resourceGroups/{resource_group_name}/providers/microsoft.network/SiteToSite/secondgateway"
45
+ },
46
+ "connectionType": "SiteToSite",
47
+ "connectivityState": "Connected"
48
+ }
49
+ }
50
+ ]
51
+ }'
52
+ connection_mapper = Azure::ARM::Network::Models::VirtualNetworkGatewayConnectionListResult.mapper
53
+ network_client.deserialize(connection_mapper, JSON.load(gateway_connection), 'result.body')
54
+ end
55
+
56
+ def self.get_connection_shared_key_response(network_client)
57
+ shared_key = '{ "value": "hello" }'
58
+ shared_key_mapper = Azure::ARM::Network::Models::ConnectionSharedKeyResult.mapper
59
+ network_client.deserialize(shared_key_mapper, JSON.load(shared_key), 'result.body')
60
+ end
61
+
62
+ def self.delete_virtual_network_gateway_connection_response
63
+ MsRestAzure::AzureOperationResponse.new(MsRest::HttpOperationRequest.new('', '', ''), Faraday::Response.new)
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
@@ -136,6 +136,19 @@ module ApiStub
136
136
  profile_mapper = Azure::ARM::TrafficManager::Models::ProfileListResult.mapper
137
137
  traffic_manager_client.deserialize(profile_mapper, JSON.load(body), 'result.body')
138
138
  end
139
+
140
+ def self.profile_hash
141
+ {
142
+ resource_group: 'resource_group',
143
+ name: 'name',
144
+ traffic_routing_method: 'traffic_routing_method',
145
+ relative_name: 'relative_name',
146
+ ttl: 'ttl',
147
+ protocol: 'protocol',
148
+ port: 'port',
149
+ path: 'path'
150
+ }
151
+ end
139
152
  end
140
153
  end
141
154
  end
data/test/api_stub.rb CHANGED
@@ -1,51 +1,100 @@
1
- require File.expand_path 'api_stub/models/compute/server', __dir__
2
- require File.expand_path 'api_stub/models/compute/availability_set', __dir__
3
- require File.expand_path 'api_stub/models/resources/resource_group', __dir__
4
- require File.expand_path 'api_stub/models/resources/deployment', __dir__
5
- require File.expand_path 'api_stub/models/resources/resource', __dir__
6
- require File.expand_path 'api_stub/models/storage/storageaccount', __dir__
7
- require File.expand_path 'api_stub/models/storage/blob', __dir__
8
- require File.expand_path 'api_stub/models/storage/container', __dir__
9
- require File.expand_path 'api_stub/models/network/public_ip', __dir__
10
- require File.expand_path 'api_stub/models/network/subnet', __dir__
11
- require File.expand_path 'api_stub/models/network/virtual_network', __dir__
12
- require File.expand_path 'api_stub/models/network/network_interface', __dir__
13
- require File.expand_path 'api_stub/models/network/load_balancer', __dir__
14
- require File.expand_path 'api_stub/models/network/network_security_group', __dir__
15
- require File.expand_path 'api_stub/models/application_gateway/gateway', __dir__
16
- require File.expand_path 'api_stub/models/network/virtual_network_gateway', __dir__
17
- require File.expand_path 'api_stub/models/network/express_route_circuit', __dir__
18
- require File.expand_path 'api_stub/models/network/express_route_circuit_peering', __dir__
19
- require File.expand_path 'api_stub/models/network/express_route_service_provider', __dir__
20
- require File.expand_path 'api_stub/models/traffic_manager/traffic_manager_end_point', __dir__
21
- require File.expand_path 'api_stub/models/traffic_manager/traffic_manager_profile', __dir__
22
- require File.expand_path 'api_stub/models/dns/zone', __dir__
23
- require File.expand_path 'api_stub/models/dns/record_set', __dir__
24
-
25
- require File.expand_path 'api_stub/requests/compute/availability_set', __dir__
26
- require File.expand_path 'api_stub/requests/compute/virtual_machine', __dir__
27
- require File.expand_path 'api_stub/requests/resources/resource_group', __dir__
28
- require File.expand_path 'api_stub/requests/resources/deployment', __dir__
29
- require File.expand_path 'api_stub/requests/resources/resource', __dir__
30
- require File.expand_path 'api_stub/requests/storage/storageaccount', __dir__
31
- require File.expand_path 'api_stub/requests/storage/blob', __dir__
32
- require File.expand_path 'api_stub/requests/storage/container', __dir__
33
- require File.expand_path 'api_stub/requests/network/public_ip', __dir__
34
- require File.expand_path 'api_stub/requests/network/subnet', __dir__
35
- require File.expand_path 'api_stub/requests/network/virtual_network', __dir__
36
- require File.expand_path 'api_stub/requests/network/network_interface', __dir__
37
- require File.expand_path 'api_stub/requests/network/load_balancer', __dir__
38
- require File.expand_path 'api_stub/requests/network/network_security_group', __dir__
39
- require File.expand_path 'api_stub/requests/application_gateway/gateway', __dir__
40
- require File.expand_path 'api_stub/requests/network/virtual_network_gateway', __dir__
41
- require File.expand_path 'api_stub/requests/network/express_route_circuit', __dir__
42
- require File.expand_path 'api_stub/requests/network/express_route_circuit_peering', __dir__
43
- require File.expand_path 'api_stub/requests/network/express_route_service_provider', __dir__
44
- require File.expand_path 'api_stub/requests/traffic_manager/traffic_manager_endpoint', __dir__
45
- require File.expand_path 'api_stub/requests/traffic_manager/traffic_manager_profile', __dir__
46
- require File.expand_path 'api_stub/requests/dns/zone', __dir__
47
- require File.expand_path 'api_stub/requests/dns/record_set', __dir__
48
-
49
1
  # Module for API Stub
50
2
  module ApiStub
3
+ module Models
4
+ module Compute
5
+ autoload :Server, File.expand_path('api_stub/models/compute/server', __dir__)
6
+ autoload :AvailabilitySet, File.expand_path('api_stub/models/compute/availability_set', __dir__)
7
+ end
8
+
9
+ module Resources
10
+ autoload :ResourceGroup, File.expand_path('api_stub/models/resources/resource_group', __dir__)
11
+ autoload :Deployment, File.expand_path('api_stub/models/resources/deployment', __dir__)
12
+ autoload :Resource, File.expand_path('api_stub/models/resources/resource', __dir__)
13
+ end
14
+
15
+ module Storage
16
+ autoload :StorageAccount, File.expand_path('api_stub/models/storage/storageaccount', __dir__)
17
+ autoload :Blob, File.expand_path('api_stub/models/storage/blob', __dir__)
18
+ autoload :Container, File.expand_path('api_stub/models/storage/container', __dir__)
19
+ end
20
+
21
+ module Network
22
+ autoload :PublicIp, File.expand_path('api_stub/models/network/public_ip', __dir__)
23
+ autoload :Subnet, File.expand_path('api_stub/models/network/subnet', __dir__)
24
+ autoload :VirtualNetwork, File.expand_path('api_stub/models/network/virtual_network', __dir__)
25
+ autoload :NetworkInterface, File.expand_path('api_stub/models/network/network_interface', __dir__)
26
+ autoload :LoadBalancer, File.expand_path('api_stub/models/network/load_balancer', __dir__)
27
+ autoload :NetworkSecurityGroup, File.expand_path('api_stub/models/network/network_security_group', __dir__)
28
+ autoload :VirtualNetworkGateway, File.expand_path('api_stub/models/network/virtual_network_gateway', __dir__)
29
+ autoload :VirtualNetworkGatewayConnection, File.expand_path('api_stub/models/network/virtual_network_gateway_connection', __dir__)
30
+ autoload :ExpressRouteCircuit, File.expand_path('api_stub/models/network/express_route_circuit', __dir__)
31
+ autoload :ExpressRouteCircuitPeering, File.expand_path('api_stub/models/network/express_route_circuit_peering', __dir__)
32
+ autoload :ExpressRouteCircuitAuthorization, File.expand_path('api_stub/models/network/express_route_circuit_authorization', __dir__)
33
+ autoload :ExpressRouteServiceProvider, File.expand_path('api_stub/models/network/express_route_service_provider', __dir__)
34
+ autoload :LocalNetworkGateway, File.expand_path('api_stub/models/network/local_network_gateway', __dir__)
35
+ end
36
+
37
+ module ApplicationGateway
38
+ autoload :Gateway, File.expand_path('api_stub/models/application_gateway/gateway', __dir__)
39
+ end
40
+
41
+ module TrafficManager
42
+ autoload :TrafficManagerEndPoint, File.expand_path('api_stub/models/traffic_manager/traffic_manager_end_point', __dir__)
43
+ autoload :TrafficManagerProfile, File.expand_path('api_stub/models/traffic_manager/traffic_manager_profile', __dir__)
44
+ end
45
+
46
+ module DNS
47
+ autoload :Zone, File.expand_path('api_stub/models/dns/zone', __dir__)
48
+ autoload :RecordSet, File.expand_path('api_stub/models/dns/record_set', __dir__)
49
+ end
50
+ end
51
+
52
+ module Requests
53
+ module Compute
54
+ autoload :AvailabilitySet, File.expand_path('api_stub/requests/compute/availability_set', __dir__)
55
+ autoload :VirtualMachine, File.expand_path('api_stub/requests/compute/virtual_machine', __dir__)
56
+ end
57
+
58
+ module Resources
59
+ autoload :ResourceGroup, File.expand_path('api_stub/requests/resources/resource_group', __dir__)
60
+ autoload :Deployment, File.expand_path('api_stub/requests/resources/deployment', __dir__)
61
+ autoload :AzureResource, File.expand_path('api_stub/requests/resources/resource', __dir__)
62
+ end
63
+
64
+ module Storage
65
+ autoload :StorageAccount, File.expand_path('api_stub/requests/storage/storageaccount', __dir__)
66
+ autoload :Blob, File.expand_path('api_stub/requests/storage/blob', __dir__)
67
+ autoload :Container, File.expand_path('api_stub/requests/storage/container', __dir__)
68
+ end
69
+
70
+ module Network
71
+ autoload :PublicIp, File.expand_path('api_stub/requests/network/public_ip', __dir__)
72
+ autoload :Subnet, File.expand_path('api_stub/requests/network/subnet', __dir__)
73
+ autoload :VirtualNetwork, File.expand_path('api_stub/requests/network/virtual_network', __dir__)
74
+ autoload :NetworkInterface, File.expand_path('api_stub/requests/network/network_interface', __dir__)
75
+ autoload :LoadBalancer, File.expand_path('api_stub/requests/network/load_balancer', __dir__)
76
+ autoload :NetworkSecurityGroup, File.expand_path('api_stub/requests/network/network_security_group', __dir__)
77
+ autoload :VirtualNetworkGateway, File.expand_path('api_stub/requests/network/virtual_network_gateway', __dir__)
78
+ autoload :VirtualNetworkGatewayConnection, File.expand_path('api_stub/requests/network/virtual_network_gateway_connection', __dir__)
79
+ autoload :ExpressRouteCircuit, File.expand_path('api_stub/requests/network/express_route_circuit', __dir__)
80
+ autoload :ExpressRouteCircuitPeering, File.expand_path('api_stub/requests/network/express_route_circuit_peering', __dir__)
81
+ autoload :ExpressRouteCircuitAuthorization, File.expand_path('api_stub/requests/network/express_route_circuit_authorization', __dir__)
82
+ autoload :ExpressRouteServiceProvider, File.expand_path('api_stub/requests/network/express_route_service_provider', __dir__)
83
+ autoload :LocalNetworkGateway, File.expand_path('api_stub/requests/network/local_network_gateway', __dir__)
84
+ end
85
+
86
+ module ApplicationGateway
87
+ autoload :Gateway, File.expand_path('api_stub/requests/application_gateway/gateway', __dir__)
88
+ end
89
+
90
+ module TrafficManager
91
+ autoload :TrafficManagerEndPoint, File.expand_path('api_stub/requests/traffic_manager/traffic_manager_endpoint', __dir__)
92
+ autoload :TrafficManagerProfile, File.expand_path('api_stub/requests/traffic_manager/traffic_manager_profile', __dir__)
93
+ end
94
+
95
+ module DNS
96
+ autoload :Zone, File.expand_path('api_stub/requests/dns/zone', __dir__)
97
+ autoload :RecordSet, File.expand_path('api_stub/requests/dns/record_set', __dir__)
98
+ end
99
+ end
51
100
  end