google-cloud-storage 1.34.1 → 1.44.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Storage
19
- VERSION = "1.34.1".freeze
19
+ VERSION = "1.44.0".freeze
20
20
  end
21
21
  end
22
22
  end
@@ -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] timeout Default timeout to use in requests. 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.
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, endpoint: nil, project: nil, keyfile: nil
80
- scope ||= configure.scope
81
- retries ||= configure.retries
82
- timeout ||= configure.timeout
83
- endpoint ||= configure.endpoint
84
- credentials ||= (keyfile || default_credentials(scope: scope))
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, host: endpoint,
97
- quota_project: configure.quota_project
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] timeout Default timeout to use in requests. 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.
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, endpoint: 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, host: endpoint
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
- # * `timeout` - (Integer) Default timeout to use in requests.
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.
@@ -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] timeout Default timeout to use in requests. 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.
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] timeout Default timeout to use in requests. 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.
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, retries: retries,
115
- timeout: timeout
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.34.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: 2021-07-08 00:00:00.000000000 Z
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: '0.1'
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: '0.1'
55
+ version: 0.19.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.5'
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.5'
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.10'
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.10'
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.2.17
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