google-cloud-storage 1.34.1 → 1.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +67 -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 +108 -16
- 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 +20 -12
- data/lib/google/cloud/storage/service.rb +227 -230
- data/lib/google/cloud/storage/version.rb +1 -1
- data/lib/google/cloud/storage.rb +66 -13
- data/lib/google-cloud-storage.rb +51 -7
- metadata +9 -9
data/lib/google/cloud/storage.rb
CHANGED
@@ -55,7 +55,16 @@ 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]
|
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.
|
63
|
+
# @param [Integer] timeout (default timeout) The max duration, in seconds, to wait before timing out. Optional.
|
64
|
+
# If left blank, the wait will be at most the time permitted by the underlying HTTP/RPC protocol.
|
65
|
+
# @param [Integer] open_timeout How long, in seconds, before failed connections time out. Optional.
|
66
|
+
# @param [Integer] read_timeout How long, in seconds, before requests time out. Optional.
|
67
|
+
# @param [Integer] send_timeout How long, in seconds, before receiving response from server times out. Optional.
|
59
68
|
# @param [String] endpoint Override of the endpoint host name. Optional.
|
60
69
|
# If the param is nil, uses the default endpoint.
|
61
70
|
# @param [String] project Alias for the `project_id` argument. Deprecated.
|
@@ -75,13 +84,24 @@ module Google
|
|
75
84
|
# bucket = storage.bucket "my-bucket"
|
76
85
|
# file = bucket.file "path/to/my-file.ext"
|
77
86
|
#
|
87
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/AbcSize
|
78
88
|
def self.new project_id: nil, credentials: nil, scope: nil, retries: nil,
|
79
|
-
timeout: nil,
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
89
|
+
timeout: nil, open_timeout: nil, read_timeout: nil,
|
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
|
85
105
|
|
86
106
|
unless credentials.is_a? Google::Auth::Credentials
|
87
107
|
credentials = Storage::Credentials.new credentials, scope: scope
|
@@ -93,11 +113,15 @@ module Google
|
|
93
113
|
Storage::Project.new(
|
94
114
|
Storage::Service.new(
|
95
115
|
project_id, credentials,
|
96
|
-
retries: retries, timeout: timeout,
|
97
|
-
|
116
|
+
retries: retries, timeout: timeout, open_timeout: open_timeout,
|
117
|
+
read_timeout: read_timeout, send_timeout: send_timeout,
|
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
|
98
121
|
)
|
99
122
|
)
|
100
123
|
end
|
124
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/AbcSize
|
101
125
|
|
102
126
|
##
|
103
127
|
# Creates an unauthenticated, anonymous client for retrieving public data
|
@@ -105,7 +129,16 @@ module Google
|
|
105
129
|
#
|
106
130
|
# @param [Integer] retries Number of times to retry requests on server
|
107
131
|
# error. The default value is `3`. Optional.
|
108
|
-
# @param [Integer]
|
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.
|
137
|
+
# @param [Integer] timeout (default timeout) The max duration, in seconds, to wait before timing out. Optional.
|
138
|
+
# If left blank, the wait will be at most the time permitted by the underlying HTTP/RPC protocol.
|
139
|
+
# @param [Integer] open_timeout How long, in seconds, before failed connections time out. Optional.
|
140
|
+
# @param [Integer] read_timeout How long, in seconds, before requests time out. Optional.
|
141
|
+
# @param [Integer] send_timeout How long, in seconds, before receiving response from server times out. Optional.
|
109
142
|
# @param [String] endpoint Override of the endpoint host name. Optional.
|
110
143
|
# If the param is nil, uses the default endpoint.
|
111
144
|
#
|
@@ -123,10 +156,19 @@ module Google
|
|
123
156
|
# downloaded.rewind
|
124
157
|
# downloaded.read #=> "Hello world!"
|
125
158
|
#
|
126
|
-
def self.anonymous retries: nil, timeout: nil,
|
159
|
+
def self.anonymous retries: nil, timeout: nil, open_timeout: nil,
|
160
|
+
read_timeout: nil, send_timeout: nil, endpoint: nil,
|
161
|
+
max_elapsed_time: nil, base_interval: nil, max_interval: nil,
|
162
|
+
multiplier: nil
|
163
|
+
open_timeout ||= timeout
|
164
|
+
read_timeout ||= timeout
|
165
|
+
send_timeout ||= timeout
|
127
166
|
Storage::Project.new(
|
128
167
|
Storage::Service.new(
|
129
|
-
nil, nil, retries: retries, timeout: timeout,
|
168
|
+
nil, nil, retries: retries, timeout: timeout, open_timeout: open_timeout,
|
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
|
130
172
|
)
|
131
173
|
)
|
132
174
|
end
|
@@ -148,7 +190,18 @@ module Google
|
|
148
190
|
# the set of resources and operations that the connection can access.
|
149
191
|
# * `retries` - (Integer) Number of times to retry requests on server
|
150
192
|
# error.
|
151
|
-
# * `
|
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.
|
200
|
+
# * `timeout` - (Integer) (default timeout) The max duration, in seconds, to wait before timing out.
|
201
|
+
# If left blank, the wait will be at most the time permitted by the underlying HTTP/RPC protocol.
|
202
|
+
# * `open_timeout` - (Integer) How long, in seconds, before failed connections time out.
|
203
|
+
# * `read_timeout` - (Integer) How long, in seconds, before requests time out.
|
204
|
+
# * `send_timeout` - (Integer) How long, in seconds, before receiving response from server times out.
|
152
205
|
#
|
153
206
|
# @return [Google::Cloud::Config] The configuration object the
|
154
207
|
# Google::Cloud::Storage library uses.
|
data/lib/google-cloud-storage.rb
CHANGED
@@ -45,7 +45,16 @@ 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]
|
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.
|
53
|
+
# @param [Integer] timeout (default timeout) The max duration, in seconds, to wait before timing out. Optional.
|
54
|
+
# If left blank, the wait will be at most the time permitted by the underlying HTTP/RPC protocol.
|
55
|
+
# @param [Integer] open_timeout How long, in seconds, before failed connections time out. Optional.
|
56
|
+
# @param [Integer] read_timeout How long, in seconds, before requests time out. Optional.
|
57
|
+
# @param [Integer] send_timeout How long, in seconds, before receiving response from server times out. Optional.
|
49
58
|
#
|
50
59
|
# @return [Google::Cloud::Storage::Project]
|
51
60
|
#
|
@@ -64,10 +73,18 @@ module Google
|
|
64
73
|
# readonly_scope = "https://www.googleapis.com/auth/devstorage.read_only"
|
65
74
|
# readonly_storage = gcloud.storage scope: readonly_scope
|
66
75
|
#
|
67
|
-
def storage scope: nil, retries: nil, 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
|
68
78
|
Google::Cloud.storage @project, @keyfile, scope: scope,
|
69
79
|
retries: (retries || @retries),
|
70
|
-
timeout: (timeout || @timeout)
|
80
|
+
timeout: (timeout || @timeout),
|
81
|
+
open_timeout: (open_timeout || timeout),
|
82
|
+
read_timeout: (read_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
|
71
88
|
end
|
72
89
|
|
73
90
|
##
|
@@ -93,7 +110,16 @@ module Google
|
|
93
110
|
# * `https://www.googleapis.com/auth/devstorage.full_control`
|
94
111
|
# @param [Integer] retries Number of times to retry requests on server
|
95
112
|
# error. The default value is `3`. Optional.
|
96
|
-
# @param [Integer]
|
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.
|
118
|
+
# @param [Integer] timeout (default timeout) The max duration, in seconds, to wait before timing out. Optional.
|
119
|
+
# If left blank, the wait will be at most the time permitted by the underlying HTTP/RPC protocol.
|
120
|
+
# @param [Integer] open_timeout How long, in seconds, before failed connections time out. Optional.
|
121
|
+
# @param [Integer] read_timeout How long, in seconds, before requests time out. Optional.
|
122
|
+
# @param [Integer] send_timeout How long, in seconds, before receiving response from server times out. Optional.
|
97
123
|
#
|
98
124
|
# @return [Google::Cloud::Storage::Project]
|
99
125
|
#
|
@@ -107,17 +133,27 @@ module Google
|
|
107
133
|
# file = bucket.file "path/to/my-file.ext"
|
108
134
|
#
|
109
135
|
def self.storage project_id = nil, credentials = nil, scope: nil,
|
110
|
-
retries: nil, 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
|
111
138
|
require "google/cloud/storage"
|
112
139
|
Google::Cloud::Storage.new project_id: project_id,
|
113
140
|
credentials: credentials,
|
114
|
-
scope: scope,
|
115
|
-
|
141
|
+
scope: scope,
|
142
|
+
retries: retries,
|
143
|
+
timeout: timeout,
|
144
|
+
open_timeout: (open_timeout || timeout),
|
145
|
+
read_timeout: (read_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
|
116
151
|
end
|
117
152
|
end
|
118
153
|
end
|
119
154
|
|
120
155
|
# Set the default storage configuration
|
156
|
+
# rubocop:disable Metrics/BlockLength
|
121
157
|
Google::Cloud.configure.add_config! :storage do |config|
|
122
158
|
default_project = Google::Cloud::Config.deferred do
|
123
159
|
ENV["STORAGE_PROJECT"]
|
@@ -138,7 +174,15 @@ Google::Cloud.configure.add_config! :storage do |config|
|
|
138
174
|
config.add_field! :scope, nil, match: [String, Array]
|
139
175
|
config.add_field! :quota_project, nil, match: String
|
140
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
|
141
181
|
config.add_field! :timeout, nil, match: Integer
|
182
|
+
config.add_field! :open_timeout, nil, match: Integer
|
183
|
+
config.add_field! :read_timeout, nil, match: Integer
|
184
|
+
config.add_field! :send_timeout, nil, match: Integer
|
142
185
|
# TODO: Remove once discovery document is updated.
|
143
186
|
config.add_field! :endpoint, "https://storage.googleapis.com/", match: String
|
144
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.41.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: 2022-09-16 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.17.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.17.0
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: googleauth
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -93,14 +93,14 @@ dependencies:
|
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '2.
|
96
|
+
version: '2.8'
|
97
97
|
type: :runtime
|
98
98
|
prerelease: false
|
99
99
|
version_requirements: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '2.
|
103
|
+
version: '2.8'
|
104
104
|
- !ruby/object:Gem::Dependency
|
105
105
|
name: mini_mime
|
106
106
|
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
|
@@ -318,7 +318,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
318
318
|
- !ruby/object:Gem::Version
|
319
319
|
version: '0'
|
320
320
|
requirements: []
|
321
|
-
rubygems_version: 3.
|
321
|
+
rubygems_version: 3.3.14
|
322
322
|
signing_key:
|
323
323
|
specification_version: 4
|
324
324
|
summary: API Client library for Google Cloud Storage
|