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.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +3 -0
  3. data/.travis.yml +11 -4
  4. data/README.md +8 -5
  5. data/Rakefile +1 -1
  6. data/examples/pb_demo.rb +49 -49
  7. data/fog-profitbricks.gemspec +4 -5
  8. data/gemfiles/Gemfile.1.9.2+ +1 -0
  9. data/lib/fog/bin/profitbricks.rb +5 -5
  10. data/lib/fog/profitbricks.rb +3 -3
  11. data/lib/fog/profitbricks/compute.rb +209 -204
  12. data/lib/fog/profitbricks/helpers/compute/data_helper.rb +1 -1
  13. data/lib/fog/profitbricks/models/compute/datacenter.rb +1 -1
  14. data/lib/fog/profitbricks/models/compute/datacenters.rb +6 -7
  15. data/lib/fog/profitbricks/models/compute/firewall_rule.rb +2 -2
  16. data/lib/fog/profitbricks/models/compute/firewall_rules.rb +5 -8
  17. data/lib/fog/profitbricks/models/compute/flavors.rb +1 -4
  18. data/lib/fog/profitbricks/models/compute/image.rb +4 -0
  19. data/lib/fog/profitbricks/models/compute/images.rb +2 -5
  20. data/lib/fog/profitbricks/models/compute/ip_block.rb +1 -1
  21. data/lib/fog/profitbricks/models/compute/ip_blocks.rb +3 -8
  22. data/lib/fog/profitbricks/models/compute/lan.rb +1 -1
  23. data/lib/fog/profitbricks/models/compute/lans.rb +4 -7
  24. data/lib/fog/profitbricks/models/compute/load_balancer.rb +6 -7
  25. data/lib/fog/profitbricks/models/compute/load_balancers.rb +5 -9
  26. data/lib/fog/profitbricks/models/compute/locations.rb +2 -5
  27. data/lib/fog/profitbricks/models/compute/nic.rb +6 -3
  28. data/lib/fog/profitbricks/models/compute/nics.rb +2 -5
  29. data/lib/fog/profitbricks/models/compute/regions.rb +1 -4
  30. data/lib/fog/profitbricks/models/compute/request.rb +0 -1
  31. data/lib/fog/profitbricks/models/compute/requests.rb +2 -4
  32. data/lib/fog/profitbricks/models/compute/server.rb +10 -13
  33. data/lib/fog/profitbricks/models/compute/servers.rb +3 -6
  34. data/lib/fog/profitbricks/models/compute/snapshot.rb +2 -2
  35. data/lib/fog/profitbricks/models/compute/snapshots.rb +3 -6
  36. data/lib/fog/profitbricks/models/compute/volume.rb +11 -9
  37. data/lib/fog/profitbricks/models/compute/volumes.rb +3 -6
  38. data/lib/fog/profitbricks/requests/compute/associate_nic_to_load_balancer.rb +26 -13
  39. data/lib/fog/profitbricks/requests/compute/attach_cdrom.rb +25 -16
  40. data/lib/fog/profitbricks/requests/compute/attach_volume.rb +25 -16
  41. data/lib/fog/profitbricks/requests/compute/create_datacenter.rb +22 -23
  42. data/lib/fog/profitbricks/requests/compute/create_firewall_rule.rb +24 -26
  43. data/lib/fog/profitbricks/requests/compute/create_flavor.rb +34 -34
  44. data/lib/fog/profitbricks/requests/compute/create_ip_block.rb +18 -20
  45. data/lib/fog/profitbricks/requests/compute/create_lan.rb +151 -150
  46. data/lib/fog/profitbricks/requests/compute/create_load_balancer.rb +67 -26
  47. data/lib/fog/profitbricks/requests/compute/create_nic.rb +24 -26
  48. data/lib/fog/profitbricks/requests/compute/create_server.rb +70 -61
  49. data/lib/fog/profitbricks/requests/compute/create_volume.rb +122 -122
  50. data/lib/fog/profitbricks/requests/compute/create_volume_snapshot.rb +42 -45
  51. data/lib/fog/profitbricks/requests/compute/delete_datacenter.rb +34 -36
  52. data/lib/fog/profitbricks/requests/compute/delete_firewall_rule.rb +8 -11
  53. data/lib/fog/profitbricks/requests/compute/delete_image.rb +7 -9
  54. data/lib/fog/profitbricks/requests/compute/delete_ip_block.rb +8 -10
  55. data/lib/fog/profitbricks/requests/compute/delete_lan.rb +7 -9
  56. data/lib/fog/profitbricks/requests/compute/delete_load_balancer.rb +8 -10
  57. data/lib/fog/profitbricks/requests/compute/delete_nic.rb +7 -10
  58. data/lib/fog/profitbricks/requests/compute/delete_server.rb +6 -10
  59. data/lib/fog/profitbricks/requests/compute/delete_snapshot.rb +7 -10
  60. data/lib/fog/profitbricks/requests/compute/delete_volume.rb +36 -38
  61. data/lib/fog/profitbricks/requests/compute/detach_cdrom.rb +11 -13
  62. data/lib/fog/profitbricks/requests/compute/detach_volume.rb +16 -13
  63. data/lib/fog/profitbricks/requests/compute/get_all_datacenters.rb +1 -1
  64. data/lib/fog/profitbricks/requests/compute/get_all_firewall_rules.rb +6 -7
  65. data/lib/fog/profitbricks/requests/compute/get_all_flavors.rb +72 -72
  66. data/lib/fog/profitbricks/requests/compute/get_all_images.rb +62 -62
  67. data/lib/fog/profitbricks/requests/compute/get_all_ip_blocks.rb +5 -5
  68. data/lib/fog/profitbricks/requests/compute/get_all_lans.rb +113 -113
  69. data/lib/fog/profitbricks/requests/compute/get_all_load_balanced_nics.rb +15 -9
  70. data/lib/fog/profitbricks/requests/compute/get_all_load_balancers.rb +9 -9
  71. data/lib/fog/profitbricks/requests/compute/get_all_locations.rb +6 -6
  72. data/lib/fog/profitbricks/requests/compute/get_all_nic.rb +94 -94
  73. data/lib/fog/profitbricks/requests/compute/get_all_requests.rb +38 -38
  74. data/lib/fog/profitbricks/requests/compute/get_all_servers.rb +8 -9
  75. data/lib/fog/profitbricks/requests/compute/get_all_snapshots.rb +4 -4
  76. data/lib/fog/profitbricks/requests/compute/get_all_volumes.rb +71 -71
  77. data/lib/fog/profitbricks/requests/compute/get_attached_cdrom.rb +11 -11
  78. data/lib/fog/profitbricks/requests/compute/get_attached_volume.rb +16 -11
  79. data/lib/fog/profitbricks/requests/compute/get_datacenter.rb +4 -6
  80. data/lib/fog/profitbricks/requests/compute/get_firewall_rule.rb +8 -11
  81. data/lib/fog/profitbricks/requests/compute/get_flavor.rb +9 -9
  82. data/lib/fog/profitbricks/requests/compute/get_image.rb +7 -9
  83. data/lib/fog/profitbricks/requests/compute/get_ip_block.rb +8 -10
  84. data/lib/fog/profitbricks/requests/compute/get_lan.rb +7 -10
  85. data/lib/fog/profitbricks/requests/compute/get_load_balanced_nic.rb +16 -12
  86. data/lib/fog/profitbricks/requests/compute/get_load_balancer.rb +7 -9
  87. data/lib/fog/profitbricks/requests/compute/get_location.rb +7 -9
  88. data/lib/fog/profitbricks/requests/compute/get_nic.rb +8 -11
  89. data/lib/fog/profitbricks/requests/compute/get_request.rb +55 -57
  90. data/lib/fog/profitbricks/requests/compute/get_request_status.rb +44 -46
  91. data/lib/fog/profitbricks/requests/compute/get_server.rb +7 -10
  92. data/lib/fog/profitbricks/requests/compute/get_snapshot.rb +7 -9
  93. data/lib/fog/profitbricks/requests/compute/get_volume.rb +7 -9
  94. data/lib/fog/profitbricks/requests/compute/list_attached_cdroms.rb +8 -8
  95. data/lib/fog/profitbricks/requests/compute/list_attached_volumes.rb +18 -8
  96. data/lib/fog/profitbricks/requests/compute/reboot_server.rb +7 -11
  97. data/lib/fog/profitbricks/requests/compute/remove_nic_association.rb +9 -11
  98. data/lib/fog/profitbricks/requests/compute/restore_volume_snapshot.rb +15 -17
  99. data/lib/fog/profitbricks/requests/compute/start_server.rb +7 -11
  100. data/lib/fog/profitbricks/requests/compute/stop_server.rb +7 -11
  101. data/lib/fog/profitbricks/requests/compute/update_datacenter.rb +20 -15
  102. data/lib/fog/profitbricks/requests/compute/update_firewall_rule.rb +9 -11
  103. data/lib/fog/profitbricks/requests/compute/update_image.rb +15 -15
  104. data/lib/fog/profitbricks/requests/compute/update_lan.rb +6 -8
  105. data/lib/fog/profitbricks/requests/compute/update_load_balancer.rb +10 -12
  106. data/lib/fog/profitbricks/requests/compute/update_nic.rb +10 -12
  107. data/lib/fog/profitbricks/requests/compute/update_server.rb +10 -13
  108. data/lib/fog/profitbricks/requests/compute/update_snapshot.rb +10 -13
  109. data/lib/fog/profitbricks/requests/compute/update_volume.rb +10 -13
  110. data/lib/fog/profitbricks/version.rb +1 -1
  111. data/spec/minitest_helper.rb +1 -3
  112. data/tests/helpers/formats_helper.rb +8 -8
  113. data/tests/profitbricks/models/compute/compute_tests.rb +529 -0
  114. data/tests/profitbricks/requests/compute/composite_create_tests.rb +16 -83
  115. data/tests/profitbricks/requests/compute/flavor_tests.rb +1 -4
  116. data/tests/profitbricks/requests/compute/location_tests.rb +14 -17
  117. data/tests/profitbricks/requests/compute/nic_tests.rb +60 -70
  118. data/tests/profitbricks/requests/compute/request_tests.rb +1 -3
  119. data/tests/profitbricks/requests/compute/server_tests.rb +163 -161
  120. metadata +5 -18
@@ -42,22 +42,20 @@ module Fog
42
42
  # {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#get-image]
43
43
  def get_image(image_id)
44
44
  request(
45
- :expects => [200],
46
- :method => "GET",
47
- :path => "/images/#{image_id}?depth=5"
45
+ :expects => [200],
46
+ :method => "GET",
47
+ :path => "/images/#{image_id}?depth=5"
48
48
  )
49
- rescue => error
50
- Fog::Errors::NotFound.new(error)
51
49
  end
52
50
  end
53
51
 
54
52
  class Mock
55
53
  def get_image(image_id)
56
- if img = self.data[:images]["items"].find {
57
- |image| image["id"] == image_id
58
- }
54
+ if img = data[:images]["items"].find do |image|
55
+ image["id"] == image_id
56
+ end
59
57
  else
60
- raise Fog::Errors::NotFound.new("The requested resource could not be found")
58
+ raise Excon::Error::HTTPStatus, "The requested resource could not be found"
61
59
  end
62
60
 
63
61
  response = Excon::Response.new
@@ -29,22 +29,20 @@ module Fog
29
29
  # {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#get-ip-block]
30
30
  def get_ip_block(ip_block_id)
31
31
  request(
32
- :expects => [200],
33
- :method => "GET",
34
- :path => "/ipblocks/#{ip_block_id}?depth=5"
32
+ :expects => [200],
33
+ :method => "GET",
34
+ :path => "/ipblocks/#{ip_block_id}?depth=5"
35
35
  )
36
- rescue => error
37
- Fog::Errors::NotFound.new(error)
38
36
  end
39
37
  end
40
38
 
41
39
  class Mock
42
40
  def get_ip_block(ip_block_id)
43
- if ip_block = self.data[:ip_blocks]['items'].find {
44
- |ipb| ipb["id"] == ip_block_id
45
- }
41
+ if ip_block = data[:ip_blocks]['items'].find do |ipb|
42
+ ipb["id"] == ip_block_id
43
+ end
46
44
  else
47
- raise Fog::Errors::NotFound.new("The requested IP Block could not be found")
45
+ raise Fog::Errors::NotFound, "The requested IP Block could not be found"
48
46
  end
49
47
 
50
48
  response = Excon::Response.new
@@ -55,4 +53,4 @@ module Fog
55
53
  end
56
54
  end
57
55
  end
58
- end
56
+ end
@@ -90,23 +90,20 @@ module Fog
90
90
  # {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#get-lan]
91
91
  def get_lan(datacenter_id, lan_id)
92
92
  request(
93
- :expects => [200],
94
- :method => "GET",
95
- :path => "/datacenters/#{datacenter_id}/lans/#{lan_id}?depth=5"
93
+ :expects => [200],
94
+ :method => "GET",
95
+ :path => "/datacenters/#{datacenter_id}/lans/#{lan_id}?depth=5"
96
96
  )
97
- rescue => error
98
- puts error
99
- Fog::Errors::NotFound.new(error)
100
97
  end
101
98
  end
102
99
 
103
100
  class Mock
104
101
  def get_lan(datacenter_id, lan_id)
105
- if lan = self.data[:lans]['items'].find {
106
- |ln| ln["datacenter_id"] == datacenter_id && ln["id"] == lan_id
107
- }
102
+ if lan = data[:lans]['items'].find do |ln|
103
+ ln["datacenter_id"] == datacenter_id && ln["id"] == lan_id
104
+ end
108
105
  else
109
- raise Fog::Errors::NotFound.new("The requested lan could not be found")
106
+ raise Fog::Errors::NotFound, "The requested lan could not be found"
110
107
  end
111
108
 
112
109
  response = Excon::Response.new
@@ -68,25 +68,29 @@ module Fog
68
68
  # {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#get-load-balanced-nic]
69
69
  def get_load_balanced_nic(datacenter_id, load_balancer_id, nic_id)
70
70
  request(
71
- :expects => [200],
72
- :method => 'GET',
73
- :path => "/datacenters/#{datacenter_id}/loadbalancers/#{load_balancer_id}/balancednics/#{nic_id}?depth=5"
71
+ :expects => [200],
72
+ :method => 'GET',
73
+ :path => "/datacenters/#{datacenter_id}/loadbalancers/#{load_balancer_id}/balancednics/#{nic_id}?depth=5"
74
74
  )
75
- rescue => error
76
- Fog::Errors::NotFound.new(error)
77
75
  end
78
76
  end
79
77
 
80
78
  class Mock
81
- def get_load_balanced_nic(datacenter_id, load_balancer_id, nic_id)
82
- if load_balancer = self.data[:load_balancers]['items'].find {
83
- |lb| lb["datacenter_id"] == datacenter_id && lb["id"] == load_balancer_id
84
- }
79
+ def get_load_balanced_nic(datacenter_id, load_balancer_id, _nic_id)
80
+ if load_balancer = data[:load_balancers]['items'].find do |lb|
81
+ lb["datacenter_id"] == datacenter_id && lb["id"] == load_balancer_id
82
+ end
85
83
  else
86
- raise Fog::Errors::NotFound.new("The requested resource could not be found")
84
+ raise Fog::Errors::NotFound, "The requested resource could not be found"
87
85
  end
88
86
 
89
- load_balanced_nic = load_balancer['entities'][:balancednics][0]
87
+ load_balanced_nic = nil
88
+
89
+ load_balanced_nic = if load_balancer['entities']
90
+ load_balancer['entities']['balancednics']['items'][0]
91
+ else
92
+ load_balancer['balancednics']['items'][0]
93
+ end
90
94
 
91
95
  response = Excon::Response.new
92
96
  response.status = 200
@@ -96,4 +100,4 @@ module Fog
96
100
  end
97
101
  end
98
102
  end
99
- end
103
+ end
@@ -87,22 +87,20 @@ module Fog
87
87
  # {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#get-load-balancer]
88
88
  def get_load_balancer(datacenter_id, load_balancer_id)
89
89
  request(
90
- :expects => [200],
91
- :method => "GET",
92
- :path => "/datacenters/#{datacenter_id}/loadbalancers/#{load_balancer_id}?depth=5"
90
+ :expects => [200],
91
+ :method => "GET",
92
+ :path => "/datacenters/#{datacenter_id}/loadbalancers/#{load_balancer_id}?depth=5"
93
93
  )
94
- rescue => error
95
- Fog::Errors::NotFound.new(error)
96
94
  end
97
95
  end
98
96
 
99
97
  class Mock
100
98
  def get_load_balancer(datacenter_id, load_balancer_id)
101
- if load_balancer = self.data[:load_balancers]['items'].find {
102
- |lb| lb["datacenter_id"] == datacenter_id && lb["id"] == load_balancer_id
103
- }
99
+ if load_balancer = data[:load_balancers]['items'].find do |lb|
100
+ lb["datacenter_id"] == datacenter_id && lb["id"] == load_balancer_id
101
+ end
104
102
  else
105
- raise Fog::Errors::NotFound.new("The requested resource could not be found")
103
+ raise Fog::Errors::NotFound, "The requested resource could not be found"
106
104
  end
107
105
 
108
106
  response = Excon::Response.new
@@ -20,22 +20,20 @@ module Fog
20
20
  # {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#get-location]
21
21
  def get_location(location_id)
22
22
  request(
23
- :expects => [200],
24
- :method => 'GET',
25
- :path => "/locations/#{location_id}?depth=5"
23
+ :expects => [200],
24
+ :method => 'GET',
25
+ :path => "/locations/#{location_id}?depth=5"
26
26
  )
27
- rescue => error
28
- Fog::Errors::NotFound.new(error)
29
27
  end
30
28
  end
31
29
 
32
30
  class Mock
33
31
  def get_location(location_id)
34
- if loc = self.data[:locations]["items"].find {
35
- |location| location["id"] == location_id
36
- }
32
+ if loc = data[:locations]['items'].find do |lo|
33
+ lo["id"] == location_id
34
+ end
37
35
  else
38
- raise Fog::Errors::NotFound.new("The requested resource could not be found")
36
+ raise Excon::Error::HTTPStatus, "The requested resource could not be found"
39
37
  end
40
38
 
41
39
  response = Excon::Response.new
@@ -68,23 +68,20 @@ module Fog
68
68
  # {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#get-a-nic]
69
69
  def get_nic(datacenter_id, server_id, nic_id)
70
70
  request(
71
- :expects => [200],
72
- :method => "GET",
73
- :path => "/datacenters/#{datacenter_id}/servers/#{server_id}/nics/#{nic_id}?depth=5"
71
+ :expects => [200],
72
+ :method => "GET",
73
+ :path => "/datacenters/#{datacenter_id}/servers/#{server_id}/nics/#{nic_id}?depth=5"
74
74
  )
75
- rescue => error
76
- puts error
77
- Fog::Errors::NotFound.new(error)
78
75
  end
79
76
  end
80
77
 
81
78
  class Mock
82
- def get_nic(datacenter_id, server_id, nic_id)
83
- if nic = self.data[:nics]['items'].find {
84
- |nic| nic["id"] == nic_id
85
- }
79
+ def get_nic(_datacenter_id, _server_id, nic_id)
80
+ if nic = data[:nics]['items'].find do |nic|
81
+ nic["id"] == nic_id
82
+ end
86
83
  else
87
- raise Fog::Errors::NotFound.new("The requested resource could not be found")
84
+ raise Fog::Errors::NotFound, "The requested resource could not be found"
88
85
  end
89
86
 
90
87
  response = Excon::Response.new
@@ -1,61 +1,59 @@
1
1
  module Fog
2
- module Compute
3
- class ProfitBricks
4
- class Real
5
- # Retrieves the attributes of a specific request
6
- #
7
- # ==== Parameters
8
- # * request_id<~String> - The requests's unique identifier
9
- #
10
- # ==== Returns
11
- # * response<~Excon::Response>:
12
- # * body<~Hash>:
13
- # * id<~String> - The resource's unique identifier
14
- # * type<~String> - The type of the resource
15
- # * href<~String> - URL to the object’s representation (absolute path)
16
- # * metadata<~Hash> - A hash containing the resource's metadata
17
- # * createdDate<~String> - The date the resource was created
18
- # * createdBy<~String> - The user who created the resource
19
- # * etag<~String> - The etag for the resource
20
- # * requestStatus<~Hash> - A hash containing the request status data
21
- # * id<~String> - The resource's unique identifier
22
- # * type<~String> - The type of the resource
23
- # * href<~String> - URL to the object’s representation (absolute path)
24
- # * properties<~Hash> - A hash containing the resource's properties
25
- # * method<~String> - The HTTP method used
26
- # * headers<~Hash> - A hash containing the request headers
27
- # * connection<~String>
28
- # * host<~String>
29
- # * x-forwarded-for<~String>
30
- # * content-length<~String>
31
- # * x-reseller<~String>
32
- # * x-forwarded-host<~String>
33
- # * user-agent<~String>
34
- # * x-forwarded-server<~String>
35
- # * body<~String> - The body of the request
36
- # * url<~String> - The targeted URL of the request
37
- #
38
- # {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#get-request]
39
- def get_request(request_id)
40
- request(
41
- :expects => [200],
42
- :method => 'GET',
43
- :path => "/requests/#{request_id}"
44
- )
45
- rescue => error
46
- Fog::Errors::NotFound.new(error)
47
- end
48
- end
2
+ module Compute
3
+ class ProfitBricks
4
+ class Real
5
+ # Retrieves the attributes of a specific request
6
+ #
7
+ # ==== Parameters
8
+ # * request_id<~String> - The requests's unique identifier
9
+ #
10
+ # ==== Returns
11
+ # * response<~Excon::Response>:
12
+ # * body<~Hash>:
13
+ # * id<~String> - The resource's unique identifier
14
+ # * type<~String> - The type of the resource
15
+ # * href<~String> - URL to the object’s representation (absolute path)
16
+ # * metadata<~Hash> - A hash containing the resource's metadata
17
+ # * createdDate<~String> - The date the resource was created
18
+ # * createdBy<~String> - The user who created the resource
19
+ # * etag<~String> - The etag for the resource
20
+ # * requestStatus<~Hash> - A hash containing the request status data
21
+ # * id<~String> - The resource's unique identifier
22
+ # * type<~String> - The type of the resource
23
+ # * href<~String> - URL to the object’s representation (absolute path)
24
+ # * properties<~Hash> - A hash containing the resource's properties
25
+ # * method<~String> - The HTTP method used
26
+ # * headers<~Hash> - A hash containing the request headers
27
+ # * connection<~String>
28
+ # * host<~String>
29
+ # * x-forwarded-for<~String>
30
+ # * content-length<~String>
31
+ # * x-reseller<~String>
32
+ # * x-forwarded-host<~String>
33
+ # * user-agent<~String>
34
+ # * x-forwarded-server<~String>
35
+ # * body<~String> - The body of the request
36
+ # * url<~String> - The targeted URL of the request
37
+ #
38
+ # {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#get-request]
39
+ def get_request(request_id)
40
+ request(
41
+ :expects => [200],
42
+ :method => 'GET',
43
+ :path => "/requests/#{request_id}"
44
+ )
45
+ end
46
+ end
49
47
 
50
- class Mock
51
- def get_request(request_id)
52
- response = Excon::Response.new
53
- response.status = 200
54
- response.body = self.data[:requests]['items'][0]
48
+ class Mock
49
+ def get_request(_request_id)
50
+ response = Excon::Response.new
51
+ response.status = 200
52
+ response.body = data[:requests]['items'][0]
55
53
 
56
- response
57
- end
58
- end
59
- end
54
+ response
55
+ end
56
+ end
60
57
  end
61
- end
58
+ end
59
+ end
@@ -1,50 +1,48 @@
1
1
  module Fog
2
- module Compute
3
- class ProfitBricks
4
- class Real
5
- # Retrieves the status of the request
6
- #
7
- # ==== Parameters
8
- # * request_id<~String> - The requests's unique identifier
9
- #
10
- # ==== Returns
11
- # * response<~Excon::Response>:
12
- # * body<~Hash>:
13
- # * id<~String> - The resource's unique identifier
14
- # * type<~String> - The type of the resource
15
- # * href<~String> - URL to the object’s representation (absolute path)
16
- # * metadata<~Hash> - A hash containing the resource's metadata
17
- # * status<~String> - The status of the entire request, e.g. RUNNING
18
- # * message<~String> - The request message
19
- # * etag<~String> - The etag for the resource
20
- # * targets<~Array> - The request status targets represented as a collection
21
- # * target<~Hash> - A hash containing individual target attributes
22
- # * id<~String> - The resource's unique identifier
23
- # * type<~String> - The type of the resource
24
- # * href<~String> - URL to the object’s representation (absolute path)
25
- # * status<~String> - Status of individual items within the request, e.g. DONE
26
- #
27
- # {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#get-request-status]
28
- def get_request_status(request_id)
29
- request(
30
- :expects => [200],
31
- :method => 'GET',
32
- :path => "/requests/#{request_id}/status"
33
- )
34
- rescue => error
35
- Fog::Errors::NotFound.new(error)
36
- end
37
- end
2
+ module Compute
3
+ class ProfitBricks
4
+ class Real
5
+ # Retrieves the status of the request
6
+ #
7
+ # ==== Parameters
8
+ # * request_id<~String> - The requests's unique identifier
9
+ #
10
+ # ==== Returns
11
+ # * response<~Excon::Response>:
12
+ # * body<~Hash>:
13
+ # * id<~String> - The resource's unique identifier
14
+ # * type<~String> - The type of the resource
15
+ # * href<~String> - URL to the object’s representation (absolute path)
16
+ # * metadata<~Hash> - A hash containing the resource's metadata
17
+ # * status<~String> - The status of the entire request, e.g. RUNNING
18
+ # * message<~String> - The request message
19
+ # * etag<~String> - The etag for the resource
20
+ # * targets<~Array> - The request status targets represented as a collection
21
+ # * target<~Hash> - A hash containing individual target attributes
22
+ # * id<~String> - The resource's unique identifier
23
+ # * type<~String> - The type of the resource
24
+ # * href<~String> - URL to the object’s representation (absolute path)
25
+ # * status<~String> - Status of individual items within the request, e.g. DONE
26
+ #
27
+ # {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#get-request-status]
28
+ def get_request_status(request_id)
29
+ request(
30
+ :expects => [200],
31
+ :method => 'GET',
32
+ :path => "/requests/#{request_id}/status"
33
+ )
34
+ end
35
+ end
38
36
 
39
- class Mock
40
- def get_request_status(request_id)
41
- response = Excon::Response.new
42
- response.status = 200
43
- response.body = self.data[:request_status]
37
+ class Mock
38
+ def get_request_status(_request_id)
39
+ response = Excon::Response.new
40
+ response.status = 200
41
+ response.body = data[:request_status]
44
42
 
45
- response
46
- end
47
- end
48
- end
43
+ response
44
+ end
45
+ end
49
46
  end
50
- end
47
+ end
48
+ end