fog-azure-rm 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 086b6f020bf8dccb6fe47578df34eacfac015719
4
- data.tar.gz: 584f0ad3a486c34686af2cdfc7e470c0d730bd77
3
+ metadata.gz: 9f6cbb38d0ef89bfa8d8ffe57b032f90995cd526
4
+ data.tar.gz: fd38e3b510976906986605f59b5382fb3e224971
5
5
  SHA512:
6
- metadata.gz: 8b228877689c27b572c230aa1eb60f75adae338133ff3b902eca215fc1dec4f8e798c1a780621add6c8908b77cd5fb4b5fc4fae1f6d0fd13a0b2b96530a6f490
7
- data.tar.gz: 8d6ad541e4b35af0f57e7d7fcc4036835774086f94360325beeb367697c5585f01041430d5d81ef2df12e61e0bb83b4a5d9ccb9f1ee4a5a762e9831a9605a48b
6
+ metadata.gz: 1c78b35720922618a1f9a717cfd200b55d8c5da58355a0a11ab3627aa96ccb58b6c12bc960b4ef50d8c00bff11c94c6cb6157a8fad656701df0f0c184d5ee116
7
+ data.tar.gz: 25ddecbe1221c2f3a38c10dfada1220b919c0b9d7959e692932ac1b5aaaa1f692a04b85bca09f908def944925f42cf8ddae847167df7dd74491c9e4bf4e8f92f
@@ -37,4 +37,4 @@ module Fog
37
37
  end
38
38
  end
39
39
  end
40
- end
40
+ end
@@ -35,8 +35,6 @@ module Fog
35
35
 
36
36
  def get(identity, type)
37
37
  all.find { |f| f.name == identity && f.type == "Microsoft.Network/dnszones/#{type}"}
38
- rescue Fog::Errors::NotFound
39
- nil
40
38
  end
41
39
  end
42
40
  end
@@ -21,8 +21,6 @@ module Fog
21
21
 
22
22
  def get(identity, resource_group)
23
23
  all.find { |f| f.name == identity && f.resource_group == resource_group }
24
- rescue Fog::Errors::NotFound
25
- nil
26
24
  end
27
25
  end
28
26
  end
@@ -4,6 +4,7 @@ module Fog
4
4
  # NetworkInterface model class for Network Service
5
5
  class NetworkInterface < Fog::Model
6
6
  identity :name
7
+ attribute :id
7
8
  attribute :location
8
9
  attribute :resource_group
9
10
  attribute :subnet_id
@@ -26,8 +26,6 @@ module Fog
26
26
 
27
27
  def get(identity)
28
28
  all.find { |f| f.name == identity }
29
- rescue Fog::Errors::NotFound
30
- nil
31
29
  end
32
30
  end
33
31
  end
@@ -14,15 +14,7 @@ module Fog
14
14
  requires :location
15
15
  requires :resource_group
16
16
 
17
- properties = Azure::ARM::Network::Models::PublicIPAddressPropertiesFormat.new
18
- properties.public_ipallocation_method = type
19
-
20
- public_ip = Azure::ARM::Network::Models::PublicIPAddress.new
21
- public_ip.name = name
22
- public_ip.location = location
23
- public_ip.properties = properties
24
-
25
- service.create_public_ip(resource_group, name, public_ip)
17
+ service.create_public_ip(resource_group, name, location, type)
26
18
  end
27
19
 
28
20
  def destroy
@@ -26,8 +26,6 @@ module Fog
26
26
 
27
27
  def get(identity)
28
28
  all.find { |f| f.name == identity }
29
- rescue Fog::Errors::NotFound
30
- nil
31
29
  end
32
30
 
33
31
  def check_if_exists(resource_group, name)
@@ -28,8 +28,6 @@ module Fog
28
28
 
29
29
  def get(identity)
30
30
  all.find { |f| f.name == identity }
31
- rescue Fog::Errors::NotFound
32
- nil
33
31
  end
34
32
  end
35
33
  end
@@ -6,10 +6,12 @@ module Fog
6
6
  class AzureRM
7
7
  class VirtualNetworks < Fog::Collection
8
8
  model Fog::Network::AzureRM::VirtualNetwork
9
+ attribute :resource_group
9
10
 
10
11
  def all
12
+ requires :resource_group
11
13
  virtual_networks = []
12
- service.list_virtual_networks.each do |vnet|
14
+ service.list_virtual_networks(resource_group).each do |vnet|
13
15
  hash = {}
14
16
  vnet.instance_variables.each do |var|
15
17
  hash[var.to_s.delete('@')] = vnet.instance_variable_get(var)
@@ -22,8 +24,6 @@ module Fog
22
24
 
23
25
  def get(identity, resource_group)
24
26
  all.find { |f| f.name == identity && f.resource_group == resource_group }
25
- rescue Fog::Errors::NotFound
26
- nil
27
27
  end
28
28
 
29
29
  def check_if_exists(name, resource_group)
@@ -15,6 +15,7 @@ module Fog
15
15
  authorization: token
16
16
  )
17
17
  Fog::Logger.debug "RecordSet #{record_set_name} Deleted Successfully!"
18
+ true
18
19
  rescue RestClient::Exception => e
19
20
  body = JSON.parse(e.http_body)
20
21
  if body.key?('error')
@@ -5,7 +5,7 @@ module Fog
5
5
  def list_zones
6
6
  zone_hash_array = []
7
7
  @resources.resource_groups.each do |rg|
8
- list_zones(rg.name).each do |zone_hash|
8
+ list_zones_by_rg(rg.name).each do |zone_hash|
9
9
  zone_hash['resource_group'] = rg.name
10
10
  zone_hash_array << zone_hash
11
11
  end
@@ -13,7 +13,9 @@ module Fog
13
13
  zone_hash_array
14
14
  end
15
15
 
16
- def list_zones(dns_resource_group)
16
+ private
17
+
18
+ def list_zones_by_rg(dns_resource_group)
17
19
  resource_url = "#{AZURE_RESOURCE}/subscriptions/#{@subscription_id}/resourceGroups/#{dns_resource_group}/providers/Microsoft.Network/dnsZones?api-version=2015-05-04-preview"
18
20
  begin
19
21
  token = Fog::Credentials::AzureRM.get_token(@tenant_id, @client_id, @client_secret)
@@ -12,7 +12,6 @@ module Fog
12
12
  msg = "Exception checking name availability: #{e.body['error']['message']}"
13
13
  raise msg if e.body['error']['code'] == 'ResourceGroupNotFound'
14
14
  return false if e.body['error']['code'] == 'ResourceNotFound'
15
- return true
16
15
  end
17
16
  end
18
17
  end
@@ -12,7 +12,6 @@ module Fog
12
12
  msg = "Exception checking name availability: #{e.body['error']['message']}"
13
13
  raise msg if e.body['error']['code'] == 'ResourceGroupNotFound'
14
14
  return false if e.body['error']['code'] == 'ResourceNotFound'
15
- return true
16
15
  end
17
16
  end
18
17
  end
@@ -3,14 +3,20 @@ module Fog
3
3
  class AzureRM
4
4
  # Real class for Network Request
5
5
  class Real
6
- def create_public_ip(resource_group, name, public_ip)
6
+ def create_public_ip(resource_group, name, location, type)
7
7
  Fog::Logger.debug "Creating PublicIP #{name} in Resource Group #{resource_group}."
8
+ properties = Azure::ARM::Network::Models::PublicIPAddressPropertiesFormat.new
9
+ properties.public_ipallocation_method = type
10
+
11
+ public_ip = Azure::ARM::Network::Models::PublicIPAddress.new
12
+ public_ip.name = name
13
+ public_ip.location = location
14
+ public_ip.properties = properties
8
15
  begin
9
16
  promise = @network_client.public_ipaddresses.create_or_update(resource_group, name, public_ip)
10
- response = promise.value!
11
- result = response.body
17
+ result = promise.value!
12
18
  Fog::Logger.debug "PublicIP #{name} Created Successfully!"
13
- return result
19
+ result
14
20
  rescue MsRestAzure::AzureOperationError => e
15
21
  msg = "Exception creating Public IP #{name} in Resource Group: #{resource_group}. #{e.body['error']['message']}"
16
22
  raise msg
@@ -4,11 +4,11 @@ module Fog
4
4
  # Real class for Network Request
5
5
  class Real
6
6
  def delete_subnet(resource_group, virtual_network_name, subnet_name)
7
- Fog::Logger.debug "Deleting Subnet: #{name}..."
7
+ Fog::Logger.debug "Deleting Subnet: #{subnet_name}..."
8
8
  begin
9
9
  promise = @network_client.subnets.delete(resource_group, virtual_network_name, subnet_name)
10
10
  response = promise.value!
11
- Fog::Logger.debug "Subnet #{name} deleted successfully."
11
+ Fog::Logger.debug "Subnet #{subnet_name} deleted successfully."
12
12
  response
13
13
  rescue MsRestAzure::AzureOperationError => e
14
14
  msg = "Exception deleting Subnet #{subnet_name} in Resource Group: #{resource_group}. #{e.body['error']['message']}"
@@ -9,7 +9,7 @@ module Fog
9
9
  response = promise.value!
10
10
  response.body.value
11
11
  rescue MsRestAzure::AzureOperationError => e
12
- msg = "Exception listing Subnets from Resource Group '#{resource_group}' in Virtal Network #{virtual_network_name}. #{e.body['error']['message']}."
12
+ msg = "Exception listing Subnets from Resource Group '#{resource_group_name}' in Virtal Network #{virtual_network_name}. #{e.body['error']['message']}."
13
13
  raise msg
14
14
  end
15
15
  end
@@ -2,9 +2,9 @@ module Fog
2
2
  module Network
3
3
  class AzureRM
4
4
  class Real
5
- def list_virtual_networks
5
+ def list_virtual_networks(resource_group)
6
6
  begin
7
- response = @network_client.virtual_networks.list_all
7
+ response = @network_client.virtual_networks.list(resource_group)
8
8
  result = response.value!
9
9
  result.body.value
10
10
  rescue MsRestAzure::AzureOperationError => e
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module AzureRM
3
- VERSION = '0.0.0'
3
+ VERSION = '0.0.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-azure-rm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shaffan Chaudhry
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-05-02 00:00:00.000000000 Z
13
+ date: 2016-05-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
@@ -271,8 +271,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
271
271
  version: '0'
272
272
  requirements: []
273
273
  rubyforge_project:
274
- rubygems_version: 2.2.5
274
+ rubygems_version: 2.4.8
275
275
  signing_key:
276
276
  specification_version: 4
277
277
  summary: Module for the 'fog' gem to support Azure Resource Manager cloud services.
278
278
  test_files: []
279
+ has_rdoc: