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,127 @@
1
+ module ApiStub
2
+ module Requests
3
+ module Network
4
+ class VirtualNetwork
5
+ def self.create_virtual_network_response
6
+ body = '{
7
+ "name":" fog-test-virtual-network",
8
+ "id":"/subscriptions/{guid}/resourceGroups/fog-test-rg/providers/Microsoft.Network/virtualNetworks/fog-test-virtual-network",
9
+ "location":"West US",
10
+ "tags":{
11
+ "key":"value"
12
+ },
13
+ "etag":"W/\"00000000-0000-0000-0000-000000000000\"",
14
+ "properties":{
15
+ "resourceGuid":"FA0F0F1A-158F-4725-ACCE-C7B6D5CD937F",
16
+ "provisioningState":"Succeeded",
17
+ "addressSpace":{
18
+ "addressPrefixes":[
19
+ "10.1.0.0/16",
20
+ "10.2.0.0/16"
21
+ ]
22
+ },
23
+ "dhcpOptions":{
24
+ "dnsServers":[
25
+ "10.1.0.5",
26
+ "10.1.0.6"
27
+ ]
28
+ },
29
+ "subnets":[
30
+ {
31
+ "name":"mysubnet1",
32
+ "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/myvnet1/subnets/mysubnet1",
33
+ "etag":"W/\"00000000-0000-0000-0000-000000000000\"",
34
+ "properties":{
35
+ "provisioningState":"Succeeded",
36
+ "addressPrefix":"10.1.0.0/24",
37
+ "networkSecurityGroup":{
38
+ "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/myNSG1"
39
+ },
40
+ "ipConfigurations":[
41
+ {
42
+ "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/vm1nic1/ipConfigurations/ip1"
43
+ },
44
+ {
45
+ "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/lb1/frontendIpConfigurations/ip1"
46
+ },
47
+ {
48
+ "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/gw1/ipConfigurations/ip1"
49
+ }
50
+ ]
51
+ }
52
+ }
53
+ ]
54
+ }
55
+ }'
56
+ result = MsRestAzure::AzureOperationResponse.new(MsRest::HttpOperationRequest.new('', '', ''), Faraday::Response.new)
57
+ result.body = Azure::ARM::Network::Models::VirtualNetwork.deserialize_object(JSON.load(body))
58
+ result
59
+ end
60
+
61
+ def self.list_virtual_networks_response
62
+ body = '
63
+ {
64
+ "value": [ {
65
+ "name":" myvnet1",
66
+ "id":"/subscriptions/{guid}/resourceGroups/mygroup1/providers/Microsoft.Network/virtualNetworks/myvnet1",
67
+ "location":"North US",
68
+ "tags":
69
+ {
70
+ "key":"value"
71
+ },
72
+ "etag":"W/\"00000000-0000-0000-0000-000000000000\"",
73
+ "properties":{
74
+ "resourceGuid":"FA0F0F1A-158F-4725-ACCE-C7B6D5CD937F",
75
+ "provisioningState":"Succeeded",
76
+ "addressSpace":{
77
+ "addressPrefixes":[
78
+ "10.1.0.0/16",
79
+ "10.2.0.0/16"
80
+ ]
81
+ },
82
+ "dhcpOptions":{
83
+ "dnsServers":[
84
+ "10.1.0.5",
85
+ "10.1.0.6"
86
+ ]
87
+ },
88
+ "subnets":[
89
+ {
90
+ "name":"mysubnet1",
91
+ "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/myvnet1/subnets/mysubnet1",
92
+ "etag":"W/\"00000000-0000-0000-0000-000000000000\"",
93
+ "properties":{
94
+ "provisioningState":"Succeeded",
95
+ "addressPrefix":"10.1.0.0/24",
96
+ "networkSecurityGroup":{
97
+ "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/myNSG1"
98
+ },
99
+ "ipConfigurations":[
100
+ {
101
+ "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/vm1nic1/ipConfigurations/ip1"
102
+ },
103
+ {
104
+ "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/lb1/frontendIpConfigurations/ip1"
105
+ },
106
+ {
107
+ "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/gw1/ipConfigurations/ip1"
108
+ }
109
+ ]
110
+ }
111
+ }
112
+ ]
113
+ }
114
+ } ]
115
+ }'
116
+ result = MsRestAzure::AzureOperationResponse.new(MsRest::HttpOperationRequest.new('', '', ''), Faraday::Response.new)
117
+ result.body = Azure::ARM::Network::Models::VirtualNetworkListResult.deserialize_object(JSON.load(body))
118
+ result
119
+ end
120
+
121
+ def self.delete_virtual_network_response
122
+ MsRestAzure::AzureOperationResponse.new(MsRest::HttpOperationRequest.new('', '', ''), Faraday::Response.new)
123
+ end
124
+ end
125
+ end
126
+ end
127
+ end
@@ -0,0 +1,23 @@
1
+ module ApiStub
2
+ module Requests
3
+ module Resources
4
+ # Mock class for Deployment Requests
5
+ class Deployment
6
+ def self.create_deployment_response
7
+ body = ApiStub::Models::Resources::Deployment.create_deployment_response
8
+ result = MsRestAzure::AzureOperationResponse.new(MsRest::HttpOperationRequest.new('', '', ''), Faraday::Response.new)
9
+ result.body = Azure::ARM::Resources::Models::DeploymentExtended.deserialize_object(body)
10
+ result
11
+ end
12
+
13
+ def self.list_deployment_response
14
+ body = ApiStub::Models::Resources::Deployment.list_deployments_response
15
+ body = { 'value' => body }
16
+ result = MsRestAzure::AzureOperationResponse.new(MsRest::HttpOperationRequest.new('', '', ''), Faraday::Response.new)
17
+ result.body = Azure::ARM::Resources::Models::DeploymentListResult.deserialize_object(body)
18
+ result
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,47 @@
1
+ module ApiStub
2
+ module Requests
3
+ module Resources
4
+ # Mock class for Tag Requests
5
+ class AzureResource
6
+ def self.azure_resource_response
7
+ body = '{
8
+ "id": "/subscriptions/########-####-####-####-############/resourceGroups/{RESOURCE-GROUP}/providers/Microsoft.Network/{PROVIDER-NAME}/{RESOURCE-NAME}",
9
+ "name": "your-resource-name",
10
+ "type": "providernamespace/resourcetype",
11
+ "location": "westus",
12
+ "tags": {
13
+ "tag_name": "tag_value"
14
+ },
15
+ "plan": {
16
+ "name": "free"
17
+ }
18
+ }'
19
+ result = MsRestAzure::AzureOperationResponse.new(MsRest::HttpOperationRequest.new('', '', ''), Faraday::Response.new)
20
+ result.body = Azure::ARM::Resources::Models::GenericResource.deserialize_object(JSON.load(body))
21
+ result
22
+ end
23
+
24
+ def self.list_tagged_resources_response
25
+ body = '{
26
+ "value": [ {
27
+ "id": "/subscriptions/########-####-####-####-############/resourceGroups/{RESOURCE-GROUP}/providers/Microsoft.Network/{PROVIDER-NAME}/{RESOURCE-NAME}",
28
+ "name": "your-resource-name",
29
+ "type": "providernamespace/resourcetype",
30
+ "location": "westus",
31
+ "tags": {
32
+ "tag_name": "tag_value"
33
+ },
34
+ "plan": {
35
+ "name": "free"
36
+ }
37
+ } ],
38
+ "nextLink": "https://management.azure.com/subscriptions/########-####-####-####-############/resourcegroups?api-version=2015-01-01&$skiptoken=######"
39
+ }'
40
+ result = MsRestAzure::AzureOperationResponse.new(MsRest::HttpOperationRequest.new('', '', ''), Faraday::Response.new)
41
+ result.body = Azure::ARM::Resources::Models::ResourceListResult.deserialize_object(JSON.load(body))
42
+ result
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,53 @@
1
+ module ApiStub
2
+ module Requests
3
+ module Resources
4
+ # Mock class for Resource Group Requests
5
+ class ResourceGroup
6
+ def self.create_resource_group_response
7
+ body = '{
8
+ "id": "/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg",
9
+ "name": "fog-test-rg",
10
+ "location": "westus",
11
+ "tags": {
12
+ "tagname1": "tagvalue1"
13
+ },
14
+ "properties": {
15
+ "provisioning_state": "Succeeded"
16
+ }
17
+ }'
18
+ result = MsRestAzure::AzureOperationResponse.new(MsRest::HttpOperationRequest.new('', '', ''), Faraday::Response.new)
19
+ result.body = Azure::ARM::Resources::Models::ResourceGroup.deserialize_object(JSON.load(body))
20
+ result
21
+ end
22
+
23
+ def self.list_resource_group_response
24
+ body = '{
25
+ "value": [ {
26
+ "id": "/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg",
27
+ "name": "fog-test-rg",
28
+ "location": "westus",
29
+ "tags": {
30
+ "tagname1": "tagvalue1"
31
+ },
32
+ "properties": {
33
+ "provisioning_state": "Succeeded"
34
+ }
35
+ } ],
36
+ "nextLink": "https://management.azure.com/subscriptions/########-####-####-####-############/resourcegroups?api-version=2015-01-01&$skiptoken=######"
37
+ }'
38
+ result = MsRestAzure::AzureOperationResponse.new(MsRest::HttpOperationRequest.new('', '', ''), Faraday::Response.new)
39
+ result.body = Azure::ARM::Resources::Models::ResourceGroupListResult.deserialize_object(JSON.load(body))
40
+ result
41
+ end
42
+
43
+ def self.list_resource_groups_for_zones
44
+ resource_group = ::Azure::ARM::Resources::Models::ResourceGroup.new
45
+ resource_group.id = '/subscriptions/########-####-####-####-############/resourceGroups/fog-test-resource-group'
46
+ resource_group.name = 'fog-test-resource-group'
47
+ resource_group.location = 'West US'
48
+ [resource_group]
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,24 @@
1
+ module ApiStub
2
+ module Requests
3
+ module Storage
4
+ # Mock class for Deployment Requests
5
+ class Blob
6
+ def self.test_get_blob_metadata
7
+ container = Azure::Storage::Blob::Blob.new
8
+ container.name = 'Test-blob'
9
+ container.metadata = metadata_response
10
+ container
11
+ end
12
+
13
+ def self.metadata_response
14
+ {
15
+ 'container-name' => 'Test-container',
16
+ 'blob-name' => 'Test-blob',
17
+ 'category' => 'Images',
18
+ 'resolution' => 'High'
19
+ }
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,95 @@
1
+ module ApiStub
2
+ module Requests
3
+ module Storage
4
+ # Mock class for Deployment Requests
5
+ class Container
6
+ def self.test_get_container_metadata
7
+ container = Azure::Storage::Blob::Container::Container.new
8
+ container.name = 'test-container'
9
+ container.metadata = metadata_response
10
+ container
11
+ end
12
+
13
+ def self.metadata_response
14
+ {
15
+ 'container-name' => 'Test-container',
16
+ 'created-by' => 'User',
17
+ 'source-machine' => 'Test-machine',
18
+ 'category' => 'guidance',
19
+ 'doctype' => 'textDocuments'
20
+ }
21
+ end
22
+
23
+ def self.create_container
24
+ {
25
+ 'name' => 'testcontainer1',
26
+ 'properties' =>
27
+ {
28
+ 'last_modified' => 'Mon, 04 Jul 2016 02:50:20 GMT',
29
+ 'etag' => '0x8D3A3B5F017F52D',
30
+ }
31
+ }
32
+ end
33
+
34
+ def self.list_containers
35
+ [
36
+ {
37
+ 'name' => 'testcontainer1',
38
+ 'properties' =>
39
+ {
40
+ 'last_modified' => 'Mon, 04 Jul 2016 02:50:20 GMT',
41
+ 'etag' => '0x8D3A3B5F017F52D',
42
+ 'lease_status' => 'unlocked',
43
+ 'lease_state' => 'available'
44
+ },
45
+ 'metadata' => {}
46
+ },
47
+ {
48
+ 'name' => 'testcontainer2',
49
+ 'properties' =>
50
+ {
51
+ 'last_modified' => 'Tue, 04 Aug 2015 06:01:08 GMT',
52
+ 'etag' => '0x8D29C92176C8352',
53
+ 'lease_status' => 'unlocked',
54
+ 'lease_state' => 'available'
55
+ },
56
+ 'metadata' => {}
57
+ },
58
+ {
59
+ 'name' => 'testcontainer3',
60
+ 'properties' =>
61
+ {
62
+ 'last_modified' => 'Tue, 01 Sep 2015 05:15:36 GMT',
63
+ 'etag' => '0x8D2B28C5EB36458',
64
+ 'lease_status' => 'unlocked',
65
+ 'lease_state' => 'available'
66
+ },
67
+ 'metadata' => {}
68
+ }
69
+ ]
70
+ end
71
+
72
+ def self.get_container_properties
73
+ {
74
+ 'name' => 'testcontainer1',
75
+ 'properties' =>
76
+ {
77
+ 'last_modified' => 'Mon, 04 Jul 2016 02:50:20 GMT',
78
+ 'etag' => '0x8D3A3B5F017F52D',
79
+ 'lease_status' => 'unlocked',
80
+ 'lease_state' => 'available'
81
+ },
82
+ 'metadata' => {}
83
+ }
84
+ end
85
+
86
+ def self.get_container_access_control_list
87
+ [{
88
+ 'name' => 'testcontainer1',
89
+ 'public_access_level' => 'blob'
90
+ }, {}]
91
+ end
92
+ end
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,112 @@
1
+ module ApiStub
2
+ module Requests
3
+ module Storage
4
+ class StorageAccount
5
+ def self.storage_account_request
6
+ body = ' {
7
+ "location": "west us",
8
+ "properties":{
9
+ "accountType": "Standard_LRS"
10
+ }
11
+ }'
12
+ result = MsRestAzure::AzureOperationResponse.new(MsRest::HttpOperationRequest.new('', '', ''), Faraday::Response.new)
13
+ result.body = Azure::ARM::Storage::Models::StorageAccount.deserialize_object(JSON.load(body))
14
+ result
15
+ end
16
+
17
+ def self.create_storage_account
18
+ storage_acc_obj = Azure::ARM::Storage::Models::StorageAccount.new
19
+ storage_acc_obj.id = '1'
20
+ storage_acc_obj.name = 'fog_test_storage_account'
21
+ storage_acc_obj.type = nil
22
+ storage_acc_obj.location = 'west us'
23
+ storage_acc_obj.tags = nil
24
+ storage_acc_obj.properties = nil
25
+ storage_acc_obj
26
+ end
27
+
28
+ def self.list_storage_accounts_for_rg
29
+ {
30
+ 'value' =>
31
+ [
32
+ {
33
+ 'id' => '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}',
34
+ 'name' => 'accountName1',
35
+ 'location' => 'account geo region',
36
+ 'tags' =>
37
+ {
38
+ 'key1' => 'value1',
39
+ 'key2' => 'value2'
40
+ },
41
+ 'type' => 'Microsoft.Storage/StorageAccount',
42
+ 'properties' =>
43
+ {
44
+ 'lastGeoFailoverTime' => '',
45
+ 'creationTime' => '2016-05-18T07:24:40Z'
46
+ }
47
+ }
48
+ ]
49
+ }
50
+ end
51
+
52
+ def self.list_storage_accounts
53
+ {
54
+ 'value' =>
55
+ [
56
+ {
57
+ 'id' => '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}',
58
+ 'name' => 'accountName1',
59
+ 'type' => 'Microsoft.Storage/StorageAccount',
60
+ 'location' => 'account geo region',
61
+ 'tags' =>
62
+ {
63
+ 'key1' => 'value1',
64
+ 'key2' => 'value2'
65
+ },
66
+ 'properties' =>
67
+ {
68
+ 'lastGeoFailoverTime' => '',
69
+ 'creationTime' => '2016-05-18T07:24:40Z'
70
+ }
71
+ }
72
+ ]
73
+ }
74
+ end
75
+
76
+ def self.true_case_for_check_name_availability
77
+ {
78
+ 'nameAvailable' => true,
79
+ 'reason' => 'AccountNameInvalid|AlreadyExists',
80
+ 'message' => 'error message'
81
+ }
82
+ end
83
+
84
+ def self.false_case_for_check_name_availability
85
+ {
86
+ 'nameAvailable' => false,
87
+ 'reason' => 'AccountNameInvalid|AlreadyExists',
88
+ 'message' => 'error message'
89
+ }
90
+ end
91
+
92
+ def self.azure_operation_response(body)
93
+ MsRestAzure::AzureOperationResponse.new(MsRest::HttpOperationRequest.new('', '', ''), Faraday::Response.new, Azure::ARM::Storage::Models::CheckNameAvailabilityResult.deserialize_object(body))
94
+ end
95
+
96
+ def self.response_storage_account_list(body)
97
+ MsRestAzure::AzureOperationResponse.new(MsRest::HttpOperationRequest.new('', '', ''), Faraday::Response.new, Azure::ARM::Storage::Models::StorageAccountListResult.deserialize_object(body))
98
+ end
99
+
100
+ def self.list_keys_response
101
+ body = '{
102
+ "key1": "key1 value",
103
+ "key2": "key2 value"
104
+ }'
105
+ result = MsRestAzure::AzureOperationResponse.new(MsRest::HttpOperationRequest.new('', '', ''), Faraday::Response.new)
106
+ result.body = Azure::ARM::Storage::Models::StorageAccountKeys.deserialize_object(JSON.load(body))
107
+ result
108
+ end
109
+ end
110
+ end
111
+ end
112
+ end