fog-profitbricks 3.0.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -3
- data/README.md +437 -3
- data/lib/fog/profitbricks/compute.rb +138 -80
- data/lib/fog/profitbricks/helpers/compute/data_helper.rb +1 -1
- data/lib/fog/profitbricks/models/compute/contract_resource.rb +35 -0
- data/lib/fog/profitbricks/models/compute/contract_resources.rb +19 -0
- data/lib/fog/profitbricks/models/compute/group.rb +66 -0
- data/lib/fog/profitbricks/models/compute/groups.rb +26 -0
- data/lib/fog/profitbricks/models/compute/lan.rb +3 -0
- data/lib/fog/profitbricks/models/compute/location.rb +1 -0
- data/lib/fog/profitbricks/models/compute/resource.rb +30 -0
- data/lib/fog/profitbricks/models/compute/resources.rb +32 -0
- data/lib/fog/profitbricks/models/compute/share.rb +59 -0
- data/lib/fog/profitbricks/models/compute/shares.rb +33 -0
- data/lib/fog/profitbricks/models/compute/user.rb +75 -0
- data/lib/fog/profitbricks/models/compute/users.rb +45 -0
- data/lib/fog/profitbricks/models/compute/volume.rb +2 -0
- data/lib/fog/profitbricks/requests/compute/add_share.rb +64 -0
- data/lib/fog/profitbricks/requests/compute/add_user_to_group.rb +89 -0
- data/lib/fog/profitbricks/requests/compute/create_group.rb +85 -0
- data/lib/fog/profitbricks/requests/compute/create_lan.rb +1 -0
- data/lib/fog/profitbricks/requests/compute/create_user.rb +83 -0
- data/lib/fog/profitbricks/requests/compute/create_volume.rb +1 -0
- data/lib/fog/profitbricks/requests/compute/delete_group.rb +43 -0
- data/lib/fog/profitbricks/requests/compute/delete_share.rb +42 -0
- data/lib/fog/profitbricks/requests/compute/delete_user.rb +43 -0
- data/lib/fog/profitbricks/requests/compute/get_all_contract_resources.rb +55 -0
- data/lib/fog/profitbricks/requests/compute/get_all_groups.rb +62 -0
- data/lib/fog/profitbricks/requests/compute/get_all_lans.rb +1 -0
- data/lib/fog/profitbricks/requests/compute/get_all_resources.rb +66 -0
- data/lib/fog/profitbricks/requests/compute/get_all_shares.rb +46 -0
- data/lib/fog/profitbricks/requests/compute/get_all_users.rb +70 -0
- data/lib/fog/profitbricks/requests/compute/get_group.rb +64 -0
- data/lib/fog/profitbricks/requests/compute/get_group_users.rb +78 -0
- data/lib/fog/profitbricks/requests/compute/get_lan.rb +1 -0
- data/lib/fog/profitbricks/requests/compute/get_resource_by_type.rb +73 -0
- data/lib/fog/profitbricks/requests/compute/get_resources_by_type.rb +44 -0
- data/lib/fog/profitbricks/requests/compute/get_share.rb +52 -0
- data/lib/fog/profitbricks/requests/compute/get_user.rb +72 -0
- data/lib/fog/profitbricks/requests/compute/remove_user_from_group.rb +49 -0
- data/lib/fog/profitbricks/requests/compute/update_group.rb +85 -0
- data/lib/fog/profitbricks/requests/compute/update_lan.rb +1 -0
- data/lib/fog/profitbricks/requests/compute/update_share.rb +67 -0
- data/lib/fog/profitbricks/requests/compute/update_user.rb +94 -0
- data/lib/fog/profitbricks/version.rb +1 -1
- data/tests/profitbricks/models/compute/compute_tests.rb +6 -0
- data/tests/profitbricks/requests/compute/location_tests.rb +4 -4
- data/tests/profitbricks/requests/compute/nic_tests.rb +7 -19
- data/tests/profitbricks/requests/compute/server_tests.rb +9 -21
- metadata +58 -28
- data/gemfiles/Gemfile.1.9.2- +0 -5
@@ -1,7 +1,7 @@
|
|
1
1
|
module Fog
|
2
2
|
module Compute
|
3
3
|
class ProfitBricks < Fog::Service
|
4
|
-
API_VERSION = '
|
4
|
+
API_VERSION = 'v4'.freeze
|
5
5
|
|
6
6
|
autoload :Base, File.expand_path('../models/base', __FILE__)
|
7
7
|
|
@@ -38,93 +38,130 @@ module Fog
|
|
38
38
|
collection :firewall_rules
|
39
39
|
model :load_balancer
|
40
40
|
collection :load_balancers
|
41
|
+
model :contract_resource
|
42
|
+
collection :contract_resources
|
43
|
+
model :group
|
44
|
+
collection :groups
|
45
|
+
model :share
|
46
|
+
collection :shares
|
47
|
+
model :user
|
48
|
+
collection :users
|
49
|
+
model :resource
|
50
|
+
collection :resources
|
41
51
|
|
42
52
|
# Requests
|
43
53
|
request_path 'fog/profitbricks/requests/compute'
|
44
|
-
request :create_server
|
45
|
-
request :delete_server
|
46
|
-
request :update_server
|
47
|
-
request :get_all_servers
|
48
|
-
request :get_server
|
49
|
-
request :list_attached_volumes
|
50
|
-
request :attach_volume
|
51
|
-
request :get_attached_volume
|
52
|
-
request :detach_volume
|
53
|
-
request :list_attached_cdroms
|
54
|
-
request :attach_cdrom
|
55
|
-
request :get_attached_cdrom
|
56
|
-
request :detach_cdrom
|
57
|
-
request :reboot_server
|
58
|
-
request :start_server
|
59
|
-
request :stop_server
|
54
|
+
request :create_server # createServer
|
55
|
+
request :delete_server # deleteServer
|
56
|
+
request :update_server # updateServer
|
57
|
+
request :get_all_servers # getAllServers
|
58
|
+
request :get_server # getServer
|
59
|
+
request :list_attached_volumes # listAttachedVolumes
|
60
|
+
request :attach_volume # attachVolume
|
61
|
+
request :get_attached_volume # getAttachedVolume
|
62
|
+
request :detach_volume # detachVolume
|
63
|
+
request :list_attached_cdroms # listAttachedCdroms
|
64
|
+
request :attach_cdrom # attachCdrom
|
65
|
+
request :get_attached_cdrom # getAttachedCdrom
|
66
|
+
request :detach_cdrom # detachCdrom
|
67
|
+
request :reboot_server # rebootServer
|
68
|
+
request :start_server # startServer
|
69
|
+
request :stop_server # stopServer
|
60
70
|
|
61
|
-
request :create_datacenter
|
62
|
-
request :delete_datacenter
|
63
|
-
request :update_datacenter
|
64
|
-
request :get_all_datacenters
|
65
|
-
request :get_datacenter
|
71
|
+
request :create_datacenter # createDataCenter
|
72
|
+
request :delete_datacenter # deleteDataCenter
|
73
|
+
request :update_datacenter # updateDataCenter
|
74
|
+
request :get_all_datacenters # getAllDataCenters
|
75
|
+
request :get_datacenter # getDataCenter
|
66
76
|
|
67
|
-
request :get_all_locations
|
68
|
-
request :get_location
|
77
|
+
request :get_all_locations # getAllLocations
|
78
|
+
request :get_location # getLocation
|
69
79
|
|
70
|
-
request :get_all_images
|
71
|
-
request :get_image
|
72
|
-
request :update_image
|
73
|
-
request :delete_image
|
80
|
+
request :get_all_images # getAllImages
|
81
|
+
request :get_image # getImage
|
82
|
+
request :update_image # updateImage
|
83
|
+
request :delete_image # deleteImage
|
74
84
|
|
75
|
-
request :get_all_flavors
|
76
|
-
request :get_flavor
|
77
|
-
request :create_flavor
|
85
|
+
request :get_all_flavors # getAllFlavors
|
86
|
+
request :get_flavor # getFlavor
|
87
|
+
request :create_flavor # createFlavor
|
78
88
|
|
79
|
-
request :create_volume
|
80
|
-
request :delete_volume
|
81
|
-
request :update_volume
|
82
|
-
request :get_all_volumes
|
83
|
-
request :get_volume
|
84
|
-
request :create_volume_snapshot
|
85
|
-
request :restore_volume_snapshot
|
89
|
+
request :create_volume # createVolume
|
90
|
+
request :delete_volume # deleteVolume
|
91
|
+
request :update_volume # updateVolume
|
92
|
+
request :get_all_volumes # getAllVolumes
|
93
|
+
request :get_volume # getVolume
|
94
|
+
request :create_volume_snapshot # createVolumeSnapshot
|
95
|
+
request :restore_volume_snapshot # restoreVolumeSnapshot
|
86
96
|
|
87
|
-
request :get_all_lans
|
88
|
-
request :get_lan
|
89
|
-
request :create_lan
|
90
|
-
request :update_lan
|
91
|
-
request :delete_lan
|
97
|
+
request :get_all_lans # getAllLans
|
98
|
+
request :get_lan # getLans
|
99
|
+
request :create_lan # createLan
|
100
|
+
request :update_lan # updateLan
|
101
|
+
request :delete_lan # deleteLan
|
92
102
|
|
93
|
-
request :create_nic
|
94
|
-
request :delete_nic
|
95
|
-
request :update_nic
|
96
|
-
request :get_all_nic
|
97
|
-
request :get_nic
|
103
|
+
request :create_nic # createNic
|
104
|
+
request :delete_nic # deleteNic
|
105
|
+
request :update_nic # updateNic
|
106
|
+
request :get_all_nic # getAllNic
|
107
|
+
request :get_nic # getNic
|
98
108
|
|
99
|
-
request :delete_snapshot
|
100
|
-
request :update_snapshot
|
101
|
-
request :get_all_snapshots
|
102
|
-
request :get_snapshot
|
109
|
+
request :delete_snapshot # deleteSnapshot
|
110
|
+
request :update_snapshot # updateSnapshot
|
111
|
+
request :get_all_snapshots # getAllSnapshots
|
112
|
+
request :get_snapshot # getSnapshot
|
103
113
|
|
104
|
-
request :get_all_requests
|
105
|
-
request :get_request
|
106
|
-
request :get_request_status
|
114
|
+
request :get_all_requests # getAllRequests
|
115
|
+
request :get_request # getRequest
|
116
|
+
request :get_request_status # getRequestStatus
|
107
117
|
|
108
|
-
request :get_all_ip_blocks
|
109
|
-
request :get_ip_block
|
110
|
-
request :create_ip_block
|
111
|
-
request :delete_ip_block
|
118
|
+
request :get_all_ip_blocks # getAllIpBlocks
|
119
|
+
request :get_ip_block # getIpBlock
|
120
|
+
request :create_ip_block # createIpBlock
|
121
|
+
request :delete_ip_block # deleteIpBlock
|
112
122
|
|
113
|
-
request :get_all_firewall_rules
|
114
|
-
request :get_firewall_rule
|
115
|
-
request :create_firewall_rule
|
116
|
-
request :update_firewall_rule
|
117
|
-
request :delete_firewall_rule
|
123
|
+
request :get_all_firewall_rules # getAllFireWallRules
|
124
|
+
request :get_firewall_rule # getFirewallRule
|
125
|
+
request :create_firewall_rule # createFirewallRule
|
126
|
+
request :update_firewall_rule # updateFirewallRule
|
127
|
+
request :delete_firewall_rule # deleteFirewallRule
|
118
128
|
|
119
|
-
request :get_all_load_balancers
|
120
|
-
request :get_load_balancer
|
121
|
-
request :create_load_balancer
|
122
|
-
request :delete_load_balancer
|
123
|
-
request :update_load_balancer
|
124
|
-
request :get_all_load_balanced_nics
|
125
|
-
request :get_load_balanced_nic
|
126
|
-
request :associate_nic_to_load_balancer
|
127
|
-
request :remove_nic_association
|
129
|
+
request :get_all_load_balancers # getAllLoadBalancers
|
130
|
+
request :get_load_balancer # getLoadBalancer
|
131
|
+
request :create_load_balancer # createLoadBalancer
|
132
|
+
request :delete_load_balancer # deleteLoadBalancer
|
133
|
+
request :update_load_balancer # deleteLoadBalancer
|
134
|
+
request :get_all_load_balanced_nics # getAllLoadBalancedNics
|
135
|
+
request :get_load_balanced_nic # getLoadBalancedNic
|
136
|
+
request :associate_nic_to_load_balancer # associateNicToLoadBalancer
|
137
|
+
request :remove_nic_association # removeNicAssociation
|
138
|
+
|
139
|
+
request :get_all_contract_resources # getAllContractResources
|
140
|
+
|
141
|
+
request :get_all_groups # getAllGroups
|
142
|
+
request :get_group # getGroup
|
143
|
+
request :create_group # createGroup
|
144
|
+
request :update_group # updateGroup
|
145
|
+
request :delete_group # deleteGroup
|
146
|
+
|
147
|
+
request :get_all_shares # getAllShares
|
148
|
+
request :get_share # getShare
|
149
|
+
request :add_share # addShare
|
150
|
+
request :update_share # updateShare
|
151
|
+
request :delete_share # deleteShare
|
152
|
+
|
153
|
+
request :get_all_users # getAllUsers
|
154
|
+
request :get_user # getUser
|
155
|
+
request :create_user # createUser
|
156
|
+
request :update_user # updateUser
|
157
|
+
request :delete_user # deleteUser
|
158
|
+
request :get_group_users # getGroupUsers
|
159
|
+
request :add_user_to_group # addUserToGroup
|
160
|
+
request :remove_user_from_group # removeUserFromGroup
|
161
|
+
|
162
|
+
request :get_all_resources # getAllResources
|
163
|
+
request :get_resources_by_type # getResourcesByType
|
164
|
+
request :get_resource_by_type # getResourcesByType
|
128
165
|
|
129
166
|
class Real
|
130
167
|
def initialize(options = {})
|
@@ -148,7 +185,6 @@ module Fog
|
|
148
185
|
|
149
186
|
begin
|
150
187
|
response = @connection.request(params)
|
151
|
-
|
152
188
|
rescue Excon::Errors::Unauthorized => error
|
153
189
|
Logger.warning('Unauthorized error')
|
154
190
|
raise error, Fog::JSON.decode(error.response.body)['messages']
|
@@ -227,7 +263,7 @@ module Fog
|
|
227
263
|
'description' => 'testing fog rest implementation',
|
228
264
|
'location' => 'us/las',
|
229
265
|
'version' => 1,
|
230
|
-
'features' => %w
|
266
|
+
'features' => %w[SSD MULTIPLE_CPU]
|
231
267
|
}
|
232
268
|
},
|
233
269
|
{
|
@@ -247,7 +283,7 @@ module Fog
|
|
247
283
|
'description' => 'testing fog rest implementation',
|
248
284
|
'location' => 'de/fkb',
|
249
285
|
'version' => 1,
|
250
|
-
'features' => %w
|
286
|
+
'features' => %w[SSD MULTIPLE_CPU]
|
251
287
|
}
|
252
288
|
}
|
253
289
|
]
|
@@ -441,7 +477,7 @@ module Fog
|
|
441
477
|
'href' => 'https://api.profitbricks.com/rest/v2/locations/de/fkb',
|
442
478
|
'properties' => {
|
443
479
|
'name' => 'karlsruhe',
|
444
|
-
'features' => %w
|
480
|
+
'features' => %w[SSD MULTIPLE_CPU]
|
445
481
|
}
|
446
482
|
},
|
447
483
|
{
|
@@ -450,7 +486,7 @@ module Fog
|
|
450
486
|
'href' => 'https://api.profitbricks.com/rest/v2/locations/de/fra',
|
451
487
|
'properties' => {
|
452
488
|
'name' => 'frankfurt',
|
453
|
-
'features' => %w
|
489
|
+
'features' => %w[SSD MULTIPLE_CPU]
|
454
490
|
}
|
455
491
|
},
|
456
492
|
{
|
@@ -459,7 +495,7 @@ module Fog
|
|
459
495
|
'href' => 'https://api.profitbricks.com/rest/v2/locations/us/las',
|
460
496
|
'properties' => {
|
461
497
|
'name' => 'lasvegas',
|
462
|
-
'features' => %w
|
498
|
+
'features' => %w[SSD MULTIPLE_CPU]
|
463
499
|
}
|
464
500
|
}
|
465
501
|
]
|
@@ -1053,13 +1089,35 @@ module Fog
|
|
1053
1089
|
'balancednics' => {
|
1054
1090
|
'id' => "#{lb2_id}/balancednics",
|
1055
1091
|
'type' => 'collection',
|
1056
|
-
'href' => "https
|
1092
|
+
'href' => "https://api.profitbricks.com/rest/v2/datacenters/#{dc1_id}/loadbalancers/#{lb2_id}/balancednics",
|
1057
1093
|
'items' => []
|
1058
1094
|
}
|
1059
1095
|
},
|
1060
1096
|
'datacenter_id' => dc1_id
|
1061
1097
|
}
|
1062
1098
|
]
|
1099
|
+
},
|
1100
|
+
:contracts => {
|
1101
|
+
'contractNumber' => '12345678',
|
1102
|
+
'owner' => 'test@domain.com',
|
1103
|
+
'status' => 'BILLABLE',
|
1104
|
+
'resourceLimits' => {
|
1105
|
+
'coresPerServer' => '20',
|
1106
|
+
'coresPerContract' => '30',
|
1107
|
+
'coresProvisioned' => '0',
|
1108
|
+
'ramPerServer' => '204800',
|
1109
|
+
'ramPerContract' => '3072000',
|
1110
|
+
'ramProvisioned' => '0',
|
1111
|
+
'hddLimitPerVolume' => '2048000',
|
1112
|
+
'hddLimitPerContract' => '3072000',
|
1113
|
+
'hddVolumeProvisioned' => '0',
|
1114
|
+
'ssdLimitPerVolume' => '2048000',
|
1115
|
+
'ssdLimitPerContract' => '3072000',
|
1116
|
+
'ssdVolumeProvisioned' => '0',
|
1117
|
+
'reservableIps' => '3',
|
1118
|
+
'reservedIpsOnContract' => '0',
|
1119
|
+
'reservedIpsInUse' => '0'
|
1120
|
+
}
|
1063
1121
|
}
|
1064
1122
|
}
|
1065
1123
|
end
|
@@ -3,7 +3,7 @@ module Fog
|
|
3
3
|
module ProfitBricks
|
4
4
|
module DataHelper
|
5
5
|
def flatten(response_json)
|
6
|
-
%w(properties metadata entities).each { |k| response_json.merge!(response_json.delete(k)) if response_json.key?(k) }
|
6
|
+
%w(properties metadata entities resourceLimits).each { |k| response_json.merge!(response_json.delete(k)) if response_json.key?(k) }
|
7
7
|
response_json
|
8
8
|
end
|
9
9
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require File.expand_path('../../../helpers/compute/data_helper', __FILE__)
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Compute
|
5
|
+
class ProfitBricks
|
6
|
+
class ContractResource < Fog::Models::ProfitBricks::Base
|
7
|
+
include Fog::Helpers::ProfitBricks::DataHelper
|
8
|
+
|
9
|
+
# properties
|
10
|
+
attribute :contract_number, :aliases => 'contractNumber'
|
11
|
+
attribute :owner
|
12
|
+
attribute :status
|
13
|
+
attribute :cores_per_server, :aliases => 'coresPerServer'
|
14
|
+
attribute :cores_per_contract, :aliases => 'coresPerContract'
|
15
|
+
attribute :cores_provisioned, :aliases => 'coresProvisioned'
|
16
|
+
attribute :ram_per_server, :aliases => 'ramPerServer'
|
17
|
+
attribute :ram_per_contract, :aliases => 'ramPerContract'
|
18
|
+
attribute :ram_provisioned, :aliases => 'ramProvisioned'
|
19
|
+
attribute :hdd_limit_per_volume, :aliases => 'hddLimitPerVolume'
|
20
|
+
attribute :hdd_limit_per_contract, :aliases => 'hddLimitPerContract'
|
21
|
+
attribute :hdd_volume_provisioned, :aliases => 'hddVolumeProvisioned'
|
22
|
+
attribute :ssd_limit_per_volume, :aliases => 'ssdLimitPerVolume'
|
23
|
+
attribute :ssd_limit_per_contract, :aliases => 'ssdLimitPerContract'
|
24
|
+
attribute :ssd_volume_provisioned, :aliases => 'ssdVolumeProvisioned'
|
25
|
+
attribute :reservable_ips, :aliases => 'reservableIps'
|
26
|
+
attribute :reservable_ips_on_contract, :aliases => 'reservedIpsOnContract'
|
27
|
+
attribute :reservable_ips_in_use, :aliases => 'reservedIpsInUse'
|
28
|
+
|
29
|
+
def initialize(attributes = {})
|
30
|
+
super
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.expand_path('../contract_resource', __FILE__)
|
2
|
+
require File.expand_path('../../../helpers/compute/data_helper', __FILE__)
|
3
|
+
|
4
|
+
module Fog
|
5
|
+
module Compute
|
6
|
+
class ProfitBricks
|
7
|
+
class ContractResources < Fog::Collection
|
8
|
+
include Fog::Helpers::ProfitBricks::DataHelper
|
9
|
+
model Fog::Compute::ProfitBricks::ContractResource
|
10
|
+
|
11
|
+
def all
|
12
|
+
result = service.get_all_contract_resources
|
13
|
+
|
14
|
+
load([flatten(result.body)])
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require File.expand_path('../../../helpers/compute/data_helper', __FILE__)
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Compute
|
5
|
+
class ProfitBricks
|
6
|
+
class Group < Fog::Models::ProfitBricks::Base
|
7
|
+
include Fog::Helpers::ProfitBricks::DataHelper
|
8
|
+
|
9
|
+
identity :id
|
10
|
+
|
11
|
+
# properties
|
12
|
+
attribute :name
|
13
|
+
attribute :create_datacenter, :aliases => 'createDataCenter'
|
14
|
+
attribute :create_snapshot, :aliases => 'createSnapshot'
|
15
|
+
attribute :reserve_ip, :aliases => 'reserveIp'
|
16
|
+
attribute :access_activity_log, :aliases => 'accessActivityLog'
|
17
|
+
|
18
|
+
# entities
|
19
|
+
attribute :users
|
20
|
+
attribute :resources
|
21
|
+
|
22
|
+
attr_accessor :options
|
23
|
+
|
24
|
+
def initialize(attributes = {})
|
25
|
+
super
|
26
|
+
end
|
27
|
+
|
28
|
+
def save
|
29
|
+
requires :name
|
30
|
+
|
31
|
+
options = {}
|
32
|
+
options[:name] = name
|
33
|
+
options[:createDataCenter] = create_datacenter if create_datacenter
|
34
|
+
options[:createSnapshot] = create_snapshot if create_snapshot
|
35
|
+
options[:reserveIp] = reserve_ip if reserve_ip
|
36
|
+
options[:accessActivityLog] = access_activity_log if access_activity_log
|
37
|
+
|
38
|
+
data = service.create_group(options)
|
39
|
+
merge_attributes(flatten(data.body))
|
40
|
+
true
|
41
|
+
end
|
42
|
+
|
43
|
+
def update
|
44
|
+
requires :id, :name
|
45
|
+
|
46
|
+
options = {}
|
47
|
+
options[:name] = name
|
48
|
+
options[:createDataCenter] = create_datacenter if create_datacenter
|
49
|
+
options[:createSnapshot] = create_snapshot if create_snapshot
|
50
|
+
options[:reserveIp] = reserve_ip if reserve_ip
|
51
|
+
options[:accessActivityLog] = access_activity_log if access_activity_log
|
52
|
+
|
53
|
+
data = service.update_group(id, options)
|
54
|
+
merge_attributes(flatten(data.body))
|
55
|
+
true
|
56
|
+
end
|
57
|
+
|
58
|
+
def delete
|
59
|
+
requires :id
|
60
|
+
service.delete_group(id)
|
61
|
+
true
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require File.expand_path('../group', __FILE__)
|
2
|
+
require File.expand_path('../../../helpers/compute/data_helper', __FILE__)
|
3
|
+
|
4
|
+
module Fog
|
5
|
+
module Compute
|
6
|
+
class ProfitBricks
|
7
|
+
class Groups < Fog::Collection
|
8
|
+
include Fog::Helpers::ProfitBricks::DataHelper
|
9
|
+
model Fog::Compute::ProfitBricks::Group
|
10
|
+
|
11
|
+
def all()
|
12
|
+
result = service.get_all_groups()
|
13
|
+
|
14
|
+
load(result.body['items'].each { |group| flatten(group) })
|
15
|
+
end
|
16
|
+
|
17
|
+
def get(group_id)
|
18
|
+
response = service.get_group(group_id)
|
19
|
+
group = response.body
|
20
|
+
|
21
|
+
new(flatten(group))
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|