fog-google 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/README.md +7 -3
  4. data/examples/pubsub/subscriptions.rb +54 -0
  5. data/examples/pubsub/topics.rb +33 -0
  6. data/fog-google.gemspec +2 -2
  7. data/lib/fog/compute/google.rb +4 -884
  8. data/lib/fog/compute/google/mock.rb +871 -0
  9. data/lib/fog/compute/google/real.rb +22 -0
  10. data/lib/fog/dns/google.rb +3 -42
  11. data/lib/fog/dns/google/mock.rb +33 -0
  12. data/lib/fog/dns/google/real.rb +19 -0
  13. data/lib/fog/google.rb +14 -208
  14. data/lib/fog/google/mock.rb +14 -0
  15. data/lib/fog/google/models/pubsub/received_message.rb +40 -0
  16. data/lib/fog/google/models/pubsub/subscription.rb +86 -0
  17. data/lib/fog/google/models/pubsub/subscriptions.rb +32 -0
  18. data/lib/fog/google/models/pubsub/topic.rb +72 -0
  19. data/lib/fog/google/models/pubsub/topics.rb +31 -0
  20. data/lib/fog/google/monitoring.rb +3 -45
  21. data/lib/fog/google/monitoring/mock.rb +35 -0
  22. data/lib/fog/google/monitoring/real.rb +20 -0
  23. data/lib/fog/google/pubsub.rb +59 -0
  24. data/lib/fog/google/pubsub/mock.rb +34 -0
  25. data/lib/fog/google/pubsub/real.rb +20 -0
  26. data/lib/fog/google/requests/pubsub/acknowledge_subscription.rb +46 -0
  27. data/lib/fog/google/requests/pubsub/create_subscription.rb +57 -0
  28. data/lib/fog/google/requests/pubsub/create_topic.rb +36 -0
  29. data/lib/fog/google/requests/pubsub/delete_subscription.rb +28 -0
  30. data/lib/fog/google/requests/pubsub/delete_topic.rb +29 -0
  31. data/lib/fog/google/requests/pubsub/get_subscription.rb +44 -0
  32. data/lib/fog/google/requests/pubsub/get_topic.rb +41 -0
  33. data/lib/fog/google/requests/pubsub/list_subscriptions.rb +39 -0
  34. data/lib/fog/google/requests/pubsub/list_topics.rb +33 -0
  35. data/lib/fog/google/requests/pubsub/publish_topic.rb +61 -0
  36. data/lib/fog/google/requests/pubsub/pull_subscription.rb +77 -0
  37. data/lib/fog/google/shared.rb +191 -0
  38. data/lib/fog/google/sql.rb +3 -50
  39. data/lib/fog/google/sql/mock.rb +40 -0
  40. data/lib/fog/google/sql/real.rb +20 -0
  41. data/lib/fog/google/version.rb +1 -1
  42. data/lib/fog/storage/google_json.rb +4 -99
  43. data/lib/fog/storage/google_json/mock.rb +18 -0
  44. data/lib/fog/storage/google_json/real.rb +64 -0
  45. data/lib/fog/storage/google_json/utils.rb +32 -0
  46. data/lib/fog/storage/google_xml.rb +4 -260
  47. data/lib/fog/storage/google_xml/mock.rb +102 -0
  48. data/lib/fog/storage/google_xml/models/file.rb +14 -4
  49. data/lib/fog/storage/google_xml/real.rb +106 -0
  50. data/lib/fog/storage/google_xml/utils.rb +66 -0
  51. data/tests/models/pubsub/received_message_tests.rb +18 -0
  52. data/tests/models/pubsub/subscription_tests.rb +26 -0
  53. data/tests/models/pubsub/subscriptions_tests.rb +33 -0
  54. data/tests/models/pubsub/topic_tests.rb +18 -0
  55. data/tests/models/pubsub/topics_tests.rb +27 -0
  56. metadata +50 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5a9b21a8d939164026be5a0a90c2425ba2952ec5
4
- data.tar.gz: 4ba281ca6e85101822de0dd8b74c26821e8c14ce
3
+ metadata.gz: 639cca28bb4028b29b11a947ff1277c9159d823e
4
+ data.tar.gz: 45bf7b279b7d6302aba89dd4e0e36a0ab49ed7af
5
5
  SHA512:
6
- metadata.gz: ec7231307a7cae4abdb789da0f1be297c2996624192c7e04c415ed2d97a80af14baaf1dd730af48de195aab369fc5746a32e4d624408b89448bcd3ead544bed9
7
- data.tar.gz: 625e5e2072bdf1646d7c7752089cfcbc1c9689037f845d4c1b40e0ab6b5ada127152d29140ab9850e6396cf80b8106a398de7ef02f61633f72d5d12aa1addc29
6
+ metadata.gz: 9bf8a05c3aae0bb108724cf4dae398ce1f593ce1dd3e76298be594dfd95e83526d2fc72f61839d0f5bb198783dcd55d16159365a5ab83fa284a8aee2821e567e
7
+ data.tar.gz: f5ac198bfe6294edf35cf7753823867ad6e8fe8d875efc914ec0c9fab1ca7e569a009d7574c755257a3e0f7139913ac3f5809e5a191cc39900dd28194e715936
data/.gitignore CHANGED
@@ -14,3 +14,4 @@
14
14
  mkmf.log
15
15
  .ruby-version
16
16
  .idea/
17
+ .DS_Store
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  The main maintainers for the Google sections are @icco, @Temikus and @plribeiro3000. Please send pull requests to them.
6
6
 
7
- As of https://github.com/fog/fog-google/pull/68, Google no longer supports Ruby versions less than 2.0.0.
7
+ **As of v0.1.1, Google no longer supports Ruby versions less than 2.0.0.**
8
8
 
9
9
  ## Storage
10
10
 
@@ -33,15 +33,19 @@ Fog implements [v1](https://cloud.google.com/dns/api/v1/) of the Google Cloud DN
33
33
 
34
34
  Fog implements [v2beta2](https://cloud.google.com/monitoring/v2beta2/) of the Google Cloud Monitoring API. As of 2016-03-15, we believe Fog for Google Cloud Monitoring is feature complete. We are always looking for people to improve our code and test coverage, so please [file issues](https://github.com/fog/fog-google/issues) for any anomalies you see or features you would like.
35
35
 
36
-
36
+ ## Pubsub
37
+
38
+ Note: You **must** have a version of google-api-client > 0.8.5 to use the Pub/Sub API; previous versions will not work.
37
39
 
40
+ Fog mostly implements [v1](https://cloud.google.com/pubsub/reference/rest/) of the Google Cloud Pub/Sub API; however some less common API methods are missing. Pull requests for additions would be greatly appreciated.
41
+
38
42
  ## Installation
39
43
 
40
44
  Add the following two lines to your application's `Gemfile`:
41
45
 
42
46
  ```ruby
43
47
  gem 'fog-google'
44
- gem 'google-api-client', '< 0.9', '>= 0.6.2'
48
+ gem 'google-api-client', '~> 0.8.6'
45
49
  ```
46
50
 
47
51
  And then execute:
@@ -0,0 +1,54 @@
1
+ # All examples presume that you have a ~/.fog credentials file set up.
2
+ # # More info on it can be found here: http://fog.io/about/getting_started.html
3
+ #
4
+ require "bundler"
5
+ Bundler.require(:default, :development)
6
+ # Uncomment this if you want to make real requests to GCE (you _will_ be billed!)
7
+ # WebMock.disable!
8
+
9
+ def test
10
+ connection = Fog::Google::Pubsub.new
11
+
12
+ puts "Creating a topic to subscribe to"
13
+ puts "--------------------------------"
14
+ topic = connection.topics.create(:name => "projects/#{connection.project}/topics/#{Fog::Mock.random_letters(16)}")
15
+
16
+ puts "Creating a subscription"
17
+ puts "-----------------------"
18
+ subscription = connection.subscriptions.create(:name => "projects/#{connection.project}/subscriptions/#{Fog::Mock.random_letters(16)}", :topic => topic)
19
+
20
+ puts "Getting a subscription"
21
+ puts "----------------------"
22
+ connection.subscriptions.get(subscription.name)
23
+
24
+ puts "Listing all subscriptions"
25
+ puts "-------------------------"
26
+ connection.subscriptions.all
27
+
28
+ puts "Publishing to topic"
29
+ puts "-------------------"
30
+ topic.publish(["test message"])
31
+
32
+ puts "Pulling from subscription"
33
+ puts "-------------------------"
34
+
35
+ msgs = []
36
+ msgs = subscription.pull while msgs.empty?
37
+
38
+ puts "Acknowledging pulled messages"
39
+ puts "-----------------------------"
40
+ subscription.acknowledge(msgs)
41
+
42
+ # Alternatively, received messages themselves can be acknowledged
43
+ msgs.each(&:acknowledge)
44
+
45
+ puts "Deleting the subscription"
46
+ puts "-------------------------"
47
+ subscription.destroy
48
+
49
+ puts "Deleting the topic subscribed to"
50
+ puts "--------------------------------"
51
+ topic.destroy
52
+ end
53
+
54
+ test
@@ -0,0 +1,33 @@
1
+ # All examples presume that you have a ~/.fog credentials file set up.
2
+ # # More info on it can be found here: http://fog.io/about/getting_started.html
3
+ #
4
+ require "bundler"
5
+ Bundler.require(:default, :development)
6
+ # Uncomment this if you want to make real requests to GCE (you _will_ be billed!)
7
+ # WebMock.disable!
8
+
9
+ def test
10
+ connection = Fog::Google::Pubsub.new
11
+
12
+ puts "Creating a topic"
13
+ puts "----------------"
14
+ topic = connection.topics.create(:name => "projects/#{connection.project}/topics/#{Fog::Mock.random_letters(16)}")
15
+
16
+ puts "Getting a topic"
17
+ puts "---------------"
18
+ connection.topics.get(topic.name)
19
+
20
+ puts "Listing all topics"
21
+ puts "------------------"
22
+ connection.topics.all
23
+
24
+ puts "Publishing to topic"
25
+ puts "-------------------"
26
+ topic.publish(["test message"])
27
+
28
+ puts "Delete the topic"
29
+ puts "----------------"
30
+ topic.destroy
31
+ end
32
+
33
+ test
data/fog-google.gemspec CHANGED
@@ -20,14 +20,14 @@ Gem::Specification.new do |spec|
20
20
  spec.require_paths = ["lib"]
21
21
 
22
22
  # As of 0.1.1
23
- spec.required_ruby_version = ">= 2.0"
23
+ spec.required_ruby_version = "~> 2.0"
24
24
 
25
25
  spec.add_dependency "fog-core"
26
26
  spec.add_dependency "fog-json"
27
27
  spec.add_dependency "fog-xml"
28
28
 
29
29
  # TODO: Upgrade to 0.9, which is not compatible.
30
- spec.add_development_dependency "google-api-client", "< 0.9", ">= 0.6.2"
30
+ spec.add_development_dependency "google-api-client", "~> 0.8.6"
31
31
  spec.add_development_dependency "rake"
32
32
  spec.add_development_dependency "shindo"
33
33
  spec.add_development_dependency "minitest"
@@ -1,6 +1,9 @@
1
1
  module Fog
2
2
  module Compute
3
3
  class Google < Fog::Service
4
+ autoload :Mock, File.expand_path("../google/mock", __FILE__)
5
+ autoload :Real, File.expand_path("../google/real", __FILE__)
6
+
4
7
  requires :google_project
5
8
  recognizes :app_name, :app_version, :google_client_email, :google_key_location, :google_key_string,
6
9
  :google_client, :google_json_key_location, :google_json_key_string, :google_extra_global_projects
@@ -12,6 +15,7 @@ module Fog
12
15
  https://www.googleapis.com/auth/ndev.cloudman
13
16
  https://www.googleapis.com/auth/cloud-platform)
14
17
  GOOGLE_COMPUTE_DEFAULT_NETWORK = "default"
18
+ RUNNING = "RUNNING".freeze
15
19
 
16
20
  request_path "fog/compute/google/requests"
17
21
  request :list_servers
@@ -237,890 +241,6 @@ module Fog
237
241
 
238
242
  model :subnetwork
239
243
  collection :subnetworks
240
-
241
- class Mock
242
- include Fog::Google::Shared
243
- attr_reader :extra_global_projects
244
-
245
- def initialize(options)
246
- shared_initialize(options[:google_project], GOOGLE_COMPUTE_API_VERSION, GOOGLE_COMPUTE_BASE_URL)
247
- @extra_global_projects = options[:google_extra_global_projects] || []
248
- end
249
-
250
- def self.data(api_version)
251
- @data ||= Hash.new do |hash, key|
252
- case key
253
- when "debian-cloud"
254
- hash[key] = {
255
- :images => {
256
- "debian-6-squeeze-v20130816" => {
257
- "kind" => "compute#image",
258
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/debian-cloud/global/images/debian-6-squeeze-v20130816",
259
- "id" => "14841592146580482051",
260
- "creationTimestamp" => "2013-09-04T13:21:53.292-07:00",
261
- "name" => "debian-6-squeeze-v20130816",
262
- "description" => "Debian GNU/Linux 6.0.7 (squeeze) built on 2013-08-16",
263
- "sourceType" => "RAW",
264
- "rawDisk" => {
265
- "containerType" => "TAR",
266
- "source" => ""
267
- },
268
- "status" => "READY"
269
- },
270
- "debian-7-wheezy-v20130816" => {
271
- "kind" => "compute#image",
272
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/debian-cloud/global/images/debian-7-wheezy-v20130816",
273
- "id" => "4213305957435180899",
274
- "creationTimestamp" => "2013-09-04T13:24:30.479-07:00",
275
- "name" => "debian-7-wheezy-v20130816",
276
- "description" => "Debian GNU/Linux 7.1 (wheezy) built on 2013-08-16",
277
- "sourceType" => "RAW",
278
- "rawDisk" => {
279
- "containerType" => "TAR",
280
- "source" => ""
281
- },
282
- "status" => "READY"
283
- },
284
- "debian-7-wheezy-v20131014" => {
285
- "kind" => "compute#image",
286
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/debian-cloud/global/images/debian-7-wheezy-v20131014",
287
- "id" => "4213305957435180899",
288
- "creationTimestamp" => "2013-09-04T13:24:30.479-07:00",
289
- "name" => "debian-7-wheezy-v20131014",
290
- "description" => "Debian GNU/Linux 7.1 (wheezy) built on 2013-10-14",
291
- "sourceType" => "RAW",
292
- "rawDisk" => {
293
- "containerType" => "TAR",
294
- "source" => ""
295
- },
296
- "status" => "READY"
297
- },
298
- "debian-7-wheezy-v20140408" => {
299
- "kind" => "compute#image",
300
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/debian-cloud/global/images/debian-7-wheezy-v20140408",
301
- "id" => "17312518942796567788",
302
- "creationTimestamp" => "2013-11-25T15:17:00.436-08:00",
303
- "name" => "debian-7-wheezy-v20131120",
304
- "description" => "Debian GNU/Linux 7.2 (wheezy) built on 2013-11-20",
305
- "sourceType" => "RAW",
306
- "rawDisk" => {
307
- "containerType" => "TAR",
308
- "source" => ""
309
- },
310
- "status" => "READY",
311
- "archiveSizeBytes" => "341857472"
312
- }
313
- }
314
- }
315
- when "centos-cloud"
316
- hash[key] = {
317
- :images => {
318
- "centos-6-v20130813" => {
319
- "kind" => "compute#image",
320
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/centos-cloud/global/images/centos-6-v20130813",
321
- "id" => "4670523370938782739",
322
- "creationTimestamp" => "2013-08-19T11:56:47.004-07:00",
323
- "name" => "centos-6-v20130813",
324
- "description" => "SCSI-enabled CentOS 6; Created Tue, 13 Aug 2013 00:00:00 +0000",
325
- "sourceType" => "RAW",
326
- "rawDisk" => {
327
- "containerType" => "TAR",
328
- "source" => ""
329
- },
330
- "status" => "READY"
331
- }
332
- }
333
- }
334
- else
335
- hash[key] = {
336
- :target_http_proxies => {
337
- "test-target-http-proxy" => {
338
- "kind" => "compute#targetHttpProxy",
339
- "id" => "1361932147851415729",
340
- "creationTimestamp" => "2014-08-23T10:06:13.951-07:00",
341
- "name" => "test-target-http-proxy",
342
- "description" => "",
343
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/targetHttpProxies/test-target-http-proxy",
344
- "urlMap" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/urlMaps/test-url-map"
345
- }
346
- },
347
- :url_maps => {
348
- "test-url-map" => {
349
- "kind" => "compute#urlMap",
350
- "id" => "1361932147851415729",
351
- "creationTimestamp" => "2014-08-23T10:06:13.951-07:00",
352
- "name" => "test-url-map",
353
- "description" => "",
354
- "hostRules" => [],
355
- "pathMatchers" => [],
356
- "tests" => [],
357
- "defaultService" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/backendServices/fog-backend-service-test",
358
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/urlMaps/test-url-map"
359
- }
360
- },
361
- :target_pools => {
362
- "test-target-pool" => {
363
- "kind" => "compute#targetPool",
364
- "id" => "1361932147851415729",
365
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/us-central1/targetPools/test-target-pool",
366
- "creationTimestamp" => "2014-08-23T10:06:13.951-07:00",
367
- "name" => "test-target-pool",
368
- "region" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/us-central1",
369
- "healthChecks" => ["https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/httpHealthChecks/test-check"],
370
- "instances" => ["https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/us-central1-a/instances/test-instance"]
371
- }
372
- },
373
-
374
- :http_health_checks => {
375
- "test-http-health-check" => {
376
- "checkIntervalSec" => 5,
377
- "creationTimestamp" => "2014-08-23T10:06:13.951-07:00",
378
- "healthyThreshold" => 2,
379
- "id" => "1361932147851415729",
380
- "kind" => "compute#httphealthCheck",
381
- "name" => "test-http-health-check",
382
- "port" => 80,
383
- "requestPath" => "/",
384
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/httpHealthChecks/test-http-health-check",
385
- "timeoutSec" => 5,
386
- "unhealthyThreshold" => 2
387
- }
388
- },
389
- :global_forwarding_rules => {
390
- "test-global-forwarding-rule" => {
391
- "kind" => "compute#forwardingRule",
392
- "id" => "1361932147851415729",
393
- "creationTimestamp" => "2014-08-23T10:06:13.951-07:00",
394
- "name" => "test-global-forwarding-rule",
395
- "IPAddress" => "107.178.255.155",
396
- "IPProtocol" => "TCP",
397
- "portRange" => "80-80",
398
- "target" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/targetHttpProxies/proxy",
399
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/forwardngRules/test-global-forwarding-rule"
400
- }
401
- },
402
- :forwarding_rules => {
403
- "test-forwarding-rule" => {
404
- "kind" => "compute#forwardingRule",
405
- "id" => "1361932147851415729",
406
- "creationTimestamp" => "2014-08-23T10:06:13.951-07:00",
407
- "name" => "test-forwarding-rule",
408
- "IPAddress" => "107.178.255.155",
409
- "IPProtocol" => "TCP",
410
- "portRange" => "80-80",
411
- "target" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/us-central1/targetPools/target_pool",
412
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/us-central1/forwardngRules/test-forwarding-rule",
413
- "region" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/regions/us-central1"
414
- }
415
- },
416
- :target_instances => {
417
- "test-target-instance" => {
418
- "kind" => "compute#targetInstance",
419
- "name" => "test-target-instance",
420
- "natPolicy" => "NO_NAT",
421
- "zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/us-central1-a",
422
- "instance" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/us-central1-a/instances/test-instance",
423
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/us-central1-a/targetInstances/test-target-instance",
424
- "id" => "1361932147851415729",
425
- "creationTimestamp" => "2014-08-23T10:06:13.951-07:00"
426
-
427
- }
428
- },
429
- :backend_services => {
430
- "test-backend-service" => {
431
- "kind" => "compute#backend_service",
432
- "id" => "1361932147851415729",
433
- "creationTimestamp" => "2014-08-23T10:06:13.951-07:00",
434
- "name" => "test-backend-service",
435
- "description" => "",
436
- "backends" => [
437
- {
438
- "description" => "",
439
- "group" => "https://www.googleapis.com/resourceviews/v1beta1/projects#{@project}/zones/us-central1-a/zoneViews/name",
440
- "balancingMode" => "RATE",
441
- "capacityScaler" => 1.1,
442
- "maxRate" => 0.5
443
- }],
444
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/backendServices/test-backend-service"
445
- }
446
- },
447
- :servers => {
448
- "fog-1" => {
449
- "kind" => "compute#instance",
450
- "id" => "1361932147851415727",
451
- "creationTimestamp" => "2013-09-26T04:55:43.881-07:00",
452
- "zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a",
453
- "status" => "RUNNING",
454
- "name" => "fog-1380196541",
455
- "tags" => { "fingerprint" => "42WmSpB8rSM=" },
456
- "machineType" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a/machineTypes/n1-standard-1",
457
- "canIpForward" => false,
458
- "networkInterfaces" => [
459
- {
460
- "network" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/global/networks/default",
461
- "networkIP" => "10.240.121.54",
462
- "name" => "nic0",
463
- "accessConfigs" => [
464
- {
465
- "kind" => "compute#accessConfig",
466
- "type" => "ONE_TO_ONE_NAT",
467
- "name" => "External NAT",
468
- "natIP" => "108.59.81.28"
469
- }
470
- ]
471
- }
472
- ],
473
- "disks" => [
474
- {
475
- "kind" => "compute#attachedDisk",
476
- "index" => 0,
477
- "type" => "PERSISTENT",
478
- "mode" => "READ_WRITE",
479
- "source" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a/disks/fog-1",
480
- "deviceName" => "persistent-disk-0",
481
- "boot" => true
482
- }
483
- ],
484
- "metadata" => {
485
- "kind" => "compute#metadata",
486
- "fingerprint" => "5_hasd_gC3E=",
487
- "items" => [
488
- {
489
- "key" => "sshKeys",
490
- "value" => "sysadmin:ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAgEA1zc7mx+0H8Roywet/L0aVX6MUdkDfzd/17kZhprAbpUXYOILv9AG4lIzQk6xGxDIltghytjfVGme/4A42Sb0Z9LN0pxB4KnWTNoOSHPJtp6jbXpq6PdN9r3Z5NKQg0A/Tfw7gt2N0GDsj6vpK8VbHHdW78JAVUxql18ootJxjaksdocsiHNK8iA6/v9qiLRhX3fOgtK7KpxxdZxLRzFg9vkp8jcGISgpZt27kOgXWhR5YLhi8pRJookzphO5O4yhflgoHoAE65XkfrsRCe0HU5QTbY2jH88rBVkq0KVlZh/lEsuwfmG4d77kEqaCGGro+j1Wrvo2K3DSQ+rEcvPp2CYRUySjhaeLF18UzQLtxNeoN14QOYqlm9ITdkCnmq5w4Wn007MjSOFp8LEq2RekrnddGXjg1/vgmXtaVSGzJAlXwtVfZor3dTRmF0JCpr7DsiupBaDFtLUlGFFlSKmPDVMPOOB5wajexmcvSp2Vu4U3yP8Lai/9/ZxMdsGPhpdCsWVL83B5tF4oYj1HVIycbYIxIIfFqOxZcCru3CMfe9jmzKgKLv2UtkfOS8jpS/Os2gAiB3wPweH3agvtwYAYBVMDwt5cnrhgHYWoOz7ABD8KgmCrD7Y9HikiCqIUNkgUFd9YmjcYi5FkU5rFXIawN7efs341lsdf923lsdf923fs= johndoe@acme"
491
- }
492
- ]
493
- },
494
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a/instances/fog-1380196541"
495
- }
496
- },
497
- :zones => {
498
- "europe-west1-a" => {
499
- "kind" => "compute#zone",
500
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/europe-west1-a",
501
- "id" => "10419676573632995924",
502
- "creationTimestamp" => "2013-09-26T02:56:13.115-07:00",
503
- "name" => "europe-west1-a",
504
- "description" => "europe-west1-a",
505
- "status" => "UP",
506
- "maintenanceWindows" => [
507
- {
508
- "name" => "2014-01-18-planned-outage",
509
- "description" => "maintenance zone",
510
- "beginTime" => "2014-01-18T12:00:00.000-08:00",
511
- "endTime" => "2014-02-02T12:00:00.000-08:00"
512
- }
513
- ],
514
- "quotas" => [
515
- { "metric" => "INSTANCES", "limit" => 16.0, "usage" => 0.0 },
516
- { "metric" => "CPUS", "limit" => 24.0, "usage" => 0.0 },
517
- { "metric" => "DISKS", "limit" => 16.0, "usage" => 0.0 },
518
- { "metric" => "DISKS_TOTAL_GB", "limit" => 2048.0, "usage" => 0.0 }
519
- ],
520
- "region" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/regions/europe-west1"
521
- },
522
- "us-central1-a" => {
523
- "kind" => "compute#zone",
524
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a",
525
- "id" => "6562457277909136262",
526
- "creationTimestamp" => "2013-09-26T02:56:13.116-07:00",
527
- "name" => "us-central1-a",
528
- "description" => "us-central1-a",
529
- "status" => "UP",
530
- "maintenanceWindows" => nil,
531
- "quotas" => [
532
- { "metric" => "INSTANCES", "limit" => 16.0, "usage" => 1.0 },
533
- { "metric" => "CPUS", "limit" => 24.0, "usage" => 1.0 },
534
- { "metric" => "DISKS", "limit" => 16.0, "usage" => 0.0 },
535
- { "metric" => "DISKS_TOTAL_GB", "limit" => 2048.0, "usage" => 0.0 }
536
- ],
537
- "region" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/regions/us-central1"
538
- },
539
- "us-central1-b" => {
540
- "kind" => "compute#zone",
541
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-b",
542
- "id" => "8701502109626061015",
543
- "creationTimestamp" => "2013-09-26T02:56:13.124-07:00",
544
- "name" => "us-central1-b",
545
- "description" => "us-central1-b",
546
- "status" => "UP",
547
- "maintenanceWindows" => [{ "name" => "2013-10-26-planned-outage",
548
- "description" => "maintenance zone",
549
- "beginTime" => "2013-10-26T12:00:00.000-07:00",
550
- "endTime" => "2013-11-10T12:00:00.000-08:00" }],
551
- "quotas" => [
552
- { "metric" => "INSTANCES", "limit" => 16.0, "usage" => 0.0 },
553
- { "metric" => "CPUS", "limit" => 24.0, "usage" => 0.0 },
554
- { "metric" => "DISKS", "limit" => 16.0, "usage" => 0.0 },
555
- { "metric" => "DISKS_TOTAL_GB", "limit" => 2048.0, "usage" => 0.0 }
556
- ],
557
- "region" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/regions/us-central1"
558
- },
559
- "us-central2-a" => {
560
- "kind" => "compute#zone",
561
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central2-a",
562
- "id" => "13611654493253680292",
563
- "creationTimestamp" => "2013-09-26T02:56:13.125-07:00",
564
- "name" => "us-central2-a",
565
- "description" => "us-central2-a",
566
- "status" => "UP",
567
- "maintenanceWindows" => [
568
- {
569
- "name" => "2013-10-12-planned-outage",
570
- "description" => "maintenance zone",
571
- "beginTime" => "2013-10-12T12:00:00.000-07:00",
572
- "endTime" => "2013-10-27T12:00:00.000-07:00"
573
- }
574
- ],
575
- "quotas" => [
576
- { "metric" => "INSTANCES", "limit" => 16.0, "usage" => 0.0 },
577
- { "metric" => "CPUS", "limit" => 24.0, "usage" => 0.0 },
578
- { "metric" => "DISKS", "limit" => 16.0, "usage" => 0.0 },
579
- { "metric" => "DISKS_TOTAL_GB", "limit" => 2048.0, "usage" => 0.0 }
580
- ],
581
- "region" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/regions/us-central2"
582
- }
583
- },
584
- :regions => {
585
- "us-central1" => {
586
- "creationTimestamp" => "2014-01-21T10:30:54.895-08:00",
587
- "description" => "us-central1",
588
- "id" => "18201118976141502843",
589
- "kind" => "compute#region",
590
- "name" => "us-central1",
591
- "quotas" => [
592
- { "metric" => "CPUS", "limit" => 1050.0, "usage" => 28.0 },
593
- { "metric" => "DISKS_TOTAL_GB", "limit" => 10_000.0, "usage" => 292.0 },
594
- { "metric" => "STATIC_ADDRESSES", "limit" => 10.0, "usage" => 0.0 },
595
- { "metric" => "IN_USE_ADDRESSES", "limit" => 1050.0, "usage" => 30.0 },
596
- { "metric" => "SSD_TOTAL_GB", "limit" => 1024.0, "usage" => 0.0 }
597
- ],
598
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/regions/us-central1",
599
- "status" => "UP",
600
- "zones" => [
601
- "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a",
602
- "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-b",
603
- "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-f"
604
- ]
605
- },
606
- "europe-west1" => {
607
- "creationTimestamp" => "2014-01-21T10:30:54.891-08:00",
608
- "description" => "europe-west1",
609
- "id" => "18201118976141502843",
610
- "kind" => "compute#region",
611
- "name" => "europe-west1",
612
- "quotas" => [
613
- { "metric" => "CPUS", "limit" => 24.0, "usage" => 0.0 },
614
- { "metric" => "DISKS_TOTAL_GB", "limit" => 2048.0, "usage" => 0.0 },
615
- { "metric" => "STATIC_ADDRESSES", "limit" => 7.0, "usage" => 0.0 },
616
- { "metric" => "IN_USE_ADDRESSES", "limit" => 23.0, "usage" => 0.0 },
617
- { "metric" => "SSD_TOTAL_GB", "limit" => 1024.0, "usage" => 0.0 }
618
- ],
619
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/regions/erope-west1",
620
- "status" => "UP",
621
- "zones" => [
622
- "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/europe-west1-a",
623
- "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/europe-west1-b"
624
- ]
625
- },
626
- "asia-east1" => {
627
- "creationTimestamp" => "2014-01-21T10:30:54.895-08:00",
628
- "description" => "asia-east1",
629
- "id" => "18201118976141502843",
630
- "kind" => "compute#region",
631
- "name" => "asia-east1",
632
- "quotas" => [
633
- { "metric" => "CPUS", "limit" => 1050.0, "usage" => 28.0 },
634
- { "metric" => "DISKS_TOTAL_GB", "limit" => 10_000.0, "usage" => 292.0 },
635
- { "metric" => "STATIC_ADDRESSES", "limit" => 10.0, "usage" => 0.0 },
636
- { "metric" => "IN_USE_ADDRESSES", "limit" => 1050.0, "usage" => 30.0 },
637
- { "metric" => "SSD_TOTAL_GB", "limit" => 1024.0, "usage" => 0.0 }
638
- ],
639
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/regions/asia-east1",
640
- "status" => "UP",
641
- "zones" => [
642
- "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/asia-east1-a",
643
- "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/asia-east1-b",
644
- "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/asia-east1-c"
645
- ]
646
- }
647
- },
648
-
649
- :machine_types => Hash.new do |machine_types_hash, zone|
650
- machine_types_hash[zone] = {
651
- "f1-micro" => {
652
- "kind" => "compute#machineType",
653
- "id" => "4618642685664990776",
654
- "creationTimestamp" => "2013-04-25T13:32:49.088-07:00",
655
- "name" => "f1-micro",
656
- "description" => "1 vCPU (shared physical core) and 0.6 GB RAM",
657
- "guestCpus" => 1,
658
- "memoryMb" => 614,
659
- "imageSpaceGb" => 0,
660
- "maximumPersistentDisks" => 4,
661
- "maximumPersistentDisksSizeGb" => "3072",
662
- "zone" => zone,
663
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/f1-micro"
664
- },
665
- "g1-small" => {
666
- "kind" => "compute#machineType",
667
- "id" => "7224129552184485774",
668
- "creationTimestamp" => "2013-04-25T13:32:45.550-07:00",
669
- "name" => "g1-small",
670
- "description" => "1 vCPU (shared physical core) and 1.7 GB RAM",
671
- "guestCpus" => 1,
672
- "memoryMb" => 1740,
673
- "imageSpaceGb" => 0,
674
- "maximumPersistentDisks" => 4,
675
- "maximumPersistentDisksSizeGb" => "3072",
676
- "zone" => zone,
677
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/g1-small"
678
- },
679
- "n1-highcpu-2" => {
680
- "kind" => "compute#machineType",
681
- "id" => "13043554592196512955",
682
- "creationTimestamp" => "2012-11-16T11:46:10.572-08:00",
683
- "name" => "n1-highcpu-2",
684
- "description" => "2 vCPUs, 1.8 GB RAM",
685
- "guestCpus" => 2,
686
- "memoryMb" => 1843,
687
- "imageSpaceGb" => 10,
688
- "maximumPersistentDisks" => 16,
689
- "maximumPersistentDisksSizeGb" => "10240",
690
- "zone" => zone,
691
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highcpu-2"
692
- },
693
- "n1-highcpu-2-d" => {
694
- "kind" => "compute#machineType",
695
- "id" => "13043555176034896271",
696
- "creationTimestamp" => "2012-11-16T11:47:07.825-08:00",
697
- "name" => "n1-highcpu-2-d",
698
- "description" => "2 vCPUs, 1.8 GB RAM, 1 scratch disk (870 GB)",
699
- "guestCpus" => 2,
700
- "memoryMb" => 1843,
701
- "imageSpaceGb" => 10,
702
- "scratchDisks" => [
703
- {
704
- "diskGb" => 870
705
- }
706
- ],
707
- "maximumPersistentDisks" => 16,
708
- "maximumPersistentDisksSizeGb" => "10240",
709
- "zone" => zone,
710
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highcpu-2-d"
711
- },
712
- "n1-highcpu-4" => {
713
- "kind" => "compute#machineType",
714
- "id" => "13043555705736970382",
715
- "creationTimestamp" => "2012-11-16T11:48:06.087-08:00",
716
- "name" => "n1-highcpu-4",
717
- "description" => "4 vCPUs, 3.6 GB RAM",
718
- "guestCpus" => 4,
719
- "memoryMb" => 3686,
720
- "imageSpaceGb" => 10,
721
- "maximumPersistentDisks" => 16,
722
- "maximumPersistentDisksSizeGb" => "10240",
723
- "zone" => zone,
724
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highcpu-4"
725
- },
726
- "n1-highcpu-4-d" => {
727
- "kind" => "compute#machineType",
728
- "id" => "13043556330284250611",
729
- "creationTimestamp" => "2012-11-16T11:49:07.563-08:00",
730
- "name" => "n1-highcpu-4-d",
731
- "description" => "4 vCPUS, 3.6 GB RAM, 1 scratch disk (1770 GB)",
732
- "guestCpus" => 4,
733
- "memoryMb" => 3686,
734
- "imageSpaceGb" => 10,
735
- "scratchDisks" => [
736
- {
737
- "diskGb" => 1770
738
- }
739
- ],
740
- "maximumPersistentDisks" => 16,
741
- "maximumPersistentDisksSizeGb" => "10240",
742
- "zone" => zone,
743
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highcpu-4-d"
744
- },
745
- "n1-highcpu-8" => {
746
- "kind" => "compute#machineType",
747
- "id" => "13043556949665240937",
748
- "creationTimestamp" => "2012-11-16T11:50:15.128-08:00",
749
- "name" => "n1-highcpu-8",
750
- "description" => "8 vCPUs, 7.2 GB RAM",
751
- "guestCpus" => 8,
752
- "memoryMb" => 7373,
753
- "imageSpaceGb" => 10,
754
- "maximumPersistentDisks" => 16,
755
- "maximumPersistentDisksSizeGb" => "10240",
756
- "zone" => zone,
757
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highcpu-8"
758
- },
759
- "n1-highcpu-8-d" => {
760
- "kind" => "compute#machineType",
761
- "id" => "13043557458004959701",
762
- "creationTimestamp" => "2012-11-16T11:51:04.549-08:00",
763
- "name" => "n1-highcpu-8-d",
764
- "description" => "8 vCPUS, 7.2 GB RAM, 2 scratch disks (1770 GB, 1770 GB)",
765
- "guestCpus" => 8,
766
- "memoryMb" => 7373,
767
- "imageSpaceGb" => 10,
768
- "scratchDisks" => [
769
- {
770
- "diskGb" => 1770
771
- },
772
- {
773
- "diskGb" => 1770
774
- }
775
- ],
776
- "maximumPersistentDisks" => 16,
777
- "maximumPersistentDisksSizeGb" => "10240",
778
- "zone" => zone,
779
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highcpu-8-d"
780
- },
781
- "n1-highmem-2" => {
782
- "kind" => "compute#machineType",
783
- "id" => "13043551079318055993",
784
- "creationTimestamp" => "2012-11-16T11:40:06.129-08:00",
785
- "name" => "n1-highmem-2",
786
- "description" => "2 vCPUs, 13 GB RAM",
787
- "guestCpus" => 2,
788
- "memoryMb" => 13_312,
789
- "imageSpaceGb" => 10,
790
- "maximumPersistentDisks" => 16,
791
- "maximumPersistentDisksSizeGb" => "10240",
792
- "zone" => zone,
793
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highmem-2"
794
- },
795
- "n1-highmem-2-d" => {
796
- "kind" => "compute#machineType",
797
- "id" => "13043551625558644085",
798
- "creationTimestamp" => "2012-11-16T11:40:59.630-08:00",
799
- "name" => "n1-highmem-2-d",
800
- "description" => "2 vCPUs, 13 GB RAM, 1 scratch disk (870 GB)",
801
- "guestCpus" => 2,
802
- "memoryMb" => 13_312,
803
- "imageSpaceGb" => 10,
804
- "scratchDisks" => [
805
- {
806
- "diskGb" => 870
807
- }
808
- ],
809
- "maximumPersistentDisks" => 16,
810
- "maximumPersistentDisksSizeGb" => "10240",
811
- "zone" => zone,
812
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highmem-2-d"
813
- },
814
- "n1-highmem-4" => {
815
- "kind" => "compute#machineType",
816
- "id" => "13043552263604939569",
817
- "creationTimestamp" => "2012-11-16T11:42:08.983-08:00",
818
- "name" => "n1-highmem-4",
819
- "description" => "4 vCPUs, 26 GB RAM",
820
- "guestCpus" => 4,
821
- "memoryMb" => 26_624,
822
- "imageSpaceGb" => 10,
823
- "maximumPersistentDisks" => 16,
824
- "maximumPersistentDisksSizeGb" => "10240",
825
- "zone" => zone,
826
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highmem-4"
827
- },
828
- "n1-highmem-4-d" => {
829
- "kind" => "compute#machineType",
830
- "id" => "13043552953632709737",
831
- "creationTimestamp" => "2012-11-16T11:43:17.400-08:00",
832
- "name" => "n1-highmem-4-d",
833
- "description" => "4 vCPUs, 26 GB RAM, 1 scratch disk (1770 GB)",
834
- "guestCpus" => 4,
835
- "memoryMb" => 26_624,
836
- "imageSpaceGb" => 10,
837
- "scratchDisks" => [
838
- {
839
- "diskGb" => 1770
840
- }
841
- ],
842
- "maximumPersistentDisks" => 16,
843
- "maximumPersistentDisksSizeGb" => "10240",
844
- "zone" => zone,
845
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highmem-4-d"
846
- },
847
- "n1-highmem-8" => {
848
- "kind" => "compute#machineType",
849
- "id" => "13043553584275586275",
850
- "creationTimestamp" => "2012-11-16T11:44:25.985-08:00",
851
- "name" => "n1-highmem-8",
852
- "description" => "8 vCPUs, 52 GB RAM",
853
- "guestCpus" => 8,
854
- "memoryMb" => 53_248,
855
- "imageSpaceGb" => 10,
856
- "maximumPersistentDisks" => 16,
857
- "maximumPersistentDisksSizeGb" => "10240",
858
- "zone" => zone,
859
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highmem-8"
860
- },
861
- "n1-highmem-8-d" => {
862
- "kind" => "compute#machineType",
863
- "id" => "13043554021673472746",
864
- "creationTimestamp" => "2012-11-16T11:45:08.195-08:00",
865
- "name" => "n1-highmem-8-d",
866
- "description" => "8 vCPUs, 52 GB RAM, 2 scratch disks (1770 GB, 1770 GB)",
867
- "guestCpus" => 8,
868
- "memoryMb" => 53_248,
869
- "imageSpaceGb" => 10,
870
- "scratchDisks" => [
871
- {
872
- "diskGb" => 1770
873
- },
874
- {
875
- "diskGb" => 1770
876
- }
877
- ],
878
- "maximumPersistentDisks" => 16,
879
- "maximumPersistentDisksSizeGb" => "10240",
880
- "zone" => zone,
881
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-highmem-8-d"
882
- },
883
- "n1-standard-1" => {
884
- "kind" => "compute#machineType",
885
- "id" => "12907738072351752276",
886
- "creationTimestamp" => "2012-06-07T13:48:14.670-07:00",
887
- "name" => "n1-standard-1",
888
- "description" => "1 vCPU, 3.75 GB RAM",
889
- "guestCpus" => 1,
890
- "memoryMb" => 3840,
891
- "imageSpaceGb" => 10,
892
- "maximumPersistentDisks" => 16,
893
- "maximumPersistentDisksSizeGb" => "10240",
894
- "zone" => zone,
895
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-standard-1"
896
- },
897
- "n1-standard-1-d" => {
898
- "kind" => "compute#machineType",
899
- "id" => "12908559201265214706",
900
- "creationTimestamp" => "2012-06-07T13:48:34.258-07:00",
901
- "name" => "n1-standard-1-d",
902
- "description" => "1 vCPU, 3.75 GB RAM, 1 scratch disk (420 GB)",
903
- "guestCpus" => 1,
904
- "memoryMb" => 3840,
905
- "imageSpaceGb" => 10,
906
- "scratchDisks" => [
907
- {
908
- "diskGb" => 420
909
- }
910
- ],
911
- "maximumPersistentDisks" => 16,
912
- "maximumPersistentDisksSizeGb" => "10240",
913
- "zone" => zone,
914
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-standard-1-d"
915
- },
916
- "n1-standard-2" => {
917
- "kind" => "compute#machineType",
918
- "id" => "12908559320241551184",
919
- "creationTimestamp" => "2012-06-07T13:48:56.867-07:00",
920
- "name" => "n1-standard-2",
921
- "description" => "2 vCPUs, 7.5 GB RAM",
922
- "guestCpus" => 2,
923
- "memoryMb" => 7680,
924
- "imageSpaceGb" => 10,
925
- "maximumPersistentDisks" => 16,
926
- "maximumPersistentDisksSizeGb" => "10240",
927
- "zone" => zone,
928
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-standard-2"
929
- },
930
- "n1-standard-2-d" => {
931
- "kind" => "compute#machineType",
932
- "id" => "12908559582417967837",
933
- "creationTimestamp" => "2012-06-07T13:49:19.448-07:00",
934
- "name" => "n1-standard-2-d",
935
- "description" => "2 vCPUs, 7.5 GB RAM, 1 scratch disk (870 GB)",
936
- "guestCpus" => 2,
937
- "memoryMb" => 7680,
938
- "imageSpaceGb" => 10,
939
- "scratchDisks" => [
940
- {
941
- "diskGb" => 870
942
- }
943
- ],
944
- "maximumPersistentDisks" => 16,
945
- "maximumPersistentDisksSizeGb" => "10240",
946
- "zone" => zone,
947
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-standard-2-d"
948
- },
949
- "n1-standard-4" => {
950
- "kind" => "compute#machineType",
951
- "id" => "12908559692070444049",
952
- "creationTimestamp" => "2012-06-07T13:49:40.050-07:00",
953
- "name" => "n1-standard-4",
954
- "description" => "4 vCPUs, 15 GB RAM",
955
- "guestCpus" => 4,
956
- "memoryMb" => 15_360,
957
- "imageSpaceGb" => 10,
958
- "maximumPersistentDisks" => 16,
959
- "maximumPersistentDisksSizeGb" => "10240",
960
- "zone" => zone,
961
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-standard-4"
962
- },
963
- "n1-standard-4-d" => {
964
- "kind" => "compute#machineType",
965
- "id" => "12908559991903153608",
966
- "creationTimestamp" => "2012-06-07T13:50:05.677-07:00",
967
- "name" => "n1-standard-4-d",
968
- "description" => "4 vCPUs, 15 GB RAM, 1 scratch disk (1770 GB)",
969
- "guestCpus" => 4,
970
- "memoryMb" => 15_360,
971
- "imageSpaceGb" => 10,
972
- "scratchDisks" => [
973
- {
974
- "diskGb" => 1770
975
- }
976
- ],
977
- "maximumPersistentDisks" => 16,
978
- "maximumPersistentDisksSizeGb" => "10240",
979
- "zone" => zone,
980
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-standard-4-d"
981
- },
982
- "n1-standard-8" => {
983
- "kind" => "compute#machineType",
984
- "id" => "12908560197989714867",
985
- "creationTimestamp" => "2012-06-07T13:50:42.334-07:00",
986
- "name" => "n1-standard-8",
987
- "description" => "8 vCPUs, 30 GB RAM",
988
- "guestCpus" => 8,
989
- "memoryMb" => 30_720,
990
- "imageSpaceGb" => 10,
991
- "maximumPersistentDisks" => 16,
992
- "maximumPersistentDisksSizeGb" => "10240",
993
- "zone" => zone,
994
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-standard-8"
995
- },
996
- "n1-standard-8-d" => {
997
- "kind" => "compute#machineType",
998
- "id" => "12908560709887590691",
999
- "creationTimestamp" => "2012-06-07T13:51:19.936-07:00",
1000
- "name" => "n1-standard-8-d",
1001
- "description" => "8 vCPUs, 30 GB RAM, 2 scratch disks (1770 GB, 1770 GB)",
1002
- "guestCpus" => 8,
1003
- "memoryMb" => 30_720,
1004
- "imageSpaceGb" => 10,
1005
- "scratchDisks" => [
1006
- {
1007
- "diskGb" => 1770
1008
- },
1009
- {
1010
- "diskGb" => 1770
1011
- }
1012
- ],
1013
- "maximumPersistentDisks" => 16,
1014
- "maximumPersistentDisksSizeGb" => "10240",
1015
- "zone" => zone,
1016
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/#{zone}/machineTypes/n1-standard-8-d"
1017
- }
1018
- }
1019
- end,
1020
- :images => {},
1021
- :disks => {
1022
- "fog-1" => {
1023
- "kind" => "compute#disk",
1024
- "id" => "3338131294770784461",
1025
- "creationTimestamp" => "2013-12-18T19:47:10.583-08:00",
1026
- "zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a",
1027
- "status" => "READY",
1028
- "name" => "fog-1",
1029
- "sizeGb" => "10",
1030
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a/disks/fog-1",
1031
- "sourceImage" => "https://www.googleapis.com/compute/#{api_version}/projects/debian-cloud/global/images/debian-7-wheezy-v20131120",
1032
- "sourceImageId" => "17312518942796567788",
1033
- "type" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a/diskTypes/pd-standard"
1034
- },
1035
- "fog-2" => {
1036
- "kind" => "compute#disk",
1037
- "id" => "3338131294770784462",
1038
- "creationTimestamp" => "2013-12-18T19:47:10.583-08:00",
1039
- "zone" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a",
1040
- "status" => "READY",
1041
- "name" => "fog-2",
1042
- "sizeGb" => "10",
1043
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a/disks/fog-1",
1044
- "type" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a/diskTypes/pd-ssd"
1045
- }
1046
- },
1047
- :subnetworks => {
1048
- "fog-1" => {
1049
- "kind" => "compute#subnetwork",
1050
- "id" => "6680781458098159920",
1051
- "creationTimestamp" => "2016-03-19T19:13:51.613-07:00",
1052
- "gatewayAddress" => "10.1.0.1",
1053
- "name" => "fog-1",
1054
- "network" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/global/networks/fog-example",
1055
- "ipCidrRange" => "10.1.0.0/20",
1056
- "region" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/regions/us-central1",
1057
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/regions/us-central1/subnetworks/fog-1"
1058
- },
1059
- "fog-2" => {
1060
- "kind" => "compute#subnetwork",
1061
- "id" => "6680781458098159921",
1062
- "creationTimestamp" => "2016-03-19T19:13:51.613-07:00",
1063
- "gatewayAddress" => "10.1.16.1",
1064
- "name" => "fog-2",
1065
- "network" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/global/networks/fog-example",
1066
- "ipCidrRange" => "10.1.16.0/20",
1067
- "region" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/regions/europe-west1",
1068
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/regions/europe-west1/subnetworks/fog-2"
1069
- },
1070
- "fog-3" => {
1071
- "kind" => "compute#subnetwork",
1072
- "id" => "6680781458098159923",
1073
- "creationTimestamp" => "2016-03-19T19:13:51.613-07:00",
1074
- "gatewayAddress" => "192.168.20.1",
1075
- "name" => "fog-3",
1076
- "network" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/global/networks/fog-elsewhere-example",
1077
- "ipCidrRange" => "192.168.20.0/20",
1078
- "region" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/regions/us-central1",
1079
- "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/regions/us-central1/subnetworks/fog-3"
1080
- },
1081
- },
1082
- :operations => {}
1083
- }
1084
- end
1085
- end
1086
- end
1087
-
1088
- def self.reset
1089
- @data = nil
1090
- end
1091
-
1092
- def data(project = @project)
1093
- self.class.data(api_version)[project]
1094
- end
1095
-
1096
- def reset_data
1097
- # not particularly useful because it deletes zones
1098
- self.class.data(api_version).delete(@project)
1099
- end
1100
-
1101
- def random_operation
1102
- "operation-#{Fog::Mock.random_numbers(13)}-#{Fog::Mock.random_hex(13)}-#{Fog::Mock.random_hex(8)}"
1103
- end
1104
- end
1105
-
1106
- class Real
1107
- include Fog::Google::Shared
1108
-
1109
- attr_accessor :client
1110
- attr_reader :compute, :extra_global_projects
1111
-
1112
- def initialize(options)
1113
- shared_initialize(options[:google_project], GOOGLE_COMPUTE_API_VERSION, GOOGLE_COMPUTE_BASE_URL)
1114
- options.merge!(:google_api_scope_url => GOOGLE_COMPUTE_API_SCOPE_URLS.join(" "))
1115
-
1116
- @client = initialize_google_client(options)
1117
- @compute = @client.discovered_api("compute", api_version)
1118
- @resourceviews = @client.discovered_api("resourceviews", "v1beta1")
1119
- @extra_global_projects = options[:google_extra_global_projects] || []
1120
- end
1121
- end
1122
-
1123
- RUNNING = "RUNNING"
1124
244
  end
1125
245
  end
1126
246
  end