fog-google 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/examples/get_list_snapshots.rb +1 -1
  3. data/examples/load-balance.rb +23 -4
  4. data/fog-google.gemspec +1 -1
  5. data/lib/fog/compute/google.rb +113 -112
  6. data/lib/fog/compute/google/models/images.rb +21 -6
  7. data/lib/fog/compute/google/models/instance_group.rb +38 -2
  8. data/lib/fog/compute/google/models/instance_groups.rb +13 -7
  9. data/lib/fog/compute/google/models/resource_view.rb +1 -1
  10. data/lib/fog/compute/google/requests/{add_instance_group_instance.rb → add_instance_group_instances.rb} +11 -7
  11. data/lib/fog/compute/google/requests/get_image_from_family.rb +35 -0
  12. data/lib/fog/compute/google/requests/insert_server.rb +4 -0
  13. data/lib/fog/compute/google/requests/list_instance_group_instances.rb +3 -3
  14. data/lib/fog/compute/google/requests/{remove_instance_group_instance.rb → remove_instance_group_instances.rb} +11 -7
  15. data/lib/fog/google/version.rb +1 -1
  16. data/lib/fog/storage/google_json.rb +1 -2
  17. data/lib/fog/storage/google_json/models/directories.rb +4 -5
  18. data/lib/fog/storage/google_json/models/file.rb +2 -2
  19. data/lib/fog/storage/google_json/real.rb +6 -7
  20. data/lib/fog/storage/google_json/requests/get_object_http_url.rb +1 -1
  21. data/lib/fog/storage/google_json/requests/get_object_url.rb +1 -1
  22. data/lib/fog/storage/google_json/requests/list_buckets.rb +32 -0
  23. data/lib/fog/storage/google_json/requests/put_bucket.rb +12 -6
  24. data/lib/fog/storage/google_xml.rb +0 -1
  25. data/lib/fog/storage/google_xml/models/file.rb +2 -2
  26. data/lib/fog/storage/google_xml/real.rb +1 -1
  27. data/lib/fog/storage/google_xml/requests/get_object_http_url.rb +1 -4
  28. data/lib/fog/storage/google_xml/requests/get_object_https_url.rb +0 -3
  29. data/lib/fog/storage/google_xml/requests/get_object_url.rb +0 -3
  30. data/lib/fog/storage/google_xml/requests/put_bucket.rb +1 -1
  31. data/tasks/console.rake +3 -5
  32. data/test/integration/compute/test_servers.rb +1 -1
  33. data/test/integration/factories/backend_services_factory.rb +2 -2
  34. data/test/integration/factories/forwarding_rules_factory.rb +3 -3
  35. data/test/integration/factories/global_forwarding_rules_factory.rb +2 -2
  36. data/test/integration/factories/images_factory.rb +2 -2
  37. data/test/integration/factories/servers_factory.rb +4 -4
  38. data/test/integration/factories/target_http_proxies_factory.rb +2 -2
  39. data/test/integration/factories/target_pools_factory.rb +4 -4
  40. data/test/integration/factories/url_maps_factory.rb +2 -2
  41. data/test/integration/storage/test_buckets.rb +2 -3
  42. data/test/integration/storage/test_directories.rb +3 -3
  43. data/test/integration/storage/test_objects.rb +5 -9
  44. metadata +9 -10
  45. data/lib/fog/storage/google_json/requests/get_object_torrent.rb +0 -13
  46. data/lib/fog/storage/google_json/requests/get_service.rb +0 -54
  47. data/lib/fog/storage/google_xml/requests/get_object_torrent.rb +0 -39
@@ -8,7 +8,7 @@ module Fog
8
8
  # * bucket_name<~String> - name of bucket to create
9
9
  # * options<~Hash> - config arguments for bucket. Defaults to {}.
10
10
  # * 'LocationConstraint'<~Symbol> - sets the location for the bucket
11
- # * 'x-amz-acl'<~String> - Permissions, must be in ['private', 'public-read', 'public-read-write', 'authenticated-read']
11
+ # * 'x-goog-acl'<~String> - The predefined access control list (ACL) that you want to apply to the bucket.
12
12
  #
13
13
  # ==== Returns
14
14
  # * response<~Excon::Response>:
data/tasks/console.rake CHANGED
@@ -3,10 +3,8 @@
3
3
 
4
4
  desc "Project IRB console"
5
5
  task :console do
6
- require "irb"
7
- require "irb/completion"
8
- require "fog/google"
9
- Fog.credential = :test
6
+ require "bundler"
7
+ Bundler.require(:default, :development)
10
8
  ARGV.clear
11
- IRB.start
9
+ Pry.start
12
10
  end
@@ -14,7 +14,7 @@ class TestServers < FogIntegrationTest
14
14
  instance = @subject.bootstrap(:name => resource_name)
15
15
  assert instance.ready?
16
16
  instance.wait_for { sshable? }
17
- assert_match /Linux/, instance.ssh("uname").first.stdout
17
+ assert_match(/Linux/, instance.ssh("uname").first.stdout)
18
18
  assert_equal instance.destroy.operation_type, "delete"
19
19
  Fog.wait_for { !@subject.all.map(&:identity).include? instance.identity }
20
20
  # XXX clean up after bootstrap's automatic creation of disks
@@ -13,7 +13,7 @@ class BackendServicesFactory < CollectionFactory
13
13
  end
14
14
 
15
15
  def params
16
- params = { :name => resource_name,
17
- :health_checks => [@http_health_checks.create.self_link] }
16
+ { :name => resource_name,
17
+ :health_checks => [@http_health_checks.create.self_link] }
18
18
  end
19
19
  end
@@ -13,8 +13,8 @@ class ForwardingRulesFactory < CollectionFactory
13
13
  end
14
14
 
15
15
  def params
16
- params = { :name => resource_name,
17
- :region => TEST_REGION,
18
- :target => @target_pools.create.self_link }
16
+ { :name => resource_name,
17
+ :region => TEST_REGION,
18
+ :target => @target_pools.create.self_link }
19
19
  end
20
20
  end
@@ -13,7 +13,7 @@ class GlobalForwardingRulesFactory < CollectionFactory
13
13
  end
14
14
 
15
15
  def params
16
- params = { :name => resource_name,
17
- :target => @targets.create.self_link }
16
+ { :name => resource_name,
17
+ :target => @targets.create.self_link }
18
18
  end
19
19
  end
@@ -6,7 +6,7 @@ class ImagesFactory < CollectionFactory
6
6
  end
7
7
 
8
8
  def params
9
- params = { :name => resource_name,
10
- :raw_disk => { :source => TEST_RAW_DISK_SOURCE } }
9
+ { :name => resource_name,
10
+ :raw_disk => { :source => TEST_RAW_DISK_SOURCE } }
11
11
  end
12
12
  end
@@ -13,9 +13,9 @@ class ServersFactory < CollectionFactory
13
13
  end
14
14
 
15
15
  def params
16
- params = { :name => resource_name,
17
- :zone_name => TEST_ZONE,
18
- :machine_type => TEST_MACHINE_TYPE,
19
- :disks => [@disks.create] }
16
+ { :name => resource_name,
17
+ :zone_name => TEST_ZONE,
18
+ :machine_type => TEST_MACHINE_TYPE,
19
+ :disks => [@disks.create] }
20
20
  end
21
21
  end
@@ -13,7 +13,7 @@ class TargetHttpProxiesFactory < CollectionFactory
13
13
  end
14
14
 
15
15
  def params
16
- params = { :name => resource_name,
17
- :url_map => @url_maps.create.self_link }
16
+ { :name => resource_name,
17
+ :url_map => @url_maps.create.self_link }
18
18
  end
19
19
  end
@@ -16,9 +16,9 @@ class TargetPoolsFactory < CollectionFactory
16
16
  end
17
17
 
18
18
  def params
19
- params = { :name => resource_name,
20
- :region => TEST_REGION,
21
- :instances => [@servers.create.self_link],
22
- :healthChecks => [@http_health_checks.create.self_link] }
19
+ { :name => resource_name,
20
+ :region => TEST_REGION,
21
+ :instances => [@servers.create.self_link],
22
+ :healthChecks => [@http_health_checks.create.self_link] }
23
23
  end
24
24
  end
@@ -13,7 +13,7 @@ class UrlMapsFactory < CollectionFactory
13
13
  end
14
14
 
15
15
  def params
16
- params = { :name => resource_name,
17
- :default_service => @backend_services.create.self_link }
16
+ { :name => resource_name,
17
+ :default_service => @backend_services.create.self_link }
18
18
  end
19
19
  end
@@ -2,7 +2,6 @@ require "helpers/integration_test_helper"
2
2
 
3
3
  class TestBuckets < FogIntegrationTest
4
4
  begin
5
- client_email = Fog.credentials[:google_client_email]
6
5
  @@connection = Fog::Storage::Google.new
7
6
  @@connection.delete_bucket("fog-smoke-test")
8
7
  rescue Exception => e
@@ -24,7 +23,7 @@ class TestBuckets < FogIntegrationTest
24
23
  end
25
24
 
26
25
  def test_put_bucket_acl
27
- response = @connection.put_bucket("fog-smoke-test", options = { "x-goog-acl" => "publicReadWrite" })
26
+ response = @connection.put_bucket("fog-smoke-test", options: { "x-goog-acl" => "publicReadWrite" })
28
27
  assert_equal response.status, 200
29
28
  acl = { :entity => "domain-google.com",
30
29
  :role => "READER" }
@@ -48,7 +47,7 @@ class TestBuckets < FogIntegrationTest
48
47
 
49
48
  def test_get_bucket_acl
50
49
  response = @connection.put_bucket("fog-smoke-test",
51
- options = { "acl" => [{ :entity => "user-fake@developer.gserviceaccount.com", :role => "OWNER" }] })
50
+ options: { "acl" => [{ :entity => "user-fake@developer.gserviceaccount.com", :role => "OWNER" }] })
52
51
  assert_equal response.status, 200
53
52
  response = @connection.get_bucket_acl("fog-smoke-test")
54
53
  assert_equal response.status, 200
@@ -4,7 +4,7 @@ class TestDirectories < FogIntegrationTest
4
4
  begin
5
5
  client_email = Fog.credentials[:google_client_email]
6
6
  @@connection = Fog::Storage::Google.new
7
- @@connection.put_bucket("fog-smoke-test", options = { "acl" => [{ :entity => "user-" + client_email, :role => "OWNER" }] })
7
+ @@connection.put_bucket("fog-smoke-test", options: { "acl" => [{ :entity => "user-" + client_email, :role => "OWNER" }] })
8
8
  @@connection.put_bucket_acl("fog-smoke-test", :entity => "allUsers", :role => "READER")
9
9
  @@directory = @@connection.directories.get("fog-smoke-test")
10
10
  rescue Exception => e
@@ -42,8 +42,8 @@ class TestDirectories < FogIntegrationTest
42
42
 
43
43
  def test_public_url
44
44
  public_url = @directory.public_url
45
- assert_match /storage\.googleapis\.com/, public_url
46
- assert_match /fog-smoke-test/, public_url
45
+ assert_match(/storage\.googleapis\.com/, public_url)
46
+ assert_match(/fog-smoke-test/, public_url)
47
47
  end
48
48
 
49
49
  def test_public
@@ -5,7 +5,7 @@ class TestObjects < FogIntegrationTest
5
5
  @connection = Fog::Storage::Google.new
6
6
 
7
7
  begin
8
- @connection.put_bucket("fog-smoke-test", options = { "x-goog-acl" => "publicReadWrite" })
8
+ @connection.put_bucket("fog-smoke-test", options: { "x-goog-acl" => "publicReadWrite" })
9
9
  rescue
10
10
  end
11
11
  end
@@ -85,12 +85,12 @@ class TestObjects < FogIntegrationTest
85
85
 
86
86
  def test_get_object_https_url
87
87
  skip
88
- response = @connection.put_object("fog-smoke-test", "my file", "THISISATESTFILE", options = { :predefinedAcl => "publicRead" })
88
+ response = @connection.put_object("fog-smoke-test", "my file", "THISISATESTFILE", options: { :predefinedAcl => "publicRead" })
89
89
  assert_equal response.status, 200
90
90
  https_url = @connection.get_object_https_url("fog-smoke-test", "my file")
91
- assert_match /https/, https_url
92
- assert_match /fog-smoke-test/, https_url
93
- assert_match /my%20file/, https_url
91
+ assert_match(/https/, https_url)
92
+ assert_match(/fog-smoke-test/, https_url)
93
+ assert_match(/my%20file/, https_url)
94
94
  end
95
95
 
96
96
  def test_get_object_url
@@ -101,10 +101,6 @@ class TestObjects < FogIntegrationTest
101
101
  assert_equal https_url, "https://www.googleapis.com/storage/v1/b/fog-smoke-test/o/my%20file"
102
102
  end
103
103
 
104
- def test_get_object_torrent
105
- skip
106
- end
107
-
108
104
  def test_head_object
109
105
  skip
110
106
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-google
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nat Welch
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-05-23 00:00:00.000000000 Z
14
+ date: 2016-08-30 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: fog-core
@@ -61,14 +61,14 @@ dependencies:
61
61
  requirements:
62
62
  - - "~>"
63
63
  - !ruby/object:Gem::Version
64
- version: 0.8.6
64
+ version: 0.8.7
65
65
  type: :development
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
69
  - - "~>"
70
70
  - !ruby/object:Gem::Version
71
- version: 0.8.6
71
+ version: 0.8.7
72
72
  - !ruby/object:Gem::Dependency
73
73
  name: rake
74
74
  requirement: !ruby/object:Gem::Requirement
@@ -300,7 +300,7 @@ files:
300
300
  - lib/fog/compute/google/models/zones.rb
301
301
  - lib/fog/compute/google/real.rb
302
302
  - lib/fog/compute/google/requests/add_backend_service_backends.rb
303
- - lib/fog/compute/google/requests/add_instance_group_instance.rb
303
+ - lib/fog/compute/google/requests/add_instance_group_instances.rb
304
304
  - lib/fog/compute/google/requests/add_region_view_resources.rb
305
305
  - lib/fog/compute/google/requests/add_server_access_config.rb
306
306
  - lib/fog/compute/google/requests/add_target_pool_health_checks.rb
@@ -346,6 +346,7 @@ files:
346
346
  - lib/fog/compute/google/requests/get_global_operation.rb
347
347
  - lib/fog/compute/google/requests/get_http_health_check.rb
348
348
  - lib/fog/compute/google/requests/get_image.rb
349
+ - lib/fog/compute/google/requests/get_image_from_family.rb
349
350
  - lib/fog/compute/google/requests/get_instance_group.rb
350
351
  - lib/fog/compute/google/requests/get_machine_type.rb
351
352
  - lib/fog/compute/google/requests/get_network.rb
@@ -424,7 +425,7 @@ files:
424
425
  - lib/fog/compute/google/requests/list_zone_view_resources.rb
425
426
  - lib/fog/compute/google/requests/list_zone_views.rb
426
427
  - lib/fog/compute/google/requests/list_zones.rb
427
- - lib/fog/compute/google/requests/remove_instance_group_instance.rb
428
+ - lib/fog/compute/google/requests/remove_instance_group_instances.rb
428
429
  - lib/fog/compute/google/requests/remove_target_pool_health_checks.rb
429
430
  - lib/fog/compute/google/requests/remove_target_pool_instance.rb
430
431
  - lib/fog/compute/google/requests/remove_target_pool_instances.rb
@@ -559,10 +560,9 @@ files:
559
560
  - lib/fog/storage/google_json/requests/get_object_acl.rb
560
561
  - lib/fog/storage/google_json/requests/get_object_http_url.rb
561
562
  - lib/fog/storage/google_json/requests/get_object_https_url.rb
562
- - lib/fog/storage/google_json/requests/get_object_torrent.rb
563
563
  - lib/fog/storage/google_json/requests/get_object_url.rb
564
- - lib/fog/storage/google_json/requests/get_service.rb
565
564
  - lib/fog/storage/google_json/requests/head_object.rb
565
+ - lib/fog/storage/google_json/requests/list_buckets.rb
566
566
  - lib/fog/storage/google_json/requests/put_bucket.rb
567
567
  - lib/fog/storage/google_json/requests/put_bucket_acl.rb
568
568
  - lib/fog/storage/google_json/requests/put_object.rb
@@ -585,7 +585,6 @@ files:
585
585
  - lib/fog/storage/google_xml/requests/get_object_acl.rb
586
586
  - lib/fog/storage/google_xml/requests/get_object_http_url.rb
587
587
  - lib/fog/storage/google_xml/requests/get_object_https_url.rb
588
- - lib/fog/storage/google_xml/requests/get_object_torrent.rb
589
588
  - lib/fog/storage/google_xml/requests/get_object_url.rb
590
589
  - lib/fog/storage/google_xml/requests/get_service.rb
591
590
  - lib/fog/storage/google_xml/requests/head_object.rb
@@ -720,7 +719,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
720
719
  version: '0'
721
720
  requirements: []
722
721
  rubyforge_project:
723
- rubygems_version: 2.2.5
722
+ rubygems_version: 2.4.8
724
723
  signing_key:
725
724
  specification_version: 4
726
725
  summary: Module for the 'fog' gem to support Google.
@@ -1,13 +0,0 @@
1
- module Fog
2
- module Storage
3
- class GoogleJSON
4
- class Real
5
- # Get torrent for an Google Storage object
6
- # * Deprecated
7
- def get_object_torrent(_bucket_name, _object_name)
8
- Fog::Logger.deprecation("Fog::Storage::Google => ##{get_object_torrent} is deprecated.[/] [light_black](#{caller.first})")
9
- end
10
- end
11
- end
12
- end
13
- end
@@ -1,54 +0,0 @@
1
- module Fog
2
- module Storage
3
- class GoogleJSON
4
- class Real
5
- # TODO: Implement in JSON API
6
-
7
- # List information about Google Storage buckets for authorized user
8
- #
9
- # ==== Returns
10
- # * response<~Excon::Response>:
11
- # * body<~Hash>:
12
- # * 'Buckets'<~Hash>:
13
- # * 'Name'<~String> - Name of bucket
14
- # * 'CreationTime'<~Time> - Timestamp of bucket creation
15
- # * 'Owner'<~Hash>:
16
- # * 'DisplayName'<~String> - Display name of bucket owner
17
- # * 'ID'<~String> - Id of bucket owner
18
- def get_service
19
- # api_method = @storage_json.buckets.list
20
- # parameters = {
21
- # "project" => Fog.credentials[:google_project],
22
- # "maxResults" => 9999
23
- # }
24
-
25
- # request(api_method, parameters)
26
-
27
- # request(:expects => 200,
28
- # :headers => {},
29
- # :host => @host,
30
- # :idempotent => true,
31
- # :method => "GET",
32
- # :parser => Fog::Parsers::Storage::Google::GetService.new)
33
- end
34
- end
35
-
36
- class Mock
37
- def get_service
38
- # response = Excon::Response.new
39
- # response.headers["Status"] = 200
40
- # buckets = data[:buckets].values.map do |bucket|
41
- # bucket.reject do |key, _value|
42
- # !%w(CreationDate Name).include?(key)
43
- # end
44
- # end
45
- # response.body = {
46
- # "Buckets" => buckets,
47
- # "Owner" => { "ID" => "some_id" }
48
- # }
49
- # response
50
- end
51
- end
52
- end
53
- end
54
- end
@@ -1,39 +0,0 @@
1
- module Fog
2
- module Storage
3
- class GoogleXML
4
- class Real
5
- # Get torrent for an Google Storage object
6
- #
7
- # ==== Parameters
8
- # * bucket_name<~String> - name of bucket containing object
9
- # * object_name<~String> - name of object to get torrent for
10
- #
11
- # ==== Returns
12
- # * response<~Excon::Response>:
13
- # * body<~Hash>:
14
- # * 'AccessControlPolicy'<~Hash>
15
- # * 'Owner'<~Hash>:
16
- # * 'DisplayName'<~String> - Display name of object owner
17
- # * 'ID'<~String> - Id of object owner
18
- # * 'AccessControlList'<~Array>:
19
- # * 'Grant'<~Hash>:
20
- # * 'Grantee'<~Hash>:
21
- # * 'DisplayName'<~String> - Display name of grantee
22
- # * 'ID'<~String> - Id of grantee
23
- # * 'Permission'<~String> - Permission, in [FULL_CONTROL, WRITE, WRITE_ACP, READ, READ_ACP]
24
- #
25
- def get_object_torrent(bucket_name, object_name)
26
- raise ArgumentError.new("bucket_name is required") unless bucket_name
27
- raise ArgumentError.new("object_name is required") unless object_name
28
- request(:expects => 200,
29
- :headers => {},
30
- :host => "#{bucket_name}.#{@host}",
31
- :idempotent => true,
32
- :method => "GET",
33
- :path => Fog::Google.escape(object_name),
34
- :query => { "torrent" => nil })
35
- end
36
- end
37
- end
38
- end
39
- end