fog-softlayer 0.3.6.pre.f7e3358 → 0.3.6.pre.f82ffe9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +2 -2
- data/fog-softlayer.gemspec +0 -2
- data/lib/fog.rb +0 -1
- data/lib/fog/softlayer/compute.rb +4 -12
- data/lib/fog/softlayer/models/compute/server.rb +8 -37
- data/lib/fog/softlayer/requests/compute/get_bare_metal_server.rb +1 -1
- data/lib/fog/softlayer/requests/compute/get_bare_metal_servers.rb +1 -1
- data/lib/fog/softlayer/requests/compute/get_vm.rb +1 -1
- data/lib/fog/softlayer/requests/compute/get_vms.rb +1 -1
- data/lib/fog/softlayer/version.rb +1 -1
- metadata +1 -36
- data/lib/fog/softlayer/models/compute/key_pair.rb +0 -48
- data/lib/fog/softlayer/models/compute/key_pairs.rb +0 -37
- data/lib/fog/softlayer/requests/compute/create_key_pair.rb +0 -41
- data/lib/fog/softlayer/requests/compute/delete_key_pair.rb +0 -37
- data/lib/fog/softlayer/requests/compute/get_key_pair.rb +0 -36
- data/lib/fog/softlayer/requests/compute/get_key_pairs.rb +0 -29
- data/lib/fog/softlayer/requests/compute/update_key_pair.rb +0 -42
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Y2EwNTExYmJhNGM1ZGM0Y2I2M2JmMmY5MTQxY2I0ZDZkZjI4MTQ5Mg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MTU4ZTRmMjkxYTFhMDAxNjg3MGU2NmU5N2E3ZGEwOGU3MzBhYTkyMA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YmJhODZmZWE3MjMwNjNkNGFlODIwYTU4OTMzOTE2NjJhNWI2MjlkM2NjYjYz
|
10
|
+
MGJhOTJiMmRjOGNiZjczNWI5N2ExMGNjMDhlYjRmY2YyN2VmOTk4YTM0ZTVm
|
11
|
+
Y2E3MGM5ZmY1MzI2NmU2OTM4ZjFlM2VlYjFhOTQ4NGViZDhlYjg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NjJhOWQ5MDVlZDNhZWRmM2NjNzYxZTAzMmZmNDM4Y2NlMjEzMTc2MTk1MjA1
|
14
|
+
ZTAwNjk3MWNiYjFhNWJkYzNmNWQwYWYzNzJjMGRjYjE0ZGJmY2YwNTZjNjEz
|
15
|
+
NzMyZTY5ZGQyN2NhMGEzYzA3YTFhMDFjNzA0OGE4MjNjZTM2MWY=
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
### `fog-softlayer` - SoftLayer module for fog.
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/fog-softlayer.png)](http://badge.fury.io/rb/fog-softlayer)
|
3
|
-
[![Build Status](https://api.travis-ci.org/
|
4
|
-
[![Dependency Status](https://gemnasium.com/
|
3
|
+
[![Build Status](https://api.travis-ci.org/softlayer/fog-softlayer.svg)](https://travis-ci.org/softlayer/fog-softlayer)
|
4
|
+
[![Dependency Status](https://gemnasium.com/softlayer/fog-softlayer.svg)](https://gemnasium.com/softlayer/fog-softlayer)
|
5
5
|
|
6
6
|
This gem is a module for the `fog` gem that allows you to manage resources in
|
7
7
|
the SoftLayer Cloud.
|
data/fog-softlayer.gemspec
CHANGED
@@ -22,7 +22,6 @@ Gem::Specification.new do |spec|
|
|
22
22
|
|
23
23
|
spec.add_dependency 'fog-core'
|
24
24
|
spec.add_dependency 'fog-json'
|
25
|
-
spec.add_dependency 'fog-xml', '0.0.1.alpha'
|
26
25
|
|
27
26
|
spec.add_development_dependency('minitest')
|
28
27
|
spec.add_development_dependency('rake')
|
@@ -33,6 +32,5 @@ Gem::Specification.new do |spec|
|
|
33
32
|
spec.add_development_dependency('shindo', '~> 0.3.4')
|
34
33
|
spec.add_development_dependency('fission')
|
35
34
|
spec.add_development_dependency('pry')
|
36
|
-
spec.add_development_dependency('pry-debugger')
|
37
35
|
spec.add_development_dependency('osrcry')
|
38
36
|
end
|
data/lib/fog.rb
CHANGED
@@ -17,7 +17,8 @@ module Fog
|
|
17
17
|
requires :softlayer_username, :softlayer_api_key
|
18
18
|
|
19
19
|
# Excon connection settings
|
20
|
-
recognizes :softlayer_api_url
|
20
|
+
recognizes :softlayer_api_url
|
21
|
+
recognizes :softlayer_default_domain
|
21
22
|
|
22
23
|
|
23
24
|
model_path 'fog/softlayer/models/compute'
|
@@ -25,8 +26,6 @@ module Fog
|
|
25
26
|
model :flavor
|
26
27
|
collection :images
|
27
28
|
model :image
|
28
|
-
collection :key_pairs
|
29
|
-
model :key_pair
|
30
29
|
collection :servers
|
31
30
|
model :server
|
32
31
|
collection :tags
|
@@ -35,21 +34,17 @@ module Fog
|
|
35
34
|
request_path 'fog/softlayer/requests/compute'
|
36
35
|
request :create_bare_metal_server
|
37
36
|
request :create_bare_metal_tags
|
38
|
-
request :create_key_pair
|
39
37
|
request :create_vm
|
40
38
|
request :create_vms
|
41
39
|
request :create_vm_tags
|
42
40
|
request :delete_bare_metal_server
|
43
41
|
request :delete_bare_metal_tags
|
44
|
-
request :delete_key_pair
|
45
42
|
request :delete_vm
|
46
43
|
request :delete_vm_tags
|
47
44
|
request :describe_tags
|
48
45
|
request :get_bare_metal_server
|
49
46
|
request :get_bare_metal_servers
|
50
47
|
request :get_bare_metal_tags
|
51
|
-
request :get_key_pair
|
52
|
-
request :get_key_pairs
|
53
48
|
request :get_references_by_tag_name
|
54
49
|
request :get_tag
|
55
50
|
request :get_vm_tags
|
@@ -70,7 +65,6 @@ module Fog
|
|
70
65
|
@virtual_guests = []
|
71
66
|
@bare_metal_servers = []
|
72
67
|
@tags = []
|
73
|
-
@key_pairs = []
|
74
68
|
super(args)
|
75
69
|
end
|
76
70
|
|
@@ -100,16 +94,13 @@ module Fog
|
|
100
94
|
# Makes real connections to Softlayer.
|
101
95
|
#
|
102
96
|
class Real
|
103
|
-
attr_accessor :
|
104
|
-
attr_accessor :softlayer_default_datacenter
|
97
|
+
attr_accessor :default_domain
|
105
98
|
include Fog::Softlayer::Slapi
|
106
99
|
include Fog::Softlayer::Compute::Shared
|
107
100
|
|
108
101
|
def initialize(options={})
|
109
102
|
@softlayer_api_key = options[:softlayer_api_key]
|
110
103
|
@softlayer_username = options[:softlayer_username]
|
111
|
-
@softlayer_default_domain = options[:softlayer_default_domain]
|
112
|
-
@softlayer_default_datacenter = options[:softlayer_default_datacenter]
|
113
104
|
end
|
114
105
|
|
115
106
|
def request(service, path, options = {})
|
@@ -117,6 +108,7 @@ module Fog
|
|
117
108
|
Fog::Softlayer::Slapi.slapi_request(service, path, options)
|
118
109
|
end
|
119
110
|
|
111
|
+
|
120
112
|
def list_servers
|
121
113
|
(self.get_vms.body.map {|s| s['bare_metal'] = false; s } << self.get_bare_metal_servers.body.map {|s| s['bare_metal'] = true; s}).flatten
|
122
114
|
end
|
@@ -123,60 +123,32 @@ module Fog
|
|
123
123
|
if self.private_vlan
|
124
124
|
attributes[:private_vlan] = { :networkVlan => { :id => self.private_vlan.id } }
|
125
125
|
end
|
126
|
-
if self.key_pairs
|
127
|
-
attributes[:key_pairs].map! { |key| { :id => key.id } }
|
128
|
-
end
|
129
126
|
remap_attributes(attributes, attributes_mapping)
|
130
127
|
clean_attributes
|
131
128
|
end
|
132
129
|
|
133
|
-
def
|
134
|
-
attributes[:
|
135
|
-
end
|
136
|
-
|
137
|
-
def os_code
|
138
|
-
self.os if attributes[:os]
|
130
|
+
def vlan
|
131
|
+
attributes[:vlan] ||= _get_vlan
|
139
132
|
end
|
140
133
|
|
141
134
|
def private_vlan
|
142
135
|
attributes[:private_vlan] ||= _get_private_vlan
|
143
136
|
end
|
144
137
|
|
145
|
-
def
|
138
|
+
def vlan=(value)
|
146
139
|
unless value.is_a?(Integer) or value.is_a?(Fog::Network::Softlayer::Network)
|
147
140
|
raise ArgumentError, "vlan argument for #{self.class.name}##{__method__} must be Integer or Fog::Network::Softlayer::Network."
|
148
141
|
end
|
149
142
|
value = Fog::Network[:softlayer].networks.get(value) if value.is_a?(Integer)
|
150
|
-
attributes[:
|
151
|
-
end
|
152
|
-
|
153
|
-
def key_pairs
|
154
|
-
attributes[:key_pairs]
|
155
|
-
end
|
156
|
-
|
157
|
-
def key_pairs=(keys)
|
158
|
-
raise ArgumentError, "Argument #{local_variables.first.to_s} for #{self.class.name}##{__method__} must be Array." unless keys.is_a?(Array)
|
159
|
-
attributes[:key_pairs] = []
|
160
|
-
keys.map do |key|
|
161
|
-
key = self.symbolize_keys(key) if key.is_a?(Hash)
|
162
|
-
unless key[:id] or key.is_a?(Fog::Compute::Softlayer::KeyPair)
|
163
|
-
raise ArgumentError, "Elements of keys array for #{self.class.name}##{__method__} must be a Hash with key 'id', or Fog::Compute::Softlayer::KeyPair"
|
164
|
-
end
|
165
|
-
key = service.key_pairs.get(key[:id]) unless key[:id].is_a?(Fog::Compute::Softlayer::KeyPair)
|
166
|
-
attributes[:key_pairs] << key
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
def vlan
|
171
|
-
attributes[:vlan] ||= _get_vlan
|
143
|
+
attributes[:vlan] = value
|
172
144
|
end
|
173
145
|
|
174
|
-
def
|
146
|
+
def private_vlan=(value)
|
175
147
|
unless value.is_a?(Integer) or value.is_a?(Fog::Network::Softlayer::Network)
|
176
148
|
raise ArgumentError, "vlan argument for #{self.class.name}##{__method__} must be Integer or Fog::Network::Softlayer::Network."
|
177
149
|
end
|
178
150
|
value = Fog::Network[:softlayer].networks.get(value) if value.is_a?(Integer)
|
179
|
-
attributes[:
|
151
|
+
attributes[:private_vlan] = value
|
180
152
|
end
|
181
153
|
|
182
154
|
def ram=(set)
|
@@ -240,6 +212,7 @@ module Fog
|
|
240
212
|
# * BUILD -> ERROR (on error)
|
241
213
|
def save
|
242
214
|
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?
|
215
|
+
|
243
216
|
copy = self.dup
|
244
217
|
copy.pre_save
|
245
218
|
|
@@ -290,7 +263,6 @@ module Fog
|
|
290
263
|
:os_code => :operatingSystemReferenceCode,
|
291
264
|
:vlan => :primaryNetworkComponent,
|
292
265
|
:private_vlan => :primaryBackendNetworkComponent,
|
293
|
-
:key_pairs => :sshKeys,
|
294
266
|
|
295
267
|
}
|
296
268
|
|
@@ -359,8 +331,7 @@ module Fog
|
|
359
331
|
def set_defaults
|
360
332
|
attributes[:hourly_billing_flag] = true if attributes[:hourly_billing_flag].nil?
|
361
333
|
attributes[:ephemeral_storage] = false if attributes[:ephemeral_storage].nil?
|
362
|
-
attributes[:domain] = service.
|
363
|
-
self.datacenter = service.softlayer_default_datacenter if service.softlayer_default_datacenter and attributes[:datacenter].nil?
|
334
|
+
attributes[:domain] = service.default_domain if service.default_domain and attributes[:domain].nil?
|
364
335
|
end
|
365
336
|
|
366
337
|
end
|
@@ -26,7 +26,7 @@ module Fog
|
|
26
26
|
|
27
27
|
class Real
|
28
28
|
def get_bare_metal_server(identifier)
|
29
|
-
request(:hardware_server, identifier, :expected => [200, 404], :query => 'objectMask=mask[datacenter,tagReferences,memory,provisionDate,processorCoreAmount,hardDrives,datacenter,hourlyBillingFlag,operatingSystem.
|
29
|
+
request(:hardware_server, identifier, :expected => [200, 404], :query => 'objectMask=mask[datacenter,tagReferences,memory,provisionDate,processorCoreAmount,hardDrives,datacenter,hourlyBillingFlag,operatingSystem.passwords.password]')
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -20,7 +20,7 @@ module Fog
|
|
20
20
|
|
21
21
|
class Real
|
22
22
|
def get_bare_metal_servers
|
23
|
-
request(:account, :get_hardware, :query => 'objectMask=mask[datacenter,tagReferences,memory,processorCoreAmount,hardDrives,datacenter,hourlyBillingFlag,operatingSystem.
|
23
|
+
request(:account, :get_hardware, :query => 'objectMask=mask[datacenter,tagReferences,memory,processorCoreAmount,hardDrives,datacenter,hourlyBillingFlag,operatingSystem.passwords.password]')
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -26,7 +26,7 @@ module Fog
|
|
26
26
|
|
27
27
|
class Real
|
28
28
|
def get_vm(identifier)
|
29
|
-
request(:virtual_guest, identifier, :expected => [200, 404], :query => 'objectMask=mask[datacenter,tagReferences,blockDevices,blockDeviceTemplateGroup.globalIdentifier,operatingSystem.
|
29
|
+
request(:virtual_guest, identifier, :expected => [200, 404], :query => 'objectMask=mask[datacenter,tagReferences,blockDevices,blockDeviceTemplateGroup.globalIdentifier,operatingSystem.passwords.password]')
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -20,7 +20,7 @@ module Fog
|
|
20
20
|
|
21
21
|
class Real
|
22
22
|
def get_vms
|
23
|
-
request(:account, :get_virtual_guests, :query => 'objectMask=mask[datacenter,tagReferences,blockDevices,blockDeviceTemplateGroup.globalIdentifier,operatingSystem.
|
23
|
+
request(:account, :get_virtual_guests, :query => 'objectMask=mask[datacenter,tagReferences,blockDevices,blockDeviceTemplateGroup.globalIdentifier,operatingSystem.passwords.password,primaryNetworkComponent.networkVlan]')
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fog-softlayer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.6.pre.
|
4
|
+
version: 0.3.6.pre.f82ffe9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Eldridge
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - ! '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: fog-xml
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - '='
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 0.0.1.alpha
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - '='
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 0.0.1.alpha
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: minitest
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -178,20 +164,6 @@ dependencies:
|
|
178
164
|
- - ! '>='
|
179
165
|
- !ruby/object:Gem::Version
|
180
166
|
version: '0'
|
181
|
-
- !ruby/object:Gem::Dependency
|
182
|
-
name: pry-debugger
|
183
|
-
requirement: !ruby/object:Gem::Requirement
|
184
|
-
requirements:
|
185
|
-
- - ! '>='
|
186
|
-
- !ruby/object:Gem::Version
|
187
|
-
version: '0'
|
188
|
-
type: :development
|
189
|
-
prerelease: false
|
190
|
-
version_requirements: !ruby/object:Gem::Requirement
|
191
|
-
requirements:
|
192
|
-
- - ! '>='
|
193
|
-
- !ruby/object:Gem::Version
|
194
|
-
version: '0'
|
195
167
|
- !ruby/object:Gem::Dependency
|
196
168
|
name: osrcry
|
197
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -244,8 +216,6 @@ files:
|
|
244
216
|
- lib/fog/softlayer/models/compute/flavors.rb
|
245
217
|
- lib/fog/softlayer/models/compute/image.rb
|
246
218
|
- lib/fog/softlayer/models/compute/images.rb
|
247
|
-
- lib/fog/softlayer/models/compute/key_pair.rb
|
248
|
-
- lib/fog/softlayer/models/compute/key_pairs.rb
|
249
219
|
- lib/fog/softlayer/models/compute/server.rb
|
250
220
|
- lib/fog/softlayer/models/compute/servers.rb
|
251
221
|
- lib/fog/softlayer/models/compute/tag.rb
|
@@ -271,27 +241,22 @@ files:
|
|
271
241
|
- lib/fog/softlayer/network.rb
|
272
242
|
- lib/fog/softlayer/requests/compute/create_bare_metal_server.rb
|
273
243
|
- lib/fog/softlayer/requests/compute/create_bare_metal_tags.rb
|
274
|
-
- lib/fog/softlayer/requests/compute/create_key_pair.rb
|
275
244
|
- lib/fog/softlayer/requests/compute/create_vm.rb
|
276
245
|
- lib/fog/softlayer/requests/compute/create_vm_tags.rb
|
277
246
|
- lib/fog/softlayer/requests/compute/create_vms.rb
|
278
247
|
- lib/fog/softlayer/requests/compute/delete_bare_metal_server.rb
|
279
248
|
- lib/fog/softlayer/requests/compute/delete_bare_metal_tags.rb
|
280
|
-
- lib/fog/softlayer/requests/compute/delete_key_pair.rb
|
281
249
|
- lib/fog/softlayer/requests/compute/delete_vm.rb
|
282
250
|
- lib/fog/softlayer/requests/compute/delete_vm_tags.rb
|
283
251
|
- lib/fog/softlayer/requests/compute/describe_tags.rb
|
284
252
|
- lib/fog/softlayer/requests/compute/get_bare_metal_server.rb
|
285
253
|
- lib/fog/softlayer/requests/compute/get_bare_metal_servers.rb
|
286
254
|
- lib/fog/softlayer/requests/compute/get_bare_metal_tags.rb
|
287
|
-
- lib/fog/softlayer/requests/compute/get_key_pair.rb
|
288
|
-
- lib/fog/softlayer/requests/compute/get_key_pairs.rb
|
289
255
|
- lib/fog/softlayer/requests/compute/get_references_by_tag_name.rb
|
290
256
|
- lib/fog/softlayer/requests/compute/get_tag.rb
|
291
257
|
- lib/fog/softlayer/requests/compute/get_vm.rb
|
292
258
|
- lib/fog/softlayer/requests/compute/get_vm_tags.rb
|
293
259
|
- lib/fog/softlayer/requests/compute/get_vms.rb
|
294
|
-
- lib/fog/softlayer/requests/compute/update_key_pair.rb
|
295
260
|
- lib/fog/softlayer/requests/dns/create_domain.rb
|
296
261
|
- lib/fog/softlayer/requests/dns/create_record.rb
|
297
262
|
- lib/fog/softlayer/requests/dns/delete_domain.rb
|
@@ -1,48 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Matt Eldridge (<matt.eldridge@us.ibm.com>)
|
3
|
-
# © Copyright IBM Corporation 2014.
|
4
|
-
#
|
5
|
-
# LICENSE: MIT (http://opensource.org/licenses/MIT)
|
6
|
-
#
|
7
|
-
|
8
|
-
require 'fog/core/model'
|
9
|
-
|
10
|
-
module Fog
|
11
|
-
module Compute
|
12
|
-
class Softlayer
|
13
|
-
class KeyPair < Fog::Model
|
14
|
-
identity :id
|
15
|
-
|
16
|
-
attribute :label
|
17
|
-
attribute :create_date, :aliases => 'createDate'
|
18
|
-
attribute :modify_date, :aliases => 'modifyDate'
|
19
|
-
attribute :note, :aliases => 'notes'
|
20
|
-
attribute :key
|
21
|
-
|
22
|
-
def save
|
23
|
-
identity ? update : create
|
24
|
-
end
|
25
|
-
|
26
|
-
def create
|
27
|
-
requires :key, :label
|
28
|
-
response = service.create_key_pair(attributes).body
|
29
|
-
merge_attributes(response)
|
30
|
-
self
|
31
|
-
end
|
32
|
-
|
33
|
-
def update
|
34
|
-
requires :id
|
35
|
-
merge_attributes(service.update_key_pair(self.id, self.attributes).body)
|
36
|
-
self
|
37
|
-
end
|
38
|
-
|
39
|
-
def destroy
|
40
|
-
requires :id
|
41
|
-
service.delete_key_pair(self.id)
|
42
|
-
true
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Matt Eldridge (<matt.eldridge@us.ibm.com>)
|
3
|
-
# © Copyright IBM Corporation 2014.
|
4
|
-
#
|
5
|
-
# LICENSE: MIT (http://opensource.org/licenses/MIT)
|
6
|
-
#
|
7
|
-
|
8
|
-
require 'fog/core/collection'
|
9
|
-
require 'fog/softlayer/models/compute/key_pair'
|
10
|
-
|
11
|
-
module Fog
|
12
|
-
module Compute
|
13
|
-
class Softlayer
|
14
|
-
class KeyPairs < Fog::Collection
|
15
|
-
model Fog::Compute::Softlayer::KeyPair
|
16
|
-
|
17
|
-
def all
|
18
|
-
data = service.get_key_pairs.body
|
19
|
-
load(data)
|
20
|
-
end
|
21
|
-
|
22
|
-
def get(id)
|
23
|
-
if key_pair = service.get_key_pair(id).body
|
24
|
-
new(key_pair)
|
25
|
-
end
|
26
|
-
rescue Fog::Network::Softlayer::NotFound
|
27
|
-
nil
|
28
|
-
end
|
29
|
-
|
30
|
-
def by_label(label)
|
31
|
-
all.select { |key_pair| key_pair.label == label }.first
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Matt Eldridge (<matt.eldridge@us.ibm.com>)
|
3
|
-
# © Copyright IBM Corporation 2014.
|
4
|
-
#
|
5
|
-
# LICENSE: MIT (http://opensource.org/licenses/MIT)
|
6
|
-
#
|
7
|
-
module Fog
|
8
|
-
module Compute
|
9
|
-
class Softlayer
|
10
|
-
|
11
|
-
class Mock
|
12
|
-
|
13
|
-
def create_key_pair(opts)
|
14
|
-
response = Excon::Response.new
|
15
|
-
|
16
|
-
response.status = 200
|
17
|
-
response.body = []
|
18
|
-
|
19
|
-
response.body = {
|
20
|
-
"createDate" => Time.now.iso8601,
|
21
|
-
"fingerprint" => "1a:1a:1a:1a:1a:1a:1a:1a:1a:1a:1a:1a:1a:1a:1a:1a",
|
22
|
-
"id" => Fog::Mock.random_numbers(5).to_i,
|
23
|
-
"key" => opts[:key],
|
24
|
-
"label" => opts[:label],
|
25
|
-
"modifyDate" => nil
|
26
|
-
}
|
27
|
-
|
28
|
-
@key_pairs.push(response.body)
|
29
|
-
response
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
class Real
|
34
|
-
def create_key_pair(opts)
|
35
|
-
request(:security_ssh_key, :create_object, :body => opts, :http_method => :post)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Matt Eldridge (<matt.eldridge@us.ibm.com>)
|
3
|
-
# © Copyright IBM Corporation 2014.
|
4
|
-
#
|
5
|
-
# LICENSE: MIT (http://opensource.org/licenses/MIT)
|
6
|
-
#
|
7
|
-
module Fog
|
8
|
-
module Compute
|
9
|
-
class Softlayer
|
10
|
-
|
11
|
-
class Mock
|
12
|
-
|
13
|
-
def delete_key_pair(id)
|
14
|
-
response = Excon::Response.new
|
15
|
-
response.status = 200
|
16
|
-
if @key_pairs.reject! { |kp| kp['id'] == id }.nil?
|
17
|
-
response.status = 404
|
18
|
-
response.body = {
|
19
|
-
"error" => "Unable to find object with id of '#{id}'.",
|
20
|
-
"code" => "SoftLayer_Exception_ObjectNotFound"
|
21
|
-
}
|
22
|
-
else
|
23
|
-
response.body = true
|
24
|
-
end
|
25
|
-
response
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
class Real
|
30
|
-
def delete_key_pair(id)
|
31
|
-
request(:security_ssh_key, id, :http_method => :delete)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Matt Eldridge (<matt.eldridge@us.ibm.com>)
|
3
|
-
# © Copyright IBM Corporation 2014.
|
4
|
-
#
|
5
|
-
# LICENSE: MIT (http://opensource.org/licenses/MIT)
|
6
|
-
#
|
7
|
-
module Fog
|
8
|
-
module Compute
|
9
|
-
class Softlayer
|
10
|
-
|
11
|
-
class Mock
|
12
|
-
def get_key_pair(id)
|
13
|
-
response = Excon::Response.new
|
14
|
-
response.status = 200
|
15
|
-
response.body = key_pair = @key_pairs.select { |kp| kp[:id] == id }.first
|
16
|
-
|
17
|
-
if key_pair.nil?
|
18
|
-
response.body = {
|
19
|
-
"error"=>"Unable to find object with id of '#{identifier}'.",
|
20
|
-
"code"=>"SoftLayer_Exception_ObjectNotFound"
|
21
|
-
}
|
22
|
-
response.status = 404
|
23
|
-
end
|
24
|
-
response
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
class Real
|
30
|
-
def get_key_pair(id)
|
31
|
-
request(:security_ssh_key, id)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Matt Eldridge (<matt.eldridge@us.ibm.com>)
|
3
|
-
# © Copyright IBM Corporation 2014.
|
4
|
-
#
|
5
|
-
# LICENSE: MIT (http://opensource.org/licenses/MIT)
|
6
|
-
#
|
7
|
-
|
8
|
-
module Fog
|
9
|
-
module Compute
|
10
|
-
class Softlayer
|
11
|
-
|
12
|
-
class Mock
|
13
|
-
def get_key_pairs
|
14
|
-
response = Excon::Response.new
|
15
|
-
response.body = @key_pairs
|
16
|
-
response.status = 200
|
17
|
-
response
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
|
22
|
-
class Real
|
23
|
-
def get_key_pairs
|
24
|
-
request(:account, :get_ssh_keys)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Matt Eldridge (<matt.eldridge@us.ibm.com>)
|
3
|
-
# © Copyright IBM Corporation 2014.
|
4
|
-
#
|
5
|
-
# LICENSE: MIT (http://opensource.org/licenses/MIT)
|
6
|
-
#
|
7
|
-
module Fog
|
8
|
-
module Compute
|
9
|
-
class Softlayer
|
10
|
-
|
11
|
-
class Mock
|
12
|
-
|
13
|
-
def update_key_pair(id, opts)
|
14
|
-
response = Excon::Response.new
|
15
|
-
response.status = 200
|
16
|
-
|
17
|
-
key_pair, index = @key_pairs.each_with_index.select { |kp, i| kp['id'] == id }
|
18
|
-
|
19
|
-
if key_pair.nil?
|
20
|
-
response.status = 404
|
21
|
-
response.body = {
|
22
|
-
"error" => "Unable to find object with id of '#{id}'.",
|
23
|
-
"code" => "SoftLayer_Exception_ObjectNotFound"
|
24
|
-
}
|
25
|
-
else
|
26
|
-
@key_pairs[index] = key_pair.merge(opts)
|
27
|
-
response.body = true
|
28
|
-
end
|
29
|
-
response
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
class Real
|
34
|
-
def update_key_pair(id, opts)
|
35
|
-
request(:security_ssh_key, id, :body => opts, :http_method => :put)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|