fog-softlayer 0.3.5 → 0.3.6.pre.f7e3358
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 +1 -0
- data/lib/fog/softlayer/compute.rb +12 -4
- data/lib/fog/softlayer/models/compute/key_pair.rb +48 -0
- data/lib/fog/softlayer/models/compute/key_pairs.rb +37 -0
- data/lib/fog/softlayer/models/compute/server.rb +37 -8
- data/lib/fog/softlayer/requests/compute/create_key_pair.rb +41 -0
- data/lib/fog/softlayer/requests/compute/delete_key_pair.rb +37 -0
- 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_key_pair.rb +36 -0
- data/lib/fog/softlayer/requests/compute/get_key_pairs.rb +29 -0
- 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/requests/compute/update_key_pair.rb +42 -0
- data/lib/fog/softlayer/version.rb +1 -1
- metadata +24 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZWI2OTJkMjg3YmQyM2I5MzY4MTZiNmI1YmMwNDQwM2I3YmMzNTQ4OA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZWM0ZmQ5N2NmYzc0OTc3NDZmNjE5YmY2N2Y0Mzg1NTM0NTk4ZTYxMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MjUzMDZjYjBlMzQzYzI1ZjM1ZjI3OGNlYjk5MmM2ZTE2MDg3YTk1YmMwMDg1
|
10
|
+
MmRhMzBkZTdjNmJmYTk2NTVkOWQ2MGY2OWY1OWZjNmY5MmUyYzcyOGNiNzVk
|
11
|
+
M2I3MDZmMzM0ZTFkMGViMDViODRhMWQ1NDQwOTVhZmEwNzExODQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTllNjkwOWJlNGI2NTBlMjc5MzNjMzgzYWZiYmJiMDJlYTMwNDM4YjJjMmEw
|
14
|
+
ZWZmYzY1ODNjZmFlYTQ2NzBmODExMjIwZTljODAwN2UzYmFhMTJkMmZjNWMy
|
15
|
+
NzUyODhhMTA2YWRkYTQ5NGVkNDY5YjcyNDkxOWJlN2E3MTBjNGM=
|
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/fog/fog-softlayer.svg)](https://travis-ci.org/fog/fog-softlayer)
|
4
|
+
[![Dependency Status](https://gemnasium.com/fog/fog-softlayer.svg)](https://gemnasium.com/fog/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
@@ -33,5 +33,6 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.add_development_dependency('shindo', '~> 0.3.4')
|
34
34
|
spec.add_development_dependency('fission')
|
35
35
|
spec.add_development_dependency('pry')
|
36
|
+
spec.add_development_dependency('pry-debugger')
|
36
37
|
spec.add_development_dependency('osrcry')
|
37
38
|
end
|
@@ -17,8 +17,7 @@ module Fog
|
|
17
17
|
requires :softlayer_username, :softlayer_api_key
|
18
18
|
|
19
19
|
# Excon connection settings
|
20
|
-
recognizes :softlayer_api_url
|
21
|
-
recognizes :softlayer_default_domain
|
20
|
+
recognizes :softlayer_api_url, :softlayer_default_domain, :softlayer_default_datacenter
|
22
21
|
|
23
22
|
|
24
23
|
model_path 'fog/softlayer/models/compute'
|
@@ -26,6 +25,8 @@ module Fog
|
|
26
25
|
model :flavor
|
27
26
|
collection :images
|
28
27
|
model :image
|
28
|
+
collection :key_pairs
|
29
|
+
model :key_pair
|
29
30
|
collection :servers
|
30
31
|
model :server
|
31
32
|
collection :tags
|
@@ -34,17 +35,21 @@ module Fog
|
|
34
35
|
request_path 'fog/softlayer/requests/compute'
|
35
36
|
request :create_bare_metal_server
|
36
37
|
request :create_bare_metal_tags
|
38
|
+
request :create_key_pair
|
37
39
|
request :create_vm
|
38
40
|
request :create_vms
|
39
41
|
request :create_vm_tags
|
40
42
|
request :delete_bare_metal_server
|
41
43
|
request :delete_bare_metal_tags
|
44
|
+
request :delete_key_pair
|
42
45
|
request :delete_vm
|
43
46
|
request :delete_vm_tags
|
44
47
|
request :describe_tags
|
45
48
|
request :get_bare_metal_server
|
46
49
|
request :get_bare_metal_servers
|
47
50
|
request :get_bare_metal_tags
|
51
|
+
request :get_key_pair
|
52
|
+
request :get_key_pairs
|
48
53
|
request :get_references_by_tag_name
|
49
54
|
request :get_tag
|
50
55
|
request :get_vm_tags
|
@@ -65,6 +70,7 @@ module Fog
|
|
65
70
|
@virtual_guests = []
|
66
71
|
@bare_metal_servers = []
|
67
72
|
@tags = []
|
73
|
+
@key_pairs = []
|
68
74
|
super(args)
|
69
75
|
end
|
70
76
|
|
@@ -94,13 +100,16 @@ module Fog
|
|
94
100
|
# Makes real connections to Softlayer.
|
95
101
|
#
|
96
102
|
class Real
|
97
|
-
attr_accessor :
|
103
|
+
attr_accessor :softlayer_default_domain
|
104
|
+
attr_accessor :softlayer_default_datacenter
|
98
105
|
include Fog::Softlayer::Slapi
|
99
106
|
include Fog::Softlayer::Compute::Shared
|
100
107
|
|
101
108
|
def initialize(options={})
|
102
109
|
@softlayer_api_key = options[:softlayer_api_key]
|
103
110
|
@softlayer_username = options[:softlayer_username]
|
111
|
+
@softlayer_default_domain = options[:softlayer_default_domain]
|
112
|
+
@softlayer_default_datacenter = options[:softlayer_default_datacenter]
|
104
113
|
end
|
105
114
|
|
106
115
|
def request(service, path, options = {})
|
@@ -108,7 +117,6 @@ module Fog
|
|
108
117
|
Fog::Softlayer::Slapi.slapi_request(service, path, options)
|
109
118
|
end
|
110
119
|
|
111
|
-
|
112
120
|
def list_servers
|
113
121
|
(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
|
114
122
|
end
|
@@ -0,0 +1,48 @@
|
|
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
|
@@ -0,0 +1,37 @@
|
|
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
|
@@ -123,32 +123,60 @@ 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
|
126
129
|
remap_attributes(attributes, attributes_mapping)
|
127
130
|
clean_attributes
|
128
131
|
end
|
129
132
|
|
130
|
-
def
|
131
|
-
attributes[:
|
133
|
+
def os
|
134
|
+
attributes[:os]['softwareLicense']['softwareDescription']['referenceCode']
|
135
|
+
end
|
136
|
+
|
137
|
+
def os_code
|
138
|
+
self.os if attributes[:os]
|
132
139
|
end
|
133
140
|
|
134
141
|
def private_vlan
|
135
142
|
attributes[:private_vlan] ||= _get_private_vlan
|
136
143
|
end
|
137
144
|
|
138
|
-
def
|
145
|
+
def private_vlan=(value)
|
139
146
|
unless value.is_a?(Integer) or value.is_a?(Fog::Network::Softlayer::Network)
|
140
147
|
raise ArgumentError, "vlan argument for #{self.class.name}##{__method__} must be Integer or Fog::Network::Softlayer::Network."
|
141
148
|
end
|
142
149
|
value = Fog::Network[:softlayer].networks.get(value) if value.is_a?(Integer)
|
143
|
-
attributes[:
|
150
|
+
attributes[:private_vlan] = value
|
144
151
|
end
|
145
152
|
|
146
|
-
def
|
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
|
172
|
+
end
|
173
|
+
|
174
|
+
def vlan=(value)
|
147
175
|
unless value.is_a?(Integer) or value.is_a?(Fog::Network::Softlayer::Network)
|
148
176
|
raise ArgumentError, "vlan argument for #{self.class.name}##{__method__} must be Integer or Fog::Network::Softlayer::Network."
|
149
177
|
end
|
150
178
|
value = Fog::Network[:softlayer].networks.get(value) if value.is_a?(Integer)
|
151
|
-
attributes[:
|
179
|
+
attributes[:vlan] = value
|
152
180
|
end
|
153
181
|
|
154
182
|
def ram=(set)
|
@@ -212,7 +240,6 @@ module Fog
|
|
212
240
|
# * BUILD -> ERROR (on error)
|
213
241
|
def save
|
214
242
|
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?
|
215
|
-
|
216
243
|
copy = self.dup
|
217
244
|
copy.pre_save
|
218
245
|
|
@@ -263,6 +290,7 @@ module Fog
|
|
263
290
|
:os_code => :operatingSystemReferenceCode,
|
264
291
|
:vlan => :primaryNetworkComponent,
|
265
292
|
:private_vlan => :primaryBackendNetworkComponent,
|
293
|
+
:key_pairs => :sshKeys,
|
266
294
|
|
267
295
|
}
|
268
296
|
|
@@ -331,7 +359,8 @@ module Fog
|
|
331
359
|
def set_defaults
|
332
360
|
attributes[:hourly_billing_flag] = true if attributes[:hourly_billing_flag].nil?
|
333
361
|
attributes[:ephemeral_storage] = false if attributes[:ephemeral_storage].nil?
|
334
|
-
attributes[:domain] = service.
|
362
|
+
attributes[:domain] = service.softlayer_default_domain if service.softlayer_default_domain and attributes[:domain].nil?
|
363
|
+
self.datacenter = service.softlayer_default_datacenter if service.softlayer_default_datacenter and attributes[:datacenter].nil?
|
335
364
|
end
|
336
365
|
|
337
366
|
end
|
@@ -0,0 +1,41 @@
|
|
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
|
@@ -0,0 +1,37 @@
|
|
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
|
@@ -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.softwareLicense.softwareDescription.referenceCode,sshKeys.id]')
|
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.softwareLicense.softwareDescription.referenceCode,sshKeys.id]')
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -0,0 +1,36 @@
|
|
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
|
@@ -0,0 +1,29 @@
|
|
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
|
@@ -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.softwareLicense.softwareDescription.referenceCode,sshKeys.id]')
|
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.softwareLicense.softwareDescription.referenceCode,primaryNetworkComponent.networkVlan,sshKeys.id]')
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -0,0 +1,42 @@
|
|
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
|
+
|
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.
|
4
|
+
version: 0.3.6.pre.f7e3358
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Eldridge
|
@@ -178,6 +178,20 @@ dependencies:
|
|
178
178
|
- - ! '>='
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
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'
|
181
195
|
- !ruby/object:Gem::Dependency
|
182
196
|
name: osrcry
|
183
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -230,6 +244,8 @@ files:
|
|
230
244
|
- lib/fog/softlayer/models/compute/flavors.rb
|
231
245
|
- lib/fog/softlayer/models/compute/image.rb
|
232
246
|
- 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
|
233
249
|
- lib/fog/softlayer/models/compute/server.rb
|
234
250
|
- lib/fog/softlayer/models/compute/servers.rb
|
235
251
|
- lib/fog/softlayer/models/compute/tag.rb
|
@@ -255,22 +271,27 @@ files:
|
|
255
271
|
- lib/fog/softlayer/network.rb
|
256
272
|
- lib/fog/softlayer/requests/compute/create_bare_metal_server.rb
|
257
273
|
- lib/fog/softlayer/requests/compute/create_bare_metal_tags.rb
|
274
|
+
- lib/fog/softlayer/requests/compute/create_key_pair.rb
|
258
275
|
- lib/fog/softlayer/requests/compute/create_vm.rb
|
259
276
|
- lib/fog/softlayer/requests/compute/create_vm_tags.rb
|
260
277
|
- lib/fog/softlayer/requests/compute/create_vms.rb
|
261
278
|
- lib/fog/softlayer/requests/compute/delete_bare_metal_server.rb
|
262
279
|
- lib/fog/softlayer/requests/compute/delete_bare_metal_tags.rb
|
280
|
+
- lib/fog/softlayer/requests/compute/delete_key_pair.rb
|
263
281
|
- lib/fog/softlayer/requests/compute/delete_vm.rb
|
264
282
|
- lib/fog/softlayer/requests/compute/delete_vm_tags.rb
|
265
283
|
- lib/fog/softlayer/requests/compute/describe_tags.rb
|
266
284
|
- lib/fog/softlayer/requests/compute/get_bare_metal_server.rb
|
267
285
|
- lib/fog/softlayer/requests/compute/get_bare_metal_servers.rb
|
268
286
|
- 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
|
269
289
|
- lib/fog/softlayer/requests/compute/get_references_by_tag_name.rb
|
270
290
|
- lib/fog/softlayer/requests/compute/get_tag.rb
|
271
291
|
- lib/fog/softlayer/requests/compute/get_vm.rb
|
272
292
|
- lib/fog/softlayer/requests/compute/get_vm_tags.rb
|
273
293
|
- lib/fog/softlayer/requests/compute/get_vms.rb
|
294
|
+
- lib/fog/softlayer/requests/compute/update_key_pair.rb
|
274
295
|
- lib/fog/softlayer/requests/dns/create_domain.rb
|
275
296
|
- lib/fog/softlayer/requests/dns/create_record.rb
|
276
297
|
- lib/fog/softlayer/requests/dns/delete_domain.rb
|
@@ -370,9 +391,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
370
391
|
version: '0'
|
371
392
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
372
393
|
requirements:
|
373
|
-
- - ! '
|
394
|
+
- - ! '>'
|
374
395
|
- !ruby/object:Gem::Version
|
375
|
-
version:
|
396
|
+
version: 1.3.1
|
376
397
|
requirements: []
|
377
398
|
rubyforge_project:
|
378
399
|
rubygems_version: 2.2.2
|