fog-softlayer 0.4.2.pre → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +5 -13
  2. data/CONTRIBUTORS.md +2 -0
  3. data/examples/compute.md +37 -1
  4. data/lib/fog/softlayer/compute.rb +8 -1
  5. data/lib/fog/softlayer/dns.rb +0 -1
  6. data/lib/fog/softlayer/ext/hash.rb +6 -0
  7. data/lib/fog/softlayer/ext/string.rb +20 -0
  8. data/lib/fog/softlayer/models/compute/flavor.rb +0 -2
  9. data/lib/fog/softlayer/models/compute/flavors.rb +0 -1
  10. data/lib/fog/softlayer/models/compute/image.rb +0 -2
  11. data/lib/fog/softlayer/models/compute/images.rb +0 -1
  12. data/lib/fog/softlayer/models/compute/key_pair.rb +0 -2
  13. data/lib/fog/softlayer/models/compute/key_pairs.rb +0 -1
  14. data/lib/fog/softlayer/models/compute/network_component.rb +0 -2
  15. data/lib/fog/softlayer/models/compute/network_components.rb +0 -1
  16. data/lib/fog/softlayer/models/compute/server.rb +10 -0
  17. data/lib/fog/softlayer/models/compute/servers.rb +25 -1
  18. data/lib/fog/softlayer/models/compute/tag.rb +0 -2
  19. data/lib/fog/softlayer/models/compute/tags.rb +0 -1
  20. data/lib/fog/softlayer/models/dns/domain.rb +1 -1
  21. data/lib/fog/softlayer/models/dns/domains.rb +1 -1
  22. data/lib/fog/softlayer/models/dns/record.rb +0 -1
  23. data/lib/fog/softlayer/models/dns/records.rb +1 -1
  24. data/lib/fog/softlayer/models/network/datacenter.rb +0 -2
  25. data/lib/fog/softlayer/models/network/datacenters.rb +0 -1
  26. data/lib/fog/softlayer/models/network/ip.rb +0 -2
  27. data/lib/fog/softlayer/models/network/ips.rb +0 -1
  28. data/lib/fog/softlayer/models/network/network.rb +0 -2
  29. data/lib/fog/softlayer/models/network/networks.rb +0 -1
  30. data/lib/fog/softlayer/models/network/subnet.rb +0 -2
  31. data/lib/fog/softlayer/models/network/subnets.rb +0 -1
  32. data/lib/fog/softlayer/models/network/tag.rb +0 -1
  33. data/lib/fog/softlayer/models/network/tags.rb +1 -1
  34. data/lib/fog/softlayer/models/product/item.rb +0 -1
  35. data/lib/fog/softlayer/models/product/items.rb +0 -1
  36. data/lib/fog/softlayer/models/product/package.rb +0 -1
  37. data/lib/fog/softlayer/models/product/packages.rb +0 -1
  38. data/lib/fog/softlayer/models/storage/directories.rb +0 -1
  39. data/lib/fog/softlayer/models/storage/directory.rb +0 -1
  40. data/lib/fog/softlayer/models/storage/file.rb +0 -2
  41. data/lib/fog/softlayer/models/storage/files.rb +0 -1
  42. data/lib/fog/softlayer/network.rb +0 -2
  43. data/lib/fog/softlayer/product.rb +0 -1
  44. data/lib/fog/softlayer/requests/compute/create_bare_metal_server.rb +1 -0
  45. data/lib/fog/softlayer/requests/compute/create_vms.rb +1 -0
  46. data/lib/fog/softlayer/requests/compute/get_bare_metal_active_tickets.rb +79 -0
  47. data/lib/fog/softlayer/requests/compute/get_bare_metal_create_options.rb +1116 -0
  48. data/lib/fog/softlayer/requests/compute/get_bare_metal_server_by_ip.rb +32 -0
  49. data/lib/fog/softlayer/requests/compute/get_bare_metal_users.rb +148 -0
  50. data/lib/fog/softlayer/requests/compute/get_virtual_guest_active_tickets.rb +79 -0
  51. data/lib/fog/softlayer/requests/compute/get_virtual_guest_by_ip.rb +32 -0
  52. data/lib/fog/softlayer/requests/compute/get_virtual_guest_create_options.rb +4060 -0
  53. data/lib/fog/softlayer/requests/compute/get_virtual_guest_users.rb +148 -0
  54. data/lib/fog/softlayer/slapi.rb +96 -0
  55. data/lib/fog/softlayer/storage.rb +1 -3
  56. data/lib/fog/softlayer/version.rb +1 -1
  57. data/lib/fog/softlayer.rb +69 -6
  58. data/tests/softlayer/requests/compute/bmc_tests.rb +38 -0
  59. data/tests/softlayer/requests/compute/vm_tests.rb +37 -0
  60. metadata +41 -32
  61. data/lib/fog/softlayer/core.rb +0 -176
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MTk2YjM1ZGQ2NWNhMTg3YWYxMmEyNmIzNmEzYzFhMGU5ZDFkODZhYg==
5
- data.tar.gz: !binary |-
6
- OTM3OTM5MDAxNWRkYWMxYzQ3Njk1OGQzMDhjZjM5ZDY3YzdlNGMyMg==
2
+ SHA1:
3
+ metadata.gz: fcc50eeec7f03f36516c3d9930ffe0ca99caf593
4
+ data.tar.gz: 19237aaa3333da5a9712b4690bb89255784295f3
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- YTM0ZTA5ZWM2NTAzMzQ1OTVmMWZlMDcyOGI3N2I3ZmY3YTRlZTZkYjJkYTVm
10
- MWQzOWZmZWRhZDUzOTYxNTQ5OTJlMDBjMTUxZTNlYmVlNTUwNWYwODVmMGQ2
11
- MWNkNGRiYjFiODVkZDRhYmVhMDM3NGI3MTQ2ZGE0NjIwZWEyZGQ=
12
- data.tar.gz: !binary |-
13
- NWNmZTE0Yjc2ODA4MmI1NzI3NmNkNGIyNDVjYWIyNTJlMjk0M2RkNjRlYzNl
14
- Y2NjMTM3ODBmZDgyNjhlMGU2NTQwMzM5MzYzN2Y5NDNmNzZiN2U4YWRiZmQw
15
- NDIyMDhlNDA1ZDQ4NzRhMzAwZDRiMDBlMWEzZDBhNTJhYjUxYzQ=
6
+ metadata.gz: e670a20dea83aab7f5bc302de049ae41cffd755530c126dbbf76fb4235afc1bd4446ee48ce69249507fd49aa89eb09e8eb6e743639cf7f6d2f656b58db030e65
7
+ data.tar.gz: 58f36d40a0a8396f0f42797e361553a6acc1785be773008e790585069f436cb684fbaa35dbec5a6b23f7a5508e2528ecc1256020b1f8371a2421c0727e9bcf9d
data/CONTRIBUTORS.md CHANGED
@@ -4,6 +4,8 @@
4
4
  * Hiroyuki Urasoko <ura.58.58@gmail.com>
5
5
  * Konstantin Krauss <konstantin@propertybase.com>
6
6
  * Manuel Franco <mfranco@flexiant.com>
7
+ * Matheus Mina <mfbmina@gmail.com>
7
8
  * Matt Eldridge <matt.eldridge@us.ibm.com>
8
9
  * Paulo Henrique Lopes Ribeiro <paulo@majority.co>
10
+ * Paulo Henrique Lopes Ribeiro <plribeiro3000@gmail.com>
9
11
  * geemus <geemus@gmail.com>
data/examples/compute.md CHANGED
@@ -27,6 +27,15 @@ If you are unfamiliar with fog, we recommend reading our [getting started](getti
27
27
  server.state # => 'Running', 'Stopped', 'Terminated', etc.
28
28
  ```
29
29
 
30
+ 1. Get a server's details using ip address
31
+
32
+ ```ruby
33
+ server = @sl.servers.get_by_ip(<server ip>)
34
+ server.name # => 'hostname.example.com'
35
+ server.created_at # => DateTime the server was created
36
+ server.state # => 'Running', 'Stopped', 'Terminated', etc.
37
+ ```
38
+
30
39
  1. Get all servers tagged with certain tags.
31
40
 
32
41
  ```ruby
@@ -288,4 +297,31 @@ If you are unfamiliar with fog, we recommend reading our [getting started](getti
288
297
  srvr.ready # true
289
298
  srvr.state # "Running"
290
299
 
291
- ```
300
+ ```
301
+
302
+
303
+ 1. Get all options to create a bare metal.
304
+
305
+ ```ruby
306
+ @sl.servers.get_bm_create_options
307
+ ```
308
+
309
+ 1. Get all options to create a VM.
310
+
311
+ ```ruby
312
+ @sl.servers.get_vm_create_options
313
+ ```
314
+
315
+ 1. Get all active tickets of a server.
316
+
317
+ ```ruby
318
+ server = @sl.servers.get(123456)
319
+ server.get_active_tickets
320
+ ```
321
+
322
+ 1. Get all users of a server.
323
+
324
+ ```ruby
325
+ server = @sl.servers.get(123456)
326
+ server.get_users
327
+ ```
@@ -5,7 +5,6 @@
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
7
 
8
- require 'fog/softlayer/core'
9
8
  require 'fog/softlayer/compute/shared'
10
9
 
11
10
  module Fog
@@ -47,13 +46,21 @@ module Fog
47
46
  request :delete_vm
48
47
  request :delete_vm_tags
49
48
  request :describe_tags
49
+ request :get_bare_metal_active_tickets
50
+ request :get_bare_metal_create_options
50
51
  request :get_bare_metal_server
52
+ request :get_bare_metal_server_by_ip
51
53
  request :get_bare_metal_servers
52
54
  request :get_bare_metal_tags
55
+ request :get_bare_metal_users
53
56
  request :get_key_pair
54
57
  request :get_key_pairs
55
58
  request :get_references_by_tag_name
56
59
  request :get_tag
60
+ request :get_virtual_guest_active_tickets
61
+ request :get_virtual_guest_by_ip
62
+ request :get_virtual_guest_create_options
63
+ request :get_virtual_guest_users
57
64
  request :get_vm_tags
58
65
  request :get_vm
59
66
  request :get_vms
@@ -5,7 +5,6 @@
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
7
 
8
- require 'fog/softlayer/core'
9
8
  require 'fog/softlayer/compute/shared'
10
9
 
11
10
  module Fog
@@ -0,0 +1,6 @@
1
+ class Hash
2
+ def deep_merge(second)
3
+ merger = proc { |key, v1, v2| Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : v2 }
4
+ self.merge(second, &merger)
5
+ end
6
+ end
@@ -0,0 +1,20 @@
1
+ ## some helpers for some dirty work
2
+ class String
3
+ def softlayer_camelize
4
+ self.split('_').inject([]){ |buffer,e| buffer.push(buffer.empty? ? e : e.capitalize) }.join
5
+ end
6
+
7
+ def fix_convention_exceptions
8
+ # SLAPI WHY U No Follow Own Convention!?
9
+ self.gsub!(/ipaddress/i, 'IpAddress')
10
+ self.gsub!(/loadbalancer/i, 'LoadBalancer')
11
+ end
12
+
13
+ def softlayer_underscore
14
+ self.gsub(/::/, '/').
15
+ gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
16
+ gsub(/([a-z\d])([A-Z])/,'\1_\2').
17
+ tr("-", "_").
18
+ downcase
19
+ end
20
+ end
@@ -5,8 +5,6 @@
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
7
 
8
- require 'fog/core/model'
9
-
10
8
  module Fog
11
9
  module Compute
12
10
  class Softlayer
@@ -5,7 +5,6 @@
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
7
 
8
- require 'fog/core/collection'
9
8
  require 'fog/softlayer/models/compute/flavor'
10
9
 
11
10
  module Fog
@@ -5,8 +5,6 @@
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
7
 
8
- require 'fog/core/model'
9
-
10
8
  module Fog
11
9
  module Compute
12
10
  class Softlayer
@@ -5,7 +5,6 @@
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
7
 
8
- require 'fog/core/collection'
9
8
  require 'fog/softlayer/models/compute/image'
10
9
 
11
10
  module Fog
@@ -5,8 +5,6 @@
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
7
 
8
- require 'fog/core/model'
9
-
10
8
  module Fog
11
9
  module Compute
12
10
  class Softlayer
@@ -5,7 +5,6 @@
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
7
 
8
- require 'fog/core/collection'
9
8
  require 'fog/softlayer/models/compute/key_pair'
10
9
 
11
10
  module Fog
@@ -5,8 +5,6 @@
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
7
 
8
- require 'fog/core/model'
9
-
10
8
  module Fog
11
9
  module Compute
12
10
  class Softlayer
@@ -5,7 +5,6 @@
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
7
 
8
- require 'fog/core/collection'
9
8
  require 'fog/softlayer/models/compute/key_pair'
10
9
 
11
10
  module Fog
@@ -347,6 +347,16 @@ module Fog
347
347
  attributes[:tags].map { |i| i['tag']['name'] } if attributes[:tags]
348
348
  end
349
349
 
350
+ def get_active_tickets
351
+ return service.get_bare_metal_active_tickets(id).body if bare_metal?
352
+ service.get_virtual_guest_active_tickets(id).body
353
+ end
354
+
355
+ def get_users
356
+ return service.get_bare_metal_users(id).body if bare_metal?
357
+ service.get_virtual_guest_users(id).body
358
+ end
359
+
350
360
  private
351
361
 
352
362
  def network_connection
@@ -5,7 +5,6 @@
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
7
 
8
- require 'fog/core/collection'
9
8
  require 'fog/softlayer/models/compute/server'
10
9
 
11
10
  module Fog
@@ -39,6 +38,23 @@ module Fog
39
38
  nil
40
39
  end
41
40
 
41
+ ## Get a SoftLayer server by ip.
42
+ #
43
+ def get_by_ip(ip)
44
+ return nil if ip.blank?
45
+ response = service.get_virtual_guest_by_ip(ip)
46
+ bare_metal = false
47
+ if response.status == 404 # we didn't find it as a VM, look for a BMC server
48
+ response = service.get_bare_metal_server_by_ip(ip)
49
+ bare_metal = true
50
+ end
51
+ data = response.body
52
+ data['bare_metal'] = bare_metal
53
+ new.merge_attributes(data)
54
+ rescue Excon::Errors::NotFound
55
+ nil
56
+ end
57
+
42
58
  def bootstrap(options={})
43
59
  server = service.create(options)
44
60
  server.wait_for { ready? }
@@ -54,6 +70,14 @@ module Fog
54
70
  end.flatten.uniq
55
71
  ids.map { |id| get(id) }
56
72
  end
73
+
74
+ def get_bm_create_options
75
+ service.get_bare_metal_create_options.body
76
+ end
77
+
78
+ def get_vm_create_options
79
+ service.get_virtual_guest_create_options.body
80
+ end
57
81
  end
58
82
  end
59
83
  end
@@ -5,8 +5,6 @@
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
7
 
8
- require 'fog/core/model'
9
-
10
8
  module Fog
11
9
  module Compute
12
10
  class Softlayer
@@ -5,7 +5,6 @@
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
7
 
8
- require 'fog/core/collection'
9
8
  require 'fog/softlayer/models/compute/tag'
10
9
 
11
10
  module Fog
@@ -4,7 +4,7 @@
4
4
  #
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
- require 'fog/core/model'
7
+
8
8
  require 'fog/softlayer/models/dns/records'
9
9
 
10
10
  module Fog
@@ -4,7 +4,7 @@
4
4
  #
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
- require 'fog/core/collection'
7
+
8
8
  require 'fog/softlayer/models/compute/server'
9
9
 
10
10
  module Fog
@@ -4,7 +4,6 @@
4
4
  #
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
- require 'fog/core/model'
8
7
 
9
8
  module Fog
10
9
  module DNS
@@ -4,7 +4,7 @@
4
4
  #
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
- require 'fog/core/collection'
7
+
8
8
  require 'fog/softlayer/models/dns/record'
9
9
 
10
10
  module Fog
@@ -5,8 +5,6 @@
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
7
 
8
- require 'fog/core/model'
9
-
10
8
  module Fog
11
9
  module Network
12
10
  class Softlayer
@@ -5,7 +5,6 @@
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
7
 
8
- require 'fog/core/collection'
9
8
  require 'fog/softlayer/models/network/datacenter'
10
9
 
11
10
  module Fog
@@ -5,8 +5,6 @@
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
7
 
8
- require 'fog/core/model'
9
-
10
8
  module Fog
11
9
  module Network
12
10
  class Softlayer
@@ -5,7 +5,6 @@
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
7
 
8
- require 'fog/core/collection'
9
8
  require 'fog/softlayer/models/network/ip'
10
9
 
11
10
  module Fog
@@ -5,8 +5,6 @@
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
7
 
8
- require 'fog/core/model'
9
-
10
8
  module Fog
11
9
  module Network
12
10
  class Softlayer
@@ -5,7 +5,6 @@
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
7
 
8
- require 'fog/core/collection'
9
8
  require 'fog/softlayer/models/network/network'
10
9
 
11
10
  module Fog
@@ -5,8 +5,6 @@
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
7
 
8
- require 'fog/core/model'
9
-
10
8
  module Fog
11
9
  module Network
12
10
  class Softlayer
@@ -5,7 +5,6 @@
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
7
 
8
- require 'fog/core/collection'
9
8
  require 'fog/softlayer/models/network/subnet'
10
9
 
11
10
  module Fog
@@ -4,7 +4,6 @@
4
4
  #
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
- require 'fog/core/model'
8
7
 
9
8
  module Fog
10
9
  module Network
@@ -4,7 +4,7 @@
4
4
  #
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
- require 'fog/core/collection'
7
+
8
8
  require 'fog/softlayer/models/network/tag'
9
9
 
10
10
  module Fog
@@ -4,7 +4,6 @@
4
4
  #
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
- require 'fog/core/model'
8
7
 
9
8
  module Fog
10
9
  module Softlayer
@@ -4,7 +4,6 @@
4
4
  #
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
- require 'fog/core/collection'
8
7
 
9
8
  module Fog
10
9
  module Softlayer
@@ -4,7 +4,6 @@
4
4
  #
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
- require 'fog/core/model'
8
7
 
9
8
  module Fog
10
9
  module Softlayer
@@ -4,7 +4,6 @@
4
4
  #
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
- require 'fog/core/collection'
8
7
 
9
8
  module Fog
10
9
  module Softlayer
@@ -5,7 +5,6 @@
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
7
 
8
- require 'fog/core/collection'
9
8
  require 'fog/softlayer/models/storage/directory'
10
9
 
11
10
  module Fog
@@ -5,7 +5,6 @@
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
7
 
8
- require 'fog/core/model'
9
8
  require 'fog/softlayer/models/storage/files'
10
9
 
11
10
  module Fog
@@ -5,8 +5,6 @@
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
7
 
8
- require 'fog/core/model'
9
-
10
8
  module Fog
11
9
  module Storage
12
10
  class Softlayer
@@ -5,7 +5,6 @@
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
7
 
8
- require 'fog/core/collection'
9
8
  require 'fog/softlayer/models/storage/file'
10
9
 
11
10
  module Fog
@@ -5,8 +5,6 @@
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
7
 
8
- require 'fog/softlayer/core'
9
-
10
8
  module Fog
11
9
  module Network
12
10
  class Softlayer < Fog::Service
@@ -5,7 +5,6 @@
5
5
  # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
6
  #
7
7
 
8
- require 'fog/softlayer/core'
9
8
  require 'fog/softlayer/compute/shared'
10
9
 
11
10
  module Fog
@@ -58,6 +58,7 @@ module Fog
58
58
  'modifyDate' => nil,
59
59
  'startCpus' => nil,
60
60
  'statusId' => 1001,
61
+ 'primaryIpAddress' => Fog::Mock.random_ip,
61
62
  'globalIdentifier' => Fog::Softlayer.mock_global_identifier
62
63
  }
63
64
  rescue MissingRequiredParameter
@@ -63,6 +63,7 @@ module Fog
63
63
  'statusId' => 1001,
64
64
  'globalIdentifier' => Fog::Softlayer.mock_global_identifier,
65
65
  'operatingSystem' => {},
66
+ 'primaryIpAddress' => Fog::Mock.random_ip,
66
67
  'tagReferences' => []
67
68
  }
68
69
 
@@ -0,0 +1,79 @@
1
+ #
2
+ # Author:: Matheus Francisco Barra Mina (<mfbmina@gmail.com>)
3
+ # © Copyright IBM Corporation 2015.
4
+ #
5
+ # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
+ #
7
+ module Fog
8
+ module Compute
9
+ class Softlayer
10
+ class Mock
11
+ # Gets all Bare Metal active tickets
12
+ # @param [Integer] id
13
+ # @return [Excon::Response]
14
+ def get_bare_metal_active_tickets(id)
15
+ response = Excon::Response.new
16
+ found = self.get_bare_metal_servers.body.map{|server| server['id']}.include?(id)
17
+ unless found
18
+ response.status = 404
19
+ response.body = {
20
+ "error" => "Unable to find object with id of '#{id}'.",
21
+ "code" => "SoftLayer_Exception_ObjectNotFound"
22
+ }
23
+ else
24
+ response.status = 200
25
+ response.body = get_active_tickets
26
+ end
27
+ response
28
+ end
29
+ end
30
+
31
+ class Real
32
+ def get_bare_metal_active_tickets(id)
33
+ request(:hardware_server, "#{id.to_s}/getActiveTickets", :http_method => :GET)
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+
40
+ module Fog
41
+ module Compute
42
+ class Softlayer
43
+ class Mock
44
+ def get_active_tickets
45
+ [
46
+ {
47
+ "accountId"=>1,
48
+ "assignedUserId"=>1,
49
+ "billableFlag"=>nil,
50
+ "changeOwnerFlag"=>false,
51
+ "createDate"=>"2015-03-17T07:42:42-05:00",
52
+ "groupId"=>1,
53
+ "id"=>1,
54
+ "lastEditDate"=>"2015-03-17T07:42:43-05:00",
55
+ "lastEditType"=>"AUTO",
56
+ "locationId"=>nil,
57
+ "modifyDate"=>"2015-03-17T07:42:43-05:00",
58
+ "notifyUserOnUpdateFlag"=>true,
59
+ "originatingIpAddress"=>"10.10.10.10",
60
+ "priority"=>0,
61
+ "responsibleBrandId"=>1,
62
+ "serverAdministrationBillingAmount"=>nil,
63
+ "serverAdministrationBillingInvoiceId"=>nil,
64
+ "serverAdministrationFlag"=>0,
65
+ "serverAdministrationRefundInvoiceId"=>nil,
66
+ "serviceProviderId"=>1,
67
+ "serviceProviderResourceId"=>1,
68
+ "statusId"=>1,
69
+ "subjectId"=>1,
70
+ "title"=>"API Question - Testing API",
71
+ "totalUpdateCount"=>1,
72
+ "userEditableFlag"=>true
73
+ }
74
+ ]
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end