google-cloud-storage 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b7f1798224baa310d43cdd64174d46389b6c66c
4
- data.tar.gz: 5cd8d77373e98f5858c430aa07592ec316bf0ab1
3
+ metadata.gz: 785ee684ed3d6225bea9ef029a33739162b73482
4
+ data.tar.gz: 795d5c813467496884077148427406a138086e3d
5
5
  SHA512:
6
- metadata.gz: 6e8caa5b4112ae3f8d8aad56157f612006eb6bb3944668c9e2f491449cf46d9fe834703863c8e372b237ad800aaa67cc60fbb92bc11662650814693127b08945
7
- data.tar.gz: 8b5272dfad3534f26db99f153bae01e2a25c5931eefe7897a4a8344bda30669a3f6525f4d85581d4277c0197a3f35fa3ff096d54e6f922c180c1a77508304d7f
6
+ metadata.gz: 8d943e560150efb216a55999bcf327277bccf5b12329a6b382147a16a29e1509e4c722c28993bf1cd626b88f51b4cec4d444b141df3881fea2595a7b4e45262c
7
+ data.tar.gz: 1a74ee5f03dff72f2ab1cdb7568bab73cb6b7d5ece7818f310712b8dff0e67e0e9eccfe2c178c36c1dd51763008b20f59d0f08c757a08ce159c47e26fce8717b
@@ -342,8 +342,9 @@ module Google
342
342
  ##
343
343
  # Indicates that a client accessing the bucket or a file it contains
344
344
  # must assume the transit costs related to the access. The requester
345
- # must pass the `user_project` option to {Project#bucket} to indicate
346
- # the project to which the access costs should be billed.
345
+ # must pass the `user_project` option to {Project#bucket} and
346
+ # {Project#buckets} to indicate the project to which the access costs
347
+ # should be billed.
347
348
  #
348
349
  # This feature is currently available only to whitelisted projects.
349
350
  #
@@ -359,8 +360,8 @@ module Google
359
360
  # Enables requester pays for the bucket. If enabled, a client accessing
360
361
  # the bucket or a file it contains must assume the transit costs related
361
362
  # to the access. The requester must pass the `user_project` option to
362
- # {Project#bucket} to indicate the project to which the access costs
363
- # should be billed.
363
+ # {Project#bucket} and {Project#buckets} to indicate the project to
364
+ # which the access costs should be billed.
364
365
  #
365
366
  # This feature is currently available only to whitelisted projects.
366
367
  #
@@ -376,7 +377,7 @@ module Google
376
377
  #
377
378
  # bucket.requester_pays = true # API call
378
379
  # # Other projects must now provide `user_project` option when calling
379
- # # Project#bucket to access this bucket.
380
+ # # Project#bucket or Project#buckets to access this bucket.
380
381
  #
381
382
  def requester_pays= new_requester_pays
382
383
  @gapi.billing ||= Google::Apis::StorageV1::Bucket::Billing.new
@@ -1211,10 +1212,10 @@ module Google
1211
1212
  # the notification. An optional list of additional attributes to
1212
1213
  # attach to each Cloud Pub/Sub message published for the notification
1213
1214
  # subscription.
1214
- # @param [Symbol, String] event_types The event types for the
1215
- # notification subscription. If provided, messages will only be sent
1216
- # for the listed event types. If empty, messages will be sent for all
1217
- # event types.
1215
+ # @param [Symbol, String, Array<Symbol, String>] event_types The event
1216
+ # types for the notification subscription. If provided, messages will
1217
+ # only be sent for the listed event types. If empty, messages will be
1218
+ # sent for all event types.
1218
1219
  #
1219
1220
  # Acceptable values are:
1220
1221
  #
@@ -1240,15 +1241,15 @@ module Google
1240
1241
  # @param [Symbol, String, Boolean] payload The desired content of the
1241
1242
  # Pub/Sub message payload. Acceptable values are:
1242
1243
  #
1243
- # * `true` or `:json` - The Pub/Sub message payload will be a UTF-8
1244
+ # * `:json` or `true` - The Pub/Sub message payload will be a UTF-8
1244
1245
  # string containing the [resource
1245
1246
  # representation](https://cloud.google.com/storage/docs/json_api/v1/objects#resource-representations)
1246
1247
  # of the file's metadata.
1247
- # * `false` or `:none` - No payload is included with the notification.
1248
+ # * `:none` or `false` - No payload is included with the notification.
1248
1249
  #
1249
1250
  # The default value is `:json`.
1250
1251
  #
1251
- # @return [Array<String>] The permissions held by the caller.
1252
+ # @return [Google::Cloud::Storage::Notification]
1252
1253
  #
1253
1254
  # @example
1254
1255
  # require "google/cloud/pubsub"
@@ -72,8 +72,9 @@ module Google
72
72
  return nil unless next?
73
73
  ensure_service!
74
74
  gapi = @service.list_buckets prefix: @prefix, token: @token,
75
- max: @max
76
- Bucket::List.from_gapi gapi, @service, @prefix, @max
75
+ max: @max, user_project: @user_project
76
+ Bucket::List.from_gapi gapi, @service, @prefix, @max,
77
+ user_project: @user_project
77
78
  end
78
79
 
79
80
  ##
@@ -144,14 +145,16 @@ module Google
144
145
  ##
145
146
  # @private New Bucket::List from a Google API Client
146
147
  # Google::Apis::StorageV1::Buckets object.
147
- def self.from_gapi gapi_list, service, prefix = nil, max = nil
148
+ def self.from_gapi gapi_list, service, prefix = nil, max = nil,
149
+ user_project: nil
148
150
  buckets = new(Array(gapi_list.items).map do |gapi_object|
149
- Bucket.from_gapi gapi_object, service
151
+ Bucket.from_gapi gapi_object, service, user_project: user_project
150
152
  end)
151
153
  buckets.instance_variable_set :@token, gapi_list.next_page_token
152
154
  buckets.instance_variable_set :@service, service
153
155
  buckets.instance_variable_set :@prefix, prefix
154
156
  buckets.instance_variable_set :@max, max
157
+ buckets.instance_variable_set :@user_project, user_project
155
158
  buckets
156
159
  end
157
160
 
@@ -55,24 +55,18 @@ module Google
55
55
  attr_accessor :service
56
56
 
57
57
  ##
58
- # A boolean value or a project ID string for a requester pays
59
- # bucket and its files. If this attribute is set to `true`, transit
60
- # costs for operations on the file will be billed to the current
61
- # project for this client. (See {Project#project} for the ID of the
62
- # current project.) If this attribute is set to a project ID, and that
63
- # project is authorized for the currently authenticated service account,
64
- # transit costs will be billed to the that project. The default is
65
- # `nil`.
58
+ # If this attribute is set to `true`, transit costs for operations on
59
+ # the file will be billed to the current project for this client. (See
60
+ # {Project#project} for the ID of the current project.) If this
61
+ # attribute is set to a project ID, and that project is authorized for
62
+ # the currently authenticated service account, transit costs will be
63
+ # billed to the that project. The default is `nil`.
66
64
  #
67
65
  # In general, this attribute should be set when first retrieving the
68
66
  # owning bucket by providing the `user_project` option to
69
- # {Project#bucket}.
67
+ # {Project#bucket} or {Project#buckets}.
70
68
  #
71
- # The requester pays feature is currently available only to whitelisted
72
- # projects.
73
- #
74
- # See also {Bucket#requester_pays=} and {Bucket#requester_pays} to
75
- # enable requester pays for a bucket.
69
+ # See also {Bucket#requester_pays=} and {Bucket#requester_pays}.
76
70
  #
77
71
  # @example Setting a non-default project:
78
72
  # require "google/cloud/storage"
@@ -24,10 +24,13 @@ module Google
24
24
  # Represents a Pub/Sub notification subscription for a Cloud Storage
25
25
  # bucket.
26
26
  #
27
+ # See {Bucket#create_notification}, {Bucket#notifications}, and
28
+ # {Bucket#notification}.
29
+ #
27
30
  # @see https://cloud.google.com/storage/docs/pubsub-notifications Cloud
28
31
  # Pub/Sub Notifications for Google Cloud
29
32
  #
30
- # @attr [String] bucket The name of the {Bucket} to which this
33
+ # @attr_reader [String] bucket The name of the {Bucket} to which this
31
34
  # notification belongs.
32
35
  #
33
36
  # @example
@@ -99,8 +102,8 @@ module Google
99
102
  end
100
103
 
101
104
  ##
102
- # The event types of this notification. If present, only send
103
- # notifications about listed event types. If empty, sent notifications
105
+ # The event types of this notification. If present, messages will only
106
+ # be sent for the listed event types. If empty, messages will be sent
104
107
  # for all event types.
105
108
  #
106
109
  # The following is a list of event types currently supported by Cloud
@@ -93,6 +93,19 @@ module Google
93
93
  # @param [String] token A previously-returned page token representing
94
94
  # part of the larger set of results to view.
95
95
  # @param [Integer] max Maximum number of buckets to return.
96
+ # @param [Boolean, String] user_project If this parameter is set to
97
+ # `true`, transit costs for operations on the enabled buckets or their
98
+ # files will be billed to the current project for this client. (See
99
+ # {#project} for the ID of the current project.) If this parameter is
100
+ # set to a project ID other than the current project, and that project
101
+ # is authorized for the currently authenticated service account,
102
+ # transit costs will be billed to the given project. The default is
103
+ # `nil`.
104
+ #
105
+ # The value provided will be applied to all operations on the returned
106
+ # bucket instances and their files.
107
+ #
108
+ # See also {Bucket#requester_pays=} and {Bucket#requester_pays}.
96
109
  #
97
110
  # @return [Array<Google::Cloud::Storage::Bucket>] (See
98
111
  # {Google::Cloud::Storage::Bucket::List})
@@ -127,9 +140,11 @@ module Google
127
140
  # puts bucket.name
128
141
  # end
129
142
  #
130
- def buckets prefix: nil, token: nil, max: nil
131
- gapi = service.list_buckets prefix: prefix, token: token, max: max
132
- Bucket::List.from_gapi gapi, service, prefix, max
143
+ def buckets prefix: nil, token: nil, max: nil, user_project: nil
144
+ gapi = service.list_buckets \
145
+ prefix: prefix, token: token, max: max, user_project: user_project
146
+ Bucket::List.from_gapi \
147
+ gapi, service, prefix, max, user_project: user_project
133
148
  end
134
149
  alias_method :find_buckets, :buckets
135
150
 
@@ -141,8 +156,7 @@ module Google
141
156
  # without verifying the bucket resource exists on the Storage service.
142
157
  # Calls made on this object will raise errors if the bucket resource
143
158
  # does not exist. Default is `false`.
144
- # @param [Boolean, String] user_project If the `requester_pays` flag is
145
- # enabled for the requested bucket, and if this parameter is set to
159
+ # @param [Boolean, String] user_project If this parameter is set to
146
160
  # `true`, transit costs for operations on the requested bucket or a
147
161
  # file it contains will be billed to the current project for this
148
162
  # client. (See {#project} for the ID of the current project.) If this
@@ -151,8 +165,8 @@ module Google
151
165
  # account, transit costs will be billed to the given project. The
152
166
  # default is `nil`.
153
167
  #
154
- # The requester pays feature is currently available only to
155
- # whitelisted projects.
168
+ # The value provided will be applied to all operations on the returned
169
+ # bucket instance and its files.
156
170
  #
157
171
  # See also {Bucket#requester_pays=} and {Bucket#requester_pays}.
158
172
  #
@@ -286,6 +300,16 @@ module Google
286
300
  # does not exist. For more information, see [How to Host a Static
287
301
  # Website
288
302
  # ](https://cloud.google.com/storage/docs/website-configuration#step4).
303
+ # @param [String] user_project If this parameter is set to a project ID
304
+ # other than the current project, and that project is authorized for
305
+ # the currently authenticated service account, transit costs will be
306
+ # billed to the given project. The default is `nil`.
307
+ #
308
+ # The value provided will be applied to all operations on the returned
309
+ # bucket instance and its files.
310
+ #
311
+ # See also {Bucket#requester_pays=} and {Bucket#requester_pays}.
312
+ #
289
313
  # @yield [bucket] a block for configuring the bucket before it is
290
314
  # created
291
315
  # @yieldparam [Bucket] cors the bucket object to be configured
@@ -317,7 +341,8 @@ module Google
317
341
  def create_bucket bucket_name, acl: nil, default_acl: nil,
318
342
  location: nil, storage_class: nil,
319
343
  logging_bucket: nil, logging_prefix: nil,
320
- website_main: nil, website_404: nil, versioning: nil
344
+ website_main: nil, website_404: nil, versioning: nil,
345
+ requester_pays: nil, user_project: nil
321
346
  new_bucket = Google::Apis::StorageV1::Bucket.new({
322
347
  name: bucket_name,
323
348
  location: location
@@ -330,13 +355,15 @@ module Google
330
355
  b.website_main = website_main unless website_main.nil?
331
356
  b.website_404 = website_404 unless website_404.nil?
332
357
  b.versioning = versioning unless versioning.nil?
358
+ b.requester_pays = requester_pays unless requester_pays.nil?
333
359
  end
334
360
  yield updater if block_given?
335
361
  updater.check_for_changed_labels!
336
362
  updater.check_for_mutable_cors!
337
363
  gapi = service.insert_bucket \
338
- new_bucket, acl: acl_rule(acl), default_acl: acl_rule(default_acl)
339
- Bucket.from_gapi gapi, service
364
+ new_bucket, acl: acl_rule(acl), default_acl: acl_rule(default_acl),
365
+ user_project: user_project
366
+ Bucket.from_gapi gapi, service, user_project: user_project
340
367
  end
341
368
 
342
369
  ##
@@ -64,10 +64,11 @@ module Google
64
64
 
65
65
  ##
66
66
  # Retrieves a list of buckets for the given project.
67
- def list_buckets prefix: nil, token: nil, max: nil
67
+ def list_buckets prefix: nil, token: nil, max: nil, user_project: nil
68
68
  execute do
69
- service.list_buckets @project, prefix: prefix, page_token: token,
70
- max_results: max
69
+ service.list_buckets \
70
+ @project, prefix: prefix, page_token: token, max_results: max,
71
+ user_project: user_project(user_project)
71
72
  end
72
73
  end
73
74
 
@@ -84,12 +85,14 @@ module Google
84
85
  ##
85
86
  # Creates a new bucket.
86
87
  # Returns Google::Apis::StorageV1::Bucket.
87
- def insert_bucket bucket_gapi, acl: nil, default_acl: nil
88
+ def insert_bucket bucket_gapi, acl: nil, default_acl: nil,
89
+ user_project: nil
88
90
  execute do
89
91
  service.insert_bucket \
90
92
  @project, bucket_gapi,
91
93
  predefined_acl: acl,
92
- predefined_default_object_acl: default_acl
94
+ predefined_default_object_acl: default_acl,
95
+ user_project: user_project(user_project)
93
96
  end
94
97
  end
95
98
 
@@ -471,8 +474,8 @@ module Google
471
474
  end
472
475
 
473
476
  # Pub/Sub notification subscription event_types
474
- def event_types arr
475
- arr.map { |x| event_type x } if arr
477
+ def event_types str_or_arr
478
+ Array(str_or_arr).map { |x| event_type x } if str_or_arr
476
479
  end
477
480
 
478
481
  # Pub/Sub notification subscription event_types
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Storage
19
- VERSION = "1.5.0"
19
+ VERSION = "1.6.0"
20
20
  end
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-storage
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Moore
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-09-26 00:00:00.000000000 Z
12
+ date: 2017-09-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-cloud-core
@@ -31,14 +31,14 @@ dependencies:
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: 0.13.0
34
+ version: 0.14.2
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: 0.13.0
41
+ version: 0.14.2
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: digest-crc
44
44
  requirement: !ruby/object:Gem::Requirement