google-cloud-storage 1.43.0 → 1.45.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
  SHA256:
3
- metadata.gz: c5dbc607cd09b7198bb96445d9ed85ef7b883a88660f4d320602837bbc543fc0
4
- data.tar.gz: 33ee9b85da98c870e73b0bfc6126087c59925693997c14b7c61e59ad652f551e
3
+ metadata.gz: 1a00be88dfffe243057e1ffe70891fabb483caadc76a7a37e8b82dcdb5f95395
4
+ data.tar.gz: 2190d664457e1419b26b95266d8911728a612647d404790b35f37586dfe59e02
5
5
  SHA512:
6
- metadata.gz: 7d70f656ac06a5c65b75a99883aa4298222dbf4cf2b9a9fbfa252d2c7800486bf1e7bf77b50ea0d64431dc50008f680b0525c0fb619f7244508fad07862941a8
7
- data.tar.gz: c4af126c15814b8a02e17282cb940067b2cd10e6cf5081b4c525a91e8993b7b717ab877d26c545ea5b7d66e0213e4edb7e65df8826369f21fa400017a6298f02
6
+ metadata.gz: e5b129dba88921e6aeec6476d60bb17ee603f0cb641194bbeb09531aff568c2290e17ab3f0f290d87976a0b0f35d4f10674dab8fea6deef70d424738a4ce767c
7
+ data.tar.gz: 87e4411cda889bb7bdbf0ccddc2a343ae475614c5cab19d8461bcd646ac78016b6be35975255e14c1af1efcd3c5087c9b769b674260a82f936ef4c0456566a19
data/AUTHENTICATION.md CHANGED
@@ -112,15 +112,6 @@ those that produce
112
112
  post objects. For these methods, authentication using a service account JSON key file
113
113
  is required.
114
114
 
115
- [gce-how-to]: https://cloud.google.com/compute/docs/authentication#using
116
- [dev-console]: https://console.cloud.google.com/project
117
-
118
- [enable-apis]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/enable-apis.png
119
-
120
- [create-new-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account.png
121
- [create-new-service-account-existing-keys]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account-existing-keys.png
122
- [reuse-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/reuse-service-account.png
123
-
124
115
  ## Creating a Service Account
125
116
 
126
117
  Google Cloud requires a **Project ID** and **Service Account Credentials** to
@@ -130,31 +121,22 @@ connect to most services with google-cloud-storage.
130
121
  If you are not running this client on Google Compute Engine, you need a Google
131
122
  Developers service account.
132
123
 
133
- 1. Visit the [Google Developers Console][dev-console].
124
+ 1. Visit the [Google Cloud Console](https://console.cloud.google.com/project).
134
125
  1. Create a new project or click on an existing project.
135
- 1. Activate the slide-out navigation tray and select **API Manager**. From
126
+ 1. Activate the menu in the upper left and select **APIs & Services**. From
136
127
  here, you will enable the APIs that your application requires.
137
128
 
138
- ![Enable the APIs that your application requires][enable-apis]
139
-
140
129
  *Note: You may need to enable billing in order to use these services.*
141
130
 
142
131
  1. Select **Credentials** from the side navigation.
143
132
 
144
- You should see a screen like one of the following.
145
-
146
- ![Create a new service account][create-new-service-account]
147
-
148
- ![Create a new service account With Existing Keys][create-new-service-account-existing-keys]
149
-
150
- Find the "Add credentials" drop down and select "Service account" to be
151
- guided through downloading a new JSON key file.
152
-
153
- If you want to re-use an existing service account, you can easily generate a
154
- new key file. Just select the account you wish to re-use, and click "Generate
155
- new JSON key":
133
+ Find the "Create credentials" drop down near the top of the page, and select
134
+ "Service account" to be guided through downloading a new JSON key file.
156
135
 
157
- ![Re-use an existing service account][reuse-service-account]
136
+ If you want to re-use an existing service account, you can easily generate
137
+ a new key file. Just select the account you wish to re-use click the pencil
138
+ tool on the right side to edit the service account, select the **Keys** tab,
139
+ and then select **Add Key**.
158
140
 
159
141
  The key file you download will be used by this library to authenticate API
160
142
  requests and should be stored in a secure location.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Release History
2
2
 
3
+ ### 1.45.0 (2023-11-06)
4
+
5
+ #### Features
6
+
7
+ * added autoclass v2.1 features ([#23483](https://github.com/googleapis/google-cloud-ruby/issues/23483))
8
+
9
+ ### 1.44.0 (2022-11-02)
10
+
11
+ #### Features
12
+
13
+ * support autoclass
14
+
3
15
  ### 1.43.0 (2022-09-30)
4
16
 
5
17
  #### Features
@@ -109,6 +109,15 @@ module Google
109
109
  @gapi.id
110
110
  end
111
111
 
112
+ ##
113
+ # The autoclass configuration of the bucket
114
+ #
115
+ # @return [Google::Apis::StorageV1::Bucket::Autoclass]
116
+ #
117
+ def autoclass
118
+ @gapi.autoclass
119
+ end
120
+
112
121
  ##
113
122
  # The name of the bucket.
114
123
  #
@@ -407,6 +416,77 @@ module Google
407
416
  patch_gapi! :storage_class
408
417
  end
409
418
 
419
+ ##
420
+ # Whether Autoclass is enabled for the bucket.
421
+ #
422
+ # @return [Boolean]
423
+ #
424
+ def autoclass_enabled
425
+ @gapi.autoclass&.enabled?
426
+ end
427
+
428
+ ##
429
+ # Toggle time of the autoclass
430
+ #
431
+ # @return [DateTime]
432
+ #
433
+ def autoclass_toggle_time
434
+ @gapi.autoclass&.toggle_time
435
+ end
436
+
437
+ ##
438
+ # Terminal Storage class of the autoclass
439
+ #
440
+ # @return [String]
441
+ #
442
+ def autoclass_terminal_storage_class
443
+ @gapi.autoclass&.terminal_storage_class
444
+ end
445
+
446
+ ##
447
+ # Update time at which the autoclass terminal storage class was last modified
448
+ #
449
+ # @return [DateTime]
450
+ #
451
+ def autoclass_terminal_storage_class_update_time
452
+ @gapi.autoclass&.terminal_storage_class_update_time
453
+ end
454
+
455
+ ##
456
+ # Updates bucket's autoclass configuration. This defines the default class for objects in the
457
+ # bucket and down/up-grades the storage class of objects based on the access patterns.
458
+ # Accepted values are `:false`, and `:true`.
459
+ #
460
+ # For more information, see [Storage
461
+ # Classes](https://cloud.google.com/storage/docs/using-autoclass).
462
+ #
463
+ # @param [Boolean] toggle for autoclass configuration of the bucket.
464
+ #
465
+ def autoclass_enabled= toggle
466
+ @gapi.autoclass ||= API::Bucket::Autoclass.new
467
+ @gapi.autoclass.enabled = toggle
468
+ patch_gapi! :autoclass
469
+ end
470
+
471
+ ##
472
+ # Update method to update all attributes of autoclass of a bucket
473
+ # It accepts params as a Hash of attributes in the following format:
474
+ #
475
+ # { enabled: true, terminal_storage_class: "ARCHIVE" }
476
+ #
477
+ # terminal_storage_class field is optional. It defaults to `NEARLINE`.
478
+ # Valid terminal_storage_class values are `NEARLINE` and `ARCHIVE`.
479
+ #
480
+ # @param [Hash(String => String)] autoclass_attributes
481
+ #
482
+ def update_autoclass autoclass_attributes
483
+ @gapi.autoclass ||= API::Bucket::Autoclass.new
484
+ autoclass_attributes.each do |k, v|
485
+ @gapi.autoclass.send "#{k}=", v
486
+ end
487
+ patch_gapi! :autoclass
488
+ end
489
+
410
490
  ##
411
491
  # Whether [Object
412
492
  # Versioning](https://cloud.google.com/storage/docs/object-versioning)
@@ -94,6 +94,41 @@ module Google
94
94
  service.project_service_account.email_address
95
95
  end
96
96
 
97
+ ##
98
+ # Add custom Google extension headers to the requests that use the signed URLs.
99
+ #
100
+ # @param [Hash] headers Google extension headers (custom HTTP headers that
101
+ # begin with `x-goog-`) to be included in requests that use the signed URLs.
102
+ # Provide headers as a key/value array, where the key is
103
+ # the header name, and the value is an array of header values.
104
+ # For headers with multiple values, provide values as a simple
105
+ # array, or a comma-separated string. For a reference of allowed
106
+ # headers, see [Reference Headers](https://cloud.google.com/storage/docs/xml-api/reference-headers).
107
+ #
108
+ # @return [Google::Cloud::Storage::Project] Returns the Project for method chaining
109
+ #
110
+ def add_custom_headers headers
111
+ @service.add_custom_headers headers
112
+ self
113
+ end
114
+
115
+ ##
116
+ # Add custom Google extension header to the requests that use the signed URLs.
117
+ #
118
+ # @param [String] header_name Name of Google extension header (custom HTTP header that
119
+ # begin with `x-goog-`) to be included in requests that use the signed URLs.
120
+ # For a reference of allowed headers, see
121
+ # [Reference Headers](https://cloud.google.com/storage/docs/xml-api/reference-headers).
122
+ # @param [Object] header_value Valid value of the Google extension header being added.
123
+ # For headers with multiple values, provide values as a simple array, or a comma-separated string.
124
+ #
125
+ # @return [Google::Cloud::Storage::Project] Returns the Project for method chaining
126
+ #
127
+ def add_custom_header header_name, header_value
128
+ @service.add_custom_header header_name, header_value
129
+ self
130
+ end
131
+
97
132
  ##
98
133
  # Retrieves a list of buckets for the given project.
99
134
  #
@@ -327,6 +362,11 @@ module Google
327
362
  # other than the current project, and that project is authorized for
328
363
  # the currently authenticated service account, transit costs will be
329
364
  # billed to the given project. The default is `nil`.
365
+ # @param [Boolean] autoclass_enabled The bucket's autoclass configuration.
366
+ # Buckets can have either StorageClass OLM rules or Autoclass, but
367
+ # not both. When Autoclass is enabled on a bucket, adding StorageClass
368
+ # OLM rules will result in failure. For more information, see
369
+ # [Autoclass](https://cloud.google.com/storage/docs/autoclass).
330
370
  #
331
371
  # The value provided will be applied to all operations on the returned
332
372
  # bucket instance and its files.
@@ -375,7 +415,8 @@ module Google
375
415
  website_404: nil,
376
416
  versioning: nil,
377
417
  requester_pays: nil,
378
- user_project: nil
418
+ user_project: nil,
419
+ autoclass_enabled: false
379
420
  params = {
380
421
  name: bucket_name,
381
422
  location: location,
@@ -386,6 +427,7 @@ module Google
386
427
  updater = Bucket::Updater.new(new_bucket).tap do |b|
387
428
  b.logging_bucket = logging_bucket unless logging_bucket.nil?
388
429
  b.logging_prefix = logging_prefix unless logging_prefix.nil?
430
+ b.autoclass_enabled = autoclass_enabled
389
431
  b.storage_class = storage_class unless storage_class.nil?
390
432
  b.website_main = website_main unless website_main.nil?
391
433
  b.website_404 = website_404 unless website_404.nil?
@@ -43,7 +43,7 @@ module Google
43
43
  timeout: nil, open_timeout: nil, read_timeout: nil,
44
44
  send_timeout: nil, host: nil, quota_project: nil,
45
45
  max_elapsed_time: nil, base_interval: nil, max_interval: nil,
46
- multiplier: nil
46
+ multiplier: nil, upload_chunk_size: nil
47
47
  @project = project
48
48
  @credentials = credentials
49
49
  @service = API::StorageService.new
@@ -65,6 +65,7 @@ module Google
65
65
  @service.request_options.max_interval = max_interval if max_interval
66
66
  @service.request_options.multiplier = multiplier if multiplier
67
67
  @service.request_options.add_invocation_id_header = true
68
+ @service.request_options.upload_chunk_size = upload_chunk_size if upload_chunk_size
68
69
  @service.authorization = @credentials.client if @credentials
69
70
  @service.root_url = host if host
70
71
  end
@@ -794,6 +795,18 @@ module Google
794
795
  "#{self.class}(#{@project})"
795
796
  end
796
797
 
798
+ ##
799
+ # Add custom Google extension headers to the requests that use the signed URLs.
800
+ def add_custom_headers headers
801
+ @service.request_options.header.merge! headers
802
+ end
803
+
804
+ ##
805
+ # Add custom Google extension header to the requests that use the signed URLs.
806
+ def add_custom_header header_name, header_value
807
+ @service.request_options.header[header_name] = header_value
808
+ end
809
+
797
810
  protected
798
811
 
799
812
  def user_project user_project
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Storage
19
- VERSION = "1.43.0".freeze
19
+ VERSION = "1.45.0".freeze
20
20
  end
21
21
  end
22
22
  end
@@ -67,6 +67,9 @@ module Google
67
67
  # @param [Integer] send_timeout How long, in seconds, before receiving response from server times out. Optional.
68
68
  # @param [String] endpoint Override of the endpoint host name. Optional.
69
69
  # If the param is nil, uses the default endpoint.
70
+ # @param [Integer] upload_chunk_size The chunk size of storage upload, in bytes.
71
+ # The default value is 100 MB, i.e. 104_857_600 bytes. To disable chunking and upload
72
+ # the complete file regardless of size, pass 0 as the chunk size.
70
73
  # @param [String] project Alias for the `project_id` argument. Deprecated.
71
74
  # @param [String] keyfile Alias for the `credentials` argument.
72
75
  # Deprecated.
@@ -89,7 +92,7 @@ module Google
89
92
  timeout: nil, open_timeout: nil, read_timeout: nil,
90
93
  send_timeout: nil, endpoint: nil, project: nil, keyfile: nil,
91
94
  max_elapsed_time: nil, base_interval: nil, max_interval: nil,
92
- multiplier: nil
95
+ multiplier: nil, upload_chunk_size: nil
93
96
  scope ||= configure.scope
94
97
  retries ||= configure.retries
95
98
  timeout ||= configure.timeout
@@ -102,6 +105,7 @@ module Google
102
105
  base_interval ||= configure.base_interval
103
106
  max_interval ||= configure.max_interval
104
107
  multiplier ||= configure.multiplier
108
+ upload_chunk_size ||= configure.upload_chunk_size
105
109
 
106
110
  unless credentials.is_a? Google::Auth::Credentials
107
111
  credentials = Storage::Credentials.new credentials, scope: scope
@@ -117,7 +121,7 @@ module Google
117
121
  read_timeout: read_timeout, send_timeout: send_timeout,
118
122
  host: endpoint, quota_project: configure.quota_project,
119
123
  max_elapsed_time: max_elapsed_time, base_interval: base_interval,
120
- max_interval: max_interval, multiplier: multiplier
124
+ max_interval: max_interval, multiplier: multiplier, upload_chunk_size: upload_chunk_size
121
125
  )
122
126
  )
123
127
  end
@@ -141,6 +145,9 @@ module Google
141
145
  # @param [Integer] send_timeout How long, in seconds, before receiving response from server times out. Optional.
142
146
  # @param [String] endpoint Override of the endpoint host name. Optional.
143
147
  # If the param is nil, uses the default endpoint.
148
+ # @param [Integer] upload_chunk_size The chunk size of storage upload, in bytes.
149
+ # The default value is 100 MB, i.e. 104_857_600 bytes. To disable chunking and upload
150
+ # the complete file regardless of size, pass 0 as the chunk size.
144
151
  #
145
152
  # @return [Google::Cloud::Storage::Project]
146
153
  #
@@ -159,7 +166,7 @@ module Google
159
166
  def self.anonymous retries: nil, timeout: nil, open_timeout: nil,
160
167
  read_timeout: nil, send_timeout: nil, endpoint: nil,
161
168
  max_elapsed_time: nil, base_interval: nil, max_interval: nil,
162
- multiplier: nil
169
+ multiplier: nil, upload_chunk_size: nil
163
170
  open_timeout ||= timeout
164
171
  read_timeout ||= timeout
165
172
  send_timeout ||= timeout
@@ -168,7 +175,7 @@ module Google
168
175
  nil, nil, retries: retries, timeout: timeout, open_timeout: open_timeout,
169
176
  read_timeout: read_timeout, send_timeout: send_timeout, host: endpoint,
170
177
  max_elapsed_time: max_elapsed_time, base_interval: base_interval,
171
- max_interval: max_interval, multiplier: multiplier
178
+ max_interval: max_interval, multiplier: multiplier, upload_chunk_size: upload_chunk_size
172
179
  )
173
180
  )
174
181
  end
@@ -202,6 +209,7 @@ module Google
202
209
  # * `open_timeout` - (Integer) How long, in seconds, before failed connections time out.
203
210
  # * `read_timeout` - (Integer) How long, in seconds, before requests time out.
204
211
  # * `send_timeout` - (Integer) How long, in seconds, before receiving response from server times out.
212
+ # * `upload_chunk_size` - (Integer) The chunk size of storage upload, in bytes.
205
213
  #
206
214
  # @return [Google::Cloud::Config] The configuration object the
207
215
  # Google::Cloud::Storage library uses.
@@ -55,6 +55,9 @@ module Google
55
55
  # @param [Integer] open_timeout How long, in seconds, before failed connections time out. Optional.
56
56
  # @param [Integer] read_timeout How long, in seconds, before requests time out. Optional.
57
57
  # @param [Integer] send_timeout How long, in seconds, before receiving response from server times out. Optional.
58
+ # @param [Integer] upload_chunk_size The chunk size of storage upload, in bytes.
59
+ # The default value is 100 MB, i.e. 104_857_600 bytes. To disable chunking and upload
60
+ # the complete file regardless of size, pass 0 as the chunk size.
58
61
  #
59
62
  # @return [Google::Cloud::Storage::Project]
60
63
  #
@@ -74,7 +77,7 @@ module Google
74
77
  # readonly_storage = gcloud.storage scope: readonly_scope
75
78
  #
76
79
  def storage scope: nil, retries: nil, timeout: nil, open_timeout: nil, read_timeout: nil, send_timeout: nil,
77
- max_elapsed_time: nil, base_interval: nil, max_interval: nil, multiplier: nil
80
+ max_elapsed_time: nil, base_interval: nil, max_interval: nil, multiplier: nil, upload_chunk_size: nil
78
81
  Google::Cloud.storage @project, @keyfile, scope: scope,
79
82
  retries: (retries || @retries),
80
83
  timeout: (timeout || @timeout),
@@ -84,7 +87,8 @@ module Google
84
87
  max_elapsed_time: max_elapsed_time,
85
88
  base_interval: base_interval,
86
89
  max_interval: max_interval,
87
- multiplier: multiplier
90
+ multiplier: multiplier,
91
+ upload_chunk_size: upload_chunk_size
88
92
  end
89
93
 
90
94
  ##
@@ -120,6 +124,9 @@ module Google
120
124
  # @param [Integer] open_timeout How long, in seconds, before failed connections time out. Optional.
121
125
  # @param [Integer] read_timeout How long, in seconds, before requests time out. Optional.
122
126
  # @param [Integer] send_timeout How long, in seconds, before receiving response from server times out. Optional.
127
+ # @param [Integer] upload_chunk_size The chunk size of storage upload, in bytes.
128
+ # The default value is 100 MB, i.e. 104_857_600 bytes. To disable chunking and upload
129
+ # the complete file regardless of size, pass 0 as the chunk size.
123
130
  #
124
131
  # @return [Google::Cloud::Storage::Project]
125
132
  #
@@ -134,7 +141,8 @@ module Google
134
141
  #
135
142
  def self.storage project_id = nil, credentials = nil, scope: nil,
136
143
  retries: nil, timeout: nil, open_timeout: nil, read_timeout: nil, send_timeout: nil,
137
- max_elapsed_time: nil, base_interval: nil, max_interval: nil, multiplier: nil
144
+ max_elapsed_time: nil, base_interval: nil, max_interval: nil, multiplier: nil,
145
+ upload_chunk_size: nil
138
146
  require "google/cloud/storage"
139
147
  Google::Cloud::Storage.new project_id: project_id,
140
148
  credentials: credentials,
@@ -147,7 +155,8 @@ module Google
147
155
  max_elapsed_time: max_elapsed_time,
148
156
  base_interval: base_interval,
149
157
  max_interval: max_interval,
150
- multiplier: multiplier
158
+ multiplier: multiplier,
159
+ upload_chunk_size: upload_chunk_size
151
160
  end
152
161
  end
153
162
  end
@@ -182,6 +191,7 @@ Google::Cloud.configure.add_config! :storage do |config|
182
191
  config.add_field! :open_timeout, nil, match: Integer
183
192
  config.add_field! :read_timeout, nil, match: Integer
184
193
  config.add_field! :send_timeout, nil, match: Integer
194
+ config.add_field! :upload_chunk_size, nil, match: Integer
185
195
  # TODO: Remove once discovery document is updated.
186
196
  config.add_field! :endpoint, "https://storage.googleapis.com/", match: String
187
197
  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.43.0
4
+ version: 1.45.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: 2022-09-30 00:00:00.000000000 Z
12
+ date: 2023-11-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-cloud-core
@@ -45,14 +45,14 @@ dependencies:
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: 0.19.0
48
+ version: 0.29.0
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: 0.19.0
55
+ version: 0.29.0
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: googleauth
58
58
  requirement: !ruby/object:Gem::Requirement
@@ -255,6 +255,20 @@ dependencies:
255
255
  - - "~>"
256
256
  - !ruby/object:Gem::Version
257
257
  version: 0.1.13
258
+ - !ruby/object:Gem::Dependency
259
+ name: retriable
260
+ requirement: !ruby/object:Gem::Requirement
261
+ requirements:
262
+ - - "~>"
263
+ - !ruby/object:Gem::Version
264
+ version: 3.1.2
265
+ type: :development
266
+ prerelease: false
267
+ version_requirements: !ruby/object:Gem::Requirement
268
+ requirements:
269
+ - - "~>"
270
+ - !ruby/object:Gem::Version
271
+ version: 3.1.2
258
272
  description: google-cloud-storage is the official library for Google Cloud Storage.
259
273
  email:
260
274
  - mike@blowmage.com
@@ -318,7 +332,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
318
332
  - !ruby/object:Gem::Version
319
333
  version: '0'
320
334
  requirements: []
321
- rubygems_version: 3.3.14
335
+ rubygems_version: 3.4.19
322
336
  signing_key:
323
337
  specification_version: 4
324
338
  summary: API Client library for Google Cloud Storage