fog-azure-rm-temp 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (209) hide show
  1. checksums.yaml +4 -4
  2. data/.arclint +8 -0
  3. data/.travis.yml +28 -14
  4. data/CHANGELOG.md +77 -0
  5. data/CONTRIBUTORS.md +4 -0
  6. data/fog-azure-rm.gemspec +3 -2
  7. data/lib/fog/azurerm.rb +1 -0
  8. data/lib/fog/azurerm/async_response.rb +9 -1
  9. data/lib/fog/azurerm/compute.rb +3 -1
  10. data/lib/fog/azurerm/constants.rb +11 -3
  11. data/lib/fog/azurerm/dns.rb +3 -1
  12. data/lib/fog/azurerm/docs/application_gateway.md +119 -117
  13. data/lib/fog/azurerm/docs/compute.md +299 -202
  14. data/lib/fog/azurerm/docs/dns.md +44 -43
  15. data/lib/fog/azurerm/docs/key_vault.md +31 -28
  16. data/lib/fog/azurerm/docs/network.md +407 -404
  17. data/lib/fog/azurerm/docs/resources.md +52 -49
  18. data/lib/fog/azurerm/docs/sql.md +56 -54
  19. data/lib/fog/azurerm/docs/storage.md +92 -157
  20. data/lib/fog/azurerm/docs/traffic_manager.md +55 -53
  21. data/lib/fog/azurerm/models/application_gateway/gateway.rb +5 -1
  22. data/lib/fog/azurerm/models/compute/availability_set.rb +4 -1
  23. data/lib/fog/azurerm/models/compute/managed_disk.rb +0 -1
  24. data/lib/fog/azurerm/models/compute/server.rb +61 -11
  25. data/lib/fog/azurerm/models/compute/servers.rb +2 -2
  26. data/lib/fog/azurerm/models/dns/a_record.rb +15 -0
  27. data/lib/fog/azurerm/models/dns/cname_record.rb +15 -0
  28. data/lib/fog/azurerm/models/dns/record_set.rb +20 -8
  29. data/lib/fog/azurerm/models/key_vault/vault.rb +3 -1
  30. data/lib/fog/azurerm/models/network/load_balancer.rb +3 -1
  31. data/lib/fog/azurerm/models/network/local_network_gateway.rb +3 -1
  32. data/lib/fog/azurerm/models/network/network_interface.rb +3 -1
  33. data/lib/fog/azurerm/models/network/network_security_group.rb +4 -2
  34. data/lib/fog/azurerm/models/network/public_ip.rb +4 -2
  35. data/lib/fog/azurerm/models/network/virtual_network.rb +4 -2
  36. data/lib/fog/azurerm/models/resources/resource_group.rb +3 -1
  37. data/lib/fog/azurerm/models/sql/sql_database.rb +3 -3
  38. data/lib/fog/azurerm/models/sql/sql_server.rb +3 -2
  39. data/lib/fog/azurerm/models/storage/directories.rb +6 -1
  40. data/lib/fog/azurerm/models/storage/file.rb +2 -0
  41. data/lib/fog/azurerm/models/storage/storage_account.rb +4 -1
  42. data/lib/fog/azurerm/models/storage/storage_accounts.rb +7 -0
  43. data/lib/fog/azurerm/models/traffic_manager/traffic_manager_profile.rb +3 -1
  44. data/lib/fog/azurerm/requests/application_gateway/check_ag_exists.rb +1 -1
  45. data/lib/fog/azurerm/requests/application_gateway/create_or_update_application_gateway.rb +1 -0
  46. data/lib/fog/azurerm/requests/compute/attach_data_disk_to_vm.rb +2 -2
  47. data/lib/fog/azurerm/requests/compute/check_availability_set_exists.rb +1 -1
  48. data/lib/fog/azurerm/requests/compute/check_managed_disk_exists.rb +1 -1
  49. data/lib/fog/azurerm/requests/compute/check_vm_exists.rb +1 -1
  50. data/lib/fog/azurerm/requests/compute/check_vm_extension_exists.rb +2 -2
  51. data/lib/fog/azurerm/requests/compute/create_availability_set.rb +4 -2
  52. data/lib/fog/azurerm/requests/compute/create_image.rb +68 -0
  53. data/lib/fog/azurerm/requests/compute/create_virtual_machine.rb +302 -135
  54. data/lib/fog/azurerm/requests/compute/delete_image.rb +29 -0
  55. data/lib/fog/azurerm/requests/compute/get_image.rb +45 -0
  56. data/lib/fog/azurerm/requests/compute/get_virtual_machine.rb +4 -2
  57. data/lib/fog/azurerm/requests/dns/check_record_set_exists.rb +1 -1
  58. data/lib/fog/azurerm/requests/dns/check_zone_exists.rb +3 -2
  59. data/lib/fog/azurerm/requests/dns/create_or_update_record_set.rb +3 -2
  60. data/lib/fog/azurerm/requests/dns/create_or_update_zone.rb +1 -2
  61. data/lib/fog/azurerm/requests/key_vault/check_vault_exists.rb +1 -1
  62. data/lib/fog/azurerm/requests/key_vault/create_or_update_vault.rb +1 -0
  63. data/lib/fog/azurerm/requests/network/check_express_route_cir_auth_exists.rb +1 -1
  64. data/lib/fog/azurerm/requests/network/check_express_route_circuit_exists.rb +1 -1
  65. data/lib/fog/azurerm/requests/network/check_load_balancer_exists.rb +1 -1
  66. data/lib/fog/azurerm/requests/network/check_local_net_gateway_exists.rb +1 -1
  67. data/lib/fog/azurerm/requests/network/check_net_sec_group_exists.rb +1 -1
  68. data/lib/fog/azurerm/requests/network/check_net_sec_rule_exists.rb +1 -1
  69. data/lib/fog/azurerm/requests/network/check_network_interface_exists.rb +1 -1
  70. data/lib/fog/azurerm/requests/network/check_public_ip_exists.rb +1 -1
  71. data/lib/fog/azurerm/requests/network/check_subnet_exists.rb +1 -1
  72. data/lib/fog/azurerm/requests/network/check_virtual_network_exists.rb +1 -1
  73. data/lib/fog/azurerm/requests/network/check_vnet_gateway_connection_exists.rb +1 -1
  74. data/lib/fog/azurerm/requests/network/check_vnet_gateway_exists.rb +1 -1
  75. data/lib/fog/azurerm/requests/network/create_load_balancer.rb +4 -4
  76. data/lib/fog/azurerm/requests/network/create_or_update_express_route_circuit.rb +1 -1
  77. data/lib/fog/azurerm/requests/network/create_or_update_local_network_gateway.rb +1 -2
  78. data/lib/fog/azurerm/requests/network/create_or_update_network_interface.rb +4 -3
  79. data/lib/fog/azurerm/requests/network/create_or_update_network_security_group.rb +4 -3
  80. data/lib/fog/azurerm/requests/network/create_or_update_public_ip.rb +5 -3
  81. data/lib/fog/azurerm/requests/network/create_or_update_virtual_network.rb +4 -3
  82. data/lib/fog/azurerm/requests/network/create_or_update_virtual_network_gateway_connection.rb +1 -1
  83. data/lib/fog/azurerm/requests/resources/check_azure_resource_exists.rb +4 -4
  84. data/lib/fog/azurerm/requests/resources/create_resource_group.rb +2 -1
  85. data/lib/fog/azurerm/requests/resources/delete_resource_tag.rb +4 -4
  86. data/lib/fog/azurerm/requests/resources/tag_resource.rb +4 -4
  87. data/lib/fog/azurerm/requests/sql/create_or_update_database.rb +13 -10
  88. data/lib/fog/azurerm/requests/sql/create_or_update_sql_server.rb +8 -5
  89. data/lib/fog/azurerm/requests/storage/check_storage_account_exists.rb +1 -1
  90. data/lib/fog/azurerm/requests/storage/create_storage_account.rb +4 -2
  91. data/lib/fog/azurerm/requests/traffic_manager/check_traffic_manager_endpoint_exists.rb +1 -1
  92. data/lib/fog/azurerm/requests/traffic_manager/check_traffic_manager_profile_exists.rb +1 -1
  93. data/lib/fog/azurerm/requests/traffic_manager/create_or_update_traffic_manager_profile.rb +13 -3
  94. data/lib/fog/azurerm/storage.rb +0 -18
  95. data/lib/fog/azurerm/utilities/general.rb +21 -10
  96. data/lib/fog/azurerm/version.rb +1 -1
  97. data/rake-script.sh +7 -1
  98. data/rakefile +1 -1
  99. data/test/api_stub.rb +19 -2
  100. data/test/api_stub/models/compute/server.rb +21 -5
  101. data/test/api_stub/requests/compute/image.rb +41 -0
  102. data/test/api_stub/requests/compute/virtual_machine.rb +60 -62
  103. data/test/api_stub/requests/resources/resource_group.rb +1 -1
  104. data/test/integration/application_gateway.rb +8 -1
  105. data/test/integration/availability_set.rb +9 -2
  106. data/test/integration/external_load_balancer.rb +2 -1
  107. data/test/integration/internal_load_balancer.rb +2 -1
  108. data/test/integration/key_vault.rb +2 -1
  109. data/test/integration/managed_disk.rb +10 -5
  110. data/test/integration/network_interface.rb +2 -1
  111. data/test/integration/network_security_group.rb +2 -1
  112. data/test/integration/public_ip.rb +2 -1
  113. data/test/integration/record_set.rb +5 -5
  114. data/test/integration/resource_group.rb +5 -2
  115. data/test/integration/resource_tag.rb +4 -2
  116. data/test/integration/server.rb +113 -23
  117. data/test/integration/server_custom_image.rb +120 -20
  118. data/test/integration/sql_server.rb +10 -2
  119. data/test/integration/storage_account.rb +32 -20
  120. data/test/integration/traffic_manager.rb +6 -1
  121. data/test/integration/virtual_network.rb +2 -1
  122. data/test/integration/virtual_network_gateway_connection.rb +3 -3
  123. data/test/models/application_gateway/test_gateway.rb +2 -1
  124. data/test/models/compute/test_availability_set.rb +2 -1
  125. data/test/models/compute/test_managed_disk.rb +2 -1
  126. data/test/models/compute/test_server.rb +13 -4
  127. data/test/models/dns/test_zone.rb +2 -1
  128. data/test/models/key_vault/test_vault.rb +2 -1
  129. data/test/models/network/test_load_balancer.rb +2 -1
  130. data/test/models/network/test_network_interface.rb +2 -1
  131. data/test/models/network/test_network_security_group.rb +2 -1
  132. data/test/models/network/test_public_ip.rb +2 -1
  133. data/test/models/network/test_virtual_network.rb +2 -1
  134. data/test/models/resources/test_resource_group.rb +2 -1
  135. data/test/models/sql/test_database.rb +2 -1
  136. data/test/models/sql/test_sql_server.rb +2 -1
  137. data/test/models/storage/test_storage_account.rb +2 -1
  138. data/test/models/traffic_manager/test_traffic_manager_profile.rb +2 -1
  139. data/test/requests/application_gateway/test_check_ag_exists.rb +11 -4
  140. data/test/requests/compute/test_attach_data_disk_to_vm.rb +2 -2
  141. data/test/requests/compute/test_check_availability_set_exists.rb +9 -2
  142. data/test/requests/compute/test_check_managed_disk_exists.rb +9 -2
  143. data/test/requests/compute/test_check_vm_exists.rb +9 -2
  144. data/test/requests/compute/test_check_vm_extension_exists.rb +9 -2
  145. data/test/requests/compute/test_create_image.rb +27 -0
  146. data/test/requests/compute/test_create_virtual_machine.rb +41 -17
  147. data/test/requests/compute/test_delete_image.rb +23 -0
  148. data/test/requests/compute/test_get_image.rb +23 -0
  149. data/test/requests/dns/test_check_record_set_exists.rb +9 -2
  150. data/test/requests/dns/test_check_zone_exists.rb +16 -2
  151. data/test/requests/key_vault/test_check_vault_exists.rb +9 -2
  152. data/test/requests/network/test_check_express_route_cir_auth_exists.rb +9 -2
  153. data/test/requests/network/test_check_express_route_circuit_exists.rb +9 -2
  154. data/test/requests/network/test_check_load_balancer_exists.rb +9 -2
  155. data/test/requests/network/test_check_local_net_gateway_exists.rb +11 -4
  156. data/test/requests/network/test_check_net_sec_group_exists.rb +9 -2
  157. data/test/requests/network/test_check_net_sec_rule_exists.rb +9 -2
  158. data/test/requests/network/test_check_network_interface_exists.rb +9 -2
  159. data/test/requests/network/test_check_public_ip_exists.rb +9 -2
  160. data/test/requests/network/test_check_subnet_exists.rb +9 -2
  161. data/test/requests/network/test_check_virtual_network_exists.rb +10 -4
  162. data/test/requests/network/test_check_vnet_gateway_connection_exists.rb +9 -2
  163. data/test/requests/network/test_check_vnet_gateway_exists.rb +9 -2
  164. data/test/requests/network/test_create_load_balancer.rb +3 -2
  165. data/test/requests/network/test_create_network_interface.rb +4 -3
  166. data/test/requests/network/test_create_or_update_network_security_group.rb +3 -2
  167. data/test/requests/network/test_create_or_update_virtual_network.rb +5 -3
  168. data/test/requests/network/test_create_public_ip.rb +3 -2
  169. data/test/requests/network/test_update_public_ip.rb +3 -2
  170. data/test/requests/resources/test_create_resource_group.rb +3 -2
  171. data/test/requests/resources/test_delete_resource_tag.rb +3 -3
  172. data/test/requests/resources/test_tag_resource.rb +3 -3
  173. data/test/requests/storage/test_check_storage_account_exists.rb +8 -1
  174. data/test/requests/traffic_manager/test_check_traffic_manager_endpoint_exists.rb +9 -2
  175. data/test/requests/traffic_manager/test_check_traffic_manager_profile_exists.rb +9 -2
  176. data/test/test_helper.rb +5 -14
  177. metadata +67 -75
  178. data/lib/fog/azurerm/models/storage/recovery_vault.rb +0 -50
  179. data/lib/fog/azurerm/models/storage/recovery_vaults.rb +0 -27
  180. data/lib/fog/azurerm/requests/storage/create_or_update_recovery_vault.rb +0 -54
  181. data/lib/fog/azurerm/requests/storage/delete_recovery_vault.rb +0 -35
  182. data/lib/fog/azurerm/requests/storage/disable_backup_protection.rb +0 -60
  183. data/lib/fog/azurerm/requests/storage/enable_backup_protection.rb +0 -61
  184. data/lib/fog/azurerm/requests/storage/get_all_backup_jobs.rb +0 -56
  185. data/lib/fog/azurerm/requests/storage/get_backup_container.rb +0 -53
  186. data/lib/fog/azurerm/requests/storage/get_backup_item.rb +0 -58
  187. data/lib/fog/azurerm/requests/storage/get_backup_job_for_vm.rb +0 -53
  188. data/lib/fog/azurerm/requests/storage/get_backup_protection_policy.rb +0 -64
  189. data/lib/fog/azurerm/requests/storage/get_recovery_vault.rb +0 -49
  190. data/lib/fog/azurerm/requests/storage/list_recovery_vaults.rb +0 -48
  191. data/lib/fog/azurerm/requests/storage/set_recovery_vault_context.rb +0 -36
  192. data/lib/fog/azurerm/requests/storage/start_backup.rb +0 -54
  193. data/test/api_stub/models/storage/recovery_vault.rb +0 -23
  194. data/test/api_stub/requests/storage/recovery_vault.rb +0 -189
  195. data/test/models/storage/test_recovery_vault.rb +0 -61
  196. data/test/models/storage/test_recovery_vaults.rb +0 -47
  197. data/test/requests/storage/test_create_recovery_vault.rb +0 -35
  198. data/test/requests/storage/test_delete_recovery_vault.rb +0 -34
  199. data/test/requests/storage/test_disable_backup_protection.rb +0 -52
  200. data/test/requests/storage/test_enable_backup_protection.rb +0 -66
  201. data/test/requests/storage/test_get_all_backup_jobs.rb +0 -35
  202. data/test/requests/storage/test_get_backup_container.rb +0 -35
  203. data/test/requests/storage/test_get_backup_item.rb +0 -35
  204. data/test/requests/storage/test_get_backup_job_for_vm.rb +0 -26
  205. data/test/requests/storage/test_get_backup_protection_policy.rb +0 -35
  206. data/test/requests/storage/test_get_recovery_vault.rb +0 -35
  207. data/test/requests/storage/test_list_recovery_vault.rb +0 -35
  208. data/test/requests/storage/test_set_recovery_vault_context.rb +0 -34
  209. data/test/requests/storage/test_start_backup.rb +0 -55
@@ -15,13 +15,11 @@ module Fog
15
15
  attribute :a_records
16
16
 
17
17
  def self.parse(recordset)
18
- hash = {}
19
- hash['id'] = recordset.id
20
- hash['name'] = recordset.name
18
+ hash = get_hash_from_object(recordset)
21
19
  hash['resource_group'] = get_resource_group_from_id(recordset.id)
22
20
  hash['zone_name'] = get_record_set_from_id(recordset.id)
23
- hash['type'] = recordset.type
24
21
  type = get_type_from_recordset_type(recordset.type)
22
+
25
23
  hash['records'] = []
26
24
  if type == 'A'
27
25
  record_entries = recordset.arecords
@@ -31,11 +29,25 @@ module Fog
31
29
  end
32
30
  if type == 'CNAME'
33
31
  record_entries = recordset.cname_record
34
- hash['records'] << record_entries
32
+ hash['records'] << record_entries.cname
33
+ end
34
+
35
+ unless recordset.arecords.nil?
36
+ a_records = []
37
+ recordset.arecords.each do |record|
38
+ a_record = Fog::DNS::AzureRM::ARecord.new
39
+ a_record.merge_attributes(Fog::DNS::AzureRM::ARecord.parse(record))
40
+ a_records.push(a_record)
41
+ end
42
+ hash['a_records'] = a_records
35
43
  end
36
- hash['a_records'] = recordset.arecords if type == 'A'
37
- hash['cname_record'] = recordset.cname_record if type == 'CNAME'
38
- hash['ttl'] = recordset.ttl
44
+
45
+ unless recordset.cname_record.nil?
46
+ cname_record = Fog::DNS::AzureRM::CnameRecord.new
47
+ cname_record.merge_attributes(Fog::DNS::AzureRM::CnameRecord.parse(recordset.cname_record))
48
+ hash['cname_record'] = cname_record
49
+ end
50
+
39
51
  hash
40
52
  end
41
53
 
@@ -15,6 +15,7 @@ module Fog
15
15
  attribute :enabled_for_deployment
16
16
  attribute :enabled_for_disk_encryption
17
17
  attribute :enabled_for_template_deployment
18
+ attribute :tags
18
19
 
19
20
  def self.parse(vault)
20
21
  vault_hash = get_hash_from_object(vault)
@@ -67,7 +68,8 @@ module Fog
67
68
  tenant_id: tenant_id,
68
69
  sku_family: sku_family,
69
70
  sku_name: sku_name,
70
- access_policies: access_policies
71
+ access_policies: access_policies,
72
+ tags: tags
71
73
  }
72
74
  end
73
75
  end
@@ -13,6 +13,7 @@ module Fog
13
13
  attribute :probes
14
14
  attribute :inbound_nat_rules
15
15
  attribute :inbound_nat_pools
16
+ attribute :tags
16
17
 
17
18
  # @param [Object] load_balancer
18
19
  def self.parse(load_balancer)
@@ -22,6 +23,7 @@ module Fog
22
23
  hash['location'] = load_balancer.location
23
24
  hash['resource_group'] = get_resource_group_from_id(load_balancer.id)
24
25
  hash['backend_address_pool_names'] = load_balancer.backend_address_pools.map(&:id) unless load_balancer.backend_address_pools.nil?
26
+ hash['tags'] = load_balancer.tags
25
27
 
26
28
  hash['frontend_ip_configurations'] = []
27
29
  load_balancer.frontend_ipconfigurations.each do |fic|
@@ -65,7 +67,7 @@ module Fog
65
67
  validate_inbound_nat_rules(inbound_nat_rules) unless inbound_nat_rules.nil?
66
68
  validate_inbound_nat_pools(inbound_nat_pools) unless inbound_nat_pools.nil?
67
69
 
68
- load_balancer = service.create_load_balancer(name, location, resource_group, frontend_ip_configurations, backend_address_pool_names, load_balancing_rules, probes, inbound_nat_rules, inbound_nat_pools)
70
+ load_balancer = service.create_load_balancer(name, location, resource_group, frontend_ip_configurations, backend_address_pool_names, load_balancing_rules, probes, inbound_nat_rules, inbound_nat_pools, tags)
69
71
 
70
72
  merge_attributes(Fog::Network::AzureRM::LoadBalancer.parse(load_balancer))
71
73
  end
@@ -15,6 +15,7 @@ module Fog
15
15
  attribute :bgp_peering_address
16
16
  attribute :peer_weight
17
17
  attribute :provisioning_state
18
+ attribute :tags
18
19
 
19
20
  def self.parse(local_network_gateway)
20
21
  local_network_gateway_hash = get_hash_from_object(local_network_gateway)
@@ -51,7 +52,8 @@ module Fog
51
52
  gateway_ip_address: gateway_ip_address,
52
53
  asn: asn,
53
54
  bgp_peering_address: bgp_peering_address,
54
- peer_weight: peer_weight
55
+ peer_weight: peer_weight,
56
+ tags: tags
55
57
  }
56
58
  end
57
59
  end
@@ -22,6 +22,7 @@ module Fog
22
22
  attribute :applied_dns_servers
23
23
  attribute :internal_dns_name_label
24
24
  attribute :internal_fqd
25
+ attribute :tags
25
26
 
26
27
  def self.parse(nic)
27
28
  hash = {}
@@ -33,6 +34,7 @@ module Fog
33
34
  hash['mac_address'] = nic.mac_address unless nic.mac_address.nil?
34
35
  hash['network_security_group_id'] = nil
35
36
  hash['network_security_group_id'] = nic.network_security_group.id unless nic.network_security_group.nil?
37
+ hash['tags'] = nic.tags
36
38
  ip_configuration = nic.ip_configurations[0] unless nic.ip_configurations.nil?
37
39
  unless ip_configuration.nil?
38
40
  hash['ip_configuration_name'] = ip_configuration.name
@@ -62,7 +64,7 @@ module Fog
62
64
  requires :subnet_id
63
65
  requires :ip_configuration_name
64
66
  requires :private_ip_allocation_method
65
- nic = service.create_or_update_network_interface(resource_group, name, location, subnet_id, public_ip_address_id, network_security_group_id, ip_configuration_name, private_ip_allocation_method, private_ip_address, load_balancer_backend_address_pools_ids, load_balancer_inbound_nat_rules_ids)
67
+ nic = service.create_or_update_network_interface(resource_group, name, location, subnet_id, public_ip_address_id, network_security_group_id, ip_configuration_name, private_ip_allocation_method, private_ip_address, load_balancer_backend_address_pools_ids, load_balancer_inbound_nat_rules_ids, tags)
66
68
  merge_attributes(Fog::Network::AzureRM::NetworkInterface.parse(nic))
67
69
  end
68
70
 
@@ -11,6 +11,7 @@ module Fog
11
11
  attribute :subnets_ids
12
12
  attribute :security_rules
13
13
  attribute :default_security_rules
14
+ attribute :tags
14
15
 
15
16
  def self.parse(nsg)
16
17
  hash = {}
@@ -22,6 +23,7 @@ module Fog
22
23
  hash['subnets_ids'] = nsg.subnets.map(&:id) unless nsg.subnets.nil?
23
24
  hash['security_rules'] = []
24
25
  hash['default_security_rules'] = []
26
+ hash['tags'] = nsg.tags
25
27
 
26
28
  nsg.security_rules.each do |sr|
27
29
  security_rule = Fog::Network::AzureRM::NetworkSecurityRule.new
@@ -40,7 +42,7 @@ module Fog
40
42
  requires :name, :location, :resource_group
41
43
 
42
44
  validate_security_rules(security_rules) unless security_rules.nil?
43
- nsg = service.create_or_update_network_security_group(resource_group, name, location, security_rules)
45
+ nsg = service.create_or_update_network_security_group(resource_group, name, location, security_rules, tags)
44
46
  merge_attributes(Fog::Network::AzureRM::NetworkSecurityGroup.parse(nsg))
45
47
  end
46
48
 
@@ -54,7 +56,7 @@ module Fog
54
56
  if !security_rule_hash[:security_rules].nil? && security_rule_hash.length == 1
55
57
  validate_security_rules(security_rule_hash[:security_rules])
56
58
  merge_attributes(security_rule_hash)
57
- nsg = service.create_or_update_network_security_group(resource_group, name, location, security_rules)
59
+ nsg = service.create_or_update_network_security_group(resource_group, name, location, security_rules, tags)
58
60
  return merge_attributes(Fog::Network::AzureRM::NetworkSecurityGroup.parse(nsg))
59
61
  end
60
62
  raise 'Invalid hash key.'
@@ -14,6 +14,7 @@ module Fog
14
14
  attribute :domain_name_label
15
15
  attribute :fqdn
16
16
  attribute :reverse_fqdn
17
+ attribute :tags
17
18
 
18
19
  def self.parse(public_ip)
19
20
  hash = {}
@@ -25,6 +26,7 @@ module Fog
25
26
  hash['ip_address'] = public_ip.ip_address
26
27
  hash['idle_timeout_in_minutes'] = public_ip.idle_timeout_in_minutes
27
28
  hash['ip_configuration_id'] = public_ip.ip_configuration.id unless public_ip.ip_configuration.nil?
29
+ hash['tags'] = public_ip.tags
28
30
 
29
31
  unless public_ip.dns_settings.nil?
30
32
  hash['domain_name_label'] = public_ip.dns_settings.domain_name_label
@@ -40,7 +42,7 @@ module Fog
40
42
  requires :public_ip_allocation_method
41
43
  requires :location
42
44
  requires :resource_group
43
- public_ip = service.create_or_update_public_ip(resource_group, name, location, public_ip_allocation_method, idle_timeout_in_minutes, domain_name_label)
45
+ public_ip = service.create_or_update_public_ip(resource_group, name, location, public_ip_allocation_method, idle_timeout_in_minutes, domain_name_label, tags)
44
46
  merge_attributes(Fog::Network::AzureRM::PublicIp.parse(public_ip))
45
47
  end
46
48
 
@@ -51,7 +53,7 @@ module Fog
51
53
  def update(input_hash)
52
54
  validate_input(input_hash)
53
55
  merge_attributes(input_hash)
54
- pip = service.create_or_update_public_ip(resource_group, name, location, public_ip_allocation_method, idle_timeout_in_minutes, domain_name_label)
56
+ pip = service.create_or_update_public_ip(resource_group, name, location, public_ip_allocation_method, idle_timeout_in_minutes, domain_name_label, tags)
55
57
  merge_attributes(Fog::Network::AzureRM::PublicIp.parse(pip))
56
58
  end
57
59
 
@@ -11,6 +11,7 @@ module Fog
11
11
  attribute :dns_servers
12
12
  attribute :subnets
13
13
  attribute :address_prefixes
14
+ attribute :tags
14
15
 
15
16
  def self.parse(vnet)
16
17
  hash = {}
@@ -20,6 +21,7 @@ module Fog
20
21
  hash['location'] = vnet.location
21
22
  hash['dns_servers'] = vnet.dhcp_options.dns_servers unless vnet.dhcp_options.nil?
22
23
  hash['address_prefixes'] = vnet.address_space.address_prefixes unless vnet.address_space.address_prefixes.nil?
24
+ hash['tags'] = vnet.tags
23
25
 
24
26
  subnets = []
25
27
  vnet.subnets.each do |subnet|
@@ -36,7 +38,7 @@ module Fog
36
38
  requires :resource_group
37
39
  validate_subnets!(subnets) unless subnets.nil?
38
40
 
39
- virtual_network = service.create_or_update_virtual_network(resource_group, name, location, dns_servers, subnets, address_prefixes)
41
+ virtual_network = service.create_or_update_virtual_network(resource_group, name, location, dns_servers, subnets, address_prefixes, tags)
40
42
  merge_attributes(Fog::Network::AzureRM::VirtualNetwork.parse(virtual_network))
41
43
  end
42
44
 
@@ -75,7 +77,7 @@ module Fog
75
77
  raise('Provided hash can not be empty.') if vnet_hash.empty? || vnet_hash.nil?
76
78
  validate_update_attributes!(vnet_hash)
77
79
  merge_attributes(vnet_hash)
78
- virtual_network = service.create_or_update_virtual_network(resource_group, name, location, dns_servers, subnets, address_prefixes)
80
+ virtual_network = service.create_or_update_virtual_network(resource_group, name, location, dns_servers, subnets, address_prefixes, tags)
79
81
  merge_attributes(Fog::Network::AzureRM::VirtualNetwork.parse(virtual_network))
80
82
  end
81
83
 
@@ -7,19 +7,21 @@ module Fog
7
7
  identity :name
8
8
  attribute :id
9
9
  attribute :location
10
+ attribute :tags
10
11
 
11
12
  def self.parse(resource_group)
12
13
  hash = {}
13
14
  hash['id'] = resource_group.id
14
15
  hash['name'] = resource_group.name
15
16
  hash['location'] = resource_group.location
17
+ hash['tags'] = resource_group.tags
16
18
  hash
17
19
  end
18
20
 
19
21
  def save
20
22
  requires :name
21
23
  requires :location
22
- resource_group = service.create_resource_group(name, location)
24
+ resource_group = service.create_resource_group(name, location, tags)
23
25
  merge_attributes(Fog::Resources::AzureRM::ResourceGroup.parse(resource_group))
24
26
  end
25
27
 
@@ -23,13 +23,12 @@ module Fog
23
23
  attribute :requested_service_objective_name, aliases: %w(requestedServiceObjectiveName)
24
24
  attribute :service_level_objective, aliases: %w(serviceLevelObjective)
25
25
  attribute :source_database_id, aliases: %w(sourceDatabaseId)
26
+ attribute :tags
26
27
 
27
28
  def self.parse(database)
28
29
  database_hash = get_hash_from_object(database)
29
-
30
30
  database_hash['resource_group'] = get_resource_group_from_id(database.id)
31
31
  database_hash['server_name'] = get_resource_from_resource_id(database.id, 8)
32
-
33
32
  database_hash
34
33
  end
35
34
 
@@ -58,7 +57,8 @@ module Fog
58
57
  max_size_bytes: max_size_bytes,
59
58
  requested_service_objective_name: requested_service_objective_name,
60
59
  elastic_pool_name: elastic_pool_name,
61
- requested_service_objective_id: requested_service_objective_id
60
+ requested_service_objective_id: requested_service_objective_id,
61
+ tags: tags
62
62
  }
63
63
  end
64
64
  end
@@ -13,11 +13,11 @@ module Fog
13
13
  attribute :administrator_login
14
14
  attribute :administrator_login_password
15
15
  attribute :fully_qualified_domain_name, aliases: %w(fullyQualifiedDomainName)
16
+ attribute :tags
16
17
 
17
18
  def self.parse(server)
18
19
  sql_server_hash = get_hash_from_object(server)
19
20
  sql_server_hash['resource_group'] = get_resource_group_from_id(server.id)
20
-
21
21
  sql_server_hash
22
22
  end
23
23
 
@@ -40,7 +40,8 @@ module Fog
40
40
  version: version,
41
41
  location: location,
42
42
  administrator_login: administrator_login,
43
- administrator_login_password: administrator_login_password
43
+ administrator_login_password: administrator_login_password,
44
+ tags: tags
44
45
  }
45
46
  end
46
47
  end
@@ -56,11 +56,16 @@ module Fog
56
56
  end
57
57
  directory.files.load(blobs)
58
58
  directory
59
- rescue => error
59
+ rescue Exception => error
60
60
  return nil if error.message == 'NotFound'
61
61
  raise error
62
62
  end
63
63
 
64
+ def delete_temporary_container(storage_account_name, access_key, container_name)
65
+ storage_data = Fog::Storage::AzureRM.new(azure_storage_account_name: storage_account_name, azure_storage_access_key: access_key)
66
+ storage_data.delete_container(container_name)
67
+ end
68
+
64
69
  def check_container_exists(name)
65
70
  service.check_container_exists(name)
66
71
  end
@@ -1,3 +1,5 @@
1
+ require 'mime/types'
2
+
1
3
  module Fog
2
4
  module Storage
3
5
  class AzureRM
@@ -11,6 +11,7 @@ module Fog
11
11
  attribute :sku_name
12
12
  attribute :replication
13
13
  attribute :encryption
14
+ attribute :tags
14
15
 
15
16
  def self.parse(storage_account)
16
17
  hash = {}
@@ -21,6 +22,7 @@ module Fog
21
22
  hash['sku_name'] = storage_account.sku.name.split('_').first
22
23
  hash['replication'] = storage_account.sku.name.split('_').last
23
24
  hash['encryption'] = storage_account.encryption.services.blob.enabled unless storage_account.encryption.nil?
25
+ hash['tags'] = storage_account.tags
24
26
  hash
25
27
  end
26
28
 
@@ -43,7 +45,8 @@ module Fog
43
45
  sku_name: sku_name,
44
46
  location: location,
45
47
  replication: replication,
46
- encryption: encryption
48
+ encryption: encryption,
49
+ tags: tags
47
50
  }
48
51
  end
49
52
 
@@ -31,6 +31,13 @@ module Fog
31
31
  service.check_storage_account_name_availability(name, type)
32
32
  end
33
33
 
34
+ def delete_storage_account_from_tag(resource_group_name, tag_key, tag_value)
35
+ storage_accounts = service.storage_accounts(resource_group: resource_group_name)
36
+ storage_accounts.each do |account|
37
+ account.destroy if account.tags[tag_key].eql? tag_value
38
+ end
39
+ end
40
+
34
41
  def check_storage_account_exists(resource_group_name, storage_account_name)
35
42
  service.check_storage_account_exists(resource_group_name, storage_account_name)
36
43
  end
@@ -17,6 +17,7 @@ module Fog
17
17
  attribute :port
18
18
  attribute :path
19
19
  attribute :endpoints
20
+ attribute :tags
20
21
 
21
22
  def self.parse(profile)
22
23
  traffic_manager_profile = get_hash_from_object(profile)
@@ -79,7 +80,8 @@ module Fog
79
80
  protocol: protocol,
80
81
  port: port,
81
82
  path: path,
82
- endpoints: endpoints
83
+ endpoints: endpoints,
84
+ tags: tags
83
85
  }
84
86
  end
85
87
  end
@@ -11,7 +11,7 @@ module Fog
11
11
  Fog::Logger.debug "Application Gateway #{application_gateway_name} exists."
12
12
  true
13
13
  rescue MsRestAzure::AzureOperationError => e
14
- if e.body['error']['code'] == 'ResourceNotFound'
14
+ if resource_not_found?(e)
15
15
  Fog::Logger.debug "Application Gateway #{application_gateway_name} doesn't exist."
16
16
  false
17
17
  else
@@ -33,6 +33,7 @@ module Fog
33
33
  application_gateway.http_listeners = define_http_listeners(gateway_params[:http_listeners]) if gateway_params[:http_listeners]
34
34
  application_gateway.url_path_maps = define_url_path_maps(gateway_params[:url_path_maps]) if gateway_params[:url_path_maps]
35
35
  application_gateway.request_routing_rules = define_request_routing_rules(gateway_params[:request_routing_rules]) if gateway_params[:request_routing_rules]
36
+ application_gateway.tags = gateway_params[:tags]
36
37
 
37
38
  gateway_sku = Azure::ARM::Network::Models::ApplicationGatewaySku.new
38
39
  gateway_sku.name = gateway_params[:sku_name]
@@ -87,12 +87,12 @@ module Fog
87
87
  managed_disk.name = disk_name
88
88
  managed_disk.lun = lun
89
89
  managed_disk.create_option = Azure::ARM::Compute::Models::DiskCreateOptionTypes::Attach
90
-
90
+
91
91
  # Managed disk parameter
92
92
  managed_disk_params = Azure::ARM::Compute::Models::ManagedDiskParameters.new
93
93
  managed_disk_params.id = disk.id
94
94
  managed_disk.managed_disk = managed_disk_params
95
-
95
+
96
96
  managed_disk
97
97
  end
98
98
 
@@ -11,7 +11,7 @@ module Fog
11
11
  Fog::Logger.debug "Availability set #{name} exists."
12
12
  true
13
13
  rescue MsRestAzure::AzureOperationError => e
14
- if e.body['error']['code'] == 'ResourceNotFound'
14
+ if resource_not_found?(e)
15
15
  Fog::Logger.debug "Availability set #{name} doesn't exist."
16
16
  false
17
17
  else
@@ -11,7 +11,7 @@ module Fog
11
11
  Fog::Logger.debug "Managed Disk #{disk_name} exist."
12
12
  true
13
13
  rescue MsRestAzure::AzureOperationError => e
14
- if e.error_code == 'ResourceNotFound'
14
+ if resource_not_found?(e)
15
15
  Fog::Logger.debug "Managed Disk #{disk_name} doesn't exist."
16
16
  false
17
17
  else
@@ -13,7 +13,7 @@ module Fog
13
13
  @compute_mgmt_client.virtual_machines.get(resource_group, name, 'instanceView')
14
14
  end
15
15
  rescue MsRestAzure::AzureOperationError => e
16
- if e.body['error']['code'] == 'ResourceNotFound'
16
+ if resource_not_found?(e)
17
17
  Fog::Logger.debug "Virtual machine #{name} doesn't exist."
18
18
  return false
19
19
  else