google-cloud-storage 1.36.2 → 1.44.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +56 -0
- data/OVERVIEW.md +32 -0
- data/lib/google/cloud/storage/bucket/acl.rb +28 -26
- data/lib/google/cloud/storage/bucket/lifecycle.rb +88 -10
- data/lib/google/cloud/storage/bucket.rb +83 -3
- data/lib/google/cloud/storage/file/signer_v2.rb +1 -1
- data/lib/google/cloud/storage/file/signer_v4.rb +1 -1
- data/lib/google/cloud/storage/project.rb +14 -5
- data/lib/google/cloud/storage/service.rb +223 -226
- data/lib/google/cloud/storage/version.rb +1 -1
- data/lib/google/cloud/storage.rb +43 -14
- data/lib/google-cloud-storage.rb +31 -5
- metadata +21 -7
data/lib/google/cloud/storage.rb
CHANGED
@@ -55,6 +55,11 @@ module Google
|
|
55
55
|
# * `https://www.googleapis.com/auth/devstorage.full_control`
|
56
56
|
# @param [Integer] retries Number of times to retry requests on server
|
57
57
|
# error. The default value is `3`. Optional.
|
58
|
+
# @param [Integer] max_elapsed_time Total time in seconds that requests are allowed to keep being retried.
|
59
|
+
# @param [Float] base_interval The initial interval in seconds between tries.
|
60
|
+
# @param [Integer] max_interval The maximum interval in seconds that any individual retry can reach.
|
61
|
+
# @param [Integer] multiplier Each successive interval grows by this factor. A multipler of 1.5 means the next
|
62
|
+
# interval will be 1.5x the current interval.
|
58
63
|
# @param [Integer] timeout (default timeout) The max duration, in seconds, to wait before timing out. Optional.
|
59
64
|
# If left blank, the wait will be at most the time permitted by the underlying HTTP/RPC protocol.
|
60
65
|
# @param [Integer] open_timeout How long, in seconds, before failed connections time out. Optional.
|
@@ -79,18 +84,24 @@ module Google
|
|
79
84
|
# bucket = storage.bucket "my-bucket"
|
80
85
|
# file = bucket.file "path/to/my-file.ext"
|
81
86
|
#
|
82
|
-
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
87
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/AbcSize
|
83
88
|
def self.new project_id: nil, credentials: nil, scope: nil, retries: nil,
|
84
89
|
timeout: nil, open_timeout: nil, read_timeout: nil,
|
85
|
-
send_timeout: nil, endpoint: nil, project: nil, keyfile: nil
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
90
|
+
send_timeout: nil, endpoint: nil, project: nil, keyfile: nil,
|
91
|
+
max_elapsed_time: nil, base_interval: nil, max_interval: nil,
|
92
|
+
multiplier: nil
|
93
|
+
scope ||= configure.scope
|
94
|
+
retries ||= configure.retries
|
95
|
+
timeout ||= configure.timeout
|
96
|
+
open_timeout ||= (configure.open_timeout || timeout)
|
97
|
+
read_timeout ||= (configure.read_timeout || timeout)
|
98
|
+
send_timeout ||= (configure.send_timeout || timeout)
|
99
|
+
endpoint ||= configure.endpoint
|
100
|
+
credentials ||= (keyfile || default_credentials(scope: scope))
|
101
|
+
max_elapsed_time ||= configure.max_elapsed_time
|
102
|
+
base_interval ||= configure.base_interval
|
103
|
+
max_interval ||= configure.max_interval
|
104
|
+
multiplier ||= configure.multiplier
|
94
105
|
|
95
106
|
unless credentials.is_a? Google::Auth::Credentials
|
96
107
|
credentials = Storage::Credentials.new credentials, scope: scope
|
@@ -104,11 +115,13 @@ module Google
|
|
104
115
|
project_id, credentials,
|
105
116
|
retries: retries, timeout: timeout, open_timeout: open_timeout,
|
106
117
|
read_timeout: read_timeout, send_timeout: send_timeout,
|
107
|
-
host: endpoint, quota_project: configure.quota_project
|
118
|
+
host: endpoint, quota_project: configure.quota_project,
|
119
|
+
max_elapsed_time: max_elapsed_time, base_interval: base_interval,
|
120
|
+
max_interval: max_interval, multiplier: multiplier
|
108
121
|
)
|
109
122
|
)
|
110
123
|
end
|
111
|
-
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
124
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/AbcSize
|
112
125
|
|
113
126
|
##
|
114
127
|
# Creates an unauthenticated, anonymous client for retrieving public data
|
@@ -116,6 +129,11 @@ module Google
|
|
116
129
|
#
|
117
130
|
# @param [Integer] retries Number of times to retry requests on server
|
118
131
|
# error. The default value is `3`. Optional.
|
132
|
+
# @param [Integer] max_elapsed_time Total time in seconds that requests are allowed to keep being retried.
|
133
|
+
# @param [Float] base_interval The initial interval in seconds between tries.
|
134
|
+
# @param [Integer] max_interval The maximum interval in seconds that any individual retry can reach.
|
135
|
+
# @param [Integer] multiplier Each successive interval grows by this factor. A multipler of 1.5 means the next
|
136
|
+
# interval will be 1.5x the current interval.
|
119
137
|
# @param [Integer] timeout (default timeout) The max duration, in seconds, to wait before timing out. Optional.
|
120
138
|
# If left blank, the wait will be at most the time permitted by the underlying HTTP/RPC protocol.
|
121
139
|
# @param [Integer] open_timeout How long, in seconds, before failed connections time out. Optional.
|
@@ -139,14 +157,18 @@ module Google
|
|
139
157
|
# downloaded.read #=> "Hello world!"
|
140
158
|
#
|
141
159
|
def self.anonymous retries: nil, timeout: nil, open_timeout: nil,
|
142
|
-
read_timeout: nil, send_timeout: nil, endpoint: nil
|
160
|
+
read_timeout: nil, send_timeout: nil, endpoint: nil,
|
161
|
+
max_elapsed_time: nil, base_interval: nil, max_interval: nil,
|
162
|
+
multiplier: nil
|
143
163
|
open_timeout ||= timeout
|
144
164
|
read_timeout ||= timeout
|
145
165
|
send_timeout ||= timeout
|
146
166
|
Storage::Project.new(
|
147
167
|
Storage::Service.new(
|
148
168
|
nil, nil, retries: retries, timeout: timeout, open_timeout: open_timeout,
|
149
|
-
read_timeout: read_timeout, send_timeout: send_timeout, host: endpoint
|
169
|
+
read_timeout: read_timeout, send_timeout: send_timeout, host: endpoint,
|
170
|
+
max_elapsed_time: max_elapsed_time, base_interval: base_interval,
|
171
|
+
max_interval: max_interval, multiplier: multiplier
|
150
172
|
)
|
151
173
|
)
|
152
174
|
end
|
@@ -168,6 +190,13 @@ module Google
|
|
168
190
|
# the set of resources and operations that the connection can access.
|
169
191
|
# * `retries` - (Integer) Number of times to retry requests on server
|
170
192
|
# error.
|
193
|
+
# * `max_elapsed_time` - (Integer) Total time in seconds that requests
|
194
|
+
# are allowed to keep being retried.
|
195
|
+
# * `base_interval` - (Float) The initial interval in seconds between tries.
|
196
|
+
# * `max_interval` - (Integer) The maximum interval in seconds that any
|
197
|
+
# individual retry can reach.
|
198
|
+
# * `multiplier` - (Integer) Each successive interval grows by this factor.
|
199
|
+
# A multipler of 1.5 means the next interval will be 1.5x the current interval.
|
171
200
|
# * `timeout` - (Integer) (default timeout) The max duration, in seconds, to wait before timing out.
|
172
201
|
# If left blank, the wait will be at most the time permitted by the underlying HTTP/RPC protocol.
|
173
202
|
# * `open_timeout` - (Integer) How long, in seconds, before failed connections time out.
|
data/lib/google-cloud-storage.rb
CHANGED
@@ -45,8 +45,13 @@ module Google
|
|
45
45
|
# * `https://www.googleapis.com/auth/devstorage.full_control`
|
46
46
|
# @param [Integer] retries Number of times to retry requests on server
|
47
47
|
# error. The default value is `3`. Optional.
|
48
|
+
# @param [Integer] max_elapsed_time Total time in seconds that requests are allowed to keep being retried.
|
49
|
+
# @param [Float] base_interval The initial interval in seconds between tries.
|
50
|
+
# @param [Integer] max_interval The maximum interval in seconds that any individual retry can reach.
|
51
|
+
# @param [Integer] multiplier Each successive interval grows by this factor. A multipler of 1.5 means the next
|
52
|
+
# interval will be 1.5x the current interval.
|
48
53
|
# @param [Integer] timeout (default timeout) The max duration, in seconds, to wait before timing out. Optional.
|
49
|
-
#
|
54
|
+
# If left blank, the wait will be at most the time permitted by the underlying HTTP/RPC protocol.
|
50
55
|
# @param [Integer] open_timeout How long, in seconds, before failed connections time out. Optional.
|
51
56
|
# @param [Integer] read_timeout How long, in seconds, before requests time out. Optional.
|
52
57
|
# @param [Integer] send_timeout How long, in seconds, before receiving response from server times out. Optional.
|
@@ -68,13 +73,18 @@ module Google
|
|
68
73
|
# readonly_scope = "https://www.googleapis.com/auth/devstorage.read_only"
|
69
74
|
# readonly_storage = gcloud.storage scope: readonly_scope
|
70
75
|
#
|
71
|
-
def storage scope: nil, retries: nil, timeout: nil, open_timeout: nil, read_timeout: nil, send_timeout: nil
|
76
|
+
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
|
72
78
|
Google::Cloud.storage @project, @keyfile, scope: scope,
|
73
79
|
retries: (retries || @retries),
|
74
80
|
timeout: (timeout || @timeout),
|
75
81
|
open_timeout: (open_timeout || timeout),
|
76
82
|
read_timeout: (read_timeout || timeout),
|
77
|
-
send_timeout: (send_timeout || timeout)
|
83
|
+
send_timeout: (send_timeout || timeout),
|
84
|
+
max_elapsed_time: max_elapsed_time,
|
85
|
+
base_interval: base_interval,
|
86
|
+
max_interval: max_interval,
|
87
|
+
multiplier: multiplier
|
78
88
|
end
|
79
89
|
|
80
90
|
##
|
@@ -100,6 +110,11 @@ module Google
|
|
100
110
|
# * `https://www.googleapis.com/auth/devstorage.full_control`
|
101
111
|
# @param [Integer] retries Number of times to retry requests on server
|
102
112
|
# error. The default value is `3`. Optional.
|
113
|
+
# @param [Integer] max_elapsed_time Total time in seconds that requests are allowed to keep being retried.
|
114
|
+
# @param [Float] base_interval The initial interval in seconds between tries.
|
115
|
+
# @param [Integer] max_interval The maximum interval in seconds that any individual retry can reach.
|
116
|
+
# @param [Integer] multiplier Each successive interval grows by this factor. A multipler of 1.5 means the next
|
117
|
+
# interval will be 1.5x the current interval.
|
103
118
|
# @param [Integer] timeout (default timeout) The max duration, in seconds, to wait before timing out. Optional.
|
104
119
|
# If left blank, the wait will be at most the time permitted by the underlying HTTP/RPC protocol.
|
105
120
|
# @param [Integer] open_timeout How long, in seconds, before failed connections time out. Optional.
|
@@ -118,7 +133,8 @@ module Google
|
|
118
133
|
# file = bucket.file "path/to/my-file.ext"
|
119
134
|
#
|
120
135
|
def self.storage project_id = nil, credentials = nil, scope: nil,
|
121
|
-
retries: nil, timeout: nil, open_timeout: nil, read_timeout: nil, send_timeout: nil
|
136
|
+
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
|
122
138
|
require "google/cloud/storage"
|
123
139
|
Google::Cloud::Storage.new project_id: project_id,
|
124
140
|
credentials: credentials,
|
@@ -127,12 +143,17 @@ module Google
|
|
127
143
|
timeout: timeout,
|
128
144
|
open_timeout: (open_timeout || timeout),
|
129
145
|
read_timeout: (read_timeout || timeout),
|
130
|
-
send_timeout: (send_timeout || timeout)
|
146
|
+
send_timeout: (send_timeout || timeout),
|
147
|
+
max_elapsed_time: max_elapsed_time,
|
148
|
+
base_interval: base_interval,
|
149
|
+
max_interval: max_interval,
|
150
|
+
multiplier: multiplier
|
131
151
|
end
|
132
152
|
end
|
133
153
|
end
|
134
154
|
|
135
155
|
# Set the default storage configuration
|
156
|
+
# rubocop:disable Metrics/BlockLength
|
136
157
|
Google::Cloud.configure.add_config! :storage do |config|
|
137
158
|
default_project = Google::Cloud::Config.deferred do
|
138
159
|
ENV["STORAGE_PROJECT"]
|
@@ -153,6 +174,10 @@ Google::Cloud.configure.add_config! :storage do |config|
|
|
153
174
|
config.add_field! :scope, nil, match: [String, Array]
|
154
175
|
config.add_field! :quota_project, nil, match: String
|
155
176
|
config.add_field! :retries, nil, match: Integer
|
177
|
+
config.add_field! :max_elapsed_time, nil, match: Integer
|
178
|
+
config.add_field! :base_interval, nil, match: Float
|
179
|
+
config.add_field! :max_interval, nil, match: Integer
|
180
|
+
config.add_field! :multiplier, nil, match: Integer
|
156
181
|
config.add_field! :timeout, nil, match: Integer
|
157
182
|
config.add_field! :open_timeout, nil, match: Integer
|
158
183
|
config.add_field! :read_timeout, nil, match: Integer
|
@@ -160,3 +185,4 @@ Google::Cloud.configure.add_config! :storage do |config|
|
|
160
185
|
# TODO: Remove once discovery document is updated.
|
161
186
|
config.add_field! :endpoint, "https://storage.googleapis.com/", match: String
|
162
187
|
end
|
188
|
+
# rubocop:enable Metrics/BlockLength
|
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.44.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-
|
12
|
+
date: 2022-11-03 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:
|
48
|
+
version: 0.19.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:
|
55
|
+
version: 0.19.0
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: googleauth
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -135,14 +135,14 @@ dependencies:
|
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '5.
|
138
|
+
version: '5.16'
|
139
139
|
type: :development
|
140
140
|
prerelease: false
|
141
141
|
version_requirements: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: '5.
|
145
|
+
version: '5.16'
|
146
146
|
- !ruby/object:Gem::Dependency
|
147
147
|
name: minitest-autotest
|
148
148
|
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.
|
335
|
+
rubygems_version: 3.3.14
|
322
336
|
signing_key:
|
323
337
|
specification_version: 4
|
324
338
|
summary: API Client library for Google Cloud Storage
|