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 +4 -4
- data/lib/fog/azurerm.rb +1 -1
- data/lib/fog/azurerm/models/dns/record_sets.rb +0 -2
- data/lib/fog/azurerm/models/dns/zones.rb +0 -2
- data/lib/fog/azurerm/models/network/network_interface.rb +1 -0
- data/lib/fog/azurerm/models/network/network_interfaces.rb +0 -2
- data/lib/fog/azurerm/models/network/public_ip.rb +1 -9
- data/lib/fog/azurerm/models/network/public_ips.rb +0 -2
- data/lib/fog/azurerm/models/network/subnets.rb +0 -2
- data/lib/fog/azurerm/models/network/virtual_networks.rb +3 -3
- data/lib/fog/azurerm/requests/dns/delete_record_set.rb +1 -0
- data/lib/fog/azurerm/requests/dns/list_zones.rb +4 -2
- data/lib/fog/azurerm/requests/network/check_for_public_ip.rb +0 -1
- data/lib/fog/azurerm/requests/network/check_for_virtual_network.rb +0 -1
- data/lib/fog/azurerm/requests/network/create_public_ip.rb +10 -4
- data/lib/fog/azurerm/requests/network/delete_subnet.rb +2 -2
- data/lib/fog/azurerm/requests/network/list_subnets.rb +1 -1
- data/lib/fog/azurerm/requests/network/list_virtual_networks.rb +2 -2
- data/lib/fog/azurerm/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f6cbb38d0ef89bfa8d8ffe57b032f90995cd526
|
4
|
+
data.tar.gz: fd38e3b510976906986605f59b5382fb3e224971
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c78b35720922618a1f9a717cfd200b55d8c5da58355a0a11ab3627aa96ccb58b6c12bc960b4ef50d8c00bff11c94c6cb6157a8fad656701df0f0c184d5ee116
|
7
|
+
data.tar.gz: 25ddecbe1221c2f3a38c10dfada1220b919c0b9d7959e692932ac1b5aaaa1f692a04b85bca09f908def944925f42cf8ddae847167df7dd74491c9e4bf4e8f92f
|
data/lib/fog/azurerm.rb
CHANGED
@@ -14,15 +14,7 @@ module Fog
|
|
14
14
|
requires :location
|
15
15
|
requires :resource_group
|
16
16
|
|
17
|
-
|
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
|
@@ -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)
|
@@ -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
|
-
|
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
|
-
|
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)
|
@@ -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,
|
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
|
-
|
11
|
-
result = response.body
|
17
|
+
result = promise.value!
|
12
18
|
Fog::Logger.debug "PublicIP #{name} Created Successfully!"
|
13
|
-
|
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: #{
|
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 #{
|
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 '#{
|
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.
|
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
|
data/lib/fog/azurerm/version.rb
CHANGED
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.
|
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-
|
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.
|
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:
|