fog-oneandone 1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (174) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +36 -0
  3. data/CONTRIBUTING.md +276 -0
  4. data/CONTRIBUTORS.md +1 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE.md +20 -0
  7. data/README.md +317 -0
  8. data/bin/fog +78 -0
  9. data/examples/example_app.rb +80 -0
  10. data/fog-oneandone.gemspec +22 -0
  11. data/gemfiles/Gemfile-edge +7 -0
  12. data/lib/fog-oneandone.rb +10 -0
  13. data/lib/oneandone/compute.rb +713 -0
  14. data/lib/oneandone/core.rb +11 -0
  15. data/lib/oneandone/models/compute/firewall.rb +128 -0
  16. data/lib/oneandone/models/compute/firewalls.rb +24 -0
  17. data/lib/oneandone/models/compute/image.rb +72 -0
  18. data/lib/oneandone/models/compute/images.rb +24 -0
  19. data/lib/oneandone/models/compute/load_balancer.rb +149 -0
  20. data/lib/oneandone/models/compute/load_balancers.rb +24 -0
  21. data/lib/oneandone/models/compute/monitoring_policies.rb +24 -0
  22. data/lib/oneandone/models/compute/monitoring_policy.rb +196 -0
  23. data/lib/oneandone/models/compute/private_network.rb +105 -0
  24. data/lib/oneandone/models/compute/private_networks.rb +24 -0
  25. data/lib/oneandone/models/compute/public_ip.rb +68 -0
  26. data/lib/oneandone/models/compute/public_ips.rb +24 -0
  27. data/lib/oneandone/models/compute/server.rb +434 -0
  28. data/lib/oneandone/models/compute/servers.rb +24 -0
  29. data/lib/oneandone/models/compute/shared_storage.rb +101 -0
  30. data/lib/oneandone/models/compute/shared_storages.rb +24 -0
  31. data/lib/oneandone/models/compute/vpn.rb +70 -0
  32. data/lib/oneandone/models/compute/vpns.rb +24 -0
  33. data/lib/oneandone/requests/compute/access.rb +35 -0
  34. data/lib/oneandone/requests/compute/add_firewall.rb +70 -0
  35. data/lib/oneandone/requests/compute/add_firewall_ips.rb +67 -0
  36. data/lib/oneandone/requests/compute/add_firewall_rules.rb +68 -0
  37. data/lib/oneandone/requests/compute/add_hdds.rb +65 -0
  38. data/lib/oneandone/requests/compute/add_load_balancer.rb +76 -0
  39. data/lib/oneandone/requests/compute/add_load_balancer_ips.rb +67 -0
  40. data/lib/oneandone/requests/compute/add_load_balancer_rules.rb +68 -0
  41. data/lib/oneandone/requests/compute/add_mp_servers.rb +64 -0
  42. data/lib/oneandone/requests/compute/add_ports.rb +65 -0
  43. data/lib/oneandone/requests/compute/add_private_network.rb +65 -0
  44. data/lib/oneandone/requests/compute/add_private_network_servers.rb +67 -0
  45. data/lib/oneandone/requests/compute/add_processes.rb +65 -0
  46. data/lib/oneandone/requests/compute/add_server_ip.rb +72 -0
  47. data/lib/oneandone/requests/compute/add_shared_storage_servers.rb +64 -0
  48. data/lib/oneandone/requests/compute/change_password.rb +45 -0
  49. data/lib/oneandone/requests/compute/change_status.rb +69 -0
  50. data/lib/oneandone/requests/compute/clone_server.rb +67 -0
  51. data/lib/oneandone/requests/compute/create_firewall.rb +78 -0
  52. data/lib/oneandone/requests/compute/create_image.rb +101 -0
  53. data/lib/oneandone/requests/compute/create_load_balancer.rb +104 -0
  54. data/lib/oneandone/requests/compute/create_monitoring_policy.rb +93 -0
  55. data/lib/oneandone/requests/compute/create_private_network.rb +82 -0
  56. data/lib/oneandone/requests/compute/create_public_ip.rb +77 -0
  57. data/lib/oneandone/requests/compute/create_server.rb +139 -0
  58. data/lib/oneandone/requests/compute/create_shared_storage.rb +83 -0
  59. data/lib/oneandone/requests/compute/create_snapshot.rb +51 -0
  60. data/lib/oneandone/requests/compute/create_vpn.rb +80 -0
  61. data/lib/oneandone/requests/compute/delete_firewall.rb +51 -0
  62. data/lib/oneandone/requests/compute/delete_firewall_rule.rb +60 -0
  63. data/lib/oneandone/requests/compute/delete_hdd.rb +61 -0
  64. data/lib/oneandone/requests/compute/delete_image.rb +51 -0
  65. data/lib/oneandone/requests/compute/delete_load_balancer.rb +51 -0
  66. data/lib/oneandone/requests/compute/delete_load_balancer_rule.rb +60 -0
  67. data/lib/oneandone/requests/compute/delete_monitoring_policy.rb +51 -0
  68. data/lib/oneandone/requests/compute/delete_port.rb +60 -0
  69. data/lib/oneandone/requests/compute/delete_private_network.rb +51 -0
  70. data/lib/oneandone/requests/compute/delete_process.rb +60 -0
  71. data/lib/oneandone/requests/compute/delete_public_ip.rb +51 -0
  72. data/lib/oneandone/requests/compute/delete_server.rb +51 -0
  73. data/lib/oneandone/requests/compute/delete_server_ip.rb +60 -0
  74. data/lib/oneandone/requests/compute/delete_shared_storage.rb +51 -0
  75. data/lib/oneandone/requests/compute/delete_snapshot.rb +51 -0
  76. data/lib/oneandone/requests/compute/delete_vpn.rb +51 -0
  77. data/lib/oneandone/requests/compute/eject_dvd.rb +51 -0
  78. data/lib/oneandone/requests/compute/get_datacenter.rb +50 -0
  79. data/lib/oneandone/requests/compute/get_dvd.rb +50 -0
  80. data/lib/oneandone/requests/compute/get_dvd_iso.rb +50 -0
  81. data/lib/oneandone/requests/compute/get_firewall.rb +50 -0
  82. data/lib/oneandone/requests/compute/get_firewall_ip.rb +59 -0
  83. data/lib/oneandone/requests/compute/get_firewall_rule.rb +59 -0
  84. data/lib/oneandone/requests/compute/get_fixed_server.rb +50 -0
  85. data/lib/oneandone/requests/compute/get_hardware.rb +50 -0
  86. data/lib/oneandone/requests/compute/get_hdd.rb +60 -0
  87. data/lib/oneandone/requests/compute/get_hdds.rb +50 -0
  88. data/lib/oneandone/requests/compute/get_image.rb +50 -0
  89. data/lib/oneandone/requests/compute/get_load_balancer.rb +50 -0
  90. data/lib/oneandone/requests/compute/get_load_balancer_ip.rb +59 -0
  91. data/lib/oneandone/requests/compute/get_load_balancer_rule.rb +59 -0
  92. data/lib/oneandone/requests/compute/get_log.rb +51 -0
  93. data/lib/oneandone/requests/compute/get_monitored_server.rb +49 -0
  94. data/lib/oneandone/requests/compute/get_monitoring_policy.rb +50 -0
  95. data/lib/oneandone/requests/compute/get_mp_server.rb +59 -0
  96. data/lib/oneandone/requests/compute/get_port.rb +59 -0
  97. data/lib/oneandone/requests/compute/get_private_network.rb +50 -0
  98. data/lib/oneandone/requests/compute/get_private_network_server.rb +59 -0
  99. data/lib/oneandone/requests/compute/get_process.rb +59 -0
  100. data/lib/oneandone/requests/compute/get_public_ip.rb +50 -0
  101. data/lib/oneandone/requests/compute/get_server.rb +50 -0
  102. data/lib/oneandone/requests/compute/get_server_appliance.rb +50 -0
  103. data/lib/oneandone/requests/compute/get_server_image.rb +50 -0
  104. data/lib/oneandone/requests/compute/get_server_ip.rb +59 -0
  105. data/lib/oneandone/requests/compute/get_server_private_network.rb +59 -0
  106. data/lib/oneandone/requests/compute/get_shared_storage.rb +50 -0
  107. data/lib/oneandone/requests/compute/get_shared_storage_server.rb +59 -0
  108. data/lib/oneandone/requests/compute/get_snapshot.rb +50 -0
  109. data/lib/oneandone/requests/compute/get_vpn.rb +50 -0
  110. data/lib/oneandone/requests/compute/install_server_image.rb +72 -0
  111. data/lib/oneandone/requests/compute/list_datacenters.rb +56 -0
  112. data/lib/oneandone/requests/compute/list_dvds.rb +56 -0
  113. data/lib/oneandone/requests/compute/list_firewall_ips.rb +50 -0
  114. data/lib/oneandone/requests/compute/list_firewall_rules.rb +50 -0
  115. data/lib/oneandone/requests/compute/list_firewalls.rb +56 -0
  116. data/lib/oneandone/requests/compute/list_fixed_servers.rb +40 -0
  117. data/lib/oneandone/requests/compute/list_images.rb +56 -0
  118. data/lib/oneandone/requests/compute/list_ip_firewalls.rb +59 -0
  119. data/lib/oneandone/requests/compute/list_ip_load_balancers.rb +59 -0
  120. data/lib/oneandone/requests/compute/list_load_balancer_ips.rb +50 -0
  121. data/lib/oneandone/requests/compute/list_load_balancer_rules.rb +50 -0
  122. data/lib/oneandone/requests/compute/list_load_balancers.rb +56 -0
  123. data/lib/oneandone/requests/compute/list_logs.rb +59 -0
  124. data/lib/oneandone/requests/compute/list_monitored_servers.rb +51 -0
  125. data/lib/oneandone/requests/compute/list_monitoring_policies.rb +56 -0
  126. data/lib/oneandone/requests/compute/list_mp_servers.rb +50 -0
  127. data/lib/oneandone/requests/compute/list_ports.rb +51 -0
  128. data/lib/oneandone/requests/compute/list_private_network_servers.rb +50 -0
  129. data/lib/oneandone/requests/compute/list_private_networks.rb +56 -0
  130. data/lib/oneandone/requests/compute/list_processes.rb +51 -0
  131. data/lib/oneandone/requests/compute/list_public_ips.rb +56 -0
  132. data/lib/oneandone/requests/compute/list_server_appliances.rb +56 -0
  133. data/lib/oneandone/requests/compute/list_server_ips.rb +50 -0
  134. data/lib/oneandone/requests/compute/list_server_private_networks.rb +50 -0
  135. data/lib/oneandone/requests/compute/list_servers.rb +56 -0
  136. data/lib/oneandone/requests/compute/list_shared_storage_servers.rb +50 -0
  137. data/lib/oneandone/requests/compute/list_shared_storages.rb +56 -0
  138. data/lib/oneandone/requests/compute/list_usages.rb +54 -0
  139. data/lib/oneandone/requests/compute/list_vpns.rb +56 -0
  140. data/lib/oneandone/requests/compute/load_dvd.rb +65 -0
  141. data/lib/oneandone/requests/compute/ping.rb +38 -0
  142. data/lib/oneandone/requests/compute/ping_auth.rb +38 -0
  143. data/lib/oneandone/requests/compute/remove_firewall.rb +60 -0
  144. data/lib/oneandone/requests/compute/remove_firewall_ip.rb +60 -0
  145. data/lib/oneandone/requests/compute/remove_load_balancer.rb +71 -0
  146. data/lib/oneandone/requests/compute/remove_load_balancer_ip.rb +60 -0
  147. data/lib/oneandone/requests/compute/remove_mp_server.rb +60 -0
  148. data/lib/oneandone/requests/compute/remove_private_network.rb +60 -0
  149. data/lib/oneandone/requests/compute/remove_private_network_server.rb +60 -0
  150. data/lib/oneandone/requests/compute/remove_shared_storage_server.rb +60 -0
  151. data/lib/oneandone/requests/compute/restore_snapshot.rb +35 -0
  152. data/lib/oneandone/requests/compute/status.rb +50 -0
  153. data/lib/oneandone/requests/compute/update_firewall.rb +76 -0
  154. data/lib/oneandone/requests/compute/update_hardware.rb +82 -0
  155. data/lib/oneandone/requests/compute/update_hdd.rb +71 -0
  156. data/lib/oneandone/requests/compute/update_image.rb +80 -0
  157. data/lib/oneandone/requests/compute/update_load_balancer.rb +96 -0
  158. data/lib/oneandone/requests/compute/update_monitoring_policy.rb +82 -0
  159. data/lib/oneandone/requests/compute/update_port.rb +74 -0
  160. data/lib/oneandone/requests/compute/update_private_network.rb +82 -0
  161. data/lib/oneandone/requests/compute/update_process.rb +76 -0
  162. data/lib/oneandone/requests/compute/update_public_ip.rb +71 -0
  163. data/lib/oneandone/requests/compute/update_server.rb +76 -0
  164. data/lib/oneandone/requests/compute/update_shared_storage.rb +80 -0
  165. data/lib/oneandone/requests/compute/update_vpn.rb +76 -0
  166. data/tests/oneandone/test_firewalls.rb +188 -0
  167. data/tests/oneandone/test_images.rb +79 -0
  168. data/tests/oneandone/test_load_balancers.rb +192 -0
  169. data/tests/oneandone/test_monitoring_policies.rb +342 -0
  170. data/tests/oneandone/test_private_networks.rb +123 -0
  171. data/tests/oneandone/test_public_ips.rb +75 -0
  172. data/tests/oneandone/test_servers.rb +465 -0
  173. data/tests/oneandone/test_shared_storages.rb +131 -0
  174. metadata +259 -0
@@ -0,0 +1,713 @@
1
+ module Fog
2
+ module Compute
3
+ class OneAndOne < Fog::Service
4
+
5
+ # Globals
6
+ SUCCESS_CODES = [200, 201, 202]
7
+
8
+ # Required Initialization Parameters
9
+ requires :oneandone_api_key
10
+
11
+ # Models
12
+ model_path 'oneandone/models/compute'
13
+
14
+ model :server
15
+ collection :servers
16
+
17
+ model :image
18
+ collection :images
19
+
20
+ model :shared_storage
21
+ collection :shared_storages
22
+
23
+ model :firewall
24
+ collection :firewalls
25
+
26
+ model :load_balancer
27
+ collection :load_balancers
28
+
29
+ model :public_ip
30
+ collection :public_ips
31
+
32
+ model :private_network
33
+ collection :private_networks
34
+
35
+ model :monitoring_policy
36
+ collection :monitoring_policies
37
+
38
+ model :vpn
39
+ collection :vpns
40
+
41
+ # Requests
42
+ request_path 'oneandone/requests/compute'
43
+
44
+ request :list_servers
45
+ request :get_server
46
+ request :create_server
47
+ request :update_server
48
+ request :delete_server
49
+
50
+ request :list_fixed_servers
51
+ request :get_fixed_server
52
+
53
+ request :get_hardware
54
+ request :update_hardware
55
+
56
+ request :get_hdds
57
+ request :add_hdds
58
+ request :get_hdd
59
+ request :update_hdd
60
+ request :delete_hdd
61
+
62
+ request :get_server_image
63
+ request :install_server_image
64
+
65
+ request :list_server_ips
66
+ request :add_server_ip
67
+ request :get_server_ip
68
+ request :delete_server_ip
69
+
70
+ request :list_ip_firewalls
71
+ request :add_firewall
72
+ request :remove_firewall
73
+
74
+ request :list_ip_load_balancers
75
+ request :add_load_balancer
76
+ request :remove_load_balancer
77
+
78
+ request :status
79
+ request :change_status
80
+
81
+ request :get_dvd
82
+ request :eject_dvd
83
+ request :load_dvd
84
+
85
+ request :list_server_private_networks
86
+ request :get_server_private_network
87
+ request :remove_private_network
88
+ request :add_private_network
89
+
90
+ request :create_snapshot
91
+ request :get_snapshot
92
+ request :restore_snapshot
93
+ request :delete_snapshot
94
+
95
+ request :clone_server
96
+
97
+
98
+ request :list_images
99
+ request :create_image
100
+ request :get_image
101
+ request :update_image
102
+ request :delete_image
103
+
104
+
105
+ request :list_shared_storages
106
+ request :create_shared_storage
107
+ request :get_shared_storage
108
+ request :update_shared_storage
109
+ request :delete_shared_storage
110
+
111
+ request :list_shared_storage_servers
112
+ request :get_shared_storage_server
113
+ request :add_shared_storage_servers
114
+ request :remove_shared_storage_server
115
+
116
+ request :access
117
+ request :change_password
118
+
119
+
120
+ request :list_firewalls
121
+ request :get_firewall
122
+ request :create_firewall
123
+ request :update_firewall
124
+ request :delete_firewall
125
+
126
+ request :list_firewall_ips
127
+ request :get_firewall_ip
128
+ request :remove_firewall_ip
129
+ request :add_firewall_ips
130
+
131
+ request :list_firewall_rules
132
+ request :get_firewall_rule
133
+ request :add_firewall_rules
134
+ request :delete_firewall_rule
135
+
136
+
137
+ request :list_load_balancers
138
+ request :create_load_balancer
139
+ request :get_load_balancer
140
+ request :update_load_balancer
141
+ request :delete_load_balancer
142
+
143
+ request :list_load_balancer_ips
144
+ request :get_load_balancer_ip
145
+ request :remove_load_balancer_ip
146
+ request :add_load_balancer_ips
147
+
148
+ request :list_load_balancer_rules
149
+ request :add_load_balancer_rules
150
+ request :get_load_balancer_rule
151
+ request :delete_load_balancer_rule
152
+
153
+
154
+ request :list_public_ips
155
+ request :create_public_ip
156
+ request :get_public_ip
157
+ request :update_public_ip
158
+ request :delete_public_ip
159
+
160
+
161
+ request :list_private_networks
162
+ request :create_private_network
163
+ request :get_private_network
164
+ request :update_private_network
165
+ request :delete_private_network
166
+
167
+ request :list_private_network_servers
168
+ request :get_private_network_server
169
+ request :remove_private_network_server
170
+ request :add_private_network_servers
171
+
172
+
173
+ request :list_monitored_servers
174
+ request :get_monitored_server
175
+
176
+
177
+ request :list_monitoring_policies
178
+ request :get_monitoring_policy
179
+ request :create_monitoring_policy
180
+ request :update_monitoring_policy
181
+ request :delete_monitoring_policy
182
+
183
+ request :list_ports
184
+ request :add_ports
185
+ request :get_port
186
+ request :update_port
187
+ request :delete_port
188
+
189
+ request :list_processes
190
+ request :add_processes
191
+ request :get_process
192
+ request :update_process
193
+ request :delete_process
194
+
195
+ request :list_mp_servers
196
+ request :get_mp_server
197
+ request :remove_mp_server
198
+ request :add_mp_servers
199
+
200
+
201
+ request :list_logs
202
+ request :get_log
203
+
204
+
205
+ request :list_usages
206
+
207
+
208
+ request :list_server_appliances
209
+ request :get_server_appliance
210
+
211
+
212
+ request :list_dvds
213
+ request :get_dvd_iso
214
+
215
+
216
+ request :list_vpns
217
+ request :create_vpn
218
+ request :get_vpn
219
+ request :update_vpn
220
+ request :delete_vpn
221
+
222
+
223
+ request :ping
224
+ request :ping_auth
225
+
226
+
227
+ request :list_datacenters
228
+ request :get_datacenter
229
+
230
+ class Real
231
+
232
+ def initialize(options = {})
233
+
234
+ @oneandone_api_key = options[:oneandone_api_key]
235
+ @base_url = 'https://cloudpanel-api.1and1.com'
236
+ @version = '/v1'
237
+ @header = {
238
+ 'X-TOKEN' => @oneandone_api_key,
239
+ 'Content-Type' => 'application/json'
240
+ }
241
+ @connection = Fog::Core::Connection.new(@base_url)
242
+
243
+ end
244
+
245
+ def request(params)
246
+
247
+ # Perform Request
248
+ response = @connection.request(:method => params['method'],
249
+ :path => @version + params['endpoint'],
250
+ :headers => @header,
251
+ :body => params['body'],
252
+ :query => params['params'])
253
+
254
+ # Parse body
255
+ response.body = Fog::JSON.decode(response.body)
256
+
257
+ # Check for server error
258
+ if response.status == 500
259
+ raise "Internal Server Error. Please try again."
260
+ end
261
+
262
+ # Raise exception if a bad status code is returned
263
+ unless SUCCESS_CODES.include? response.status
264
+ raise response.body
265
+ end
266
+
267
+ response
268
+
269
+ end
270
+
271
+ def clean_hash(hash)
272
+
273
+ # Clear Out null Values
274
+ hash.each do |key, value|
275
+ if value == nil
276
+ hash.delete(key)
277
+ end
278
+ end
279
+
280
+ end
281
+
282
+ end # Real
283
+
284
+ class Mock
285
+
286
+ def self.data
287
+
288
+ @data ||= Hash.new do |hash, key|
289
+ hash[key] = {
290
+ :servers => [],
291
+ :images => [],
292
+ :shared_storages => [],
293
+ :firewalls => [],
294
+ :load_balancers => [],
295
+ :public_ips => [],
296
+ :private_networks => [],
297
+ :monitoring_policies => [],
298
+ :vpns => [],
299
+ :datacenters => [
300
+ {
301
+ "id" => "81DEF28500FBC2A973FC0C620DF5B721",
302
+ "location" => "Spain",
303
+ "country_code" => "ES"
304
+ },
305
+ {
306
+ "id" => "908DC2072407C94C8054610AD5A53B8C",
307
+ "location" => "United States of America",
308
+ "country_code" => "US"
309
+ },
310
+ {
311
+ "id" => "4EFAD5836CE43ACA502FD5B99BEE44EF",
312
+ "location" => "Germany",
313
+ "country_code" => "DE"
314
+ },
315
+ {
316
+ "id" => "5091F6D8CBFEF9C26ACE957C652D5D49",
317
+ "location" => "United Kingdom of Great Britain and Northern Ireland",
318
+ "country_code" => "GB"
319
+ }
320
+ ],
321
+ :fixed_servers => [
322
+ {
323
+ "name" => "M",
324
+ "id" => "8C626C1A7005D0D1F527143C413D461E",
325
+ "hardware" => {
326
+ "vcore" => 1,
327
+ "cores_per_processor" => 1,
328
+ "ram" => 1,
329
+ "unit" => "GB",
330
+ "hdds" => [
331
+ {
332
+ "size" => 40,
333
+ "unit" => "GB",
334
+ "is_main" => true
335
+ }
336
+ ]
337
+ }
338
+ },
339
+ {
340
+ "name" => "L",
341
+ "id" => "8C626C1A7005D0D1F527143C413D461F",
342
+ "hardware" => {
343
+ "vcore" => 2,
344
+ "cores_per_processor" => 1,
345
+ "ram" => 2,
346
+ "unit" => "GB",
347
+ "hdds" => [
348
+ {
349
+ "size" => 80,
350
+ "unit" => "GiB",
351
+ "is_main" => true
352
+ }
353
+ ]
354
+ }
355
+ },
356
+ {
357
+ "name" => "XL",
358
+ "id" => "8C626C1A7005D0D1F527143C413D4620",
359
+ "hardware" => {
360
+ "vcore" => 2,
361
+ "cores_per_processor" => 1,
362
+ "ram" => 4,
363
+ "unit" => "GB",
364
+ "hdds" => [
365
+ {
366
+ "size" => 120,
367
+ "unit" => "GB",
368
+ "is_main" => true
369
+ }
370
+ ]
371
+ }
372
+ },
373
+ {
374
+ "name" => "XXL",
375
+ "id" => "8C626C1A7005D0D1F527143C413D4621",
376
+ "hardware" => {
377
+ "vcore" => 4,
378
+ "cores_per_processor" => 1,
379
+ "ram" => 8,
380
+ "unit" => "GB",
381
+ "hdds" => [
382
+ {
383
+ "size" => 160,
384
+ "unit" => "GiB",
385
+ "is_main" => true
386
+ }
387
+ ]
388
+ }
389
+ }
390
+ ],
391
+ :logs => [
392
+ {
393
+ "id" => "E485755233541090E369E957EA2499D7",
394
+ "start_date" => "2015-04-06T23:46:38Z",
395
+ "end_date" => "2015-04-06T23:48:52Z",
396
+ "duration" => 72,
397
+ "status" => {
398
+ "state" => "COMPLETED",
399
+ "percent" => 100
400
+ },
401
+ "action" => "DELETE",
402
+ "type" => "MONITORINGPOLICY",
403
+ "resource" => {
404
+ "id" => "E485755233541090E6546957EA2499D7",
405
+ "name" => "My Monitoring Policy 1"
406
+ },
407
+ "details" => {
408
+
409
+ },
410
+ "user" => {
411
+ "id" => "7C88E50FBC500A3D9D7F94E414255D6B",
412
+ "name" => "034b011e.user"
413
+ },
414
+ "cloudpanel_id" => "ap99AA4_1"
415
+ },
416
+ {
417
+ "id" => "E485755233541090E369E957EA2499D8",
418
+ "start_date" => "2015-04-06T23:51:00Z",
419
+ "end_date" => "2015-04-06T23:51:29Z",
420
+ "duration" => 29,
421
+ "status" => {
422
+ "state" => "COMPLETED",
423
+ "percent" => 100
424
+ },
425
+ "action" => "CREATE",
426
+ "type" => "MONITORINGPOLICY",
427
+ "resource" => {
428
+ "id" => "E485755233541090E6546957EA2499D7",
429
+ "name" => "My Monitoring Policy test"
430
+ },
431
+ "details" => {
432
+
433
+ },
434
+ "user" => {
435
+ "id" => "7C88E50FBC500A3D9D7F94E414255D6B",
436
+ "name" => "034b011e.user"
437
+ }
438
+ }
439
+ ],
440
+ :server_appliances => [
441
+ {
442
+ "id" => "55726DEDA20C99CF6F2AF8F18CAC9963",
443
+ "name" => "w2012r2datacenter64iso",
444
+ "available_datacenters" => [
445
+ "DA41201B4A006EDE6DA62A5A62A658E7",
446
+ "47FA5A2D251AE57935E30F9D5AB4F817",
447
+ "7C5FA1D21B98DE39D7516333AAB7DA54"
448
+ ],
449
+ "os_installation_base" => "ISO_OS",
450
+ "os_family" => "Windows",
451
+ "os" => "WindowsDatacenter",
452
+ "os_version" => "Windows2012R2",
453
+ "min_hdd_size" => 40,
454
+ "os_architecture" => 64,
455
+ "licenses" => nil,
456
+ "type" => "ISO",
457
+ "version" => nil,
458
+ "categories" => [],
459
+ "eula_url" => nil
460
+ },
461
+ {
462
+ "id" => "81504C620D98BCEBAA5202D145203B4C",
463
+ "name" => "Windows 2008R2 - 64 bits (Standard) + SQL Server 2012 (Standard)",
464
+ "available_datacenters" => [
465
+ "DA41201B4A006EDE6DA62A5A62A658E7",
466
+ "47FA5A2D251AE57935E30F9D5AB4F817",
467
+ "7C5FA1D21B98DE39D7516333AAB7DA54"
468
+ ],
469
+ "os_installation_base" => "Standard",
470
+ "os_family" => "Windows",
471
+ "os" => "Windows",
472
+ "os_version" => "Windows 2008R2",
473
+ "min_hdd_size" => 40,
474
+ "os_architecture" => 64,
475
+ "licenses" =>[
476
+ "Windows",
477
+ "SQL Server"
478
+ ],
479
+ "type" => "IMAGE",
480
+ "version" => nil,
481
+ "categories" => [],
482
+ "eula_url" => nil
483
+ }
484
+ ],
485
+ :dvd_isos => [
486
+ {
487
+ "id" => "55726DEDA20C99CF6F2AF8F18CAC9963",
488
+ "name" => "w2012r2datacenter64iso",
489
+ "available_datacenters" => [
490
+ "DA41201B4A006EDE6DA62A5A62A658E7",
491
+ "47FA5A2D251AE57935E30F9D5AB4F817",
492
+ "7C5FA1D21B98DE39D7516333AAB7DA54"
493
+ ],
494
+ "os_family" => "Windows",
495
+ "os" => "WindowsDatacenter",
496
+ "os_version" => "Windows2012R2",
497
+ "os_architecture" => 64,
498
+ "type" => "OS"
499
+ },
500
+ {
501
+ "id" => "B675B070A3BB5C8D71B2129952F04BC8",
502
+ "name" => "ubuntu1404-64iso",
503
+ "available_datacenters" => [
504
+ "DA41201B4A006EDE6DA62A5A62A658E7",
505
+ "47FA5A2D251AE57935E30F9D5AB4F817",
506
+ "7C5FA1D21B98DE39D7516333AAB7DA54"
507
+ ],
508
+ "os_family" => "Linux",
509
+ "os" => "Ubuntu",
510
+ "os_version" => "Ubuntu14.04",
511
+ "os_architecture" => 64,
512
+ "type" => "OS"
513
+ },
514
+ {
515
+ "id" => "F9DCFAF16B4929D9F9AE6B24B125EC17",
516
+ "name" => "centos6-32iso",
517
+ "available_datacenters" => [
518
+ "DA41201B4A006EDE6DA62A5A62A658E7",
519
+ "47FA5A2D251AE57935E30F9D5AB4F817",
520
+ "7C5FA1D21B98DE39D7516333AAB7DA54"
521
+ ],
522
+ "os_family" => "Linux",
523
+ "os" => "Centos",
524
+ "os_version" => "Centos6",
525
+ "os_architecture" => 32,
526
+ "type" => "OS"
527
+ },
528
+ {
529
+ "id" => "3E04654E0DA19EE6A3699272D4114AFA",
530
+ "name" => "centos6-64iso",
531
+ "available_datacenters" => [
532
+ "DA41201B4A006EDE6DA62A5A62A658E7",
533
+ "47FA5A2D251AE57935E30F9D5AB4F817",
534
+ "7C5FA1D21B98DE39D7516333AAB7DA54"
535
+ ],
536
+ "os_family" => "Linux",
537
+ "os" => "Centos",
538
+ "os_version" => "Centos6",
539
+ "os_architecture" => 64,
540
+ "type" => "OS"
541
+ },
542
+ {
543
+ "id" => "8F8CBE2DAB9FF6F0F9A4D846E82DD651",
544
+ "name" => "rhel6-64iso",
545
+ "available_datacenters" => [
546
+ "DA41201B4A006EDE6DA62A5A62A658E7",
547
+ "47FA5A2D251AE57935E30F9D5AB4F817",
548
+ "7C5FA1D21B98DE39D7516333AAB7DA54"
549
+ ],
550
+ "os_family" => "Linux",
551
+ "os" => "RedHat",
552
+ "os_version" => "RedHat6",
553
+ "os_architecture" => 64,
554
+ "type" => "OS"
555
+ },
556
+ {
557
+ "id" => "B62716F09C314B46D6782EA385E27206",
558
+ "name" => "centos7-64iso",
559
+ "available_datacenters" => [
560
+ "DA41201B4A006EDE6DA62A5A62A658E7",
561
+ "47FA5A2D251AE57935E30F9D5AB4F817",
562
+ "7C5FA1D21B98DE39D7516333AAB7DA54"
563
+ ],
564
+ "os_family" => "Linux",
565
+ "os" => "Centos",
566
+ "os_version" => "Centos7",
567
+ "os_architecture" => 64,
568
+ "type" => "OS"
569
+ },
570
+ {
571
+ "id" => "AE54D0EE48B1F6E59021FAA63988274B",
572
+ "name" => "debian6-64iso",
573
+ "available_datacenters" => [
574
+ "DA41201B4A006EDE6DA62A5A62A658E7",
575
+ "47FA5A2D251AE57935E30F9D5AB4F817",
576
+ "7C5FA1D21B98DE39D7516333AAB7DA54"
577
+ ],
578
+ "os_family" => "Linux",
579
+ "os" => "Debian",
580
+ "os_version" => "Debian6",
581
+ "os_architecture" => 64,
582
+ "type" => "OS"
583
+ },
584
+ {
585
+ "id" => "AA70C76B77BC6132117DCA202D34A5A4",
586
+ "name" => "debian6-32iso",
587
+ "available_datacenters" => [
588
+ "DA41201B4A006EDE6DA62A5A62A658E7",
589
+ "47FA5A2D251AE57935E30F9D5AB4F817",
590
+ "7C5FA1D21B98DE39D7516333AAB7DA54"
591
+ ],
592
+ "os_family" => "Linux",
593
+ "os" => "Debian",
594
+ "os_version" => "Debian6",
595
+ "os_architecture" => 32,
596
+ "type" => "OS"
597
+ },
598
+ {
599
+ "id" => "4001EE28F2E195BD4D2D44844FAC9591",
600
+ "name" => "debian7-64iso",
601
+ "available_datacenters" => [
602
+ "DA41201B4A006EDE6DA62A5A62A658E7",
603
+ "47FA5A2D251AE57935E30F9D5AB4F817",
604
+ "7C5FA1D21B98DE39D7516333AAB7DA54"
605
+ ],
606
+ "os_family" => "Linux",
607
+ "os" => "Debian",
608
+ "os_version" => "Debian7",
609
+ "os_architecture" => 64,
610
+ "type" => "OS"
611
+ },
612
+ {
613
+ "id" => "B1A2D93BE081873BF127C9B9200849D8",
614
+ "name" => "debian7-32iso",
615
+ "available_datacenters" => [
616
+ "DA41201B4A006EDE6DA62A5A62A658E7",
617
+ "47FA5A2D251AE57935E30F9D5AB4F817",
618
+ "7C5FA1D21B98DE39D7516333AAB7DA54"
619
+ ],
620
+ "os_family" => "Linux",
621
+ "os" => "Debian",
622
+ "os_version" => "Debian7",
623
+ "os_architecture" => 32,
624
+ "type" => "OS"
625
+ },
626
+ {
627
+ "id" => "DC0886301FA0BFDD8BA21F3E9FDFC012",
628
+ "name" => "freebsd10-64iso",
629
+ "available_datacenters" => [
630
+ "DA41201B4A006EDE6DA62A5A62A658E7",
631
+ "47FA5A2D251AE57935E30F9D5AB4F817",
632
+ "7C5FA1D21B98DE39D7516333AAB7DA54"
633
+ ],
634
+ "os_family" => "Linux",
635
+ "os" => "FreeBSD",
636
+ "os_version" => "FreeBSD10",
637
+ "os_architecture" => 64,
638
+ "type" => "OS"
639
+ },
640
+ {
641
+ "id" => "369A148192AAD04C83FEC050F9072C76",
642
+ "name" => "freebsd10-32iso",
643
+ "available_datacenters" => [
644
+ "DA41201B4A006EDE6DA62A5A62A658E7",
645
+ "47FA5A2D251AE57935E30F9D5AB4F817",
646
+ "7C5FA1D21B98DE39D7516333AAB7DA54"
647
+ ],
648
+ "os_family" => "Linux",
649
+ "os" => "FreeBSD",
650
+ "os_version" => "FreeBSD10",
651
+ "os_architecture" => 32,
652
+ "type" => "OS"
653
+ },
654
+ {
655
+ "id" => "9F3A97E35D7C182EE7B871B7FBFEBBDC",
656
+ "name" => "rhel7-64iso",
657
+ "available_datacenters" => [
658
+ "DA41201B4A006EDE6DA62A5A62A658E7",
659
+ "47FA5A2D251AE57935E30F9D5AB4F817",
660
+ "7C5FA1D21B98DE39D7516333AAB7DA54"
661
+ ],
662
+ "os_family" => "Linux",
663
+ "os" => "RedHat",
664
+ "os_version" => "RedHat7",
665
+ "os_architecture" => 64,
666
+ "type" => "OS"
667
+ },
668
+ {
669
+ "id" => "FEF6DB2420612426911F2F9CA9E25755",
670
+ "name" => "w2008r2datacenter64iso",
671
+ "available_datacenters" => [
672
+ "DA41201B4A006EDE6DA62A5A62A658E7",
673
+ "47FA5A2D251AE57935E30F9D5AB4F817",
674
+ "7C5FA1D21B98DE39D7516333AAB7DA54"
675
+ ],
676
+ "os_family" => "Windows",
677
+ "os" => "WindowsDatacenter",
678
+ "os_version" => "Windows2008R2",
679
+ "os_architecture" => 64,
680
+ "type" => "OS"
681
+ }
682
+ ]
683
+ }
684
+ end
685
+
686
+ end
687
+
688
+
689
+ def initialize(options={})
690
+
691
+ @oneandone_api_key = options[:oneandone_api_key]
692
+
693
+ end
694
+
695
+
696
+ def data
697
+
698
+ self.class.data[@oneandone_api_key]
699
+
700
+ end
701
+
702
+
703
+ def reset_data
704
+
705
+ self.class.data.delete(@oneandone_api_key)
706
+
707
+ end
708
+
709
+ end # Mock
710
+
711
+ end # OneAndOne
712
+ end # Compute
713
+ end # Fog