fog-azure-rm 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (251) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -0
  3. data/Gemfile +1 -1
  4. data/README.md +0 -1
  5. data/fog-azure-rm.gemspec +4 -1
  6. data/lib/fog/azurerm.rb +7 -0
  7. data/lib/fog/azurerm/application_gateway.rb +10 -2
  8. data/lib/fog/azurerm/compute.rb +14 -4
  9. data/lib/fog/azurerm/config.rb +0 -51
  10. data/lib/fog/azurerm/constants.rb +51 -0
  11. data/lib/fog/azurerm/dns.rb +12 -4
  12. data/lib/fog/azurerm/docs/application_gateway.md +38 -4
  13. data/lib/fog/azurerm/docs/compute.md +23 -4
  14. data/lib/fog/azurerm/docs/dns.md +18 -4
  15. data/lib/fog/azurerm/docs/key_vault.md +88 -0
  16. data/lib/fog/azurerm/docs/network.md +98 -9
  17. data/lib/fog/azurerm/docs/resources.md +24 -4
  18. data/lib/fog/azurerm/docs/sql.md +5 -6
  19. data/lib/fog/azurerm/docs/storage.md +12 -0
  20. data/lib/fog/azurerm/docs/traffic_manager.md +22 -4
  21. data/lib/fog/azurerm/key_vault.rb +51 -0
  22. data/lib/fog/azurerm/models/application_gateway/backend_address_pool.rb +2 -0
  23. data/lib/fog/azurerm/models/application_gateway/backend_http_setting.rb +2 -0
  24. data/lib/fog/azurerm/models/application_gateway/frontend_ip_configuration.rb +4 -0
  25. data/lib/fog/azurerm/models/application_gateway/frontend_port.rb +2 -0
  26. data/lib/fog/azurerm/models/application_gateway/gateway.rb +2 -6
  27. data/lib/fog/azurerm/models/application_gateway/gateways.rb +4 -0
  28. data/lib/fog/azurerm/models/application_gateway/http_listener.rb +2 -0
  29. data/lib/fog/azurerm/models/application_gateway/ip_configuration.rb +3 -0
  30. data/lib/fog/azurerm/models/application_gateway/probe.rb +2 -0
  31. data/lib/fog/azurerm/models/application_gateway/request_routing_rule.rb +2 -0
  32. data/lib/fog/azurerm/models/application_gateway/ssl_certificate.rb +2 -0
  33. data/lib/fog/azurerm/models/application_gateway/url_path_map.rb +2 -0
  34. data/lib/fog/azurerm/models/compute/availability_sets.rb +4 -0
  35. data/lib/fog/azurerm/models/compute/servers.rb +4 -0
  36. data/lib/fog/azurerm/models/compute/virtual_machine_extensions.rb +4 -0
  37. data/lib/fog/azurerm/models/dns/record_sets.rb +4 -0
  38. data/lib/fog/azurerm/models/dns/zones.rb +2 -2
  39. data/lib/fog/azurerm/models/key_vault/access_policy_entry.rb +31 -0
  40. data/lib/fog/azurerm/models/key_vault/vault.rb +76 -0
  41. data/lib/fog/azurerm/models/key_vault/vaults.rb +27 -0
  42. data/lib/fog/azurerm/models/network/express_route_circuit_authorizations.rb +4 -0
  43. data/lib/fog/azurerm/models/network/express_route_circuits.rb +4 -0
  44. data/lib/fog/azurerm/models/network/load_balancers.rb +12 -2
  45. data/lib/fog/azurerm/models/network/local_network_gateways.rb +4 -0
  46. data/lib/fog/azurerm/models/network/network_interfaces.rb +4 -0
  47. data/lib/fog/azurerm/models/network/network_security_groups.rb +4 -0
  48. data/lib/fog/azurerm/models/network/network_security_rules.rb +4 -0
  49. data/lib/fog/azurerm/models/network/public_ips.rb +2 -9
  50. data/lib/fog/azurerm/models/network/subnets.rb +4 -0
  51. data/lib/fog/azurerm/models/network/virtual_network_gateway_connections.rb +4 -0
  52. data/lib/fog/azurerm/models/network/virtual_network_gateways.rb +4 -0
  53. data/lib/fog/azurerm/models/network/virtual_networks.rb +9 -11
  54. data/lib/fog/azurerm/models/resources/azure_resources.rb +4 -0
  55. data/lib/fog/azurerm/models/resources/deployments.rb +4 -0
  56. data/lib/fog/azurerm/models/resources/resource_groups.rb +4 -0
  57. data/lib/fog/azurerm/models/sql/firewall_rule.rb +5 -17
  58. data/lib/fog/azurerm/models/sql/firewall_rules.rb +4 -0
  59. data/lib/fog/azurerm/models/sql/sql_database.rb +4 -21
  60. data/lib/fog/azurerm/models/sql/sql_databases.rb +4 -0
  61. data/lib/fog/azurerm/models/sql/sql_server.rb +5 -18
  62. data/lib/fog/azurerm/models/sql/sql_servers.rb +4 -0
  63. data/lib/fog/azurerm/models/storage/directories.rb +4 -0
  64. data/lib/fog/azurerm/models/storage/storage_accounts.rb +4 -0
  65. data/lib/fog/azurerm/models/traffic_manager/traffic_manager_end_points.rb +4 -0
  66. data/lib/fog/azurerm/models/traffic_manager/traffic_manager_profiles.rb +4 -0
  67. data/lib/fog/azurerm/network.rb +22 -4
  68. data/lib/fog/azurerm/requests/application_gateway/check_ag_exists.rb +31 -0
  69. data/lib/fog/azurerm/requests/application_gateway/create_or_update_application_gateway.rb +6 -0
  70. data/lib/fog/azurerm/requests/compute/check_availability_set_exists.rb +31 -0
  71. data/lib/fog/azurerm/requests/compute/check_vm_exists.rb +31 -0
  72. data/lib/fog/azurerm/requests/compute/check_vm_extension_exists.rb +31 -0
  73. data/lib/fog/azurerm/requests/dns/check_record_set_exists.rb +31 -0
  74. data/lib/fog/azurerm/requests/dns/{check_for_zone.rb → check_zone_exists.rb} +4 -2
  75. data/lib/fog/azurerm/requests/dns/list_record_sets.rb +1 -1
  76. data/lib/fog/azurerm/requests/dns/list_zones.rb +2 -2
  77. data/lib/fog/azurerm/requests/key_vault/check_vault_exists.rb +31 -0
  78. data/lib/fog/azurerm/requests/key_vault/create_or_update_vault.rb +105 -0
  79. data/lib/fog/azurerm/requests/key_vault/delete_vault.rb +28 -0
  80. data/lib/fog/azurerm/requests/key_vault/get_vault.rb +54 -0
  81. data/lib/fog/azurerm/requests/key_vault/list_vaults.rb +56 -0
  82. data/lib/fog/azurerm/requests/network/check_express_route_cir_auth_exists.rb +31 -0
  83. data/lib/fog/azurerm/requests/network/check_express_route_circuit_exists.rb +31 -0
  84. data/lib/fog/azurerm/requests/network/check_load_balancer_exists.rb +31 -0
  85. data/lib/fog/azurerm/requests/network/check_local_net_gateway_exists.rb +31 -0
  86. data/lib/fog/azurerm/requests/network/check_net_sec_group_exists.rb +31 -0
  87. data/lib/fog/azurerm/requests/network/check_net_sec_rule_exists.rb +31 -0
  88. data/lib/fog/azurerm/requests/network/check_network_interface_exists.rb +31 -0
  89. data/lib/fog/azurerm/requests/network/{check_for_public_ip.rb → check_public_ip_exists.rb} +12 -5
  90. data/lib/fog/azurerm/requests/network/check_subnet_exists.rb +32 -0
  91. data/lib/fog/azurerm/requests/network/{check_for_virtual_network.rb → check_virtual_network_exists.rb} +11 -6
  92. data/lib/fog/azurerm/requests/network/check_vnet_gateway_connection_exists.rb +32 -0
  93. data/lib/fog/azurerm/requests/network/check_vnet_gateway_exists.rb +32 -0
  94. data/lib/fog/azurerm/requests/network/list_load_balancers_in_subscription.rb +31 -0
  95. data/lib/fog/azurerm/requests/network/list_virtual_networks_in_subscription.rb +74 -0
  96. data/lib/fog/azurerm/requests/resources/check_azure_resource_exists.rb +40 -0
  97. data/lib/fog/azurerm/requests/resources/check_deployment_exists.rb +30 -0
  98. data/lib/fog/azurerm/requests/resources/check_resource_group_exists.rb +30 -0
  99. data/lib/fog/azurerm/requests/sql/check_database_exists.rb +21 -0
  100. data/lib/fog/azurerm/requests/sql/check_firewall_rule_exists.rb +21 -0
  101. data/lib/fog/azurerm/requests/sql/check_sql_server_exists.rb +21 -0
  102. data/lib/fog/azurerm/requests/sql/create_or_update_database.rb +26 -32
  103. data/lib/fog/azurerm/requests/sql/create_or_update_firewall_rule.rb +8 -22
  104. data/lib/fog/azurerm/requests/sql/create_or_update_sql_server.rb +14 -24
  105. data/lib/fog/azurerm/requests/sql/delete_database.rb +2 -9
  106. data/lib/fog/azurerm/requests/sql/delete_firewall_rule.rb +2 -9
  107. data/lib/fog/azurerm/requests/sql/delete_sql_server.rb +3 -9
  108. data/lib/fog/azurerm/requests/sql/get_database.rb +4 -10
  109. data/lib/fog/azurerm/requests/sql/get_firewall_rule.rb +4 -10
  110. data/lib/fog/azurerm/requests/sql/get_sql_server.rb +3 -10
  111. data/lib/fog/azurerm/requests/sql/list_databases.rb +3 -10
  112. data/lib/fog/azurerm/requests/sql/list_firewall_rules.rb +4 -10
  113. data/lib/fog/azurerm/requests/sql/list_sql_servers.rb +3 -10
  114. data/lib/fog/azurerm/requests/storage/check_container_exists.rb +30 -0
  115. data/lib/fog/azurerm/requests/storage/check_storage_account_exists.rb +31 -0
  116. data/lib/fog/azurerm/requests/storage/create_or_update_recovery_vault.rb +1 -1
  117. data/lib/fog/azurerm/requests/storage/delete_recovery_vault.rb +1 -1
  118. data/lib/fog/azurerm/requests/storage/disable_backup_protection.rb +1 -1
  119. data/lib/fog/azurerm/requests/storage/enable_backup_protection.rb +1 -1
  120. data/lib/fog/azurerm/requests/storage/get_all_backup_jobs.rb +1 -1
  121. data/lib/fog/azurerm/requests/storage/get_backup_container.rb +1 -1
  122. data/lib/fog/azurerm/requests/storage/get_backup_item.rb +1 -1
  123. data/lib/fog/azurerm/requests/storage/get_backup_protection_policy.rb +1 -1
  124. data/lib/fog/azurerm/requests/storage/get_recovery_vault.rb +1 -1
  125. data/lib/fog/azurerm/requests/storage/list_recovery_vaults.rb +1 -1
  126. data/lib/fog/azurerm/requests/storage/set_recovery_vault_context.rb +1 -1
  127. data/lib/fog/azurerm/requests/storage/start_backup.rb +1 -1
  128. data/lib/fog/azurerm/requests/traffic_manager/check_traffic_manager_endpoint_exists.rb +31 -0
  129. data/lib/fog/azurerm/requests/traffic_manager/check_traffic_manager_profile_exists.rb +31 -0
  130. data/lib/fog/azurerm/resources.rb +10 -2
  131. data/lib/fog/azurerm/sql.rb +18 -10
  132. data/lib/fog/azurerm/storage.rb +4 -0
  133. data/lib/fog/azurerm/traffic_manager.rb +9 -2
  134. data/lib/fog/azurerm/version.rb +1 -1
  135. data/rake-script.sh +3 -10
  136. data/test/api_stub.rb +8 -0
  137. data/test/api_stub/models/key_vault/vault.rb +39 -0
  138. data/test/api_stub/models/sql/sql_database.rb +18 -16
  139. data/test/api_stub/models/sql/sql_firewall_rule.rb +12 -10
  140. data/test/api_stub/models/sql/sql_server.rb +12 -10
  141. data/test/api_stub/requests/key_vault/vault.rb +95 -0
  142. data/test/api_stub/requests/sql/database.rb +8 -6
  143. data/test/api_stub/requests/sql/firewall_rule.rb +8 -4
  144. data/test/api_stub/requests/sql/sql_server.rb +8 -4
  145. data/test/integration/Virtual_network_gateway_connection.rb +7 -0
  146. data/test/integration/application_gateway.rb +8 -0
  147. data/test/integration/availability_set.rb +13 -2
  148. data/test/integration/blob.rb +0 -6
  149. data/test/integration/container.rb +7 -0
  150. data/test/integration/deployment.rb +7 -0
  151. data/test/integration/express_route_circuit.rb +16 -0
  152. data/test/integration/external_load_balancer.rb +18 -0
  153. data/test/integration/key_vault.rb +98 -0
  154. data/test/integration/local_network_gateway.rb +8 -0
  155. data/test/integration/network_interface.rb +8 -0
  156. data/test/integration/network_security_group.rb +8 -0
  157. data/test/integration/network_security_rule.rb +8 -0
  158. data/test/integration/public_ip.rb +3 -2
  159. data/test/integration/record_set.rb +8 -0
  160. data/test/integration/resource_group.rb +12 -4
  161. data/test/integration/resource_tag.rb +7 -0
  162. data/test/integration/server.rb +8 -0
  163. data/test/integration/sql_server.rb +23 -3
  164. data/test/integration/storage_account.rb +8 -1
  165. data/test/integration/subnet.rb +7 -0
  166. data/test/integration/traffic_manager.rb +14 -0
  167. data/test/integration/virtual_machine_extension.rb +8 -0
  168. data/test/integration/virtual_network.rb +13 -4
  169. data/test/integration/virtual_network_gateway.rb +7 -0
  170. data/test/integration/zone.rb +8 -0
  171. data/test/models/application_gateway/test_gateway.rb +1 -0
  172. data/test/models/application_gateway/test_gateways.rb +14 -1
  173. data/test/models/compute/test_availability_sets.rb +14 -1
  174. data/test/models/compute/test_servers.rb +14 -1
  175. data/test/models/compute/test_virtual_machine_extensions.rb +14 -1
  176. data/test/models/dns/test_record_sets.rb +14 -1
  177. data/test/models/dns/test_zones.rb +7 -7
  178. data/test/models/key_vault/test_vault.rb +39 -0
  179. data/test/models/key_vault/test_vaults.rb +55 -0
  180. data/test/models/network/test_express_route_circuit_authorizations.rb +14 -1
  181. data/test/models/network/test_express_route_circuits.rb +14 -1
  182. data/test/models/network/test_load_balancers.rb +14 -1
  183. data/test/models/network/test_local_network_gateways.rb +14 -1
  184. data/test/models/network/test_network_interfaces.rb +14 -1
  185. data/test/models/network/test_network_security_groups.rb +14 -1
  186. data/test/models/network/test_network_security_rules.rb +14 -1
  187. data/test/models/network/test_public_ips.rb +6 -6
  188. data/test/models/network/test_subnets.rb +14 -1
  189. data/test/models/network/test_virtual_network_gateway_connections.rb +14 -1
  190. data/test/models/network/test_virtual_network_gateways.rb +14 -1
  191. data/test/models/network/test_virtual_networks.rb +20 -8
  192. data/test/models/resources/test_deployments.rb +14 -1
  193. data/test/models/resources/test_resource_groups.rb +14 -1
  194. data/test/models/resources/test_resources.rb +16 -3
  195. data/test/models/sql/test_database.rb +3 -4
  196. data/test/models/sql/test_databases.rb +5 -5
  197. data/test/models/sql/test_firewall_rule.rb +2 -1
  198. data/test/models/sql/test_firewall_rules.rb +3 -2
  199. data/test/models/sql/test_sql_server.rb +2 -1
  200. data/test/models/sql/test_sql_servers.rb +5 -5
  201. data/test/models/storage/test_directories.rb +14 -1
  202. data/test/models/storage/test_storage_accounts.rb +14 -1
  203. data/test/models/traffic_manager/test_traffic_manager_end_points.rb +14 -1
  204. data/test/models/traffic_manager/test_traffic_manager_profiles.rb +14 -1
  205. data/test/requests/application_gateway/test_check_ag_exists.rb +31 -0
  206. data/test/requests/compute/test_check_availability_set_exists.rb +31 -0
  207. data/test/requests/compute/test_check_vm_exists.rb +31 -0
  208. data/test/requests/compute/test_check_vm_extension_exists.rb +31 -0
  209. data/test/requests/dns/test_check_record_set_exists.rb +31 -0
  210. data/test/requests/dns/test_check_zone_exists.rb +35 -0
  211. data/test/requests/dns/test_list_record_sets.rb +35 -0
  212. data/test/requests/dns/{test_check_for_zone.rb → test_list_zones.rb} +10 -8
  213. data/test/requests/key_vault/test_check_vault_exists.rb +31 -0
  214. data/test/requests/key_vault/test_create_or_update_vault.rb +25 -0
  215. data/test/requests/key_vault/test_delete_vault.rb +23 -0
  216. data/test/requests/key_vault/test_get_vault.rb +24 -0
  217. data/test/requests/key_vault/test_list_vaults.rb +24 -0
  218. data/test/requests/network/test_check_express_route_cir_auth_exists.rb +31 -0
  219. data/test/requests/network/test_check_express_route_circuit_exists.rb +31 -0
  220. data/test/requests/network/test_check_load_balancer_exists.rb +31 -0
  221. data/test/requests/network/test_check_local_net_gateway_exists.rb +31 -0
  222. data/test/requests/network/test_check_net_sec_group_exists.rb +31 -0
  223. data/test/requests/network/test_check_net_sec_rule_exists.rb +31 -0
  224. data/test/requests/network/test_check_network_interface_exists.rb +31 -0
  225. data/test/requests/network/{test_check_for_public_ip.rb → test_check_public_ip_exists.rb} +8 -8
  226. data/test/requests/network/test_check_subnet_exists.rb +31 -0
  227. data/test/requests/network/{test_check_for_virtual_network.rb → test_check_virtual_network_exists.rb} +8 -8
  228. data/test/requests/network/test_check_vnet_gateway_connection_exists.rb +31 -0
  229. data/test/requests/network/test_check_vnet_gateway_exists.rb +31 -0
  230. data/test/requests/network/test_list_virtual_networks_in_subscription.rb +24 -0
  231. data/test/requests/resources/test_check_azure_resource_exists.rb +22 -0
  232. data/test/requests/resources/test_check_deployment_exists.rb +29 -0
  233. data/test/requests/resources/test_check_resource_group_exists.rb +29 -0
  234. data/test/requests/sql/test_create_or_update_database.rb +9 -12
  235. data/test/requests/sql/test_create_or_update_firewall_rule.rb +9 -11
  236. data/test/requests/sql/test_create_or_update_sql_server.rb +9 -12
  237. data/test/requests/sql/test_delete_database.rb +6 -17
  238. data/test/requests/sql/test_delete_firewall_rule.rb +6 -17
  239. data/test/requests/sql/test_delete_sql_server.rb +6 -17
  240. data/test/requests/sql/test_get_database.rb +7 -18
  241. data/test/requests/sql/test_get_firewall_rule.rb +7 -18
  242. data/test/requests/sql/test_get_sql_server.rb +7 -18
  243. data/test/requests/sql/test_list_databases.rb +7 -18
  244. data/test/requests/sql/test_list_firewall_rules.rb +7 -18
  245. data/test/requests/sql/test_list_sql_servers.rb +7 -18
  246. data/test/requests/storage/test_check_container_exists.rb +18 -0
  247. data/test/requests/storage/test_check_storage_account_exists.rb +32 -0
  248. data/test/requests/traffic_manager/test_check_traffic_manager_endpoint_exists.rb +31 -0
  249. data/test/requests/traffic_manager/test_check_traffic_manager_profile_exists.rb +31 -0
  250. data/test/test_helper.rb +39 -4
  251. metadata +125 -10
@@ -0,0 +1,88 @@
1
+ # Key Vault
2
+
3
+ This document explains how to get started using Azure Key Vault Service with Fog to manage Vault. With this gem you can create/list/delete Vault.
4
+
5
+ ## Usage
6
+
7
+ First of all, you need to require the Fog library by executing:
8
+
9
+ ```ruby
10
+ require 'fog/azurerm'
11
+ ```
12
+ ## Create Connection
13
+
14
+ Next, create a connection to the Key Vault Service:
15
+
16
+ ```ruby
17
+ azure_key_vault_service = Fog::KeyVault::AzureRM.new(
18
+ tenant_id: '<Tenantid>', # Tenant id of Azure Active Directory Application
19
+ client_id: '<Clientid>', # Client id of Azure Active Directory Application
20
+ client_secret: '<ClientSecret>', # Client Secret of Azure Active Directory Application
21
+ subscription_id: '<Subscriptionid>' # Subscription id of an Azure Account
22
+ )
23
+ ```
24
+
25
+ ## Check Vault Existence
26
+
27
+ ```ruby
28
+ azure_key_vault_service.vaults.check_vault_exists(<Resource Group name>, <Vault Name>)
29
+ ```
30
+
31
+ ## Create Vault
32
+
33
+ Create a new Vault.
34
+
35
+ ```ruby
36
+ vault = azure_key_vault_service.vaults.create(
37
+ name: '<Vault Name>',
38
+ location: 'eastus',
39
+ resource_group: '<Resource Group name>',
40
+ tenant_id: <Tenantid>,
41
+ sku_family: 'A',
42
+ sku_name: 'standard',
43
+ access_policies: [
44
+ {
45
+ tenant_id: <Tenantid>,
46
+ object_id: <Tenantid>,
47
+ permissions: {
48
+ keys: ['all'],
49
+ secrets: ['all']
50
+ }
51
+ }
52
+ ]
53
+
54
+ )
55
+ ```
56
+
57
+ ## List Vaults
58
+
59
+ List all vaults in a resource group
60
+
61
+ ```ruby
62
+ vaults = azure_key_vault_service.vaults(resource_group: '<Resource Group Name>')
63
+ vaults.each do |vault|
64
+ puts "#{vault.name}"
65
+ end
66
+ ```
67
+
68
+ ## Retrieve a single Vault
69
+
70
+ Get a single record of Vault
71
+
72
+ ```ruby
73
+ vault = azure_key_vault_service
74
+ .vaults
75
+ .get('<Resource Group name>', '<Vault Name>')
76
+ puts "#{vault.name}"
77
+ ```
78
+
79
+ ## Destroy a single Vault
80
+
81
+ Get a vault object from the get method and then destroy that vault.
82
+
83
+ ```ruby
84
+ vault.destroy
85
+ ```
86
+
87
+ ## Support and Feedback
88
+ Your feedback is highly appreciated! If you have specific issues with the fog ARM, you should file an issue via Github.
@@ -15,12 +15,20 @@ Next, create a connection to the Network Service:
15
15
 
16
16
  ```ruby
17
17
  azure_network_service = Fog::Network::AzureRM.new(
18
- tenant_id: '<Tenantid>', # Tenant id of Azure Active Directory Application
19
- client_id: '<Clientid>', # Client id of Azure Active Directory Application
20
- client_secret: '<ClientSecret>', # Client Secret of Azure Active Directory Application
21
- subscription_id: '<Subscriptionid>' # Subscription id of an Azure Account
18
+ tenant_id: '<Tenantid>', # Tenant id of Azure Active Directory Application
19
+ client_id: '<Clientid>', # Client id of Azure Active Directory Application
20
+ client_secret: '<ClientSecret>', # Client Secret of Azure Active Directory Application
21
+ subscription_id: '<Subscriptionid>', # Subscription id of an Azure Account
22
+ :environment => '<AzureCloud/AzureChinaCloud/AzureUSGovernment/AzureGermanCloud>' # Azure cloud environment. Default is AzureCloud.
22
23
  )
23
24
  ```
25
+
26
+ ## Check Virtual Network Existence
27
+
28
+ ```ruby
29
+ azure_network_service.virtual_networks.check_virtual_network_exists(<Resource Group name>, <Virtual Network Name>)
30
+ ```
31
+
24
32
  ## Create Virtual Network
25
33
 
26
34
  Create a new virtual network
@@ -44,20 +52,24 @@ Optional parameters for Subnet: network_security_group_id, route_table_id & addr
44
52
  )
45
53
  ```
46
54
 
47
- ## Check for Virtual Network
55
+ ## List Virtual Networks in Resource Group
48
56
 
49
- Checks if the Virtual Network already exists or not.
57
+ List all virtual networks in a resource group
50
58
 
51
59
  ```ruby
52
- azure_network_service.virtual_networks.check_if_exists('<Virtual Network name>', '<Resource Group name>')
60
+ vnets = azure_network_service.virtual_networks(resource_group: '<Resource Group Name>')
61
+ vnets.each do |vnet|
62
+ puts "#{vnet.name}"
63
+ puts "#{vnet.location}"
64
+ end
53
65
  ```
54
66
 
55
- ## List Virtual Networks
67
+ ## List Virtual Networks in Subscription
56
68
 
57
69
  List all virtual networks in a subscription
58
70
 
59
71
  ```ruby
60
- vnets = azure_network_service.virtual_networks(resource_group: '<Resource Group Name>')
72
+ vnets = azure_network_service.virtual_networks
61
73
  vnets.each do |vnet|
62
74
  puts "#{vnet.name}"
63
75
  puts "#{vnet.location}"
@@ -126,6 +138,12 @@ Get virtual network object from the get method and then destroy that virtual net
126
138
  vnet.destroy
127
139
  ```
128
140
 
141
+ ## Check Subnet Existence
142
+
143
+ ```ruby
144
+ azure_network_service.subnets.check_subnet_exists(<Resource Group name>, <Virtual Network Name>, <Subnet Name>)
145
+ ```
146
+
129
147
  ## Create Subnet
130
148
 
131
149
  Create a new Subnet
@@ -217,6 +235,12 @@ Get a subnet object from the get method and then destroy that subnet.
217
235
  subnet.destroy
218
236
  ```
219
237
 
238
+ ## Check Network Interface Card Existence
239
+
240
+ ```ruby
241
+ azure_network_service.network_interfaces.check_network_interface_exists(<Resource Group name>, <Network Interface name>)
242
+ ```
243
+
220
244
  ## Create Network Interface Card
221
245
 
222
246
  Create a new network interface. Skip public_ip_address_id parameter to create network interface without PublicIP. The parameter, private_ip_allocation_method can be Dynamic or Static.
@@ -294,6 +318,12 @@ Get a network interface object from the get method and then destroy that network
294
318
  nic.destroy
295
319
  ```
296
320
 
321
+ ## Check Public IP Existence
322
+
323
+ ```ruby
324
+ azure_network_service.public_ips.check_public_ip_exists(<Resource Group name>, <Public IP name>>)
325
+ ```
326
+
297
327
  ## Create Public IP
298
328
 
299
329
  Create a new public IP. The parameter, type can be Dynamic or Static.
@@ -357,6 +387,12 @@ Get a Public IP object from the get method and then destroy that public IP.
357
387
  pubip.destroy
358
388
  ```
359
389
 
390
+ ## Check Network Security Group Existence
391
+
392
+ ```ruby
393
+ azure_network_service.network_security_groups.check_net_sec_group_exists(<Resource Group name>, <Network Security Group name>)
394
+ ```
395
+
360
396
  ## Create Network Security Group
361
397
 
362
398
  Network security group requires a resource group to create.
@@ -462,6 +498,12 @@ Get a network security group object from the get method and then destroy that ne
462
498
  nsg.destroy
463
499
  ```
464
500
 
501
+ ## Check Network Security Rule Existence
502
+
503
+ ```ruby
504
+ azure_network_service.network_security_rules.check_net_sec_rule_exists(<Resource Group name>, <Network Security Group name>, <Security Rule name>)
505
+ ```
506
+
465
507
  ## Create Network Security Rule
466
508
 
467
509
  Network security rule requires a resource group and network security group to create.
@@ -513,6 +555,12 @@ Get a network security rule object from the get method and then destroy that net
513
555
  network_security_rule.destroy
514
556
  ```
515
557
 
558
+ ## Check External Load Balancer Existence
559
+
560
+ ```ruby
561
+ azure_network_service.load_balancers.check_load_balancer_exists(<Resource Group name>, <Load Balancer name>)
562
+ ```
563
+
516
564
  ## Create External Load Balancer
517
565
 
518
566
  Create a new load balancer.
@@ -637,6 +685,17 @@ List all load balancers in a resource group
637
685
  end
638
686
  ```
639
687
 
688
+ ## List Load Balancers in subscription
689
+
690
+ List all load balancers in a subscription
691
+
692
+ ```ruby
693
+ lbs = azure_network_service.load_balancers
694
+ lbs.each do |lb|
695
+ puts "#{lb.name}"
696
+ end
697
+ ```
698
+
640
699
  ## Retrieve a single Load Balancer
641
700
 
642
701
  Get a single record of Load Balancer
@@ -656,6 +715,12 @@ Get a load balancer object from the get method and then destroy that load balanc
656
715
  lb.destroy
657
716
  ```
658
717
 
718
+ ## Check Virtual Network Gateway Existence
719
+
720
+ ```ruby
721
+ azure_network_service.virtual_network_gateways.check_vnet_gateway_exists(<Resource Group name>, <Virtual Network Gateway Name>)
722
+ ```
723
+
659
724
  ## Create Virtual Network Gateway
660
725
 
661
726
  Create a new Virtual Network Gateway.
@@ -737,6 +802,12 @@ Get a virtual network gateway object from the get method and then destroy that v
737
802
  network_gateway.destroy
738
803
  ```
739
804
 
805
+ ## Check Local Network Gateway Existence
806
+
807
+ ```ruby
808
+ azure_network_service.local_network_gateways.check_local_net_gateway_exists(<Resource Group name>, <Local Network Gateway Name>)
809
+ ```
810
+
740
811
  ## Create Local Network Gateway
741
812
 
742
813
  Create a new Local Network Gateway.
@@ -795,6 +866,12 @@ For more details about express route [click here](https://azure.microsoft.com/en
795
866
 
796
867
  The Circuit represents the entity created by customer to register with an express route service provider with intent to connect to Microsoft.
797
868
 
869
+ ## Check Express Route Circuit Existence
870
+
871
+ ```ruby
872
+ azure_network_service.express_route_circuits.check_express_route_circuit_exists(<Resource Group name>, <Circuit Name>)
873
+ ```
874
+
798
875
  ## Create an Express Route Circuit
799
876
 
800
877
  Create a new Express Route Circuit.
@@ -858,6 +935,12 @@ Get an express route circuit object from the get method and then destroy that ex
858
935
 
859
936
  Authorization is part of Express Route circuit.
860
937
 
938
+ ## Check Express Route Circuit Authorization Existence
939
+
940
+ ```ruby
941
+ azure_network_service.express_route_circuit_authorizations.check_express_route_cir_auth_exists(<Resource Group name>, <Circuit Name>, <Authorization-Name>)
942
+ ```
943
+
861
944
  ## Create an Express Route Circuit Authorization
862
945
 
863
946
  Create a new Express Route Circuit Authorization. Parameter 'authorization_status' can be 'Available' or 'InUse'.
@@ -963,6 +1046,12 @@ List all express route service providers
963
1046
  puts service_providers
964
1047
  ```
965
1048
 
1049
+ ## Check Virtual Network Gateway Connection Existence
1050
+
1051
+ ```ruby
1052
+ azure_network_service.virtual_network_gateway_connections.check_vnet_gateway_connection_exists(<Resource Group name>, <Virtual Network Gateway Connection Name>)
1053
+ ```
1054
+
966
1055
  ## Create Virtual Network Gateway Connection
967
1056
 
968
1057
  Create a new Virtual Network Gateway Connection.
@@ -16,12 +16,20 @@ Next, create a connection to the Resources Service:
16
16
 
17
17
  ```ruby
18
18
  azure_resources_service = Fog::Resources::AzureRM.new(
19
- tenant_id: '<Tenantid>', # Tenant id of Azure Active Directory Application
20
- client_id: '<Clientid>', # Client id of Azure Active Directory Application
21
- client_secret: '<ClientSecret>', # Client Secret of Azure Active Directory Application
22
- subscription_id: '<Subscriptionid>' # Subscription id of an Azure Account
19
+ tenant_id: '<Tenantid>', # Tenant id of Azure Active Directory Application
20
+ client_id: '<Clientid>', # Client id of Azure Active Directory Application
21
+ client_secret: '<ClientSecret>', # Client Secret of Azure Active Directory Application
22
+ subscription_id: '<Subscriptionid>', # Subscription id of an Azure Account
23
+ :environment => '<AzureCloud/AzureChinaCloud/AzureUSGovernment/AzureGermanCloud>' # Azure cloud environment. Default is AzureCloud.
23
24
  )
24
25
  ```
26
+
27
+ ## Check Resource Group Existence
28
+
29
+ ```ruby
30
+ azure_resources_service.resource_groups.check_resource_group_exists(<Resource Group name>)
31
+ ```
32
+
25
33
  ## Create Resource Group
26
34
 
27
35
  Create a new resource group
@@ -110,6 +118,18 @@ Remove tag from a resource as following:
110
118
  )
111
119
  ```
112
120
 
121
+ ## Check Resource Existence
122
+
123
+ ```ruby
124
+ azure_resources_service.azure_resources.check_azure_resource_exists(<Resource-ID>, <API-Version>)
125
+ ```
126
+
127
+ ## Check Deployment Existence
128
+
129
+ ```ruby
130
+ azure_resources_service.deployments.check_deployment_exists(<Resource Group Name>, <Deployment name>)
131
+ ```
132
+
113
133
  ## Create Deployment
114
134
 
115
135
  Create a Deployment
@@ -16,10 +16,11 @@ Next, create a connection to the SQL Service:
16
16
 
17
17
  ```ruby
18
18
  azure_sql_service = Fog::Sql::AzureRM.new(
19
- tenant_id: '<Tenantid>', # Tenant id of Azure Active Directory Application
20
- client_id: '<Clientid>', # Client id of Azure Active Directory Application
21
- client_secret: '<ClientSecret>', # Client Secret of Azure Active Directory Application
22
- subscription_id: '<Subscriptionid>' # Subscription id of an Azure Account
19
+ tenant_id: '<Tenantid>', # Tenant id of Azure Active Directory Application
20
+ client_id: '<Clientid>', # Client id of Azure Active Directory Application
21
+ client_secret: '<ClientSecret>', # Client Secret of Azure Active Directory Application
22
+ subscription_id: '<Subscriptionid>', # Subscription id of an Azure Account
23
+ :environment => '<AzureCloud/AzureChinaCloud/AzureUSGovernment/AzureGermanCloud>' # Azure cloud environment. Default is AzureCloud.
23
24
  )
24
25
  ```
25
26
 
@@ -89,8 +90,6 @@ If parameter {edition} is set to DataWarehouse, the acceptable values for parame
89
90
  collation: '<Collation>', # Conditional. Specifies the name of the collation. If createMode is set to Default, then this value must be specified.
90
91
  max_size_bytes: '<Size>', # Conditional. Specifies the maximum size to which the database may grow. If createMode is set to Default, then this value must be specified.
91
92
  requested_service_objective_name: '<Name>' , # Conditional. Specifies the requested service level of the database. If requestedServiceObjectiveId is specified, then this value must not be specified. The acceptable value are: [Basic, S0, S1, S2, S3, P1, P2, P4, P6, P11, ElasticPool]
92
- restore_point_in_time: '<String>', # Conditional. Specifies the point in time for the restore. If createMode is set to PointInTimeRestore, then this value must be specified.
93
- source_database_deletion_date: '<Date>', # Conditional. Specifies the deletion date of the source database. If createMode is set to Restore, then this value must be specified
94
93
  elastic_pool_name: '<Pool Name>', # Conditional. Specifies the name of the elastic database pool. If requestedServiceObjectiveId or requestedServiceObjectiveName is set to ElasticPool, then this value must be specified.
95
94
  requested_service_objective_id: '<GUID>' # Conditional. Specifies the identifier of the requested service level. If requestedServiceObjectiveName is specified, then this value must not be specified.
96
95
  )
@@ -59,6 +59,12 @@ Check Storage Account Name Availability.This operation checks that account name
59
59
  azure_storage_service.storage_accounts.check_name_availability('<Storage Account name>')
60
60
  ```
61
61
 
62
+ ## Check Storage Account Existence
63
+
64
+ ```ruby
65
+ azure_storage_service.storage_accounts.check_storage_account_exists(<Resource Group name>, <StorageAccountName>)
66
+ ```
67
+
62
68
  ## Create Storage Account
63
69
 
64
70
  Create a new storage account. Replication attribute for Standard and Premium account types are as follows
@@ -161,6 +167,12 @@ By default the disk will be deleted from the container 'vhds'. You can specify o
161
167
  azure_storage_service.delete_disk('<Data Disk Name>', options = {})
162
168
  ```
163
169
 
170
+ ## Check Storage Container Existence
171
+
172
+ ```ruby
173
+ azure_storage_service.directories.check_container_exists(<container name>)
174
+ ```
175
+
164
176
  ## Create a storage container
165
177
 
166
178
  Create a storage container in the current storage account.
@@ -15,13 +15,20 @@ Next, create a connection to the Traffic Manager Service:
15
15
 
16
16
  ```ruby
17
17
  azure_traffic_manager_service = Fog::TrafficManager::AzureRM.new(
18
- tenant_id: '<Tenantid>', # Tenant id of Azure Active Directory Application
19
- client_id: '<Clientid>', # Client id of Azure Active Directory Application
20
- client_secret: '<ClientSecret>', # Client Secret of Azure Active Directory Application
21
- subscription_id: '<Subscriptionid>' # Subscription id of an Azure Account
18
+ tenant_id: '<Tenantid>', # Tenant id of Azure Active Directory Application
19
+ client_id: '<Clientid>', # Client id of Azure Active Directory Application
20
+ client_secret: '<ClientSecret>', # Client Secret of Azure Active Directory Application
21
+ subscription_id: '<Subscriptionid>', # Subscription id of an Azure Account
22
+ :environment => '<AzureCloud/AzureChinaCloud/AzureUSGovernment/AzureGermanCloud>' # Azure cloud environment. Default is AzureCloud.
22
23
  )
23
24
  ```
24
25
 
26
+ ## Check Traffic Manager Profile Existence
27
+
28
+ ```ruby
29
+ azure_traffic_manager_service.traffic_manager_profiles.check_traffic_manager_profile_exists(<Resource Group Name>, <Profile Name>)
30
+ ```
31
+
25
32
  ## Create Traffic Manager Profile
26
33
 
27
34
  Create a new Traffic Manager Profile. The parameter 'traffic_routing_method' can be 'Performance', 'Weighted' or 'Priority'.
@@ -83,6 +90,17 @@ Get a Traffic Manager Profile object from the get method and then destroy that T
83
90
  profile.destroy
84
91
  ```
85
92
 
93
+ ## Check Traffic Manager Endpoint Existence
94
+
95
+ ```ruby
96
+ azure_network_service.traffic_manager_end_points.check_traffic_manager_endpoint_exists(
97
+ <Resource Group Name>,
98
+ <Profile Name>,
99
+ <Endpoint Name>,
100
+ <Type(externalEndpoints)>
101
+ )
102
+ ```
103
+
86
104
  ## Create Traffic Manager Endpoint
87
105
 
88
106
  Traffic Manager Profile is pre-requisite of Traffic Manager Endpoint. Create a new Traffic Manager Endpoint. The parameter 'type' can be 'externalEndpoints, 'azureEndpoints' or 'nestedEndpoints'.
@@ -0,0 +1,51 @@
1
+ module Fog
2
+ module KeyVault
3
+ # This class registers models, requests and collections
4
+ class AzureRM < Fog::Service
5
+ requires :tenant_id
6
+ requires :client_id
7
+ requires :client_secret
8
+ requires :subscription_id
9
+
10
+ request_path 'fog/azurerm/requests/key_vault'
11
+ request :get_vault
12
+ request :list_vaults
13
+ request :create_or_update_vault
14
+ request :delete_vault
15
+ request :check_vault_exists
16
+
17
+ model_path 'fog/azurerm/models/key_vault'
18
+ model :vault
19
+ model :access_policy_entry
20
+ collection :vaults
21
+
22
+ # This class provides the mock implementation for unit tests.
23
+ class Mock
24
+ def initialize(_options = {})
25
+ begin
26
+ require 'azure_mgmt_key_vault'
27
+ rescue LoadError => e
28
+ retry if require('rubygems')
29
+ raise e.message
30
+ end
31
+ end
32
+ end
33
+
34
+ # This class provides the actual implementation for service calls.
35
+ class Real
36
+ def initialize(options)
37
+ begin
38
+ require 'azure_mgmt_key_vault'
39
+ rescue LoadError => e
40
+ retry if require('rubygems')
41
+ raise e.message
42
+ end
43
+
44
+ credentials = Fog::Credentials::AzureRM.get_credentials(options[:tenant_id], options[:client_id], options[:client_secret])
45
+ @key_vault_client = ::Azure::ARM::KeyVault::KeyVaultManagementClient.new(credentials)
46
+ @key_vault_client.subscription_id = options[:subscription_id]
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end