fog-azure-rm 0.2.5 → 0.2.6
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/fog-azure-rm.gemspec +0 -1
- data/lib/fog/azurerm/models/compute/server.rb +1 -0
- data/lib/fog/azurerm/models/network/network_interface.rb +2 -2
- data/lib/fog/azurerm/requests/network/create_or_update_network_interface.rb +16 -9
- data/lib/fog/azurerm/version.rb +1 -1
- data/test/integration/network_interface.rb +2 -1
- data/test/requests/network/test_create_network_interface.rb +4 -4
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b24d2c21a6e6802af2ca763b1230cb7a7d75acc
|
4
|
+
data.tar.gz: 1a176bf88ef73639cf5c4cceafdebfb13f676d28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57b1cd6b6c20875fcd62db652f45818741b6fb37bd855250881ea261a50b401900dea6851384565642fa9cb492030aac6f4e3708135fe03bd69525c9bee6a3de
|
7
|
+
data.tar.gz: e730e48874f042e56027233ee84167ae48cdb38fbc96c02a49ecf9aaddee839bbdcf4953fb88b9a8087d80cb6a3262d1bd8296a403ec3b237a8592c8be39833d
|
data/CHANGELOG.md
CHANGED
data/fog-azure-rm.gemspec
CHANGED
@@ -41,6 +41,7 @@ module Fog
|
|
41
41
|
unless vm.storage_profile.nil?
|
42
42
|
hash['os_disk_name'] = vm.storage_profile.os_disk.name
|
43
43
|
hash['os_disk_vhd_uri'] = vm.storage_profile.os_disk.vhd.uri
|
44
|
+
hash['storage_account_name'] = hash['os_disk_vhd_uri'].split('/')[2].split('.')[0]
|
44
45
|
hash['os_disk_caching'] = vm.storage_profile.os_disk.caching
|
45
46
|
unless vm.storage_profile.image_reference.nil?
|
46
47
|
hash['publisher'] = vm.storage_profile.image_reference.publisher
|
@@ -62,14 +62,14 @@ module Fog
|
|
62
62
|
requires :subnet_id
|
63
63
|
requires :ip_configuration_name
|
64
64
|
requires :private_ip_allocation_method
|
65
|
-
nic = service.create_or_update_network_interface(resource_group, name, location, subnet_id, public_ip_address_id, ip_configuration_name, private_ip_allocation_method, private_ip_address, load_balancer_backend_address_pools_ids, load_balancer_inbound_nat_rules_ids)
|
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)
|
66
66
|
merge_attributes(Fog::Network::AzureRM::NetworkInterface.parse(nic))
|
67
67
|
end
|
68
68
|
|
69
69
|
def update(updated_attributes = {})
|
70
70
|
validate_update_attributes!(updated_attributes)
|
71
71
|
merge_attributes(updated_attributes)
|
72
|
-
nic = service.create_or_update_network_interface(resource_group, name, location, subnet_id, public_ip_address_id, ip_configuration_name, private_ip_allocation_method, private_ip_address)
|
72
|
+
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)
|
73
73
|
merge_attributes(Fog::Network::AzureRM::NetworkInterface.parse(nic))
|
74
74
|
end
|
75
75
|
|
@@ -4,10 +4,10 @@ module Fog
|
|
4
4
|
class AzureRM
|
5
5
|
# Real class for Network Request
|
6
6
|
class Real
|
7
|
-
def create_or_update_network_interface(resource_group_name, name, location, subnet_id, public_ip_address_id, ip_config_name, private_ip_allocation_method, private_ip_address, load_balancer_backend_address_pools_ids, load_balancer_inbound_nat_rules_ids)
|
7
|
+
def create_or_update_network_interface(resource_group_name, name, location, subnet_id, public_ip_address_id, network_security_group_id, ip_config_name, private_ip_allocation_method, private_ip_address, load_balancer_backend_address_pools_ids, load_balancer_inbound_nat_rules_ids)
|
8
8
|
msg = "Creating/Updating Network Interface Card: #{name}"
|
9
9
|
Fog::Logger.debug msg
|
10
|
-
network_interface = get_network_interface_object(name, location, subnet_id, public_ip_address_id, ip_config_name, private_ip_allocation_method, private_ip_address, load_balancer_backend_address_pools_ids, load_balancer_inbound_nat_rules_ids)
|
10
|
+
network_interface = get_network_interface_object(name, location, subnet_id, public_ip_address_id, network_security_group_id, ip_config_name, private_ip_allocation_method, private_ip_address, load_balancer_backend_address_pools_ids, load_balancer_inbound_nat_rules_ids)
|
11
11
|
begin
|
12
12
|
network_interface_obj = @network_client.network_interfaces.create_or_update(resource_group_name, name, network_interface)
|
13
13
|
rescue MsRestAzure::AzureOperationError => e
|
@@ -19,10 +19,7 @@ module Fog
|
|
19
19
|
|
20
20
|
private
|
21
21
|
|
22
|
-
def get_network_interface_object(name, location, subnet_id, public_ip_address_id, ip_config_name, private_ip_allocation_method, private_ip_address, load_balancer_backend_address_pools_ids, load_balancer_inbound_nat_rules_ids)
|
23
|
-
subnet = Azure::ARM::Network::Models::Subnet.new
|
24
|
-
subnet.id = subnet_id
|
25
|
-
|
22
|
+
def get_network_interface_object(name, location, subnet_id, public_ip_address_id, network_security_group_id, ip_config_name, private_ip_allocation_method, private_ip_address, load_balancer_backend_address_pools_ids, load_balancer_inbound_nat_rules_ids)
|
26
23
|
if public_ip_address_id
|
27
24
|
public_ipaddress = Azure::ARM::Network::Models::PublicIPAddress.new
|
28
25
|
public_ipaddress.id = public_ip_address_id
|
@@ -33,16 +30,20 @@ module Fog
|
|
33
30
|
ip_configs.private_ipallocation_method = private_ip_allocation_method
|
34
31
|
ip_configs.private_ipaddress = private_ip_address
|
35
32
|
ip_configs.public_ipaddress = public_ipaddress unless public_ip_address_id.nil?
|
36
|
-
ip_configs.subnet = subnet
|
37
33
|
|
34
|
+
if subnet_id
|
35
|
+
subnet = Azure::ARM::Network::Models::Subnet.new
|
36
|
+
subnet.id = subnet_id
|
37
|
+
ip_configs.subnet = subnet
|
38
|
+
end
|
38
39
|
|
39
40
|
if load_balancer_backend_address_pools_ids
|
40
41
|
ip_configs.load_balancer_backend_address_pools = []
|
41
|
-
|
42
|
+
load_balancer_backend_address_pools_ids.each do |load_balancer_backend_address_pools_id|
|
42
43
|
backend_pool = Azure::ARM::Network::Models::BackendAddressPool.new
|
43
44
|
backend_pool.id = load_balancer_backend_address_pools_id
|
44
45
|
ip_configs.load_balancer_backend_address_pools.push(backend_pool)
|
45
|
-
|
46
|
+
end
|
46
47
|
end
|
47
48
|
|
48
49
|
if load_balancer_inbound_nat_rules_ids
|
@@ -59,6 +60,12 @@ module Fog
|
|
59
60
|
network_interface.location = location
|
60
61
|
network_interface.ip_configurations = [ip_configs]
|
61
62
|
|
63
|
+
if network_security_group_id
|
64
|
+
network_security_group = Azure::ARM::Network::Models::NetworkSecurityGroup.new
|
65
|
+
network_security_group.id = network_security_group_id
|
66
|
+
network_interface.network_security_group = network_security_group
|
67
|
+
end
|
68
|
+
|
62
69
|
network_interface
|
63
70
|
end
|
64
71
|
end
|
data/lib/fog/azurerm/version.rb
CHANGED
@@ -67,7 +67,7 @@ begin
|
|
67
67
|
public_ip_allocation_method: 'Dynamic'
|
68
68
|
)
|
69
69
|
|
70
|
-
network.network_security_groups.create(
|
70
|
+
nsg = network.network_security_groups.create(
|
71
71
|
name: 'test_nsg',
|
72
72
|
resource_group: 'TestRG-NI',
|
73
73
|
location: LOCATION,
|
@@ -102,6 +102,7 @@ begin
|
|
102
102
|
name: 'NetInt',
|
103
103
|
resource_group: 'TestRG-NI',
|
104
104
|
location: LOCATION,
|
105
|
+
network_security_group_id: nsg.id,
|
105
106
|
subnet_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/TestRG-NI/providers/Microsoft.Network/virtualNetworks/testVnet/subnets/mysubnet",
|
106
107
|
public_ip_address_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/TestRG-NI/providers/Microsoft.Network/publicIPAddresses/mypubip",
|
107
108
|
ip_configuration_name: 'testIpConfiguration',
|
@@ -11,14 +11,14 @@ class TestCreateNetworkInterface < Minitest::Test
|
|
11
11
|
def test_create_network_interface_success
|
12
12
|
mocked_response = ApiStub::Requests::Network::NetworkInterface.create_network_interface_response(@network_client)
|
13
13
|
@network_interfaces.stub :create_or_update, mocked_response do
|
14
|
-
assert_equal @service.create_or_update_network_interface('fog-test-rg', 'fog-test-network-interface', 'West US', 'fog-test-subnet-id', 'fog-test-ip-address-id', 'fog-test-ip-configuration', 'Dynamic', '10.0.0.8', ['id-1', 'id-2'], ['id-1', 'id-2']), mocked_response
|
14
|
+
assert_equal @service.create_or_update_network_interface('fog-test-rg', 'fog-test-network-interface', 'West US', 'fog-test-subnet-id', 'fog-test-ip-address-id', 'fog-test-nsg-id', 'fog-test-ip-configuration', 'Dynamic', '10.0.0.8', ['id-1', 'id-2'], ['id-1', 'id-2']), mocked_response
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
def test_create_network_interface_without_public_ip_success
|
19
19
|
mocked_response = ApiStub::Requests::Network::NetworkInterface.create_network_interface_response(@network_client)
|
20
20
|
@network_interfaces.stub :create_or_update, mocked_response do
|
21
|
-
assert_equal @service.create_or_update_network_interface('fog-test-rg', 'fog-test-network-interface', 'West US', 'fog-test-subnet-id', nil, 'fog-test-ip-configuration', 'Dynamic', '10.0.0.8', ['id-1', 'id-2'], ['id-1', 'id-2']), mocked_response
|
21
|
+
assert_equal @service.create_or_update_network_interface('fog-test-rg', 'fog-test-network-interface', 'West US', 'fog-test-subnet-id', nil, 'fog-test-nsg-id', 'fog-test-ip-configuration', 'Dynamic', '10.0.0.8', ['id-1', 'id-2'], ['id-1', 'id-2']), mocked_response
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -26,7 +26,7 @@ class TestCreateNetworkInterface < Minitest::Test
|
|
26
26
|
response = ApiStub::Requests::Network::NetworkInterface.create_network_interface_response(@network_client)
|
27
27
|
@network_interfaces.stub :create_or_update, response do
|
28
28
|
assert_raises ArgumentError do
|
29
|
-
@service.create_or_update_network_interface('fog-test-rg', 'fog-test-network-interface', 'West US', 'fog-test-subnet-id', 'fog-test-ip-address-id', 'fog-test-ip-configuration', ['id-1', 'id-2'], ['id-1', 'id-2'])
|
29
|
+
@service.create_or_update_network_interface('fog-test-rg', 'fog-test-network-interface', 'West US', 'fog-test-subnet-id', 'fog-test-ip-address-id', 'fog-test-nsg-id', 'fog-test-ip-configuration', ['id-1', 'id-2'], ['id-1', 'id-2'])
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -35,7 +35,7 @@ class TestCreateNetworkInterface < Minitest::Test
|
|
35
35
|
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
36
36
|
@network_interfaces.stub :create_or_update, response do
|
37
37
|
assert_raises RuntimeError do
|
38
|
-
@service.create_or_update_network_interface('fog-test-rg', 'fog-test-network-interface', 'West US', 'fog-test-subnet-id', 'fog-test-ip-address-id', 'fog-test-ip-configuration', 'Dynamic', '10.0.0.8', ['id-1', 'id-2'], ['id-1', 'id-2'])
|
38
|
+
@service.create_or_update_network_interface('fog-test-rg', 'fog-test-network-interface', 'West US', 'fog-test-subnet-id', 'fog-test-ip-address-id', 'fog-test-nsg-id', 'fog-test-ip-configuration', 'Dynamic', '10.0.0.8', ['id-1', 'id-2'], ['id-1', 'id-2'])
|
39
39
|
end
|
40
40
|
end
|
41
41
|
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.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shaffan Chaudhry
|
@@ -14,7 +14,7 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date: 2017-01-
|
17
|
+
date: 2017-01-30 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: rake
|
@@ -254,20 +254,6 @@ dependencies:
|
|
254
254
|
- - '='
|
255
255
|
- !ruby/object:Gem::Version
|
256
256
|
version: 0.0.4
|
257
|
-
- !ruby/object:Gem::Dependency
|
258
|
-
name: nokogiri
|
259
|
-
requirement: !ruby/object:Gem::Requirement
|
260
|
-
requirements:
|
261
|
-
- - "~>"
|
262
|
-
- !ruby/object:Gem::Version
|
263
|
-
version: 1.6.0
|
264
|
-
type: :runtime
|
265
|
-
prerelease: false
|
266
|
-
version_requirements: !ruby/object:Gem::Requirement
|
267
|
-
requirements:
|
268
|
-
- - "~>"
|
269
|
-
- !ruby/object:Gem::Version
|
270
|
-
version: 1.6.0
|
271
257
|
description: |-
|
272
258
|
This library can be used as a module for 'fog' or as standalone provider
|
273
259
|
to use the Azure Resource Manager cloud services in applications..
|