google-cloud-storage 1.44.0 → 1.45.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +8 -26
- data/CHANGELOG.md +6 -0
- data/lib/google/cloud/storage/bucket.rb +37 -3
- data/lib/google/cloud/storage/project.rb +35 -0
- data/lib/google/cloud/storage/service.rb +14 -1
- data/lib/google/cloud/storage/version.rb +1 -1
- data/lib/google/cloud/storage.rb +12 -4
- data/lib/google-cloud-storage.rb +14 -4
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a00be88dfffe243057e1ffe70891fabb483caadc76a7a37e8b82dcdb5f95395
|
4
|
+
data.tar.gz: 2190d664457e1419b26b95266d8911728a612647d404790b35f37586dfe59e02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
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
|
-
|
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
|
-
|
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
@@ -434,6 +434,24 @@ module Google
|
|
434
434
|
@gapi.autoclass&.toggle_time
|
435
435
|
end
|
436
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
|
+
|
437
455
|
##
|
438
456
|
# Updates bucket's autoclass configuration. This defines the default class for objects in the
|
439
457
|
# bucket and down/up-grades the storage class of objects based on the access patterns.
|
@@ -442,9 +460,6 @@ module Google
|
|
442
460
|
# For more information, see [Storage
|
443
461
|
# Classes](https://cloud.google.com/storage/docs/using-autoclass).
|
444
462
|
#
|
445
|
-
# Note: Only patch requests that disable autoclass are currently supported.
|
446
|
-
# To enable autoclass, you must set it at bucket creation time.
|
447
|
-
#
|
448
463
|
# @param [Boolean] toggle for autoclass configuration of the bucket.
|
449
464
|
#
|
450
465
|
def autoclass_enabled= toggle
|
@@ -453,6 +468,25 @@ module Google
|
|
453
468
|
patch_gapi! :autoclass
|
454
469
|
end
|
455
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
|
+
|
456
490
|
##
|
457
491
|
# Whether [Object
|
458
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
|
#
|
@@ -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
|
data/lib/google/cloud/storage.rb
CHANGED
@@ -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.
|
data/lib/google-cloud-storage.rb
CHANGED
@@ -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.
|
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:
|
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.
|
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.
|
55
|
+
version: 0.29.0
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: googleauth
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -332,7 +332,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
332
332
|
- !ruby/object:Gem::Version
|
333
333
|
version: '0'
|
334
334
|
requirements: []
|
335
|
-
rubygems_version: 3.
|
335
|
+
rubygems_version: 3.4.19
|
336
336
|
signing_key:
|
337
337
|
specification_version: 4
|
338
338
|
summary: API Client library for Google Cloud Storage
|