fog-azure-rm 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +19 -8
  3. data/LICENSE.md +1 -1
  4. data/README.md +9 -8
  5. data/lib/fog/azurerm/models/compute/availability_set.rb +17 -3
  6. data/lib/fog/azurerm/models/compute/availability_sets.rb +2 -6
  7. data/lib/fog/azurerm/models/compute/server.rb +1 -1
  8. data/lib/fog/azurerm/models/compute/servers.rb +3 -1
  9. data/lib/fog/azurerm/models/dns/record_set.rb +31 -3
  10. data/lib/fog/azurerm/models/dns/record_sets.rb +7 -17
  11. data/lib/fog/azurerm/models/dns/zone.rb +26 -3
  12. data/lib/fog/azurerm/models/dns/zones.rb +8 -6
  13. data/lib/fog/azurerm/models/network/frontend_ip_configuration.rb +32 -0
  14. data/lib/fog/azurerm/models/network/inbound_nat_pool.rb +27 -0
  15. data/lib/fog/azurerm/models/network/inbound_nat_rule.rb +29 -0
  16. data/lib/fog/azurerm/models/network/load_balancer.rb +249 -0
  17. data/lib/fog/azurerm/models/network/load_balancers.rb +27 -0
  18. data/lib/fog/azurerm/models/network/load_balancing_rule.rb +42 -0
  19. data/lib/fog/azurerm/models/network/network_interface.rb +46 -7
  20. data/lib/fog/azurerm/models/network/network_interfaces.rb +2 -8
  21. data/lib/fog/azurerm/models/network/network_security_group.rb +89 -0
  22. data/lib/fog/azurerm/models/network/network_security_groups.rb +27 -0
  23. data/lib/fog/azurerm/models/network/network_security_rule.rb +40 -0
  24. data/lib/fog/azurerm/models/network/probe.rb +29 -0
  25. data/lib/fog/azurerm/models/network/public_ip.rb +32 -4
  26. data/lib/fog/azurerm/models/network/public_ips.rb +2 -8
  27. data/lib/fog/azurerm/models/network/subnet.rb +20 -12
  28. data/lib/fog/azurerm/models/network/subnets.rb +1 -7
  29. data/lib/fog/azurerm/models/network/traffic_manager_end_point.rb +63 -0
  30. data/lib/fog/azurerm/models/network/traffic_manager_end_points.rb +29 -0
  31. data/lib/fog/azurerm/models/network/traffic_manager_profile.rb +59 -0
  32. data/lib/fog/azurerm/models/network/traffic_manager_profiles.rb +24 -0
  33. data/lib/fog/azurerm/models/network/virtual_network.rb +19 -6
  34. data/lib/fog/azurerm/models/network/virtual_networks.rb +4 -9
  35. data/lib/fog/azurerm/models/resources/resource_group.rb +2 -1
  36. data/lib/fog/azurerm/models/resources/resource_groups.rb +1 -9
  37. data/lib/fog/azurerm/models/storage/storage_account.rb +5 -7
  38. data/lib/fog/azurerm/models/storage/storage_accounts.rb +5 -6
  39. data/lib/fog/azurerm/network.rb +30 -0
  40. data/lib/fog/azurerm/requests/compute/create_availability_set.rb +13 -2
  41. data/lib/fog/azurerm/requests/compute/create_virtual_machine.rb +60 -2
  42. data/lib/fog/azurerm/requests/compute/deallocate_virtual_machine.rb +4 -2
  43. data/lib/fog/azurerm/requests/compute/delete_availability_set.rb +4 -2
  44. data/lib/fog/azurerm/requests/compute/delete_virtual_machine.rb +4 -2
  45. data/lib/fog/azurerm/requests/compute/generalize_virtual_machine.rb +4 -2
  46. data/lib/fog/azurerm/requests/compute/get_virtual_machine.rb +57 -1
  47. data/lib/fog/azurerm/requests/compute/list_availability_sets.rb +16 -1
  48. data/lib/fog/azurerm/requests/compute/list_available_sizes_for_virtual_machine.rb +27 -1
  49. data/lib/fog/azurerm/requests/compute/power_off_virtual_machine.rb +4 -2
  50. data/lib/fog/azurerm/requests/compute/redeploy_virtual_machine.rb +4 -2
  51. data/lib/fog/azurerm/requests/compute/restart_virtual_machine.rb +4 -2
  52. data/lib/fog/azurerm/requests/compute/start_virtual_machine.rb +4 -2
  53. data/lib/fog/azurerm/requests/dns/check_for_zone.rb +16 -17
  54. data/lib/fog/azurerm/requests/dns/create_record_set.rb +80 -37
  55. data/lib/fog/azurerm/requests/dns/create_zone.rb +43 -27
  56. data/lib/fog/azurerm/requests/dns/delete_record_set.rb +17 -19
  57. data/lib/fog/azurerm/requests/dns/delete_zone.rb +16 -19
  58. data/lib/fog/azurerm/requests/dns/get_records_from_record_set.rb +29 -28
  59. data/lib/fog/azurerm/requests/dns/list_record_sets.rb +49 -23
  60. data/lib/fog/azurerm/requests/dns/list_zones.rb +57 -23
  61. data/lib/fog/azurerm/requests/network/check_for_public_ip.rb +3 -1
  62. data/lib/fog/azurerm/requests/network/check_for_virtual_network.rb +4 -2
  63. data/lib/fog/azurerm/requests/network/create_load_balancer.rb +208 -0
  64. data/lib/fog/azurerm/requests/network/create_network_interface.rb +42 -4
  65. data/lib/fog/azurerm/requests/network/create_network_security_group.rb +200 -0
  66. data/lib/fog/azurerm/requests/network/create_public_ip.rb +19 -5
  67. data/lib/fog/azurerm/requests/network/create_subnet.rb +19 -6
  68. data/lib/fog/azurerm/requests/network/create_traffic_manager_endpoint.rb +78 -0
  69. data/lib/fog/azurerm/requests/network/create_traffic_manager_profile.rb +127 -0
  70. data/lib/fog/azurerm/requests/network/create_virtual_network.rb +40 -5
  71. data/lib/fog/azurerm/requests/network/delete_load_balancer.rb +27 -0
  72. data/lib/fog/azurerm/requests/network/delete_network_interface.rb +5 -3
  73. data/lib/fog/azurerm/requests/network/delete_network_security_group.rb +29 -0
  74. data/lib/fog/azurerm/requests/network/delete_public_ip.rb +4 -2
  75. data/lib/fog/azurerm/requests/network/delete_subnet.rb +10 -8
  76. data/lib/fog/azurerm/requests/network/delete_traffic_manager_endpoint.rb +37 -0
  77. data/lib/fog/azurerm/requests/network/delete_traffic_manager_profile.rb +37 -0
  78. data/lib/fog/azurerm/requests/network/delete_virtual_network.rb +8 -6
  79. data/lib/fog/azurerm/requests/network/get_traffic_manager_profile.rb +96 -0
  80. data/lib/fog/azurerm/requests/network/list_load_balancers.rb +31 -0
  81. data/lib/fog/azurerm/requests/network/list_network_interfaces.rb +41 -9
  82. data/lib/fog/azurerm/requests/network/list_network_security_groups.rb +171 -0
  83. data/lib/fog/azurerm/requests/network/list_public_ips.rb +21 -9
  84. data/lib/fog/azurerm/requests/network/list_subnets.rb +34 -11
  85. data/lib/fog/azurerm/requests/network/list_traffic_manager_profiles.rb +98 -0
  86. data/lib/fog/azurerm/requests/network/list_virtual_networks.rb +53 -8
  87. data/lib/fog/azurerm/requests/resources/create_resource_group.rb +11 -2
  88. data/lib/fog/azurerm/requests/resources/delete_resource_group.rb +4 -2
  89. data/lib/fog/azurerm/requests/resources/list_resource_groups.rb +23 -7
  90. data/lib/fog/azurerm/requests/storage/check_storage_account_name_availability.rb +2 -0
  91. data/lib/fog/azurerm/requests/storage/create_storage_account.rb +14 -8
  92. data/lib/fog/azurerm/requests/storage/delete_storage_account.rb +4 -3
  93. data/lib/fog/azurerm/requests/storage/list_storage_account_for_rg.rb +33 -2
  94. data/lib/fog/azurerm/requests/storage/list_storage_accounts.rb +32 -5
  95. data/lib/fog/azurerm/storage.rb +0 -1
  96. data/lib/fog/azurerm/version.rb +1 -1
  97. metadata +35 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9f6cbb38d0ef89bfa8d8ffe57b032f90995cd526
4
- data.tar.gz: fd38e3b510976906986605f59b5382fb3e224971
3
+ metadata.gz: 383946b845128b2c0a73641f825dee37cc02f5be
4
+ data.tar.gz: 5e9413c7e0991277335912bfe558062f6953aed8
5
5
  SHA512:
6
- metadata.gz: 1c78b35720922618a1f9a717cfd200b55d8c5da58355a0a11ab3627aa96ccb58b6c12bc960b4ef50d8c00bff11c94c6cb6157a8fad656701df0f0c184d5ee116
7
- data.tar.gz: 25ddecbe1221c2f3a38c10dfada1220b919c0b9d7959e692932ac1b5aaaa1f692a04b85bca09f908def944925f42cf8ddae847167df7dd74491c9e4bf4e8f92f
6
+ metadata.gz: 8ed53c8c074f39e27cedc5ee8827ff6b441772f8082e5c665809f74b8c127c12dee612389799c8b3b739c6d8b21b00f650ded1d2db4fe17cba9619e985dbdfd0
7
+ data.tar.gz: 569bda7824aa556ded3c1dae642246ee213d05f357e883bc53a86c783ac95bffa6d5b843f84e4e002cd40bf140261d5a8df11781560beff6f848654302b2bf04
@@ -5,23 +5,34 @@ New contributors are always welcome, when it doubt please ask questions. We stri
5
5
  ### Coding
6
6
 
7
7
  * Pick a task:
8
- * Offer feedback on open [pull requests](https://github.com/Confiz/fog-azure-rm/pulls).
9
- * Review open [issues](https://github.com/Confiz/fog-azure-rm/issues) for things to help on.
10
- * [Create an issue](https://github.com/Confiz/fog-azure-rm/issues/new) to start a discussion on additions or features.
8
+ * Offer feedback on open [pull requests](https://github.com/fog/fog-azure-rm/pulls).
9
+ * Review open [issues](https://github.com/fog/fog-azure-rm/issues) for things to help on.
10
+ * [Create an issue](https://github.com/fog/fog-azure-rm/issues/new) to start a discussion on additions or features.
11
11
  * Fork the project, add your changes and tests to cover them in a topic branch.
12
- * [Fork](https://github.com/Confiz/fog-azure-rm/fork)
12
+ * [Fork](https://github.com/fog/fog-azure-rm/fork)
13
13
  * Create your feature branch (`git checkout -b my-new-feature`)
14
14
  * Commit your changes (`git commit -am 'Add some feature'`)
15
15
  * Push to the branch (`git push origin my-new-feature`)
16
16
  * Create a new pull request
17
- * Commit your changes and rebase against `Confiz/fog-azure-rm` to ensure everything is up to date.
18
- * [Submit a pull request](https://github.com/Confiz/fog-azure-rm/compare/).
17
+ * Commit your changes and rebase against `fog/fog-azure-rm` to ensure everything is up to date.
18
+ * [Submit a pull request](https://github.com/fog/fog-azure-rm/compare/).
19
19
 
20
20
  ### Non-Coding
21
21
 
22
- * Offer feedback on open [issues](https://github.com/Confiz/fog-azure-rm/issues).
22
+ * Offer feedback on open [issues](https://github.com/fog/fog-azure-rm/issues).
23
23
  * Organize or volunteer at events.
24
- * Write and help edit [documentation](https://github.com/Confiz/fog-azure-rm/tree/develop/lib/fog/azurerm/docs).
24
+ * Write and help edit [documentation](https://github.com/fog/fog-azure-rm/tree/master/lib/fog/azurerm/docs).
25
25
 
26
26
  ## Testing
27
+ You can run `Minitest` tests by running this command in the root directory.
27
28
 
29
+ ```shell
30
+ $ rake test
31
+ ```
32
+
33
+ ## Code Coverage
34
+ We are using Simplecov Gem for code coverage. You can see the report of Code Coverage by running this command in the root directory.
35
+
36
+ ```shell
37
+ $ rake coverage
38
+ ```
data/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2014-2015 [CONTRIBUTORS.md](https://github.com/Confiz/fog-azure-rm/blob/develop/CONTRIBUTORS.md)
3
+ Copyright (c) 2014-2015 [CONTRIBUTORS.md](https://github.com/fog/fog-azure-rm/blob/master/CONTRIBUTORS.md)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
data/README.md CHANGED
@@ -1,11 +1,12 @@
1
+ [![Gem Version](https://badge.fury.io/rb/fog-azure-rm.svg)](https://badge.fury.io/rb/fog-azure-rm)
2
+
1
3
  # Fog Azure Resource Manager
2
4
 
3
5
  This document describes how to get started with Fog using Microsoft Azure as a cloud resource management services provider.
4
6
 
5
7
  ## Pre-requisites
6
8
 
7
- * Fog supports Ruby version 2.0.0 or later
8
- * Fog requires Azure SDK For Ruby version 0.2.1.
9
+ * Fog-azure-rm supports Ruby version 2.0.0 or later
9
10
 
10
11
  ## Installation
11
12
 
@@ -41,23 +42,23 @@ After creating the service principal, you should have three pieces of informatio
41
42
 
42
43
  ### Compute
43
44
 
44
- Fog-AzureRM for compute includes implementaion of Virtual Machines and Availability Sets. Readme for the usage of [Compute](https://github.com/Confiz/fog-azure-rm/blob/develop/lib/fog/azurerm/docs/compute.md) module.
45
+ Fog-AzureRM for compute includes implementaion of Virtual Machines and Availability Sets. Readme for the usage of [Compute](https://github.com/fog/fog-azure-rm/blob/master/lib/fog/azurerm/docs/compute.md) module.
45
46
 
46
47
  ### Resources
47
48
 
48
- Fog-AzureRM for resources includes implementaion of Resource Groups. Readme for the usage of [Resources](https://github.com/Confiz/fog-azure-rm/blob/develop/lib/fog/azurerm/docs/resources.md) module.
49
+ Fog-AzureRM for resources includes implementaion of Resource Groups. Readme for the usage of [Resources](https://github.com/fog/fog-azure-rm/blob/master/lib/fog/azurerm/docs/resources.md) module.
49
50
 
50
51
  ### DNS
51
52
 
52
- Fog-AzureRM for dns includes implementaion of Record sets and Zones. Readme for the usage of [DNS](https://github.com/Confiz/fog-azure-rm/blob/develop/lib/fog/azurerm/docs/dns.md) module.
53
+ Fog-AzureRM for dns includes implementaion of Record sets and Zones. Readme for the usage of [DNS](https://github.com/fog/fog-azure-rm/blob/master/lib/fog/azurerm/docs/dns.md) module.
53
54
 
54
55
  ### Network
55
56
 
56
- Fog-AzureRM for network includes implementaion of Network Interfaces, Public IPs, Subnets and Virtual Networks. Readme for the usage of [Network](https://github.com/Confiz/fog-azure-rm/blob/develop/lib/fog/azurerm/docs/network.md) module.
57
+ Fog-AzureRM for network includes implementaion of Network Interfaces, Public IPs, Subnets and Virtual Networks. Readme for the usage of [Network](https://github.com/fog/fog-azure-rm/blob/master/lib/fog/azurerm/docs/network.md) module.
57
58
 
58
59
  ### Storage
59
60
 
60
- Fog-AzureRM for storage includes implementaion of Storage Accounts. Readme for the usage of [Storage](https://github.com/Confiz/fog-azure-rm/blob/develop/lib/fog/azurerm/docs/storage.md) module.
61
+ Fog-AzureRM for storage includes implementaion of Storage Accounts. Readme for the usage of [Storage](https://github.com/fog/fog-azure-rm/blob/master/lib/fog/azurerm/docs/storage.md) module.
61
62
 
62
63
  ## Supported Services
63
64
 
@@ -70,7 +71,7 @@ Fog::AzureRM.services
70
71
 
71
72
  ## Contributing
72
73
 
73
- See [CONTRIBUTING.md](https://github.com/Confiz/fog-azure-rm/blob/develop/CONTRIBUTING.md) in this repository.
74
+ See [CONTRIBUTING.md](https://github.com/fog/fog-azure-rm/blob/master/CONTRIBUTING.md) in this repository.
74
75
 
75
76
  ## License
76
77
 
@@ -10,16 +10,30 @@ module Fog
10
10
  identity :name
11
11
  attribute :type
12
12
  attribute :location
13
- attribute :tags
14
13
  attribute :resource_group
15
- attribute :properties
14
+ attribute :platform_update_domain_count
15
+ attribute :platform_fault_domain_count
16
+
17
+ def self.parse(as)
18
+ hash = {}
19
+ hash['id'] = as['id']
20
+ hash['name'] = as['name']
21
+ hash['type'] = as['type']
22
+ hash['location'] = as['location']
23
+ hash['resource_group'] = as['id'].split('/')[4]
24
+ hash['platform_update_domain_count'] = as['properties']['platformUpdateDomainCount']
25
+ hash['platform_fault_domain_count'] = as['properties']['platformFaultDomainCount']
26
+ hash
27
+ end
16
28
 
17
29
  def save
18
30
  requires :name
19
31
  requires :location
20
32
  requires :resource_group
21
33
  # need to create the availability set
22
- service.create_availability_set(resource_group, name, location)
34
+ as = service.create_availability_set(resource_group, name, location)
35
+ hash = Fog::Compute::AzureRM::AvailabilitySet.parse(as)
36
+ merge_attributes(hash)
23
37
  end
24
38
 
25
39
  def destroy
@@ -16,12 +16,8 @@ module Fog
16
16
  service.list_availability_sets(resource_group)
17
17
  unless list_of_availability_sets.nil?
18
18
  list_of_availability_sets.each do |account|
19
- hash = {}
20
- account.instance_variables.each do |var|
21
- hash[var.to_s.delete('@')] = account.instance_variable_get(var)
22
- end
23
- hash['resource_group'] = resource_group
24
- accounts << hash
19
+ parse_response = Fog::Compute::AzureRM::AvailabilitySet.parse(account)
20
+ accounts << parse_response
25
21
  end
26
22
  end
27
23
  load(accounts)
@@ -50,7 +50,7 @@ module Fog
50
50
  :network_interface_card_id, :publisher, :offer, :sku, :version
51
51
 
52
52
  ssh_key_path = "/home/#{username}/.ssh/authorized_keys" unless ssh_key_data.nil?
53
- vm = service.create_virtual_machine(name, location, resource_group, vm_size, storage_account_name,
53
+ vm = service.create_virtual_machine(resource_group, name, location, vm_size, storage_account_name,
54
54
  username, password, disable_password_authentication,
55
55
  ssh_key_path, ssh_key_data, network_interface_card_id,
56
56
  availability_set_id, publisher, offer, sku, version)
@@ -24,7 +24,9 @@ module Fog
24
24
  end
25
25
 
26
26
  def get_from_remote(resource_group, name)
27
- service.get_virtual_machine(resource_group, name)
27
+ result_obj = service.get_virtual_machine(resource_group, name)
28
+ model_obj = Fog::Compute::AzureRM::Server.new
29
+ model_obj.merge_attributes(Fog::Compute::AzureRM::Server.parse(result_obj))
28
30
  end
29
31
  end
30
32
  end
@@ -1,13 +1,36 @@
1
1
  module Fog
2
2
  module DNS
3
3
  class AzureRM
4
+ # This class is giving implementation of create/save and
5
+ # delete/destroy for RecordSet.
4
6
  class RecordSet < Fog::Model
7
+ attribute :id
5
8
  identity :name
6
9
  attribute :resource_group
10
+ attribute :location
7
11
  attribute :zone_name
8
12
  attribute :records
9
13
  attribute :type
10
14
  attribute :ttl
15
+ attribute :fqdn
16
+ attribute :cname_record
17
+ attribute :a_record
18
+
19
+ def self.parse(recordset)
20
+ hash = {}
21
+ hash['id'] = recordset['id']
22
+ hash['name'] = recordset['name']
23
+ hash['resource_group'] = recordset['id'].split('/')[4]
24
+ hash['location'] = recordset['location']
25
+ hash['zone_name'] = recordset['id'].split('/')[8]
26
+ hash['type'] = recordset['type']
27
+ type = recordset['type'].split('/')[2]
28
+ hash['a_record'] = recordset['properties']['ARecords'] if type == 'A'
29
+ hash['cname_record'] = recordset['properties']['CNAMERecord'] if type == 'CNAME'
30
+ hash['ttl'] = recordset['properties']['TTL']
31
+ hash['fqdn'] = recordset['properties']['fqdn']
32
+ hash
33
+ end
11
34
 
12
35
  def save
13
36
  requires :name
@@ -16,13 +39,18 @@ module Fog
16
39
  requires :records
17
40
  requires :type
18
41
  requires :ttl
19
- service.create_record_set(resource_group, zone_name, name, records, type, ttl)
42
+ record_set = service.create_record_set(resource_group, name, zone_name, records, type, ttl)
43
+ merge_attributes(Fog::DNS::AzureRM::RecordSet.parse(record_set))
20
44
  end
21
45
 
22
46
  def destroy
23
- service.delete_record_set(name, resource_group, zone_name, type.split("/").last)
47
+ service.delete_record_set(resource_group, name, zone_name, type.split('/').last)
48
+ end
49
+
50
+ def get_records(resource_group, name, zone_name, record_type)
51
+ service.get_records_from_record_set(resource_group, name, zone_name, record_type)
24
52
  end
25
53
  end
26
54
  end
27
55
  end
28
- end
56
+ end
@@ -1,11 +1,12 @@
1
- require "fog/core/collection"
2
- require "fog/azurerm/models/dns/record_set"
1
+ require 'fog/core/collection'
2
+ require 'fog/azurerm/models/dns/record_set'
3
3
 
4
4
  module Fog
5
5
  module DNS
6
6
  class AzureRM
7
+ # This class is giving implementation of
8
+ # all/get for RecordSets.
7
9
  class RecordSets < Fog::Collection
8
-
9
10
  attribute :resource_group
10
11
  attribute :zone_name
11
12
  attribute :type
@@ -16,27 +17,16 @@ module Fog
16
17
  requires :resource_group
17
18
  requires :zone_name
18
19
  record_sets = []
19
- exclude = false
20
20
  service.list_record_sets(resource_group, zone_name).each do |r|
21
- hash = {}
22
- r.each do |k, v|
23
- if (k == 'name' && v == '@')
24
- exclude = true
25
- end
26
- hash[k] = v
27
- hash['zone_name'] = zone_name
28
- hash['resource_group'] = resource_group
29
- end
30
- record_sets << hash if !exclude
31
- exclude = false
21
+ record_sets << Fog::DNS::AzureRM::RecordSet.parse(r)
32
22
  end
33
23
  load(record_sets)
34
24
  end
35
25
 
36
26
  def get(identity, type)
37
- all.find { |f| f.name == identity && f.type == "Microsoft.Network/dnszones/#{type}"}
27
+ all.find { |f| f.name == identity && f.type == "Microsoft.Network/dnszones/#{type}" }
38
28
  end
39
29
  end
40
30
  end
41
31
  end
42
- end
32
+ end
@@ -1,19 +1,42 @@
1
1
  module Fog
2
2
  module DNS
3
3
  class AzureRM
4
+ # This class is giving implementation of create/save and
5
+ # delete/destroy for Zone.
4
6
  class Zone < Fog::Model
5
- identity :name
6
7
  attribute :id
8
+ identity :name
7
9
  attribute :resource_group
10
+ attribute :location
11
+ attribute :type
12
+ attribute :tags
13
+ attribute :etag
14
+ attribute :number_of_record_sets
15
+ attribute :max_number_of_recordsets
16
+
17
+ def self.parse(zone)
18
+ hash = {}
19
+ hash['id'] = zone['id']
20
+ hash['name'] = zone['name']
21
+ hash['resource_group'] = zone['id'].split('/')[4]
22
+ hash['location'] = zone['location']
23
+ hash['type'] = zone['type']
24
+ hash['tags'] = zone['tags']
25
+ hash['etag'] = zone['etag']
26
+ hash['number_of_record_sets'] = zone['properties']['numberOfRecordSets']
27
+ hash['max_number_of_recordsets'] = zone['properties']['maxNumberOfRecordSets']
28
+ hash
29
+ end
8
30
 
9
31
  def save
10
32
  requires :name
11
33
  requires :resource_group
12
- service.create_zone(resource_group, name)
34
+ zone = service.create_zone(resource_group, name)
35
+ merge_attributes(Fog::DNS::AzureRM::Zone.parse(zone))
13
36
  end
14
37
 
15
38
  def destroy
16
- service.delete_zone(name, resource_group)
39
+ service.delete_zone(resource_group, name)
17
40
  end
18
41
  end
19
42
  end
@@ -4,24 +4,26 @@ require 'fog/azurerm/models/dns/zone'
4
4
  module Fog
5
5
  module DNS
6
6
  class AzureRM
7
+ # This class is giving implementation of
8
+ # all/get for Zones.
7
9
  class Zones < Fog::Collection
8
10
  model Fog::DNS::AzureRM::Zone
9
11
 
10
12
  def all
11
13
  zones = []
12
14
  service.list_zones.each do |z|
13
- hash = {}
14
- z.each do |k, v|
15
- hash[k] = v
16
- end
17
- zones << hash
15
+ zones << Fog::DNS::AzureRM::Zone.parse(z)
18
16
  end
19
17
  load(zones)
20
18
  end
21
19
 
22
- def get(identity, resource_group)
20
+ def get(resource_group, identity)
23
21
  all.find { |f| f.name == identity && f.resource_group == resource_group }
24
22
  end
23
+
24
+ def check_for_zone(resource_group, name)
25
+ service.check_for_zone(resource_group, name)
26
+ end
25
27
  end
26
28
  end
27
29
  end
@@ -0,0 +1,32 @@
1
+ module Fog
2
+ module Network
3
+ class AzureRM
4
+ # FrontendIPConfiguration model for Network Service
5
+ class FrontendIPConfiguration < Fog::Model
6
+ identity :name
7
+ attribute :id
8
+ attribute :load_balancing_rules
9
+ attribute :private_ipaddress
10
+ attribute :private_ipallocation_method
11
+ attribute :subnet_id
12
+ attribute :public_ipaddress_id
13
+
14
+ def self.parse(frontend_ip_configuration)
15
+ hash = {}
16
+ hash['name'] = frontend_ip_configuration['name']
17
+ subnet = frontend_ip_configuration['properties']['subnet']
18
+ hash['subnet_id'] = subnet['id'] unless subnet.nil?
19
+ private_ip_address = frontend_ip_configuration['properties']['privateIPAllocationMethod']
20
+ unless private_ip_address.nil?
21
+ hash['private_ipaddress'] = private_ip_address
22
+ end
23
+ public_ip_address = frontend_ip_configuration['properties']['publicIPAddress']
24
+ unless public_ip_address.nil?
25
+ hash['public_ip_address_id'] = public_ip_address['id']
26
+ end
27
+ hash
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,27 @@
1
+ module Fog
2
+ module Network
3
+ class AzureRM
4
+ # InboundNatPool model for Network Service
5
+ class InboundNatPool < Fog::Model
6
+ identity :name
7
+ attribute :id
8
+ attribute :protocol
9
+ attribute :frontend_port_range_start
10
+ attribute :frontend_port_range_end
11
+ attribute :backend_port
12
+
13
+ def self.parse(inbound_nat_pool)
14
+ inbound_nat_pool_prop = inbound_nat_pool['properties']
15
+ hash = {}
16
+ hash['id'] = inbound_nat_pool['id']
17
+ hash['name'] = inbound_nat_pool['name']
18
+ hash['protocol'] = inbound_nat_pool_prop['protocol']
19
+ hash['frontend_port_range_start'] = inbound_nat_pool_prop['frontendPortRangeStart']
20
+ hash['frontend_port_range_end'] = inbound_nat_pool_prop['frontendPortRangeEnd']
21
+ hash['backend_port'] = inbound_nat_pool_prop['backendPort']
22
+ hash
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,29 @@
1
+ module Fog
2
+ module Network
3
+ class AzureRM
4
+ # InboundNatRule model for Network Service
5
+ class InboundNatRule < Fog::Model
6
+ identity :name
7
+ attribute :id
8
+ attribute :frontend_ip_configuration_id
9
+ attribute :protocol
10
+ attribute :frontend_port
11
+ attribute :backend_port
12
+
13
+ def self.parse(inbound_nat_rule)
14
+ inbound_nat_rule_prop = inbound_nat_rule['properties']
15
+ hash = {}
16
+ hash['id'] = inbound_nat_rule['id']
17
+ hash['name'] = inbound_nat_rule['name']
18
+ unless inbound_nat_rule_prop['frontendIPConfiguration'].nil?
19
+ hash['frontend_ip_configuration_id'] = inbound_nat_rule_prop['frontendIPConfiguration']['id']
20
+ end
21
+ hash['protocol'] = inbound_nat_rule_prop['protocol']
22
+ hash['frontend_port'] = inbound_nat_rule_prop['frontendPort']
23
+ hash['backend_port'] = inbound_nat_rule_prop['backendPort']
24
+ hash
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end