fog-azure-rm 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (277) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -0
  3. data/README.md +2 -1
  4. data/fog-azure-rm.gemspec +11 -9
  5. data/lib/fog/azurerm.rb +1 -0
  6. data/lib/fog/azurerm/compute.rb +3 -3
  7. data/lib/fog/azurerm/config.rb +33 -0
  8. data/lib/fog/azurerm/credentials.rb +1 -1
  9. data/lib/fog/azurerm/dns.rb +2 -2
  10. data/lib/fog/azurerm/docs/storage.md +120 -66
  11. data/lib/fog/azurerm/models/application_gateway/gateway.rb +30 -31
  12. data/lib/fog/azurerm/models/application_gateway/gateways.rb +4 -4
  13. data/lib/fog/azurerm/models/compute/availability_sets.rb +4 -4
  14. data/lib/fog/azurerm/models/compute/server.rb +14 -14
  15. data/lib/fog/azurerm/models/compute/servers.rb +4 -4
  16. data/lib/fog/azurerm/models/compute/virtual_machine_extension.rb +3 -5
  17. data/lib/fog/azurerm/models/compute/virtual_machine_extensions.rb +5 -5
  18. data/lib/fog/azurerm/models/dns/record_sets.rb +4 -4
  19. data/lib/fog/azurerm/models/dns/zones.rb +4 -4
  20. data/lib/fog/azurerm/models/network/express_route_circuit.rb +2 -5
  21. data/lib/fog/azurerm/models/network/express_route_circuit_authorization.rb +1 -1
  22. data/lib/fog/azurerm/models/network/express_route_circuit_authorizations.rb +4 -4
  23. data/lib/fog/azurerm/models/network/express_route_circuit_peering.rb +3 -5
  24. data/lib/fog/azurerm/models/network/express_route_circuit_peerings.rb +4 -4
  25. data/lib/fog/azurerm/models/network/express_route_circuits.rb +4 -4
  26. data/lib/fog/azurerm/models/network/express_route_service_providers.rb +2 -2
  27. data/lib/fog/azurerm/models/network/load_balancers.rb +5 -5
  28. data/lib/fog/azurerm/models/network/local_network_gateway.rb +1 -1
  29. data/lib/fog/azurerm/models/network/local_network_gateways.rb +4 -4
  30. data/lib/fog/azurerm/models/network/network_interfaces.rb +5 -5
  31. data/lib/fog/azurerm/models/network/network_security_groups.rb +5 -5
  32. data/lib/fog/azurerm/models/network/network_security_rule.rb +3 -4
  33. data/lib/fog/azurerm/models/network/network_security_rules.rb +4 -4
  34. data/lib/fog/azurerm/models/network/public_ips.rb +4 -4
  35. data/lib/fog/azurerm/models/network/subnets.rb +4 -4
  36. data/lib/fog/azurerm/models/network/virtual_network_gateway.rb +6 -7
  37. data/lib/fog/azurerm/models/network/virtual_network_gateway_connection.rb +5 -5
  38. data/lib/fog/azurerm/models/network/virtual_network_gateway_connections.rb +4 -4
  39. data/lib/fog/azurerm/models/network/virtual_network_gateways.rb +4 -4
  40. data/lib/fog/azurerm/models/network/virtual_networks.rb +4 -4
  41. data/lib/fog/azurerm/models/resources/azure_resources.rb +2 -2
  42. data/lib/fog/azurerm/models/resources/deployments.rb +4 -4
  43. data/lib/fog/azurerm/models/resources/resource_groups.rb +4 -4
  44. data/lib/fog/azurerm/models/sql/firewall_rule.rb +1 -1
  45. data/lib/fog/azurerm/models/sql/firewall_rules.rb +4 -4
  46. data/lib/fog/azurerm/models/sql/sql_database.rb +28 -24
  47. data/lib/fog/azurerm/models/sql/sql_databases.rb +5 -6
  48. data/lib/fog/azurerm/models/sql/sql_servers.rb +4 -4
  49. data/lib/fog/azurerm/models/storage/directories.rb +49 -24
  50. data/lib/fog/azurerm/models/storage/directory.rb +126 -40
  51. data/lib/fog/azurerm/models/storage/file.rb +226 -114
  52. data/lib/fog/azurerm/models/storage/files.rb +168 -13
  53. data/lib/fog/azurerm/models/storage/recovery_vault.rb +1 -1
  54. data/lib/fog/azurerm/models/storage/recovery_vaults.rb +4 -4
  55. data/lib/fog/azurerm/models/storage/storage_account.rb +5 -5
  56. data/lib/fog/azurerm/models/storage/storage_accounts.rb +4 -4
  57. data/lib/fog/azurerm/models/traffic_manager/traffic_manager_end_point.rb +1 -1
  58. data/lib/fog/azurerm/models/traffic_manager/traffic_manager_end_points.rb +4 -4
  59. data/lib/fog/azurerm/models/traffic_manager/traffic_manager_profile.rb +4 -4
  60. data/lib/fog/azurerm/models/traffic_manager/traffic_manager_profiles.rb +4 -4
  61. data/lib/fog/azurerm/network.rb +1 -1
  62. data/lib/fog/azurerm/requests/compute/create_virtual_machine.rb +17 -13
  63. data/lib/fog/azurerm/requests/network/list_virtual_networks.rb +1 -1
  64. data/lib/fog/azurerm/requests/resources/create_deployment.rb +1 -1
  65. data/lib/fog/azurerm/requests/resources/create_resource_group.rb +1 -1
  66. data/lib/fog/azurerm/requests/resources/delete_deployment.rb +1 -1
  67. data/lib/fog/azurerm/requests/resources/delete_resource_group.rb +1 -1
  68. data/lib/fog/azurerm/requests/resources/get_deployment.rb +1 -1
  69. data/lib/fog/azurerm/requests/resources/get_resource_group.rb +1 -1
  70. data/lib/fog/azurerm/requests/resources/list_deployments.rb +1 -1
  71. data/lib/fog/azurerm/requests/resources/list_resource_groups.rb +1 -1
  72. data/lib/fog/azurerm/requests/resources/list_tagged_resources.rb +1 -1
  73. data/lib/fog/azurerm/requests/resources/tag_resource.rb +1 -1
  74. data/lib/fog/azurerm/requests/sql/create_or_update_database.rb +3 -3
  75. data/lib/fog/azurerm/requests/sql/create_or_update_firewall_rule.rb +3 -3
  76. data/lib/fog/azurerm/requests/sql/create_or_update_sql_server.rb +3 -3
  77. data/lib/fog/azurerm/requests/sql/delete_database.rb +2 -2
  78. data/lib/fog/azurerm/requests/sql/delete_firewall_rule.rb +4 -4
  79. data/lib/fog/azurerm/requests/sql/delete_sql_server.rb +4 -4
  80. data/lib/fog/azurerm/requests/sql/get_database.rb +3 -3
  81. data/lib/fog/azurerm/requests/sql/get_firewall_rule.rb +3 -3
  82. data/lib/fog/azurerm/requests/sql/get_sql_server.rb +3 -3
  83. data/lib/fog/azurerm/requests/sql/list_databases.rb +3 -3
  84. data/lib/fog/azurerm/requests/sql/list_firewall_rules.rb +3 -3
  85. data/lib/fog/azurerm/requests/sql/list_sql_servers.rb +3 -3
  86. data/lib/fog/azurerm/requests/storage/acquire_blob_lease.rb +5 -2
  87. data/lib/fog/azurerm/requests/storage/acquire_container_lease.rb +5 -2
  88. data/lib/fog/azurerm/requests/storage/commit_blob_blocks.rb +30 -0
  89. data/lib/fog/azurerm/requests/storage/compare_container_blobs.rb +148 -0
  90. data/lib/fog/azurerm/requests/storage/copy_blob.rb +8 -8
  91. data/lib/fog/azurerm/requests/storage/copy_blob_from_uri.rb +8 -8
  92. data/lib/fog/azurerm/requests/storage/create_block_blob.rb +108 -0
  93. data/lib/fog/azurerm/requests/storage/create_container.rb +12 -10
  94. data/lib/fog/azurerm/requests/storage/create_disk.rb +45 -19
  95. data/lib/fog/azurerm/requests/storage/create_or_update_recovery_vault.rb +2 -2
  96. data/lib/fog/azurerm/requests/storage/create_page_blob.rb +31 -0
  97. data/lib/fog/azurerm/requests/storage/create_storage_account.rb +2 -2
  98. data/lib/fog/azurerm/requests/storage/delete_blob.rb +10 -5
  99. data/lib/fog/azurerm/requests/storage/delete_container.rb +6 -2
  100. data/lib/fog/azurerm/requests/storage/delete_disk.rb +19 -16
  101. data/lib/fog/azurerm/requests/storage/get_all_backup_jobs.rb +2 -2
  102. data/lib/fog/azurerm/requests/storage/get_backup_container.rb +2 -2
  103. data/lib/fog/azurerm/requests/storage/get_backup_item.rb +2 -2
  104. data/lib/fog/azurerm/requests/storage/get_backup_job_for_vm.rb +1 -1
  105. data/lib/fog/azurerm/requests/storage/get_backup_protection_policy.rb +2 -2
  106. data/lib/fog/azurerm/requests/storage/get_blob.rb +163 -0
  107. data/lib/fog/azurerm/requests/storage/get_blob_http_url.rb +39 -0
  108. data/lib/fog/azurerm/requests/storage/get_blob_https_url.rb +39 -0
  109. data/lib/fog/azurerm/requests/storage/get_blob_properties.rb +37 -35
  110. data/lib/fog/azurerm/requests/storage/get_blob_url.rb +28 -0
  111. data/lib/fog/azurerm/requests/storage/get_container_acl.rb +30 -0
  112. data/lib/fog/azurerm/requests/storage/get_container_properties.rb +16 -12
  113. data/lib/fog/azurerm/requests/storage/get_container_url.rb +34 -0
  114. data/lib/fog/azurerm/requests/storage/get_recovery_vault.rb +2 -2
  115. data/lib/fog/azurerm/requests/storage/get_storage_access_keys.rb +4 -3
  116. data/lib/fog/azurerm/requests/storage/get_storage_account.rb +2 -2
  117. data/lib/fog/azurerm/requests/storage/list_blobs.rb +110 -24
  118. data/lib/fog/azurerm/requests/storage/list_containers.rb +46 -23
  119. data/lib/fog/azurerm/requests/storage/list_recovery_vaults.rb +2 -2
  120. data/lib/fog/azurerm/requests/storage/list_storage_account_for_rg.rb +2 -2
  121. data/lib/fog/azurerm/requests/storage/list_storage_accounts.rb +2 -2
  122. data/lib/fog/azurerm/requests/storage/multipart_save_block_blob.rb +110 -0
  123. data/lib/fog/azurerm/requests/storage/put_blob_block.rb +30 -0
  124. data/lib/fog/azurerm/requests/storage/{set_blob_metadata.rb → put_blob_metadata.rb} +7 -3
  125. data/lib/fog/azurerm/requests/storage/put_blob_pages.rb +30 -0
  126. data/lib/fog/azurerm/requests/storage/put_blob_properties.rb +31 -0
  127. data/lib/fog/azurerm/requests/storage/put_container_acl.rb +31 -0
  128. data/lib/fog/azurerm/requests/storage/{set_container_metadata.rb → put_container_metadata.rb} +7 -3
  129. data/lib/fog/azurerm/requests/storage/release_blob_lease.rb +4 -1
  130. data/lib/fog/azurerm/requests/storage/release_container_lease.rb +4 -1
  131. data/lib/fog/azurerm/requests/storage/save_page_blob.rb +111 -0
  132. data/lib/fog/azurerm/requests/storage/start_backup.rb +1 -1
  133. data/lib/fog/azurerm/requests/storage/wait_blob_copy_operation_to_finish.rb +56 -0
  134. data/lib/fog/azurerm/resources.rb +2 -2
  135. data/lib/fog/azurerm/storage.rb +33 -19
  136. data/lib/fog/azurerm/traffic_manager.rb +1 -1
  137. data/lib/fog/azurerm/utilities/general.rb +70 -3
  138. data/lib/fog/azurerm/version.rb +1 -1
  139. data/rake-script.sh +5 -2
  140. data/test/api_stub/models/application_gateway/gateway.rb +1 -1
  141. data/test/api_stub/models/compute/server.rb +1 -1
  142. data/test/api_stub/models/dns/record_set.rb +2 -2
  143. data/test/api_stub/models/dns/zone.rb +1 -1
  144. data/test/api_stub/models/network/express_route_circuit.rb +1 -1
  145. data/test/api_stub/models/network/express_route_circuit_authorization.rb +1 -1
  146. data/test/api_stub/models/network/express_route_circuit_peering.rb +1 -1
  147. data/test/api_stub/models/network/express_route_service_provider.rb +1 -1
  148. data/test/api_stub/models/network/load_balancer.rb +1 -1
  149. data/test/api_stub/models/network/network_interface.rb +1 -1
  150. data/test/api_stub/models/network/network_security_group.rb +1 -1
  151. data/test/api_stub/models/network/network_security_rule.rb +1 -1
  152. data/test/api_stub/models/network/public_ip.rb +1 -1
  153. data/test/api_stub/models/network/subnet.rb +1 -1
  154. data/test/api_stub/models/network/virtual_network.rb +1 -1
  155. data/test/api_stub/models/network/virtual_network_gateway.rb +1 -1
  156. data/test/api_stub/models/network/virtual_network_gateway_connection.rb +1 -1
  157. data/test/api_stub/models/resources/resource.rb +2 -2
  158. data/test/api_stub/models/resources/resource_group.rb +1 -1
  159. data/test/api_stub/models/storage/directory.rb +148 -62
  160. data/test/api_stub/models/storage/file.rb +122 -119
  161. data/test/api_stub/models/traffic_manager/traffic_manager_end_point.rb +1 -1
  162. data/test/api_stub/models/traffic_manager/traffic_manager_profile.rb +1 -1
  163. data/test/api_stub/requests/application_gateway/gateway.rb +2 -2
  164. data/test/api_stub/requests/compute/availability_set.rb +3 -3
  165. data/test/api_stub/requests/compute/virtual_machine.rb +9 -9
  166. data/test/api_stub/requests/dns/record_set.rb +3 -3
  167. data/test/api_stub/requests/dns/zone.rb +18 -18
  168. data/test/api_stub/requests/network/express_route_circuit.rb +2 -2
  169. data/test/api_stub/requests/network/express_route_circuit_authorization.rb +1 -1
  170. data/test/api_stub/requests/network/express_route_circuit_peering.rb +2 -2
  171. data/test/api_stub/requests/network/express_route_service_provider.rb +1 -1
  172. data/test/api_stub/requests/network/load_balancer.rb +2 -2
  173. data/test/api_stub/requests/network/network_interface.rb +4 -4
  174. data/test/api_stub/requests/network/network_security_group.rb +3 -3
  175. data/test/api_stub/requests/network/network_security_rule.rb +2 -2
  176. data/test/api_stub/requests/network/public_ip.rb +2 -2
  177. data/test/api_stub/requests/network/subnet.rb +2 -2
  178. data/test/api_stub/requests/network/virtual_network.rb +2 -2
  179. data/test/api_stub/requests/network/virtual_network_gateway.rb +2 -2
  180. data/test/api_stub/requests/network/virtual_network_gateway_connection.rb +3 -3
  181. data/test/api_stub/requests/resources/resource.rb +2 -2
  182. data/test/api_stub/requests/resources/resource_group.rb +2 -2
  183. data/test/api_stub/requests/storage/directory.rb +59 -65
  184. data/test/api_stub/requests/storage/file.rb +183 -113
  185. data/test/api_stub/requests/storage/storageaccount.rb +1 -1
  186. data/test/api_stub/requests/traffic_manager/traffic_manager_endpoint.rb +1 -1
  187. data/test/api_stub/requests/traffic_manager/traffic_manager_profile.rb +2 -2
  188. data/test/integration/Virtual_network_gateway_connection.rb +189 -182
  189. data/test/integration/application_gateway.rb +208 -183
  190. data/test/integration/availability_set.rb +44 -27
  191. data/test/integration/blob.rb +293 -169
  192. data/test/integration/container.rb +93 -42
  193. data/test/integration/data_disk.rb +57 -46
  194. data/test/integration/deployment.rb +40 -32
  195. data/test/integration/express_route_circuit.rb +86 -82
  196. data/test/integration/external_load_balancer.rb +108 -100
  197. data/test/integration/internal_load_balancer.rb +115 -106
  198. data/test/integration/local_network_gateway.rb +46 -39
  199. data/test/integration/network_interface.rb +119 -107
  200. data/test/integration/network_security_group.rb +86 -74
  201. data/test/integration/network_security_rule.rb +65 -57
  202. data/test/integration/public_ip.rb +50 -42
  203. data/test/integration/record_set.rb +90 -78
  204. data/test/integration/resource_group.rb +26 -14
  205. data/test/integration/resource_tag.rb +56 -45
  206. data/test/integration/server.rb +152 -135
  207. data/test/integration/server_custom_image.rb +85 -76
  208. data/test/integration/sql_server.rb +130 -117
  209. data/test/integration/storage_account.rb +82 -70
  210. data/test/integration/subnet.rb +87 -74
  211. data/test/integration/traffic_manager.rb +86 -74
  212. data/test/integration/virtual_machine_extension.rb +115 -106
  213. data/test/integration/virtual_network.rb +121 -100
  214. data/test/integration/virtual_network_gateway.rb +86 -79
  215. data/test/integration/virtual_network_gateway_connection_to_express_route.rb +94 -87
  216. data/test/integration/zone.rb +36 -28
  217. data/test/models/storage/test_directories.rb +26 -71
  218. data/test/models/storage/test_directory.rb +111 -58
  219. data/test/models/storage/test_file.rb +179 -143
  220. data/test/models/storage/test_files.rb +197 -30
  221. data/test/models/storage/test_storage_account.rb +1 -1
  222. data/test/requests/compute/test_attach_data_disk_to_vm.rb +15 -17
  223. data/test/requests/storage/test_acquire_blob_lease.rb +23 -4
  224. data/test/requests/storage/test_acquire_container_lease.rb +24 -5
  225. data/test/requests/storage/test_commit_blob_blocks.rb +34 -0
  226. data/test/requests/storage/test_compare_container_blobs.rb +36 -0
  227. data/test/requests/storage/test_copy_blob.rb +22 -3
  228. data/test/requests/storage/test_copy_blob_from_uri.rb +23 -4
  229. data/test/requests/storage/test_create_block_blob.rb +80 -0
  230. data/test/requests/storage/test_create_container.rb +18 -13
  231. data/test/requests/storage/test_create_disk.rb +57 -4
  232. data/test/requests/storage/test_create_page_blob.rb +34 -0
  233. data/test/requests/storage/test_delete_blob.rb +25 -5
  234. data/test/requests/storage/test_delete_container.rb +21 -9
  235. data/test/requests/storage/test_delete_disk.rb +14 -7
  236. data/test/requests/storage/test_get_blob.rb +141 -0
  237. data/test/requests/storage/test_get_blob_http_url.rb +30 -0
  238. data/test/requests/storage/test_get_blob_https_url.rb +30 -0
  239. data/test/requests/storage/test_get_blob_properties.rb +29 -7
  240. data/test/requests/storage/test_get_blob_url.rb +33 -0
  241. data/test/requests/storage/test_get_container_acl.rb +37 -0
  242. data/test/requests/storage/test_get_container_properties.rb +25 -11
  243. data/test/requests/storage/test_get_container_url.rb +33 -0
  244. data/test/requests/storage/test_list_blobs.rb +77 -0
  245. data/test/requests/storage/test_list_containers.rb +38 -7
  246. data/test/requests/storage/test_multipart_save_block_blob.rb +105 -0
  247. data/test/requests/storage/test_put_blob_block.rb +34 -0
  248. data/test/requests/storage/test_put_blob_metadata.rb +36 -0
  249. data/test/requests/storage/test_put_blob_pages.rb +34 -0
  250. data/test/requests/storage/test_put_blob_properties.rb +39 -0
  251. data/test/requests/storage/test_put_container_acl.rb +34 -0
  252. data/test/requests/storage/test_put_container_metadata.rb +36 -0
  253. data/test/requests/storage/test_release_blob_lease.rb +20 -2
  254. data/test/requests/storage/test_release_container_lease.rb +21 -3
  255. data/test/requests/storage/test_save_page_blob.rb +115 -0
  256. data/test/requests/storage/test_wait_blob_copy_operation_to_finish.rb +148 -0
  257. data/test/test_helper.rb +34 -21
  258. metadata +92 -46
  259. data/lib/fog/azurerm/requests/storage/check_blob_exist.rb +0 -25
  260. data/lib/fog/azurerm/requests/storage/compare_blob.rb +0 -73
  261. data/lib/fog/azurerm/requests/storage/download_blob_to_file.rb +0 -56
  262. data/lib/fog/azurerm/requests/storage/get_blob_metadata.rb +0 -59
  263. data/lib/fog/azurerm/requests/storage/get_container_access_control_list.rb +0 -30
  264. data/lib/fog/azurerm/requests/storage/get_container_metadata.rb +0 -32
  265. data/lib/fog/azurerm/requests/storage/set_blob_properties.rb +0 -26
  266. data/lib/fog/azurerm/requests/storage/upload_block_blob_from_file.rb +0 -60
  267. data/test/requests/storage/test_check_blob_exist.rb +0 -17
  268. data/test/requests/storage/test_compare_blob.rb +0 -17
  269. data/test/requests/storage/test_download_blob_to_file.rb +0 -25
  270. data/test/requests/storage/test_get_blob_metadata.rb +0 -18
  271. data/test/requests/storage/test_get_container_access_control_list.rb +0 -31
  272. data/test/requests/storage/test_get_container_metadata.rb +0 -18
  273. data/test/requests/storage/test_list_blobs_in_container.rb +0 -23
  274. data/test/requests/storage/test_set_blob_metadata.rb +0 -17
  275. data/test/requests/storage/test_set_blob_properties.rb +0 -16
  276. data/test/requests/storage/test_set_container_metadata.rb +0 -17
  277. data/test/requests/storage/test_upload_block_blob_from_file.rb +0 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fcef6aa93014d6ab06b64750d6ab060e209f8d68
4
- data.tar.gz: 35bc5f202cb58139facb70944270721c96436ab1
3
+ metadata.gz: 15dd6d696881e8c4cee014dda7af43a3d8cc764f
4
+ data.tar.gz: 4b5d62e0d1e723cc7eb3a972caf1b291d59ad5d9
5
5
  SHA512:
6
- metadata.gz: 360d9b598b28e2669f160425a05fd6996d764e52b943cc626ec6df995b2c3754cecc895d404bbade9af4cfa63bb674e6e430cf2b6e284309c4b5c89a407d511b
7
- data.tar.gz: 67912e5342afef2657d176406f39a0239377f40d3240e04567641e3c88f5fefa2f513006ce05d9c82780692937ebf47f2c89e5f29b75d75b937b479083045f89
6
+ metadata.gz: afc8b7054bd8b01ff6d47caae60f4482aede6bdb4c2e01cb70cf273b615e0867c013fdf5260d79a1f7fdff077096d61680f218c7dac41c7785418e54157d8fa0
7
+ data.tar.gz: d9c876d9da40fd246df634beb2d6eb35e696e7f90f0f7c1aa8715cfd816c1adeae0ca490490b625224f93d7afc7e2ad8abbd4f3945607a2555a7f6dae9548929
data/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ ## 0.1.1
2
+
3
+ **Added:**
4
+ - Storage Service - Multi-thread support for uploading blobs
5
+ - Added support for all Azure locations(Global, China, Gov and Germany)
6
+
7
+ **Changed:**
8
+ * Updated fog-azure-rm runtime gem dependencies to latest:
9
+ * azure_mgmt_compute 0.7.0
10
+ * azure_mgmt_network 0.7.0
11
+ * azure_mgmt_resources 0.7.0
12
+ * azure_mgmt_storage 0.7.0
13
+ * azure_mgmt_dns 0.7.0
14
+ * azure_mgmt_traffic_manager 0.7.0
15
+ * azure-storage 0.11.3.preview'
16
+ * Provided same storage interfaces as other providers (PR: 204)
17
+ * Updated Data Disk operations (PR: 220)
18
+ * Updated namespaces
19
+ * Updated integration scripts
20
+
1
21
  ## 0.1.0
2
22
 
3
23
  **Added:**
data/README.md CHANGED
@@ -33,7 +33,8 @@ Or install it yourself as:
33
33
  ## Usage
34
34
 
35
35
  You can use this gem against the Microsoft Azure Resource Manager Services in the cloud. Of course, to use the Microsoft Azure Resource Manager Services in the cloud, you need to first [create a Microsoft Azure account](http://www.azure.com/en-us/pricing/free-trial/).
36
-
36
+ * Set 'CLOUD' constant from 'Azure', 'AzureChina', 'AzureGermanCloud' or 'AzureUSGovernment' in [config.rb] (https://github.com/fog/fog-azure-rm/blob/master/lib/fog/azurerm/config.rb) file. By default it will be 'Azure' (Azure Global).
37
+ * Set 'LOCATION' constant based on the Azure cloud you are using in [config.rb] (https://github.com/fog/fog-azure-rm/blob/master/lib/fog/azurerm/config.rb) file. By default it will be 'eastus'.
37
38
 
38
39
  ### Authentication
39
40
 
data/fog-azure-rm.gemspec CHANGED
@@ -20,15 +20,17 @@ Gem::Specification.new do |spec|
20
20
  spec.post_install_message = 'Thanks for installing!'
21
21
  spec.add_development_dependency 'rake', '~> 10.0'
22
22
  spec.add_development_dependency 'minitest', '~> 5.8.4'
23
- spec.add_development_dependency 'simplecov', '~> 0.11.2'
24
- spec.add_development_dependency 'codeclimate-test-reporter'
23
+ spec.add_development_dependency 'simplecov'
24
+ spec.add_development_dependency 'codeclimate-test-reporter' , '~> 1.0.0'
25
25
  spec.add_dependency 'fog-core', '~> 1.43.0'
26
+ spec.add_dependency 'fog-json', '~> 1.0'
26
27
  spec.add_dependency 'rest-client', '~> 2.0.0'
27
- spec.add_dependency 'azure_mgmt_compute', '~> 0.6.0'
28
- spec.add_dependency 'azure_mgmt_resources', '~> 0.6.0'
29
- spec.add_dependency 'azure_mgmt_storage', '~> 0.6.0'
30
- spec.add_dependency 'azure_mgmt_network', '~> 0.6.0'
31
- spec.add_dependency 'azure_mgmt_dns', '~> 0.6.0'
32
- spec.add_dependency 'azure_mgmt_traffic_manager', '~> 0.6.0'
33
- spec.add_dependency 'azure-storage', '~> 0.11.1.preview'
28
+ spec.add_dependency 'azure_mgmt_compute', '~> 0.7.0'
29
+ spec.add_dependency 'azure_mgmt_resources', '~> 0.7.0'
30
+ spec.add_dependency 'azure_mgmt_storage', '~> 0.7.0'
31
+ spec.add_dependency 'azure_mgmt_network', '~> 0.7.0'
32
+ spec.add_dependency 'azure_mgmt_dns', '~> 0.7.0'
33
+ spec.add_dependency 'azure_mgmt_traffic_manager', '~> 0.7.0'
34
+ spec.add_dependency 'azure-storage', '~> 0.11.3.preview'
35
+ spec.add_dependency 'vhd', '0.0.4'
34
36
  end
data/lib/fog/azurerm.rb CHANGED
@@ -5,6 +5,7 @@ require 'fog/azurerm/config'
5
5
  require 'fog/azurerm/utilities/general'
6
6
  require 'fog/azurerm/version'
7
7
  require 'fog/core'
8
+ require 'fog/json'
8
9
 
9
10
  module Fog
10
11
  # Autoload Module for Credentials
@@ -49,7 +49,7 @@ module Fog
49
49
  end
50
50
  end
51
51
  end
52
- # This class provides the actual implemention for service calls.
52
+ # This class provides the actual implementation for service calls.
53
53
  class Real
54
54
  def initialize(options)
55
55
  begin
@@ -62,9 +62,9 @@ module Fog
62
62
  end
63
63
 
64
64
  credentials = Fog::Credentials::AzureRM.get_credentials(options[:tenant_id], options[:client_id], options[:client_secret])
65
- @compute_mgmt_client = ::Azure::ARM::Compute::ComputeManagementClient.new(credentials)
65
+ @compute_mgmt_client = ::Azure::ARM::Compute::ComputeManagementClient.new(credentials, resource_manager_endpoint_url)
66
66
  @compute_mgmt_client.subscription_id = options[:subscription_id]
67
- @storage_mgmt_client = ::Azure::ARM::Storage::StorageManagementClient.new(credentials)
67
+ @storage_mgmt_client = ::Azure::ARM::Storage::StorageManagementClient.new(credentials, resource_manager_endpoint_url)
68
68
  @storage_mgmt_client.subscription_id = options[:subscription_id]
69
69
  @storage_service = Fog::Storage::AzureRM.new(tenant_id: options[:tenant_id], client_id: options[:client_id], client_secret: options[:client_secret], subscription_id: options[:subscription_id])
70
70
  end
@@ -20,3 +20,36 @@ AZURE_ENDPOINTS = 'azureEndpoints'.freeze
20
20
  EXTERNAL_ENDPOINTS = 'externalEndpoints'.freeze
21
21
  NESTED_ENDPOINTS = 'nestedEndpoints'.freeze
22
22
  GLOBAL = 'global'.freeze
23
+ UPLOAD_BLOB_WORKER_THREAD_COUNT = 8
24
+ VM_NAME_POSITION = 8
25
+
26
+ # Set a CLOUD value from 'Azure', 'AzureChina', 'AzureGermanCloud' and 'AzureUSGovernment'
27
+ CLOUD = 'Azure'.freeze
28
+
29
+ AZURE_GLOBAL_RM_ENDPOINT_URL = 'https://management.azure.com/'.freeze
30
+ AZURE_CHINA_RM_ENDPOINT_URL = 'https://management.chinacloudapi.cn'.freeze
31
+ GERMAN_CLOUD_RM_ENDPOINT_URL = 'https://management.microsoftazure.de'.freeze
32
+ US_GOVERNMENT_RM_ENDPOINT_URL = 'https://management.usgovcloudapi.net'.freeze
33
+
34
+ LOCATION = 'eastus'.freeze
35
+
36
+ # State of the copy operation
37
+ COPY_STATUS = {
38
+ # The copy completed successfully.
39
+ SUCCESS: 'success',
40
+ # The copy is in progress
41
+ PENDING: 'pending'
42
+ }.freeze
43
+
44
+ # https://msdn.microsoft.com/en-us/library/azure/dd179451.aspx
45
+ # The maximum size for a block blob created via Put Blob is 64 MB. But for better performance, this size should be 32 MB.
46
+ # If your blob is larger than 32 MB, you must upload it as a set of blocks.
47
+ SINGLE_BLOB_PUT_THRESHOLD = 32 * 1024 * 1024
48
+
49
+ # Block blob: https://msdn.microsoft.com/en-us/library/azure/dd135726.aspx
50
+ # Page blob: https://msdn.microsoft.com/en-us/library/azure/ee691975.aspx
51
+ # Each block/page can be a different size, up to a maximum of 4 MB
52
+ MAXIMUM_CHUNK_SIZE = 4 * 1024 * 1024
53
+
54
+ # The hash value of 4MB empty content
55
+ HASH_OF_4MB_EMPTY_CONTENT = 'b5cfa9d6c8febd618f91ac2843d50a1c'.freeze
@@ -20,7 +20,7 @@ module Fog
20
20
  @client_id = client_id
21
21
  @client_secret = client_secret
22
22
  return if @tenant_id.nil? || @client_id.nil? || @client_secret.nil?
23
- @token_provider = MsRestAzure::ApplicationTokenProvider.new(@tenant_id, @client_id, @client_secret)
23
+ @token_provider = MsRestAzure::ApplicationTokenProvider.new(@tenant_id, @client_id, @client_secret, active_directory_service_settings)
24
24
  @credentials = MsRest::TokenCredentials.new(@token_provider)
25
25
  @credentials
26
26
  end
@@ -31,7 +31,7 @@ module Fog
31
31
  end
32
32
  end
33
33
 
34
- # This class provides the actual implemention for service calls.
34
+ # This class provides the actual implementation for service calls.
35
35
  class Real
36
36
  def initialize(options)
37
37
  begin
@@ -42,7 +42,7 @@ module Fog
42
42
  end
43
43
 
44
44
  credentials = Fog::Credentials::AzureRM.get_credentials(options[:tenant_id], options[:client_id], options[:client_secret])
45
- @dns_client = ::Azure::ARM::Dns::DnsManagementClient.new(credentials)
45
+ @dns_client = ::Azure::ARM::Dns::DnsManagementClient.new(credentials, resource_manager_endpoint_url)
46
46
  @dns_client.subscription_id = options[:subscription_id]
47
47
  @tenant_id = options[:tenant_id]
48
48
  @client_id = options[:client_id]
@@ -163,10 +163,11 @@ azure_storage_service.delete_disk('<Data Disk Name>')
163
163
  Create a storage container in the current storage account.
164
164
 
165
165
  ```ruby
166
- container = azure_storage_service.create_container(
167
- name: '<container name>'
166
+ directory = azure_storage_service.directories.create(
167
+ key: '<container name>',
168
+ public: true
168
169
  )
169
- puts "#{container.name}"
170
+ puts directory.key
170
171
  ```
171
172
 
172
173
  ## List storage containers
@@ -175,18 +176,39 @@ List all the storage containers in the current storage accounts.
175
176
 
176
177
  ```ruby
177
178
  azure_storage_service.directories.each do |directory|
178
- puts "#{directory.name}"
179
+ puts directory.key
179
180
  end
180
181
  ```
181
182
 
182
- ## Get the access control list of the storage container
183
+ ## Get the access control level of the storage container
183
184
 
184
185
  Get the permissions for the specified container. The permissions indicate whether container data may be accessed publicly.
185
186
 
186
187
  ```ruby
187
- directory = azure_storage_service.directories.get('<container name>')
188
- access_control_list = directory.get_access_control_list('<container name>')
189
- puts "#{access_control_list.inspect}"
188
+ directory = azure_storage_service.directories.get('<Container Name>', max_results: 1)
189
+ puts directory.acl
190
+ ```
191
+
192
+ ## Set the access control level of the storage container
193
+
194
+ Set the permissions for the specified container. The permissions indicate whether container data may be accessed publicly. The container permissions provide the following options for managing container access:
195
+
196
+ - container
197
+
198
+ Full public read access. Container and blob data can be read via anonymous request. Clients can enumerate blobs within the container via anonymous request, but cannot enumerate containers within the storage account.
199
+
200
+ - blob
201
+
202
+ Public read access for blobs only. Blob data within this container can be read via anonymous request, but container data is not available. Clients cannot enumerate blobs within the container via anonymous request.
203
+
204
+ - nil
205
+
206
+ No public read access. Container and blob data can be read by the account owner only.
207
+
208
+ ```ruby
209
+ directory = azure_storage_service.directories.get('<Container Name>', max_results: 1)
210
+ directory.acl = 'container'
211
+ directory.save(is_create: false)
190
212
  ```
191
213
 
192
214
  ## Delete the storage container
@@ -194,91 +216,117 @@ puts "#{access_control_list.inspect}"
194
216
  Mark the specified container for deletion. The container and any blobs contained within it are later deleted during garbage collection.
195
217
 
196
218
  ```ruby
197
- directory = azure_storage_service.directories.get('<container name>')
198
- result = directory.destroy
199
- puts "#{result}"
219
+ directory = azure_storage_service.directories.get('<Container Name>', max_results: 1)
220
+ puts directory.destroy
200
221
  ```
201
222
 
202
- ## Upload a local file as a blob
223
+ ## Upload data as a block blob
203
224
  ```ruby
204
- new_cloud_file = azure_storage_service.files.get('<Container name>', '<Blob name>').create(file_path: '<file path>')
205
- puts "#{new_cloud_file.inspect}"
225
+ directory = azure_storage_service.directories.get('<Container Name>', max_results: 1)
226
+ options = {
227
+ key: '<Blob Name>',
228
+ body: '<Blob Content>'
229
+ }
230
+ new_block_blob = directory.files.create(options)
231
+ puts new_block_blob.inspect
206
232
  ```
207
233
 
208
- ## Copy Blob from one container to another
234
+ ## Upload a local file as a block blob
209
235
  ```ruby
210
- puts storage_data.copy_blob('<destination_container_name>', '<destination_blob_name>', '<source_container_name>', '<source_blob_name>')
236
+ directory = azure_storage_service.directories.get('<Container Name>', max_results: 1)
237
+ File.open('<File Path>') do |file|
238
+ options = {
239
+ key: '<Blob Name>',
240
+ body: file
241
+ }
242
+ new_block_blob = directory.files.create(options)
243
+ puts new_block_blob.inspect
244
+ end
211
245
  ```
212
246
 
213
- ## Download a blob to a local file
247
+ ## Upload VHD data as a page blob
214
248
  ```ruby
215
- blob = azure_storage_service.files.get('<Container name>', '<Blob name>').save_to_file('<file path>')
216
- puts "#{blob.inspect}"
217
- puts "File Size: #{::File.size <file_path>}"
249
+ directory = azure_storage_service.directories.get('<Container Name>', max_results: 1)
250
+ options = {
251
+ key: '<Blob Name>',
252
+ body: '<Blob Content>',
253
+ blob_type: 'PageBlob'
254
+ }
255
+ new_page_blob = directory.files.create(options)
256
+ puts new_page_blob.inspect
218
257
  ```
219
258
 
220
- ## Delete the storage blob
221
-
222
- Mark the specified blob for deletion. The blob is later deleted during garbage collection.
223
-
259
+ ## Upload a local VHD as a page blob
224
260
  ```ruby
225
- cloud_file = azure_storage_service.files.get('<container name>', '<blob name>')
226
- result = cloud_file.destroy
227
- puts "#{result}"
261
+ directory = azure_storage_service.directories.get('<Container Name>', max_results: 1)
262
+ File.open('<File Path>') do |file|
263
+ options = {
264
+ key: '<Blob Name>',
265
+ body: file,
266
+ blob_type: 'PageBlob'
267
+ }
268
+ new_page_blob = directory.files.create(options)
269
+ puts new_page_blob.inspect
270
+ end
228
271
  ```
229
272
 
230
- Note that in order to delete a blob, you must delete all of its snapshots.
231
-
273
+ ## Copy Blob from one container to another
232
274
  ```ruby
233
- cloud_file = azure_storage_service.files.get('<container name>', '<blob name>')
234
- result = cloud_file.destroy(delete_snapshots: 'only')
235
- puts "#{result}"
236
-
237
- result = cloud_file.destroy
238
- puts "#{result}"
275
+ directory = azure_storage_service.directories.get('<Source Container Name>', max_results: 1)
276
+ copied_blob = directory.files.head('<Source Blob Name>').copy('<Destination Container Name>', '<Destination Blob Name>')
277
+ puts copied_blob.inspect
239
278
  ```
240
279
 
241
- You can delete both at the same time by specifying the option.
242
-
280
+ ## Copy Blob from one uri to self
243
281
  ```ruby
244
- cloud_file = azure_storage_service.files.get('<container name>', '<blob name>')
245
- result = cloud_file.destroy(delete_snapshots: 'inlcude')
246
- puts "#{result}"
282
+ directory = azure_storage_service.directories.get('<Destination Container Name>', max_results: 1)
283
+ copied_blob = directory.files.new(key: '<Destination Blob Name>')
284
+ copied_blob.copy_from_uri('<Source Blob Uri>')
285
+ puts copied_blob.inspect
247
286
  ```
248
287
 
249
- ## Properties
250
-
251
- ### Get storage container properties
252
-
253
- Get the storage container properties. The properties will not fetch the access control list. Call `get_container_access_control_list` to fetch it.
288
+ ## Download a small blob to a local file
289
+ ```ruby
290
+ directory = azure_storage_service.directories.get('<Container Name>', max_results: 1)
291
+ blob = directory.files.get('<Blob Name>')
292
+ File.open('<File Path>', 'wb') do |file|
293
+ file.write(blob.body)
294
+ end
295
+ puts "File Size: #{::File.size <File Path>}"
296
+ ```
254
297
 
298
+ ## Download a large blob to a local file
255
299
  ```ruby
256
- directory = azure_storage_service.directories.get('<container name>')
257
- properties = directory.get_properties
258
- puts "#{properties.inspect}"
300
+ directory = azure_storage_service.directories.get('<Container Name>', max_results: 1)
301
+ File.open('<File Path>', 'wb') do |file|
302
+ directory.files.get('<Blob Name>') do |chunk, remaining_bytes, total_bytes|
303
+ puts "remaining_bytes: #{remaining_bytes}, total_bytes: #{total_bytes}"
304
+ file.write(chunk)
305
+ end
306
+ end
307
+ puts "File Size: #{::File.size <File Path>}"
259
308
  ```
260
309
 
261
- ### Get storage blob properties
310
+ ## Delete the storage blob
262
311
 
263
- Get the storage blob properties.
312
+ Mark the specified blob for deletion. The blob is later deleted during garbage collection.
264
313
 
265
314
  ```ruby
266
- cloud_file = azure_storage_service.files.get('<container name>', '<blob name>')
267
- properties = cloud_file.get_properties
268
- puts "#{properties.inspect}"
315
+ directory = azure_storage_service.directories.get('<Container Name>', max_results: 1)
316
+ blob = directory.files.head('<Blob Name>')
317
+ puts blob.destroy
269
318
  ```
270
319
 
271
320
  ### Set storage blob properties
272
321
 
273
- Set the storage blob properties. The properties are passed in name/value pairs.
322
+ Set the storage blob properties.
274
323
 
275
324
  ```ruby
276
- cloud_file = azure_storage_service.files.get('<container name>', '<blob name>')
277
- properties = {
278
- "content_language" => "English",
279
- "content_disposition" => "attachment"
280
- }
281
- cloud_file.set_properties(properties)
325
+ directory = azure_storage_service.directories.get('<Container Name>', max_results: 1)
326
+ blob = directory.files.head('<Blob Name>')
327
+ blob.content_language = "English"
328
+ blob.content_disposition = "attachment"
329
+ blob.save(update_body: false)
282
330
  ```
283
331
 
284
332
  ## Metadata
@@ -288,35 +336,41 @@ Metadata allows us to provide descriptive information about specific containers
288
336
  ### Get Blob Metadata
289
337
 
290
338
  ```ruby
291
- azure_storage_service.files.get('<Container name>', '<Blob name>').get_metadata
339
+ directory = azure_storage_service.directories.get('<Container Name>', max_results: 1)
340
+ blob = directory.files.head('<Blob Name>')
341
+ puts blob.metadata
292
342
  ```
293
343
 
294
344
  ### Set Blob Metadata
295
345
 
296
346
  ```ruby
297
- metadata = {
347
+ directory = azure_storage_service.directories.get('<Container Name>', max_results: 1)
348
+ blob = directory.files.head('<Blob Name>')
349
+ blob.metadata = {
298
350
  "Category" => "Images",
299
351
  "Resolution" => "High"
300
352
  }
301
- azure_storage_service.files.get('<Container name>', '<Blob name>').set_metadata(metadata)
353
+ blob.save(update_body: false)
302
354
  ```
303
355
 
304
356
  ### Get Container Metadata
305
357
 
306
358
  ```ruby
307
- azure_storage_service.directories.get_metadata('<Container name>')
359
+ directory = azure_storage_service.directories.get('<Container Name>', max_results: 1)
360
+ puts directory.metadata
308
361
  ```
309
362
 
310
363
  ### Set Container Metadata
311
364
 
312
365
  ```ruby
313
- metadata = {
366
+ directory = azure_storage_service.directories.get('<Container Name>', max_results: 1)
367
+ directory.metadata = {
314
368
  "CreatedBy" => "User",
315
369
  "SourceMachine" => "Mymachine",
316
370
  "category" => "guidance",
317
371
  "docType" => "textDocuments"
318
372
  }
319
- azure_storage_service.directories.set_metadata('<Container name>', metadata)
373
+ directory.save(is_create: false)
320
374
  ```
321
375
 
322
376
  ### Create Recovery Vault