fog-profitbricks 2.0.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/.travis.yml +11 -4
- data/README.md +8 -5
- data/Rakefile +1 -1
- data/examples/pb_demo.rb +49 -49
- data/fog-profitbricks.gemspec +4 -5
- data/gemfiles/Gemfile.1.9.2+ +1 -0
- data/lib/fog/bin/profitbricks.rb +5 -5
- data/lib/fog/profitbricks.rb +3 -3
- data/lib/fog/profitbricks/compute.rb +209 -204
- data/lib/fog/profitbricks/helpers/compute/data_helper.rb +1 -1
- data/lib/fog/profitbricks/models/compute/datacenter.rb +1 -1
- data/lib/fog/profitbricks/models/compute/datacenters.rb +6 -7
- data/lib/fog/profitbricks/models/compute/firewall_rule.rb +2 -2
- data/lib/fog/profitbricks/models/compute/firewall_rules.rb +5 -8
- data/lib/fog/profitbricks/models/compute/flavors.rb +1 -4
- data/lib/fog/profitbricks/models/compute/image.rb +4 -0
- data/lib/fog/profitbricks/models/compute/images.rb +2 -5
- data/lib/fog/profitbricks/models/compute/ip_block.rb +1 -1
- data/lib/fog/profitbricks/models/compute/ip_blocks.rb +3 -8
- data/lib/fog/profitbricks/models/compute/lan.rb +1 -1
- data/lib/fog/profitbricks/models/compute/lans.rb +4 -7
- data/lib/fog/profitbricks/models/compute/load_balancer.rb +6 -7
- data/lib/fog/profitbricks/models/compute/load_balancers.rb +5 -9
- data/lib/fog/profitbricks/models/compute/locations.rb +2 -5
- data/lib/fog/profitbricks/models/compute/nic.rb +6 -3
- data/lib/fog/profitbricks/models/compute/nics.rb +2 -5
- data/lib/fog/profitbricks/models/compute/regions.rb +1 -4
- data/lib/fog/profitbricks/models/compute/request.rb +0 -1
- data/lib/fog/profitbricks/models/compute/requests.rb +2 -4
- data/lib/fog/profitbricks/models/compute/server.rb +10 -13
- data/lib/fog/profitbricks/models/compute/servers.rb +3 -6
- data/lib/fog/profitbricks/models/compute/snapshot.rb +2 -2
- data/lib/fog/profitbricks/models/compute/snapshots.rb +3 -6
- data/lib/fog/profitbricks/models/compute/volume.rb +11 -9
- data/lib/fog/profitbricks/models/compute/volumes.rb +3 -6
- data/lib/fog/profitbricks/requests/compute/associate_nic_to_load_balancer.rb +26 -13
- data/lib/fog/profitbricks/requests/compute/attach_cdrom.rb +25 -16
- data/lib/fog/profitbricks/requests/compute/attach_volume.rb +25 -16
- data/lib/fog/profitbricks/requests/compute/create_datacenter.rb +22 -23
- data/lib/fog/profitbricks/requests/compute/create_firewall_rule.rb +24 -26
- data/lib/fog/profitbricks/requests/compute/create_flavor.rb +34 -34
- data/lib/fog/profitbricks/requests/compute/create_ip_block.rb +18 -20
- data/lib/fog/profitbricks/requests/compute/create_lan.rb +151 -150
- data/lib/fog/profitbricks/requests/compute/create_load_balancer.rb +67 -26
- data/lib/fog/profitbricks/requests/compute/create_nic.rb +24 -26
- data/lib/fog/profitbricks/requests/compute/create_server.rb +70 -61
- data/lib/fog/profitbricks/requests/compute/create_volume.rb +122 -122
- data/lib/fog/profitbricks/requests/compute/create_volume_snapshot.rb +42 -45
- data/lib/fog/profitbricks/requests/compute/delete_datacenter.rb +34 -36
- data/lib/fog/profitbricks/requests/compute/delete_firewall_rule.rb +8 -11
- data/lib/fog/profitbricks/requests/compute/delete_image.rb +7 -9
- data/lib/fog/profitbricks/requests/compute/delete_ip_block.rb +8 -10
- data/lib/fog/profitbricks/requests/compute/delete_lan.rb +7 -9
- data/lib/fog/profitbricks/requests/compute/delete_load_balancer.rb +8 -10
- data/lib/fog/profitbricks/requests/compute/delete_nic.rb +7 -10
- data/lib/fog/profitbricks/requests/compute/delete_server.rb +6 -10
- data/lib/fog/profitbricks/requests/compute/delete_snapshot.rb +7 -10
- data/lib/fog/profitbricks/requests/compute/delete_volume.rb +36 -38
- data/lib/fog/profitbricks/requests/compute/detach_cdrom.rb +11 -13
- data/lib/fog/profitbricks/requests/compute/detach_volume.rb +16 -13
- data/lib/fog/profitbricks/requests/compute/get_all_datacenters.rb +1 -1
- data/lib/fog/profitbricks/requests/compute/get_all_firewall_rules.rb +6 -7
- data/lib/fog/profitbricks/requests/compute/get_all_flavors.rb +72 -72
- data/lib/fog/profitbricks/requests/compute/get_all_images.rb +62 -62
- data/lib/fog/profitbricks/requests/compute/get_all_ip_blocks.rb +5 -5
- data/lib/fog/profitbricks/requests/compute/get_all_lans.rb +113 -113
- data/lib/fog/profitbricks/requests/compute/get_all_load_balanced_nics.rb +15 -9
- data/lib/fog/profitbricks/requests/compute/get_all_load_balancers.rb +9 -9
- data/lib/fog/profitbricks/requests/compute/get_all_locations.rb +6 -6
- data/lib/fog/profitbricks/requests/compute/get_all_nic.rb +94 -94
- data/lib/fog/profitbricks/requests/compute/get_all_requests.rb +38 -38
- data/lib/fog/profitbricks/requests/compute/get_all_servers.rb +8 -9
- data/lib/fog/profitbricks/requests/compute/get_all_snapshots.rb +4 -4
- data/lib/fog/profitbricks/requests/compute/get_all_volumes.rb +71 -71
- data/lib/fog/profitbricks/requests/compute/get_attached_cdrom.rb +11 -11
- data/lib/fog/profitbricks/requests/compute/get_attached_volume.rb +16 -11
- data/lib/fog/profitbricks/requests/compute/get_datacenter.rb +4 -6
- data/lib/fog/profitbricks/requests/compute/get_firewall_rule.rb +8 -11
- data/lib/fog/profitbricks/requests/compute/get_flavor.rb +9 -9
- data/lib/fog/profitbricks/requests/compute/get_image.rb +7 -9
- data/lib/fog/profitbricks/requests/compute/get_ip_block.rb +8 -10
- data/lib/fog/profitbricks/requests/compute/get_lan.rb +7 -10
- data/lib/fog/profitbricks/requests/compute/get_load_balanced_nic.rb +16 -12
- data/lib/fog/profitbricks/requests/compute/get_load_balancer.rb +7 -9
- data/lib/fog/profitbricks/requests/compute/get_location.rb +7 -9
- data/lib/fog/profitbricks/requests/compute/get_nic.rb +8 -11
- data/lib/fog/profitbricks/requests/compute/get_request.rb +55 -57
- data/lib/fog/profitbricks/requests/compute/get_request_status.rb +44 -46
- data/lib/fog/profitbricks/requests/compute/get_server.rb +7 -10
- data/lib/fog/profitbricks/requests/compute/get_snapshot.rb +7 -9
- data/lib/fog/profitbricks/requests/compute/get_volume.rb +7 -9
- data/lib/fog/profitbricks/requests/compute/list_attached_cdroms.rb +8 -8
- data/lib/fog/profitbricks/requests/compute/list_attached_volumes.rb +18 -8
- data/lib/fog/profitbricks/requests/compute/reboot_server.rb +7 -11
- data/lib/fog/profitbricks/requests/compute/remove_nic_association.rb +9 -11
- data/lib/fog/profitbricks/requests/compute/restore_volume_snapshot.rb +15 -17
- data/lib/fog/profitbricks/requests/compute/start_server.rb +7 -11
- data/lib/fog/profitbricks/requests/compute/stop_server.rb +7 -11
- data/lib/fog/profitbricks/requests/compute/update_datacenter.rb +20 -15
- data/lib/fog/profitbricks/requests/compute/update_firewall_rule.rb +9 -11
- data/lib/fog/profitbricks/requests/compute/update_image.rb +15 -15
- data/lib/fog/profitbricks/requests/compute/update_lan.rb +6 -8
- data/lib/fog/profitbricks/requests/compute/update_load_balancer.rb +10 -12
- data/lib/fog/profitbricks/requests/compute/update_nic.rb +10 -12
- data/lib/fog/profitbricks/requests/compute/update_server.rb +10 -13
- data/lib/fog/profitbricks/requests/compute/update_snapshot.rb +10 -13
- data/lib/fog/profitbricks/requests/compute/update_volume.rb +10 -13
- data/lib/fog/profitbricks/version.rb +1 -1
- data/spec/minitest_helper.rb +1 -3
- data/tests/helpers/formats_helper.rb +8 -8
- data/tests/profitbricks/models/compute/compute_tests.rb +529 -0
- data/tests/profitbricks/requests/compute/composite_create_tests.rb +16 -83
- data/tests/profitbricks/requests/compute/flavor_tests.rb +1 -4
- data/tests/profitbricks/requests/compute/location_tests.rb +14 -17
- data/tests/profitbricks/requests/compute/nic_tests.rb +60 -70
- data/tests/profitbricks/requests/compute/request_tests.rb +1 -3
- data/tests/profitbricks/requests/compute/server_tests.rb +163 -161
- metadata +5 -18
@@ -3,7 +3,7 @@ module Fog
|
|
3
3
|
module ProfitBricks
|
4
4
|
module DataHelper
|
5
5
|
def flatten(response_json)
|
6
|
-
|
6
|
+
%w(properties metadata entities).each { |k| response_json.merge!(response_json.delete(k)) if response_json.key?(k) }
|
7
7
|
response_json
|
8
8
|
end
|
9
9
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require File.expand_path('../datacenter', __FILE__)
|
2
|
-
require File.expand_path('
|
2
|
+
require File.expand_path('../../../helpers/compute/data_helper', __FILE__)
|
3
3
|
|
4
4
|
module Fog
|
5
5
|
module Compute
|
@@ -11,18 +11,17 @@ module Fog
|
|
11
11
|
def all
|
12
12
|
result = service.get_all_datacenters
|
13
13
|
|
14
|
-
load(result.body['items'].each {|dc| flatten(dc)})
|
14
|
+
load(result.body['items'].each { |dc| flatten(dc) })
|
15
15
|
end
|
16
16
|
|
17
17
|
def get(id)
|
18
|
-
|
18
|
+
response = service.get_datacenter(id)
|
19
|
+
|
20
|
+
datacenter = response.body
|
19
21
|
|
20
|
-
Excon::Errors
|
21
22
|
new(flatten(datacenter))
|
22
|
-
rescue Excon::Errors::NotFound
|
23
|
-
nil
|
24
23
|
end
|
25
24
|
end
|
26
25
|
end
|
27
26
|
end
|
28
|
-
end
|
27
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.expand_path('
|
1
|
+
require File.expand_path('../../../helpers/compute/data_helper', __FILE__)
|
2
2
|
|
3
3
|
module Fog
|
4
4
|
module Compute
|
@@ -11,7 +11,7 @@ module Fog
|
|
11
11
|
# properties
|
12
12
|
attribute :name
|
13
13
|
attribute :protocol
|
14
|
-
attribute :source_mac,
|
14
|
+
attribute :source_mac, :aliases => 'sourceMac'
|
15
15
|
attribute :source_ip, :aliases => 'sourceIp'
|
16
16
|
attribute :target_ip, :aliases => 'targetIp'
|
17
17
|
attribute :icmp_code, :aliases => 'icmpCode'
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require File.expand_path('../firewall_rule', __FILE__)
|
2
|
-
require File.expand_path('
|
2
|
+
require File.expand_path('../../../helpers/compute/data_helper', __FILE__)
|
3
3
|
|
4
4
|
module Fog
|
5
5
|
module Compute
|
@@ -11,30 +11,27 @@ module Fog
|
|
11
11
|
def all(datacenter_id, server_id, nic_id)
|
12
12
|
result = service.get_all_firewall_rules(datacenter_id, server_id, nic_id)
|
13
13
|
|
14
|
-
firewall_rules = result.body['items'].each
|
14
|
+
firewall_rules = result.body['items'].each do |fwr|
|
15
15
|
fwr['datacenter_id'] = datacenter_id
|
16
16
|
fwr['server_id'] = server_id
|
17
17
|
fwr['nic_id'] = nic_id
|
18
|
-
|
18
|
+
end
|
19
19
|
|
20
20
|
result.body['items'] = firewall_rules
|
21
21
|
|
22
|
-
load(result.body['items'].each {|fwr| flatten(fwr)})
|
22
|
+
load(result.body['items'].each { |fwr| flatten(fwr) })
|
23
23
|
end
|
24
24
|
|
25
25
|
def get(datacenter_id, server_id, nic_id, firewall_rule_id)
|
26
26
|
firewall_rule = service.get_firewall_rule(datacenter_id, server_id, nic_id, firewall_rule_id).body
|
27
27
|
|
28
|
-
Excon::Errors
|
29
28
|
firewall_rule['datacenter_id'] = datacenter_id
|
30
29
|
firewall_rule['server_id'] = server_id
|
31
30
|
firewall_rule['nic_id'] = nic_id
|
32
31
|
|
33
32
|
new(flatten(firewall_rule))
|
34
|
-
rescue Excon::Errors::NotFound
|
35
|
-
nil
|
36
33
|
end
|
37
34
|
end
|
38
35
|
end
|
39
36
|
end
|
40
|
-
end
|
37
|
+
end
|
@@ -6,16 +6,13 @@ module Fog
|
|
6
6
|
class Flavors < Fog::Collection
|
7
7
|
model Fog::Compute::ProfitBricks::Flavor
|
8
8
|
|
9
|
-
def all
|
9
|
+
def all
|
10
10
|
load(service.get_all_flavors.body["getAllFlavorsResponse"])
|
11
11
|
end
|
12
12
|
|
13
13
|
def get(id)
|
14
14
|
flavor = service.get_flavor(id).body["getFlavorResponse"]
|
15
|
-
Excon::Errors
|
16
15
|
new(flavor)
|
17
|
-
rescue Excon::Errors::NotFound
|
18
|
-
nil
|
19
16
|
end
|
20
17
|
end
|
21
18
|
end
|
@@ -1,7 +1,11 @@
|
|
1
|
+
require File.expand_path('../../../helpers/compute/data_helper', __FILE__)
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module Compute
|
3
5
|
class ProfitBricks
|
4
6
|
class Image < Fog::Models::ProfitBricks::Base
|
7
|
+
include Fog::Helpers::ProfitBricks::DataHelper
|
8
|
+
|
5
9
|
identity :id
|
6
10
|
|
7
11
|
# properties
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require File.expand_path('../image', __FILE__)
|
2
|
-
require File.expand_path('
|
2
|
+
require File.expand_path('../../../helpers/compute/data_helper', __FILE__)
|
3
3
|
|
4
4
|
module Fog
|
5
5
|
module Compute
|
@@ -11,16 +11,13 @@ module Fog
|
|
11
11
|
def all
|
12
12
|
result = service.get_all_images
|
13
13
|
|
14
|
-
load(result.body['items'].each {|img| flatten(img)})
|
14
|
+
load(result.body['items'].each { |img| flatten(img) })
|
15
15
|
end
|
16
16
|
|
17
17
|
def get(id)
|
18
18
|
image = service.get_image(id).body
|
19
19
|
|
20
|
-
Excon::Errors
|
21
20
|
new(flatten(image))
|
22
|
-
rescue Excon::Errors::NotFound
|
23
|
-
nil
|
24
21
|
end
|
25
22
|
end
|
26
23
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require File.expand_path('../ip_block', __FILE__)
|
2
|
-
require File.expand_path('
|
2
|
+
require File.expand_path('../../../helpers/compute/data_helper', __FILE__)
|
3
3
|
|
4
4
|
module Fog
|
5
5
|
module Compute
|
@@ -11,20 +11,15 @@ module Fog
|
|
11
11
|
def all
|
12
12
|
result = service.get_all_ip_blocks
|
13
13
|
|
14
|
-
load(result.body['items'].each {|ip_block| flatten(ip_block)})
|
14
|
+
load(result.body['items'].each { |ip_block| flatten(ip_block) })
|
15
15
|
end
|
16
16
|
|
17
17
|
def get(ip_block_id)
|
18
18
|
ip_block = service.get_ip_block(ip_block_id).body
|
19
19
|
|
20
|
-
Excon::Errors
|
21
|
-
|
22
20
|
new(flatten(ip_block))
|
23
|
-
rescue Excon::Errors::NotFound
|
24
|
-
nil
|
25
21
|
end
|
26
|
-
|
27
22
|
end
|
28
23
|
end
|
29
24
|
end
|
30
|
-
end
|
25
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require File.expand_path('../lan', __FILE__)
|
2
|
-
require File.expand_path('
|
2
|
+
require File.expand_path('../../../helpers/compute/data_helper', __FILE__)
|
3
3
|
|
4
4
|
module Fog
|
5
5
|
module Compute
|
@@ -11,24 +11,21 @@ module Fog
|
|
11
11
|
def all(datacenter_id)
|
12
12
|
result = service.get_all_lans(datacenter_id)
|
13
13
|
|
14
|
-
lans = result.body['items'].each
|
14
|
+
lans = result.body['items'].each do |lan|
|
15
15
|
lan['datacenter_id'] = datacenter_id
|
16
|
-
|
16
|
+
end
|
17
17
|
|
18
18
|
result.body['items'] = lans
|
19
19
|
|
20
|
-
load(result.body['items'].each {|lan| flatten(lan)})
|
20
|
+
load(result.body['items'].each { |lan| flatten(lan) })
|
21
21
|
end
|
22
22
|
|
23
23
|
def get(datacenter_id, lan_id)
|
24
24
|
lan = service.get_lan(datacenter_id, lan_id).body
|
25
25
|
|
26
|
-
Excon::Errors
|
27
26
|
lan['datacenter_id'] = datacenter_id
|
28
27
|
|
29
28
|
new(flatten(lan))
|
30
|
-
rescue Excon::Errors::NotFound
|
31
|
-
nil
|
32
29
|
end
|
33
30
|
end
|
34
31
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.expand_path('
|
1
|
+
require File.expand_path('../../../helpers/compute/data_helper', __FILE__)
|
2
2
|
|
3
3
|
module Fog
|
4
4
|
module Compute
|
@@ -14,7 +14,7 @@ module Fog
|
|
14
14
|
attribute :dhcp
|
15
15
|
|
16
16
|
# metadata
|
17
|
-
attribute :created_date, :aliases => 'createdDate',
|
17
|
+
attribute :created_date, :aliases => 'createdDate', :type => :time
|
18
18
|
attribute :created_by, :aliases => 'createdBy'
|
19
19
|
attribute :last_modified_date, :aliases => 'lastModifiedDate', :type => :time
|
20
20
|
attribute :last_modified_by, :aliases => 'lastModifiedBy'
|
@@ -32,15 +32,14 @@ module Fog
|
|
32
32
|
def save
|
33
33
|
requires :datacenter_id, :name
|
34
34
|
|
35
|
-
properties
|
35
|
+
properties = {}
|
36
36
|
properties[:name] = name if name
|
37
37
|
properties[:ip] = ip if ip
|
38
38
|
properties[:dhcp] = dhcp if dhcp
|
39
39
|
|
40
|
-
entities
|
40
|
+
entities = {}
|
41
41
|
entities[:balancednics] = balancednics if balancednics
|
42
42
|
|
43
|
-
|
44
43
|
data = service.create_load_balancer(datacenter_id, properties, entities)
|
45
44
|
merge_attributes(flatten(data.body))
|
46
45
|
true
|
@@ -49,7 +48,7 @@ module Fog
|
|
49
48
|
def update
|
50
49
|
requires :datacenter_id, :id
|
51
50
|
|
52
|
-
properties
|
51
|
+
properties = {}
|
53
52
|
properties[:name] = name if name
|
54
53
|
properties[:ip] = ip if ip
|
55
54
|
properties[:dhcp] = dhcp if dhcp
|
@@ -86,7 +85,7 @@ module Fog
|
|
86
85
|
|
87
86
|
response = service.get_all_load_balanced_nics(datacenter_id, id)
|
88
87
|
|
89
|
-
response.body['items'].each {|load_balanced_nic| flatten(load_balanced_nic)}
|
88
|
+
response.body['items'].each { |load_balanced_nic| flatten(load_balanced_nic) }
|
90
89
|
end
|
91
90
|
|
92
91
|
def get_nic(nic_id)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require File.expand_path('../load_balancer', __FILE__)
|
2
|
-
require File.expand_path('
|
2
|
+
require File.expand_path('../../../helpers/compute/data_helper', __FILE__)
|
3
3
|
|
4
4
|
module Fog
|
5
5
|
module Compute
|
@@ -11,24 +11,20 @@ module Fog
|
|
11
11
|
def all(datacenter_id)
|
12
12
|
result = service.get_all_load_balancers(datacenter_id)
|
13
13
|
|
14
|
-
load_balancers = result.body['items'].each {|volume| volume['datacenter_id'] = datacenter_id}
|
14
|
+
load_balancers = result.body['items'].each { |volume| volume['datacenter_id'] = datacenter_id }
|
15
15
|
result.body['items'] = load_balancers
|
16
16
|
|
17
|
-
load(result.body['items'].each {|load_balancer| flatten(load_balancer)})
|
17
|
+
load(result.body['items'].each { |load_balancer| flatten(load_balancer) })
|
18
18
|
end
|
19
19
|
|
20
20
|
def get(datacenter_id, load_balancer_id)
|
21
|
-
response
|
21
|
+
response = service.get_load_balancer(datacenter_id, load_balancer_id)
|
22
22
|
load_balancer = response.body
|
23
23
|
|
24
|
-
Excon::Errors
|
25
24
|
load_balancer['datacenter_id'] = datacenter_id
|
26
25
|
new(flatten(load_balancer))
|
27
|
-
rescue Excon::Errors::NotFound
|
28
|
-
nil
|
29
26
|
end
|
30
|
-
|
31
27
|
end
|
32
28
|
end
|
33
29
|
end
|
34
|
-
end
|
30
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require File.expand_path('../location', __FILE__)
|
2
|
-
require File.expand_path('
|
2
|
+
require File.expand_path('../../../helpers/compute/data_helper', __FILE__)
|
3
3
|
|
4
4
|
module Fog
|
5
5
|
module Compute
|
@@ -11,16 +11,13 @@ module Fog
|
|
11
11
|
def all
|
12
12
|
result = service.get_all_locations
|
13
13
|
|
14
|
-
load(result.body['items'].each {|location| flatten(location)})
|
14
|
+
load(result.body['items'].each { |location| flatten(location) })
|
15
15
|
end
|
16
16
|
|
17
17
|
def get(id)
|
18
18
|
location = service.get_location(id).body
|
19
19
|
|
20
|
-
Excon::Errors
|
21
20
|
new(flatten(location))
|
22
|
-
rescue Excon::Errors::NotFound
|
23
|
-
nil
|
24
21
|
end
|
25
22
|
end
|
26
23
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.expand_path('
|
1
|
+
require File.expand_path('../../../helpers/compute/data_helper', __FILE__)
|
2
2
|
|
3
3
|
module Fog
|
4
4
|
module Compute
|
@@ -14,6 +14,7 @@ module Fog
|
|
14
14
|
attribute :ips
|
15
15
|
attribute :dhcp
|
16
16
|
attribute :lan
|
17
|
+
attribute :nat
|
17
18
|
attribute :firewall_active, :aliases => 'firewallActive'
|
18
19
|
|
19
20
|
# metadata
|
@@ -41,6 +42,7 @@ module Fog
|
|
41
42
|
properties[:ips] = ips if ips
|
42
43
|
properties[:dhcp] = dhcp if dhcp
|
43
44
|
properties[:lan] = lan if lan
|
45
|
+
properties[:nat] = nat if nat
|
44
46
|
properties[:firewallActive] = firewall_active if firewall_active
|
45
47
|
|
46
48
|
entities = {}
|
@@ -61,6 +63,7 @@ module Fog
|
|
61
63
|
properties[:ips] = ips if ips
|
62
64
|
properties[:dhcp] = dhcp if dhcp
|
63
65
|
properties[:lan] = lan if lan
|
66
|
+
properties[:nat] = nat if nat
|
64
67
|
|
65
68
|
data = service.update_nic(datacenter_id, server_id, id, properties)
|
66
69
|
merge_attributes(data.body)
|
@@ -101,9 +104,9 @@ module Fog
|
|
101
104
|
item[:portRangeEnd] = firewall_rule[:port_range_end] if firewall_rule.key?(:port_range_end)
|
102
105
|
item[:icmpType] = firewall_rule[:icmp_type] if firewall_rule.key?(:icmp_type)
|
103
106
|
item[:icmpCode] = firewall_rule[:icmp_code] if firewall_rule.key?(:icmp_code)
|
104
|
-
items << { properties
|
107
|
+
items << { :properties => item }
|
105
108
|
end
|
106
|
-
{ items
|
109
|
+
{ :items => items }
|
107
110
|
end
|
108
111
|
end
|
109
112
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require File.expand_path('../nic', __FILE__)
|
2
|
-
require File.expand_path('
|
2
|
+
require File.expand_path('../../../helpers/compute/data_helper', __FILE__)
|
3
3
|
|
4
4
|
module Fog
|
5
5
|
module Compute
|
@@ -24,13 +24,10 @@ module Fog
|
|
24
24
|
def get(datacenter_id, server_id, nic_id)
|
25
25
|
nic = service.get_nic(datacenter_id, server_id, nic_id).body
|
26
26
|
|
27
|
-
Excon::Errors
|
28
27
|
nic['datacenter_id'] = datacenter_id
|
29
|
-
nic['server_id']
|
28
|
+
nic['server_id'] = server_id
|
30
29
|
|
31
30
|
new(flatten(nic))
|
32
|
-
rescue Excon::Errors::NotFound
|
33
|
-
nil
|
34
31
|
end
|
35
32
|
end
|
36
33
|
end
|
@@ -6,16 +6,13 @@ module Fog
|
|
6
6
|
class Regions < Fog::Collection
|
7
7
|
model Fog::Compute::ProfitBricks::Region
|
8
8
|
|
9
|
-
def all
|
9
|
+
def all
|
10
10
|
load(service.get_all_locations.body["getAllLocationsResponse"])
|
11
11
|
end
|
12
12
|
|
13
13
|
def get(id)
|
14
14
|
region = service.get_location(id).body["getLocationResponse"]
|
15
|
-
Excon::Errors
|
16
15
|
new(region)
|
17
|
-
rescue Excon::Errors::NotFound
|
18
|
-
nil
|
19
16
|
end
|
20
17
|
end
|
21
18
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require File.expand_path('../request', __FILE__)
|
2
|
-
require File.expand_path('
|
2
|
+
require File.expand_path('../../../helpers/compute/data_helper', __FILE__)
|
3
3
|
|
4
4
|
module Fog
|
5
5
|
module Compute
|
@@ -11,7 +11,7 @@ module Fog
|
|
11
11
|
def all
|
12
12
|
result = service.get_all_requests
|
13
13
|
|
14
|
-
load(result.body['items'].each {|request| flatten(request)})
|
14
|
+
load(result.body['items'].each { |request| flatten(request) })
|
15
15
|
end
|
16
16
|
|
17
17
|
def get(request_id)
|
@@ -27,8 +27,6 @@ module Fog
|
|
27
27
|
def get_status(request_id)
|
28
28
|
request = service.get_request_status(request_id).body
|
29
29
|
|
30
|
-
Excon::Errors
|
31
|
-
|
32
30
|
new(flatten(request))
|
33
31
|
end
|
34
32
|
end
|