fog-azure-rm 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (288) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +17 -0
  3. data/.gitignore +6 -0
  4. data/.hound.yml +2 -0
  5. data/.rubocop.yml +36 -0
  6. data/.travis.yml +14 -0
  7. data/CHANGELOG.md +28 -0
  8. data/CONTRIBUTING.md +2 -0
  9. data/CONTRIBUTORS.md +2 -0
  10. data/Gemfile +3 -0
  11. data/fog-azure-rm.gemspec +34 -0
  12. data/lib/fog/azurerm.rb +1 -0
  13. data/lib/fog/azurerm/compute.rb +0 -1
  14. data/lib/fog/azurerm/config.rb +4 -0
  15. data/lib/fog/azurerm/credentials.rb +10 -3
  16. data/lib/fog/azurerm/docs/compute.md +172 -0
  17. data/lib/fog/azurerm/docs/dns.md +112 -0
  18. data/lib/fog/azurerm/docs/network.md +794 -0
  19. data/lib/fog/azurerm/docs/resources.md +155 -0
  20. data/lib/fog/azurerm/docs/storage.md +222 -0
  21. data/lib/fog/azurerm/docs/structure.md +53 -0
  22. data/lib/fog/azurerm/models/compute/server.rb +3 -2
  23. data/lib/fog/azurerm/models/network/frontend_ip_configuration.rb +5 -1
  24. data/lib/fog/azurerm/models/network/network_interface.rb +49 -4
  25. data/lib/fog/azurerm/models/network/network_interfaces.rb +4 -2
  26. data/lib/fog/azurerm/models/network/network_security_group.rb +27 -4
  27. data/lib/fog/azurerm/models/network/network_security_groups.rb +4 -2
  28. data/lib/fog/azurerm/models/network/network_security_rule.rb +1 -1
  29. data/lib/fog/azurerm/models/network/subnet.rb +26 -6
  30. data/lib/fog/azurerm/models/network/subnets.rb +4 -2
  31. data/lib/fog/azurerm/models/network/virtual_network.rb +72 -10
  32. data/lib/fog/azurerm/models/network/virtual_networks.rb +4 -2
  33. data/lib/fog/azurerm/models/resources/azure_resource.rb +25 -0
  34. data/lib/fog/azurerm/models/resources/azure_resources.rb +31 -0
  35. data/lib/fog/azurerm/models/resources/dependency.rb +27 -0
  36. data/lib/fog/azurerm/models/resources/deployment.rb +65 -0
  37. data/lib/fog/azurerm/models/resources/deployments.rb +27 -0
  38. data/lib/fog/azurerm/models/resources/provider.rb +27 -0
  39. data/lib/fog/azurerm/models/resources/provider_resource_type.rb +22 -0
  40. data/lib/fog/azurerm/models/storage/blob.rb +13 -0
  41. data/lib/fog/azurerm/models/storage/blobs.rb +22 -0
  42. data/lib/fog/azurerm/models/storage/container.rb +65 -0
  43. data/lib/fog/azurerm/models/storage/containers.rb +44 -0
  44. data/lib/fog/azurerm/models/storage/data_disk.rb +26 -0
  45. data/lib/fog/azurerm/models/storage/storage_account.rb +4 -0
  46. data/lib/fog/azurerm/network.rb +21 -3
  47. data/lib/fog/azurerm/requests/network/add_address_prefixes_in_virtual_network.rb +68 -0
  48. data/lib/fog/azurerm/requests/network/add_dns_servers_in_virtual_network.rb +74 -0
  49. data/lib/fog/azurerm/requests/network/add_security_rules.rb +152 -0
  50. data/lib/fog/azurerm/requests/network/add_subnets_in_virtual_network.rb +69 -0
  51. data/lib/fog/azurerm/requests/network/attach_network_security_group_to_subnet.rb +59 -0
  52. data/lib/fog/azurerm/requests/network/attach_resource_to_nic.rb +88 -0
  53. data/lib/fog/azurerm/requests/network/attach_route_table_to_subnet.rb +59 -0
  54. data/lib/fog/azurerm/requests/network/create_load_balancer.rb +4 -4
  55. data/lib/fog/azurerm/requests/network/{create_network_interface.rb → create_or_update_network_interface.rb} +14 -13
  56. data/lib/fog/azurerm/requests/network/{create_network_security_group.rb → create_or_update_network_security_group.rb} +17 -35
  57. data/lib/fog/azurerm/requests/network/create_or_update_virtual_network.rb +116 -0
  58. data/lib/fog/azurerm/requests/network/create_subnet.rb +28 -14
  59. data/lib/fog/azurerm/requests/network/detach_network_security_group_from_subnet.rb +53 -0
  60. data/lib/fog/azurerm/requests/network/detach_resource_from_nic.rb +80 -0
  61. data/lib/fog/azurerm/requests/network/detach_route_table_from_subnet.rb +53 -0
  62. data/lib/fog/azurerm/requests/network/get_network_interface.rb +60 -0
  63. data/lib/fog/azurerm/requests/network/get_network_security_group.rb +161 -0
  64. data/lib/fog/azurerm/requests/network/get_subnet.rb +36 -0
  65. data/lib/fog/azurerm/requests/network/get_virtual_network.rb +64 -0
  66. data/lib/fog/azurerm/requests/network/remove_address_prefixes_from_virtual_network.rb +67 -0
  67. data/lib/fog/azurerm/requests/network/remove_dns_servers_from_virtual_network.rb +67 -0
  68. data/lib/fog/azurerm/requests/network/remove_security_rule.rb +155 -0
  69. data/lib/fog/azurerm/requests/network/remove_subnets_from_virtual_network.rb +57 -0
  70. data/lib/fog/azurerm/requests/resources/create_deployment.rb +90 -0
  71. data/lib/fog/azurerm/requests/resources/delete_deployment.rb +28 -0
  72. data/lib/fog/azurerm/requests/resources/delete_resource_tag.rb +48 -0
  73. data/lib/fog/azurerm/requests/resources/list_deployments.rb +75 -0
  74. data/lib/fog/azurerm/requests/resources/list_tagged_resources.rb +46 -0
  75. data/lib/fog/azurerm/requests/resources/tag_resource.rb +46 -0
  76. data/lib/fog/azurerm/requests/storage/create_container.rb +37 -0
  77. data/lib/fog/azurerm/requests/storage/delete_container.rb +26 -0
  78. data/lib/fog/azurerm/requests/storage/delete_disk.rb +36 -0
  79. data/lib/fog/azurerm/requests/storage/get_blob_metadata.rb +30 -0
  80. data/lib/fog/azurerm/requests/storage/get_container_access_control_list.rb +29 -0
  81. data/lib/fog/azurerm/requests/storage/get_container_metadata.rb +31 -0
  82. data/lib/fog/azurerm/requests/storage/get_container_properties.rb +36 -0
  83. data/lib/fog/azurerm/requests/storage/get_storage_access_keys.rb +31 -0
  84. data/lib/fog/azurerm/requests/storage/list_containers.rb +49 -0
  85. data/lib/fog/azurerm/requests/storage/list_storage_account_for_rg.rb +0 -1
  86. data/lib/fog/azurerm/requests/storage/set_blob_metadata.rb +26 -0
  87. data/lib/fog/azurerm/requests/storage/set_container_metadata.rb +26 -0
  88. data/lib/fog/azurerm/resources.rb +13 -0
  89. data/lib/fog/azurerm/storage.rb +46 -6
  90. data/lib/fog/azurerm/utilities/general.rb +18 -0
  91. data/lib/fog/azurerm/version.rb +1 -1
  92. data/rakefile +21 -0
  93. data/test/api_stub.rb +44 -0
  94. data/test/api_stub/models/compute/availability_set.rb +21 -0
  95. data/test/api_stub/models/compute/server.rb +191 -0
  96. data/test/api_stub/models/dns/record_set.rb +59 -0
  97. data/test/api_stub/models/dns/zone.rb +47 -0
  98. data/test/api_stub/models/network/application_gateway.rb +135 -0
  99. data/test/api_stub/models/network/load_balancer.rb +132 -0
  100. data/test/api_stub/models/network/network_interface.rb +71 -0
  101. data/test/api_stub/models/network/network_security_group.rb +94 -0
  102. data/test/api_stub/models/network/public_ip.rb +35 -0
  103. data/test/api_stub/models/network/subnet.rb +35 -0
  104. data/test/api_stub/models/network/traffic_manager_end_point.rb +26 -0
  105. data/test/api_stub/models/network/traffic_manager_profile.rb +74 -0
  106. data/test/api_stub/models/network/virtual_network.rb +61 -0
  107. data/test/api_stub/models/resources/deployment.rb +110 -0
  108. data/test/api_stub/models/resources/resource.rb +40 -0
  109. data/test/api_stub/models/resources/resource_group.rb +38 -0
  110. data/test/api_stub/models/storage/blob.rb +17 -0
  111. data/test/api_stub/models/storage/container.rb +92 -0
  112. data/test/api_stub/models/storage/data_disk.rb +30 -0
  113. data/test/api_stub/models/storage/storageaccount.rb +29 -0
  114. data/test/api_stub/requests/compute/availability_set.rb +46 -0
  115. data/test/api_stub/requests/compute/virtual_machine.rb +654 -0
  116. data/test/api_stub/requests/dns/record_set.rb +105 -0
  117. data/test/api_stub/requests/dns/zone.rb +67 -0
  118. data/test/api_stub/requests/network/application_gateway.rb +433 -0
  119. data/test/api_stub/requests/network/load_balancer.rb +366 -0
  120. data/test/api_stub/requests/network/network_interface.rb +268 -0
  121. data/test/api_stub/requests/network/network_security_group.rb +240 -0
  122. data/test/api_stub/requests/network/public_ip.rb +73 -0
  123. data/test/api_stub/requests/network/subnet.rb +73 -0
  124. data/test/api_stub/requests/network/traffic_manager_endpoint.rb +25 -0
  125. data/test/api_stub/requests/network/traffic_manager_profile.rb +140 -0
  126. data/test/api_stub/requests/network/virtual_network.rb +127 -0
  127. data/test/api_stub/requests/resources/deployment.rb +23 -0
  128. data/test/api_stub/requests/resources/resource.rb +47 -0
  129. data/test/api_stub/requests/resources/resource_group.rb +53 -0
  130. data/test/api_stub/requests/storage/blob.rb +24 -0
  131. data/test/api_stub/requests/storage/container.rb +95 -0
  132. data/test/api_stub/requests/storage/storageaccount.rb +112 -0
  133. data/test/integration/README.md +14 -0
  134. data/test/integration/application_gateway.rb +129 -0
  135. data/test/integration/availability_set.rb +56 -0
  136. data/test/integration/container.rb +81 -0
  137. data/test/integration/credentials/azure.yml +4 -0
  138. data/test/integration/external_load_balancer.rb +119 -0
  139. data/test/integration/internal_load_balancer.rb +126 -0
  140. data/test/integration/network_interface.rb +135 -0
  141. data/test/integration/network_security_group.rb +104 -0
  142. data/test/integration/public_ip.rb +63 -0
  143. data/test/integration/record_set.rb +88 -0
  144. data/test/integration/server.rb +139 -0
  145. data/test/integration/storage_account.rb +62 -0
  146. data/test/integration/subnet.rb +91 -0
  147. data/test/integration/traffic_manager.rb +81 -0
  148. data/test/integration/virtual_network.rb +124 -0
  149. data/test/integration/zone.rb +64 -0
  150. data/test/models/compute/test_availability_set.rb +53 -0
  151. data/test/models/compute/test_availability_sets.rb +41 -0
  152. data/test/models/compute/test_server.rb +143 -0
  153. data/test/models/compute/test_servers.rb +49 -0
  154. data/test/models/dns/test_record_set.rb +59 -0
  155. data/test/models/dns/test_record_sets.rb +51 -0
  156. data/test/models/dns/test_zone.rb +49 -0
  157. data/test/models/dns/test_zones.rb +49 -0
  158. data/test/models/network/test_application_gateway.rb +62 -0
  159. data/test/models/network/test_application_gateways.rb +42 -0
  160. data/test/models/network/test_load_balancer.rb +56 -0
  161. data/test/models/network/test_load_balancers.rb +42 -0
  162. data/test/models/network/test_network_interface.rb +106 -0
  163. data/test/models/network/test_network_interfaces.rb +41 -0
  164. data/test/models/network/test_network_security_group.rb +88 -0
  165. data/test/models/network/test_network_security_groups.rb +40 -0
  166. data/test/models/network/test_network_security_rule.rb +30 -0
  167. data/test/models/network/test_public_ip.rb +58 -0
  168. data/test/models/network/test_public_ips.rb +55 -0
  169. data/test/models/network/test_subnet.rb +84 -0
  170. data/test/models/network/test_subnets.rb +42 -0
  171. data/test/models/network/test_traffic_manager_end_point.rb +53 -0
  172. data/test/models/network/test_traffic_manager_end_points.rb +42 -0
  173. data/test/models/network/test_traffic_manager_profile.rb +54 -0
  174. data/test/models/network/test_traffic_manager_profiles.rb +41 -0
  175. data/test/models/network/test_virtual_network.rb +112 -0
  176. data/test/models/network/test_virtual_networks.rb +54 -0
  177. data/test/models/resources/test_deployment.rb +54 -0
  178. data/test/models/resources/test_deployments.rb +37 -0
  179. data/test/models/resources/test_resource.rb +22 -0
  180. data/test/models/resources/test_resource_group.rb +43 -0
  181. data/test/models/resources/test_resource_groups.rb +37 -0
  182. data/test/models/resources/test_resources.rb +38 -0
  183. data/test/models/storage/test_blobs.rb +32 -0
  184. data/test/models/storage/test_container.rb +67 -0
  185. data/test/models/storage/test_containers.rb +56 -0
  186. data/test/models/storage/test_data_disk.rb +29 -0
  187. data/test/models/storage/test_storage_account.rb +62 -0
  188. data/test/models/storage/test_storage_accounts.rb +65 -0
  189. data/test/requests/compute/test_attach_data_disk_to_vm.rb +175 -0
  190. data/test/requests/compute/test_create_availability_set.rb +30 -0
  191. data/test/requests/compute/test_create_virtual_machine.rb +50 -0
  192. data/test/requests/compute/test_deallocate_virtual_machine.rb +29 -0
  193. data/test/requests/compute/test_delete_availability_set.rb +29 -0
  194. data/test/requests/compute/test_delete_virtual_machine.rb +29 -0
  195. data/test/requests/compute/test_detach_data_disk_from_vm.rb +53 -0
  196. data/test/requests/compute/test_generalize_virtual_machine.rb +29 -0
  197. data/test/requests/compute/test_get_virtual_machine.rb +31 -0
  198. data/test/requests/compute/test_get_vm_status.rb +31 -0
  199. data/test/requests/compute/test_list_availability_sets.rb +30 -0
  200. data/test/requests/compute/test_list_available_sizes_for_virtual_machine.rb +31 -0
  201. data/test/requests/compute/test_list_virtual_machines.rb +30 -0
  202. data/test/requests/compute/test_power_off_virtual_machine.rb +29 -0
  203. data/test/requests/compute/test_redeploy_virtual_machine.rb +29 -0
  204. data/test/requests/compute/test_restart_virtual_machine.rb +29 -0
  205. data/test/requests/compute/test_start_virtual_machine.rb +29 -0
  206. data/test/requests/dns/test_check_for_zone.rb +52 -0
  207. data/test/requests/dns/test_create_record_set.rb +45 -0
  208. data/test/requests/dns/test_create_zone.rb +36 -0
  209. data/test/requests/dns/test_delete_record_set.rb +35 -0
  210. data/test/requests/dns/test_delete_zone.rb +35 -0
  211. data/test/requests/dns/test_get_records_from_record_set.rb +55 -0
  212. data/test/requests/dns/test_list_record_sets.rb +36 -0
  213. data/test/requests/dns/test_list_zones.rb +40 -0
  214. data/test/requests/network/test_add_address_prefixes_in_virtual_network.rb +45 -0
  215. data/test/requests/network/test_add_dns_servers_in_virtual_network.rb +45 -0
  216. data/test/requests/network/test_add_security_rules.rb +63 -0
  217. data/test/requests/network/test_add_subnets_in_virtual_network.rb +45 -0
  218. data/test/requests/network/test_attach_network_security_group_to_subnet.rb +33 -0
  219. data/test/requests/network/test_attach_resource_to_nic.rb +65 -0
  220. data/test/requests/network/test_attach_route_table_to_subnet.rb +33 -0
  221. data/test/requests/network/test_check_for_public_ip.rb +38 -0
  222. data/test/requests/network/test_check_for_virtual_network.rb +38 -0
  223. data/test/requests/network/test_create_application_gateway.rb +61 -0
  224. data/test/requests/network/test_create_load_balancer.rb +56 -0
  225. data/test/requests/network/test_create_network_interface.rb +54 -0
  226. data/test/requests/network/test_create_network_security_group.rb +45 -0
  227. data/test/requests/network/test_create_or_update_virtual_network.rb +63 -0
  228. data/test/requests/network/test_create_public_ip.rb +44 -0
  229. data/test/requests/network/test_create_subnet.rb +44 -0
  230. data/test/requests/network/test_create_traffic_manager_endpoint.rb +32 -0
  231. data/test/requests/network/test_create_traffic_manager_profile.rb +32 -0
  232. data/test/requests/network/test_delete_application_gateway.rb +30 -0
  233. data/test/requests/network/test_delete_load_balancer.rb +30 -0
  234. data/test/requests/network/test_delete_network_interface.rb +30 -0
  235. data/test/requests/network/test_delete_network_security_group.rb +32 -0
  236. data/test/requests/network/test_delete_public_ip.rb +30 -0
  237. data/test/requests/network/test_delete_subnet.rb +30 -0
  238. data/test/requests/network/test_delete_traffic_manager_endpoint.rb +28 -0
  239. data/test/requests/network/test_delete_traffic_manager_profile.rb +28 -0
  240. data/test/requests/network/test_delete_virtual_network.rb +30 -0
  241. data/test/requests/network/test_detach_network_security_group_from_subnet.rb +33 -0
  242. data/test/requests/network/test_detach_resource_from_nic.rb +60 -0
  243. data/test/requests/network/test_detach_route_table_from_subnet.rb +33 -0
  244. data/test/requests/network/test_get_network_interface.rb +31 -0
  245. data/test/requests/network/test_get_network_security_group.rb +33 -0
  246. data/test/requests/network/test_get_subnet.rb +33 -0
  247. data/test/requests/network/test_get_traffic_manager_profile.rb +29 -0
  248. data/test/requests/network/test_list_application_gateways.rb +31 -0
  249. data/test/requests/network/test_list_load_balancers.rb +31 -0
  250. data/test/requests/network/test_list_network_interfaces.rb +31 -0
  251. data/test/requests/network/test_list_network_security_groups.rb +33 -0
  252. data/test/requests/network/test_list_public_ips.rb +31 -0
  253. data/test/requests/network/test_list_subnets.rb +31 -0
  254. data/test/requests/network/test_list_traffic_manager_profiles.rb +29 -0
  255. data/test/requests/network/test_list_virtual_networks.rb +31 -0
  256. data/test/requests/network/test_remove_address_prefixes_from_virtual_network.rb +45 -0
  257. data/test/requests/network/test_remove_dns_servers_from_virtual_network.rb +45 -0
  258. data/test/requests/network/test_remove_security_rule.rb +49 -0
  259. data/test/requests/network/test_remove_subnets_from_virtual_network.rb +45 -0
  260. data/test/requests/resources/test_create_deployment.rb +49 -0
  261. data/test/requests/resources/test_create_resource_group.rb +31 -0
  262. data/test/requests/resources/test_delete_deployment.rb +31 -0
  263. data/test/requests/resources/test_delete_resource_group.rb +30 -0
  264. data/test/requests/resources/test_delete_resource_tag.rb +51 -0
  265. data/test/requests/resources/test_list_deployments.rb +32 -0
  266. data/test/requests/resources/test_list_resource_groups.rb +31 -0
  267. data/test/requests/resources/test_list_tagged_resources.rb +31 -0
  268. data/test/requests/resources/test_tag_resource.rb +51 -0
  269. data/test/requests/storage/test_check_storage_account_name_availability.rb +59 -0
  270. data/test/requests/storage/test_create_container.rb +31 -0
  271. data/test/requests/storage/test_create_storage_account.rb +56 -0
  272. data/test/requests/storage/test_delete_container.rb +30 -0
  273. data/test/requests/storage/test_delete_storage_account.rb +34 -0
  274. data/test/requests/storage/test_get_blob_metadata.rb +18 -0
  275. data/test/requests/storage/test_get_container_access_control_list.rb +31 -0
  276. data/test/requests/storage/test_get_container_metadata.rb +18 -0
  277. data/test/requests/storage/test_get_container_properties.rb +31 -0
  278. data/test/requests/storage/test_get_storage_access_keys.rb +31 -0
  279. data/test/requests/storage/test_list_containers.rb +23 -0
  280. data/test/requests/storage/test_list_storage_accounts.rb +47 -0
  281. data/test/requests/storage/test_list_storage_accounts_for_rg.rb +51 -0
  282. data/test/requests/storage/test_set_blob_metadata.rb +17 -0
  283. data/test/requests/storage/test_set_container_metadata.rb +17 -0
  284. data/test/test_credentials.rb +39 -0
  285. data/test/test_helper.rb +428 -0
  286. metadata +273 -14
  287. data/lib/fog/azurerm/models/compute/data_disk.rb +0 -26
  288. data/lib/fog/azurerm/requests/network/create_virtual_network.rb +0 -115
@@ -0,0 +1,31 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for Get Storage Access Keys
4
+ class TestGetStorageAccessKeys < Minitest::Test
5
+ def setup
6
+ @service = Fog::Storage::AzureRM.new(credentials)
7
+ client = @service.instance_variable_get(:@storage_mgmt_client)
8
+ @storage_accounts = client.storage_accounts
9
+ @promise = Concurrent::Promise.execute do
10
+ end
11
+ end
12
+
13
+ def test_get_storage_access_keys_success
14
+ mocked_response = ApiStub::Requests::Storage::StorageAccount.list_keys_response
15
+ expected_response = Azure::ARM::Storage::Models::StorageAccountKeys.serialize_object(mocked_response.body)
16
+ @promise.stub :value!, mocked_response do
17
+ @storage_accounts.stub :list_keys, @promise do
18
+ assert_equal @service.get_storage_access_keys('fog-test-rg', 'fogstorageaccount'), expected_response
19
+ end
20
+ end
21
+ end
22
+
23
+ def test_get_storage_access_keys_failure
24
+ response = -> { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
25
+ @promise.stub :value!, response do
26
+ @storage_accounts.stub :list_keys, @promise do
27
+ assert_raises(RuntimeError) { @service.get_storage_access_keys('fog-test-rg', 'fogstorageaccount') }
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,23 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Storage Container Class
4
+ class TestListContaienrs < Minitest::Test
5
+ # This class posesses the test cases for the requests of listing storage containers.
6
+ def setup
7
+ @service = Fog::Storage::AzureRM.new(storage_account_credentials)
8
+ @blob_client = @service.instance_variable_get(:@blob_client)
9
+ @storage_container_object = ApiStub::Requests::Storage::Container.list_containers
10
+ end
11
+
12
+ def test_list_containers_with_service_success
13
+ @blob_client.stub :list_containers, @storage_container_object do
14
+ assert @service.list_containers.size >= 1
15
+ end
16
+ end
17
+
18
+ def test_list_containers_with_internal_client_success
19
+ @blob_client.stub :list_containers, @storage_container_object do
20
+ assert @blob_client.list_containers.size >= 1
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,47 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Storage Account Class
4
+ class TestListStorageAccounts < Minitest::Test
5
+ # This class posesses the test cases for the requests of storage account service.
6
+ def setup
7
+ @azure_credentials = Fog::Storage::AzureRM.new(credentials)
8
+ client = @azure_credentials.instance_variable_get(:@storage_mgmt_client)
9
+ @storage_accounts = client.storage_accounts
10
+ end
11
+
12
+ def test_list_storage_accounts_success
13
+ mock_promise = Concurrent::Promise.execute do
14
+ end
15
+ response_body = ApiStub::Requests::Storage::StorageAccount.list_storage_accounts
16
+ result = ApiStub::Requests::Storage::StorageAccount.response_storage_account_list(response_body)
17
+ mock_promise.stub :value!, result do
18
+ @storage_accounts.stub :list, mock_promise do
19
+ assert @azure_credentials.list_storage_accounts.size >= 1
20
+ @azure_credentials.list_storage_accounts.each do |s|
21
+ assert_equal s['name'], response_body['value'][0]['name']
22
+ end
23
+ end
24
+ end
25
+ end
26
+
27
+ def test_list_storage_accounts_failure
28
+ mock_promise = Concurrent::Promise.execute do
29
+ end
30
+ response_body = ApiStub::Requests::Storage::StorageAccount.list_storage_accounts
31
+ result = ApiStub::Requests::Storage::StorageAccount.response_storage_account_list(response_body)
32
+ mock_promise.stub :value!, result do
33
+ @storage_accounts.stub :list, mock_promise do
34
+ assert_raises ArgumentError do
35
+ assert @azure_credentials.list_storage_accounts('wrong arg', 'second wrong arg')
36
+ end
37
+ end
38
+ end
39
+ end
40
+
41
+ def test_list_storage_accounts_exeception
42
+ raise_exception = -> { fail MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
43
+ @storage_accounts.stub :list, raise_exception do
44
+ assert_raises(RuntimeError) { @azure_credentials.list_storage_accounts }
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,51 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Storage Account Class
4
+ class TestListStorageAccountsForRG < Minitest::Test
5
+ # This class posesses the test cases for the requests of storage account service.
6
+ def setup
7
+ @azure_credentials = Fog::Storage::AzureRM.new(credentials)
8
+ client = @azure_credentials.instance_variable_get(:@storage_mgmt_client)
9
+ @storage_accounts = client.storage_accounts
10
+ end
11
+
12
+ def test_list_storage_accounts_for_rg_success
13
+ mock_promise = Concurrent::Promise.execute do
14
+ end
15
+ response_body = ApiStub::Requests::Storage::StorageAccount.list_storage_accounts_for_rg
16
+ result = ApiStub::Requests::Storage::StorageAccount.response_storage_account_list(response_body)
17
+ mock_promise.stub :value!, result do
18
+ @storage_accounts.stub :list_by_resource_group, mock_promise do
19
+ assert @azure_credentials.list_storage_account_for_rg('gateway-RG').size >= 1
20
+ @azure_credentials.list_storage_account_for_rg('gateway-RG').each do |s|
21
+ assert_equal s['name'], response_body['value'][0]['name']
22
+ end
23
+ end
24
+ end
25
+ end
26
+
27
+ def test_list_storage_accounts_for_rg_failure
28
+ mock_promise = Concurrent::Promise.execute do
29
+ end
30
+ response_body = ApiStub::Requests::Storage::StorageAccount.list_storage_accounts_for_rg
31
+ result = ApiStub::Requests::Storage::StorageAccount.response_storage_account_list(response_body)
32
+ mock_promise.stub :value!, result do
33
+ @storage_accounts.stub :list_by_resource_group, mock_promise do
34
+ assert_raises ArgumentError do
35
+ @azure_credentials.list_storage_account_for_rg('gateway-RG', 'wrong argument')
36
+ end
37
+ end
38
+ end
39
+ end
40
+
41
+ def test_list_storage_accounts_for_rg_exception
42
+ raise_exception = -> { fail MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
43
+ mock_promise = Concurrent::Promise.execute do
44
+ end
45
+ mock_promise.stub :value!, raise_exception do
46
+ @storage_accounts.stub :list_by_resource_group, mock_promise do
47
+ assert_raises(RuntimeError) { @azure_credentials.list_storage_account_for_rg('gateway-RG') }
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,17 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Blob Class
4
+ class TestSetBlobMetadata < Minitest::Test
5
+ # This class posesses the test cases for the requests of blob service.
6
+ def setup
7
+ @service = Fog::Storage::AzureRM.new(storage_account_credentials)
8
+ @blob_client = @service.instance_variable_get(:@blob_client)
9
+ @metadata = ApiStub::Requests::Storage::Blob.metadata_response
10
+ end
11
+
12
+ def test_set_blob_metadata_success
13
+ @blob_client.stub :set_blob_metadata, true do
14
+ assert @service.set_blob_metadata('Test-container', 'Test-blob', @metadata)
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Container Class
4
+ class TestSetContainerMetadata < Minitest::Test
5
+ # This class posesses the test cases for the requests of container service.
6
+ def setup
7
+ @service = Fog::Storage::AzureRM.new(storage_account_credentials)
8
+ @blob_client = @service.instance_variable_get(:@blob_client)
9
+ @metadata = ApiStub::Requests::Storage::Container.metadata_response
10
+ end
11
+
12
+ def test_set_container_metadata_success
13
+ @blob_client.stub :set_container_metadata, true do
14
+ assert @service.set_container_metadata('Test-container', @metadata)
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,39 @@
1
+ require File.expand_path 'test_helper', __dir__
2
+
3
+ # Test class for Credentials Helper Class
4
+ class TestCredentials < Minitest::Test
5
+ def setup
6
+ @creds = credentials
7
+ end
8
+
9
+ def test_methods
10
+ methods = [
11
+ :get_credentials,
12
+ :get_token
13
+ ]
14
+ methods.each do |method|
15
+ assert Fog::Credentials::AzureRM.respond_to? method
16
+ end
17
+ end
18
+
19
+ def test_get_credentials_method_with_same_client
20
+ cred_obj_one = Fog::Credentials::AzureRM.get_credentials(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret])
21
+ cred_obj_two = Fog::Credentials::AzureRM.get_credentials(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret])
22
+ assert_equal cred_obj_one.object_id, cred_obj_two.object_id
23
+ end
24
+
25
+ def test_get_credentials_method_with_different_client
26
+ cred_obj_one = Fog::Credentials::AzureRM.get_credentials(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret])
27
+ @creds[:client_id] = '<NEW-CLIENT-ID>'
28
+ cred_obj_two = Fog::Credentials::AzureRM.get_credentials(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret])
29
+ refute_equal cred_obj_one.object_id, cred_obj_two.object_id
30
+ end
31
+
32
+ def test_get_token_method
33
+ Fog::Credentials::AzureRM.get_credentials(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret])
34
+ token_provider = Fog::Credentials::AzureRM.instance_variable_get(:@token_provider)
35
+ token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
36
+ assert_equal Fog::Credentials::AzureRM.get_token(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret]), 'Bearer <some-token>'
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,428 @@
1
+ if ENV['COVERAGE']
2
+ require 'simplecov'
3
+ SimpleCov.start do
4
+ add_filter 'test'
5
+ command_name 'Minitest'
6
+ end
7
+ end
8
+
9
+ if ENV['CODECLIMATE_REPO_TOKEN']
10
+ require 'codeclimate-test-reporter'
11
+ CodeClimate::TestReporter.start
12
+ end
13
+
14
+ require 'minitest/autorun'
15
+ $LOAD_PATH.unshift(File.expand_path '../lib', __dir__)
16
+ require File.expand_path '../lib/fog/azurerm', __dir__
17
+ require File.expand_path './api_stub', __dir__
18
+ def credentials
19
+ {
20
+ tenant_id: '<TENANT-ID>',
21
+ client_id: '<CLIENT-ID>',
22
+ client_secret: '<CLIENT-SECRET>',
23
+ subscription_id: '<SUBSCRIPTION-ID>'
24
+ }
25
+ end
26
+
27
+ def storage_account_credentials
28
+ {
29
+ azure_storage_account_name: 'mockaccount',
30
+ azure_storage_access_key: 'YWNjZXNzLWtleQ=='
31
+ }
32
+ end
33
+
34
+ def server(service)
35
+ Fog::Compute::AzureRM::Server.new(
36
+ name: 'fog-test-server',
37
+ location: 'West US',
38
+ resource_group: 'fog-test-rg',
39
+ vm_size: 'Basic_A0',
40
+ storage_account_name: 'shaffanstrg',
41
+ username: 'shaffan',
42
+ password: 'Confiz=123',
43
+ disable_password_authentication: false,
44
+ network_interface_card_id: '/subscriptions/########-####-####-####-############/resourceGroups/shaffanRG/providers/Microsoft.Network/networkInterfaces/testNIC',
45
+ publisher: 'Canonical',
46
+ offer: 'UbuntuServer',
47
+ sku: '14.04.2-LTS',
48
+ version: 'latest',
49
+ platform: 'Windows',
50
+ service: service
51
+ )
52
+ end
53
+
54
+ def availability_set(service)
55
+ Fog::Compute::AzureRM::AvailabilitySet.new(
56
+ name: 'availability-set',
57
+ location: 'West US',
58
+ resource_group: 'fog-test-rg',
59
+ service: service
60
+ )
61
+ end
62
+
63
+ def resource_group(service)
64
+ Fog::Resources::AzureRM::ResourceGroup.new(
65
+ name: 'fog-test-rg',
66
+ location: 'West US',
67
+ service: service
68
+ )
69
+ end
70
+
71
+ def deployment(service)
72
+ Fog::Resources::AzureRM::Deployment.new(
73
+ name: 'fog-test-deployment',
74
+ resource_group: 'fog-test-rg',
75
+ template_link: 'https://test.com/template.json',
76
+ parameters_link: 'https://test.com/parameters.json',
77
+ service: service
78
+ )
79
+ end
80
+
81
+ def storage_account(service)
82
+ Fog::Storage::AzureRM::StorageAccount.new(
83
+ name: 'storage-account',
84
+ location: 'West US',
85
+ resource_group: 'fog-test-rg',
86
+ service: service
87
+ )
88
+ end
89
+
90
+ def storage_container(service)
91
+ Fog::Storage::AzureRM::Container.new(
92
+ name: 'storage-test-container',
93
+ last_modified: 'Tue, 04 Aug 2015 06:01:08 GMT',
94
+ etag: '0x8D29C92176C8352',
95
+ lease_status: 'unlocked',
96
+ lease_state: 'available',
97
+ lease_duration: nil,
98
+ metadata: {
99
+ 'key1' => 'value1',
100
+ 'key2' => 'value2'
101
+ },
102
+ public_access_level: nil,
103
+ service: service
104
+ )
105
+ end
106
+
107
+ def public_ip(service)
108
+ Fog::Network::AzureRM::PublicIp.new(
109
+ name: 'fog-test-public-ip',
110
+ resource_group: 'fog-test-rg',
111
+ location: 'West US',
112
+ public_ip_allocation_method: 'Dynamic',
113
+ service: service
114
+ )
115
+ end
116
+
117
+ def subnet(service)
118
+ Fog::Network::AzureRM::Subnet.new(
119
+ name: 'fog-test-subnet',
120
+ resource_group: 'fog-test-rg',
121
+ virtual_network_name: 'vnet1',
122
+ address_prefix: '10.0.0.0/24',
123
+ network_security_group_id: '/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/myNSG1',
124
+ route_table_id: '/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/myRT1',
125
+ service: service
126
+ )
127
+ end
128
+
129
+ def virtual_network(service)
130
+ Fog::Network::AzureRM::VirtualNetwork.new(
131
+ name: 'fog-test-virtual-network',
132
+ location: 'westus',
133
+ resource_group: 'fog-test-rg',
134
+ subnets: [{
135
+ name: 'fog-test-subnet',
136
+ address_prefix: '10.1.0.0/24',
137
+ network_security_group_id: '/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/myNSG1',
138
+ route_table_id: '/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/myRT1'
139
+ }],
140
+ dns_servers: ['10.1.0.0', '10.2.0.0'],
141
+ address_prefixes: ['10.1.0.0/16', '10.2.0.0/16'],
142
+ service: service
143
+ )
144
+ end
145
+
146
+ def network_interface(service)
147
+ Fog::Network::AzureRM::NetworkInterface.new(
148
+ name: 'fog-test-network-interface',
149
+ location: 'West US',
150
+ resource_group: 'fog-test-rg',
151
+ subnet_id: '/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.Network/virtualNetworks/fog-test-virtual-network/subnets/fog-test-subnet',
152
+ public_ip_address_id: '/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.Network/publicIPAddresses/fog-test-public-ip',
153
+ network_security_group_id: '/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.Network/networkSecurityGroups/fog-test-nsg',
154
+ ip_configuration_name: 'fog-test-ip-configuration',
155
+ private_ip_allocation_method: 'fog-test-private-ip-allocation-method',
156
+ properties: nil,
157
+ service: service
158
+ )
159
+ end
160
+
161
+ def load_balancer(service)
162
+ Fog::Network::AzureRM::LoadBalancer.new(
163
+ name: 'lb',
164
+ resource_group: 'fogRM-rg',
165
+ location: 'westus',
166
+ frontend_ip_configurations:
167
+ [
168
+ {
169
+ name: 'fic',
170
+ private_ipallocation_method: 'Dynamic',
171
+ public_ipaddress_id: '/subscriptions/########-####-####-####-############/resourcegroups/fogRM-rg/providers/Microsoft.Network/publicIPAddresses/pip',
172
+ subnet_id: '/subscriptions/########-####-####-####-############/resourcegroups/fogRM-rg/providers/Microsoft.Network/virtualNetworks/vnet/subnets/sb1'
173
+ }
174
+ ],
175
+ backend_address_pool_names:
176
+ [
177
+ 'pool1'
178
+ ],
179
+ load_balancing_rules:
180
+ [
181
+ {
182
+ name: 'lb_rule_1',
183
+ frontend_ip_configuration_id: '/subscriptions/########-####-####-####-############/resourceGroups/fogRM-rg/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fic',
184
+ backend_address_pool_id: '/subscriptions/########-####-####-####-############/resourceGroups/fogRM-rg/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/pool1',
185
+ protocol: 'Tcp',
186
+ frontend_port: '80',
187
+ backend_port: '8080',
188
+ enable_floating_ip: false,
189
+ idle_timeout_in_minutes: 4,
190
+ load_distribution: 'Default'
191
+ }
192
+ ],
193
+ inbound_nat_rules:
194
+ [
195
+ {
196
+ name: 'RDP-Traffic',
197
+ frontend_ip_configuration_id: '/subscriptions/########-####-####-####-############/resourceGroups/fogRM-rg/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fic',
198
+ protocol: 'Tcp',
199
+ frontend_port: 3389,
200
+ backend_port: 3389
201
+ }
202
+ ],
203
+ probes:
204
+ [
205
+ {
206
+ name: 'probe1',
207
+ protocol: 'Tcp',
208
+ port: 8080,
209
+ request_path: 'myprobeapp1/myprobe1.svc',
210
+ interval_in_seconds: 5,
211
+ number_of_probes: 16
212
+ }
213
+ ],
214
+ inbound_nat_pools:
215
+ [
216
+ {
217
+ name: 'RDPForVMSS1',
218
+ protocol: 'Tcp',
219
+ frontend_port_range_start: 500,
220
+ frontend_port_range_end: 505,
221
+ backend_port: 3389
222
+ }
223
+ ],
224
+ service: service
225
+ )
226
+ end
227
+
228
+ def zone(service)
229
+ Fog::DNS::AzureRM::Zone.new(
230
+ name: 'fog-test-zone.com',
231
+ id: '/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.Network/dnszones/fog-test-zone.com',
232
+ resource_group: 'fog-test-rg',
233
+ service: service
234
+ )
235
+ end
236
+
237
+ def record_set(service)
238
+ Fog::DNS::AzureRM::RecordSet.new(
239
+ name: 'fog-test-record_set',
240
+ resource_group: 'fog-test-rg',
241
+ zone_name: 'fog-test-zone.com',
242
+ records: %w(1.2.3.4 1.2.3.3),
243
+ type: 'A',
244
+ ttl: 60,
245
+ service: service
246
+ )
247
+ end
248
+
249
+ def network_security_group(service)
250
+ Fog::Network::AzureRM::NetworkSecurityGroup.new(
251
+ name: 'fog-test-nsg',
252
+ resource_group: 'fog-test-rg',
253
+ location: 'West US',
254
+ security_rules: [{
255
+ name: 'fog-test-rule',
256
+ protocol: 'tcp',
257
+ source_port_range: '22',
258
+ destination_port_range: '22',
259
+ source_address_prefix: '0.0.0.0/0',
260
+ destination_address_prefix: '0.0.0.0/0',
261
+ access: 'Allow',
262
+ priority: '100',
263
+ direction: 'Inbound'
264
+ }],
265
+ service: service
266
+ )
267
+ end
268
+
269
+ def network_security_rule(service)
270
+ Fog::Network::AzureRM::NetworkSecurityRule.new(
271
+ name: 'fog-test-nsr',
272
+ resource_group: 'fog-test-rg',
273
+ network_security_group_name: 'fog-test-nsr',
274
+ protocol: 'tcp',
275
+ source_port_range: '22',
276
+ destination_port_range: '22',
277
+ source_address_prefix: '0.0.0.0/0',
278
+ destination_address_prefix: '0.0.0.0/0',
279
+ access: 'Allow',
280
+ priority: '100',
281
+ direction: 'Inbound',
282
+ service: service
283
+ )
284
+ end
285
+
286
+ def application_gateway(service)
287
+ Fog::Network::AzureRM::ApplicationGateway.new(
288
+ name: 'gateway',
289
+ location: 'eastus',
290
+ resource_group: 'fogRM-rg',
291
+ sku_name: 'Standard_Medium',
292
+ sku_tier: 'Standard',
293
+ sku_capacity: '2',
294
+ gateway_ip_configurations:
295
+ [
296
+ {
297
+ name: 'gatewayIpConfigName',
298
+ subnet_id: '/subscriptions/########-####-####-####-############/resourcegroups/fogRM-rg/providers/Microsoft.Network/virtualNetworks/vnet/subnets/subnetName'
299
+ }
300
+ ],
301
+ ssl_certificates:
302
+ [
303
+ {
304
+ name: 'certificate',
305
+ data: 'data',
306
+ password: '123',
307
+ public_cert_data: 'MIIDiDCCAnACCQCwYkR0Mxy+QTANBgkqhkiG9w0BAQUFADCBhTELMAkGA1UEBhMCUEsxDzANBgNVBAgTBlB1bmphYjEPMA0GA1UEBxMGTGFob3JlMQ8wDQYDVQQKEwZDb25maXoxDDAKBgNVBAsTA0RldjEPMA0GA1UEAxMGaGFpZGVyMSQwIgYJKoZIhvcNAQkBFhVoYWlkZXIuYWxpQGNvbmZpei5jb20wHhcNMTYwMzAyMTE0NTM2WhcNMTcwMzAyMTE0NTM2WjCBhTELMAkGA1UEBhMCUEsxDzANBgNVBAgTBlB1bmphYjEPMA0GA1UEBxMGTGFob3JlMQ8wDQYDVQQKEwZDb25maXoxDDAKBgNVBAsTA0RldjEPMA0GA1UEAxMGaGFpZGVyMSQwIgYJKoZIhvcNAQkBFhVoYWlkZXIuYWxpQGNvbmZpei5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCuJrPbvOG+4oXQRamkOALlpdK98m+atJue9zOcCCagY8IJI4quYL13d8VItmrZf7erA+siqpYlWEuk1+lmmUY7T4AWAL8mXeR2vc7hWF601WDUjeVPK19+IcC8emMLOlBpvjXC9nbvADLQuR0PGitfjCqFoG66EOqJmLDNBsyHWmy+qhb8J4WXitruNAJDPe/20h6L23vD6z4tvwBjh4zkrfskGlKCNcAuvG1NI0FAS8261Jvs3lf+8oFyI+oSXGtknrkeQv3PbXyeEe3KO5a/M61Uebo04Uwd4yCvdu6H0sF+YYA4bfFdanuFmrZvf9cZSwknQid+vOdzyGkTHTPFAgMBAAEwDQYJKoZIhvcNAQEFBQADggEBAKtPhYpfvn5OxP+BcChsWaQA4KZQj0THGdiAjHsvfjsgteFvhkzqZBkhKYtsAWV5tB5/GDl+o4c6PQJ2/TXhOJn3pSNaUzrCJIGtKS5DknbqTQxCwVlxyBtPHLAYWqKcPMlH282rw3VY0OYTL96XOgZ/WZjcN6A7ku+uWsNCql443FoWL+N3Gpaab45OyIluFUOH+yc0ToHNlP3iOpI3rVpi2xwmGrSyUKsGUma3nrBq7TWjkDE1E+oJoybaMNZzgXGIPSJC1HYIF1U8GSoFkZpAFxXecD0FinXWDRwUP6K54iti3i6a/Ox73WhwfI4mVCqsOy1WYWtKYhMVe6Kj4Nw='
308
+ }
309
+ ],
310
+ frontend_ip_configurations:
311
+ [
312
+ {
313
+ name: 'frontendIpConfig',
314
+ private_ip_allocation_method: 'Dynamic',
315
+ public_ip_address_id: '/subscriptions/########-####-####-####-############/resourcegroups/fogRM-rg/providers/Microsoft.Network/publicIPAddresses/publicIp',
316
+ private_ip_address: '10.0.1.5'
317
+ }
318
+ ],
319
+ frontend_ports:
320
+ [
321
+ {
322
+ name: 'frontendPort',
323
+ port: 443
324
+ }
325
+ ],
326
+ probes:
327
+ [
328
+ {
329
+ name: 'probe1',
330
+ protocol: 'tcp',
331
+ host: 'localhost',
332
+ path: '/usr/',
333
+ interval: 30,
334
+ timeout: 20,
335
+ unhealthy_threshold: 20
336
+ }
337
+ ],
338
+ backend_address_pools:
339
+ [
340
+ {
341
+ name: 'backendAddressPool',
342
+ ip_addresses: [
343
+ {
344
+ ipAddress: '10.0.1.6'
345
+ }
346
+ ]
347
+ }
348
+ ],
349
+ backend_http_settings_list:
350
+ [
351
+ {
352
+ name: 'gateway_settings',
353
+ port: 80,
354
+ protocol: 'Http',
355
+ cookie_based_affinity: 'Enabled',
356
+ request_timeout: '30',
357
+ probe: ''
358
+ }
359
+ ],
360
+ http_listeners:
361
+ [
362
+ {
363
+ name: 'gateway_listener',
364
+ frontend_ip_config_id: '/subscriptions/########-####-####-####-############/resourceGroups/fogRM-rg/providers/Microsoft.Network/applicationGateways/gateway/frontendIPConfigurations/frontend_ip_config',
365
+ frontend_port_id: '/subscriptions/########-####-####-####-############/resourceGroups/fogRM-rg/providers/Microsoft.Network/applicationGateways/gateway/frontendPorts/gateway_front_port',
366
+ protocol: 'Https',
367
+ host_name: '',
368
+ ssl_certificate_id: '/subscriptions/########-####-####-####-############/resourceGroups/fogRM-rg/providers/Microsoft.Network/applicationGateways/gateway/sslCertificates/ssl_certificate',
369
+ require_server_name_indication: 'false'
370
+ }
371
+ ],
372
+ url_path_maps:
373
+ [
374
+ {
375
+ name: 'map1',
376
+ default_backend_address_pool_id: '/subscriptions/########-####-####-####-############/resourceGroups/fogRM-rg/providers/Microsoft.Network/applicationGateways/gateway/backendAddressPools/AG-BackEndAddressPool',
377
+ default_backend_http_settings_id: '/subscriptions/########-####-####-####-############/resourceGroups/fogRM-rg/providers/Microsoft.Network/applicationGateways/gateway/backendHttpSettingsCollection/gateway_settings',
378
+ path_rules: [
379
+ {
380
+ backend_address_pool_id: '/subscriptions/########-####-####-####-############/resourceGroups/fogRM-rg/providers/Microsoft.Network/applicationGateways/gateway/backendAddressPools/AG-BackEndAddressPool',
381
+ backend_http_settings_id: '/subscriptions/########-####-####-####-############/resourceGroups/fogRM-rg/providers/Microsoft.Network/applicationGateways/gateway/backendHttpSettingsCollection/gateway_settings',
382
+ paths: [
383
+ %w('/usr', '/etc')
384
+ ]
385
+ }
386
+ ]
387
+ }
388
+ ],
389
+ request_routing_rules:
390
+ [
391
+ {
392
+ name: 'gateway_request_route_rule',
393
+ type: 'Basic',
394
+ http_listener_id: '/subscriptions/########-####-####-####-############/resourceGroups/fogRM-rg/providers/Microsoft.Network/applicationGateways/gateway/httpListeners/gateway_listener',
395
+ backend_address_pool_id: '/subscriptions/########-####-####-####-############/resourceGroups/fogRM-rg/providers/Microsoft.Network/applicationGateways/gateway/backendAddressPools/AG-BackEndAddressPool',
396
+ backend_http_settings_id: '/subscriptions/########-####-####-####-############/resourceGroups/fogRM-rg/providers/Microsoft.Network/applicationGateways/gateway/backendHttpSettingsCollection/gateway_settings',
397
+ url_path_map: ''
398
+ }
399
+ ],
400
+ service: service
401
+ )
402
+ end
403
+
404
+ def traffic_manager_end_point(service)
405
+ Fog::Network::AzureRM::TrafficManagerEndPoint.new(
406
+ name: 'fog-test-end-point',
407
+ traffic_manager_profile_name: 'fog-test-profile',
408
+ resource_group: 'fog-test-rg',
409
+ type: 'external',
410
+ target: 'test.com',
411
+ endpoint_location: 'West US',
412
+ service: service
413
+ )
414
+ end
415
+
416
+ def traffic_manager_profile(service)
417
+ Fog::Network::AzureRM::TrafficManagerProfile.new(
418
+ name: 'fog-test-profile',
419
+ resource_group: 'fog-test-rg',
420
+ traffic_routing_method: 'Performance',
421
+ relative_name: 'fog-test-app',
422
+ ttl: '30',
423
+ protocol: 'http',
424
+ port: '80',
425
+ path: '/monitorpage.aspx',
426
+ service: service
427
+ )
428
+ end