google-cloud-storage 1.34.1 → 1.35.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 +11 -0
- data/lib/google/cloud/storage/bucket.rb +14 -12
- data/lib/google/cloud/storage/service.rb +6 -5
- data/lib/google/cloud/storage/version.rb +1 -1
- data/lib/google/cloud/storage.rb +37 -13
- data/lib/google-cloud-storage.rb +25 -7
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46a00811174d5f74691bc49b43c14fe9a541f3c964c332eb9bccc4d2e85778cd
|
4
|
+
data.tar.gz: 0425d311a50177d6321a172958a6b2afef376a2c13f3dd3d5aa5d07ce974b773
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd0fb3dd2b5d31ce65febca446c4826e72384de658bcf9bb66b349a2f8304c8494c86a6a88263dd38add67fd6083f375f436ffcad225413a7d803ee67c4a351c
|
7
|
+
data.tar.gz: f62d337690f49269a0839d1dfe65f998da7fb1e6a530c151a11eb4a890fc1942321b6c34ef34c9b932b59ab33a0a74ffb6a3b082d1e6688cfd4ddf9a48b478b3
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 1.35.0 / 2021-12-08
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* changed PAP unspecified to inherited
|
8
|
+
* support for more client timeout options
|
9
|
+
|
10
|
+
#### Bug Fixes
|
11
|
+
|
12
|
+
* Update dependency on the addressable gem to 2.8 to remediate a vulnerability
|
13
|
+
|
3
14
|
### 1.34.1 / 2021-07-08
|
4
15
|
|
5
16
|
#### Documentation
|
@@ -932,11 +932,11 @@ module Google
|
|
932
932
|
end
|
933
933
|
|
934
934
|
##
|
935
|
-
# The value for Public Access Prevention in the bucket's IAM configuration. Currently, `
|
935
|
+
# The value for Public Access Prevention in the bucket's IAM configuration. Currently, `inherited` and
|
936
936
|
# `enforced` are supported. When set to `enforced`, Public Access Prevention is enforced in the bucket's IAM
|
937
937
|
# configuration. This value can be modified by calling {#public_access_prevention=}.
|
938
938
|
#
|
939
|
-
# @return [String, nil] Currently, `
|
939
|
+
# @return [String, nil] Currently, `inherited` and `enforced` are supported. Returns `nil` if the bucket has
|
940
940
|
# no IAM configuration.
|
941
941
|
#
|
942
942
|
# @example
|
@@ -958,7 +958,7 @@ module Google
|
|
958
958
|
# calling {#public_access_prevention}.
|
959
959
|
#
|
960
960
|
# @param [Symbol, String] new_public_access_prevention The bucket's new Public Access Prevention configuration.
|
961
|
-
# Currently, `
|
961
|
+
# Currently, `inherited` and `enforced` are supported. When set to `enforced`, Public Access
|
962
962
|
# Prevention is enforced in the bucket's IAM configuration.
|
963
963
|
#
|
964
964
|
# @example Set Public Access Prevention to enforced:
|
@@ -971,15 +971,15 @@ module Google
|
|
971
971
|
# bucket.public_access_prevention = :enforced
|
972
972
|
# bucket.public_access_prevention #=> "enforced"
|
973
973
|
#
|
974
|
-
# @example Set Public Access Prevention to
|
974
|
+
# @example Set Public Access Prevention to inherited:
|
975
975
|
# require "google/cloud/storage"
|
976
976
|
#
|
977
977
|
# storage = Google::Cloud::Storage.new
|
978
978
|
#
|
979
979
|
# bucket = storage.bucket "my-bucket"
|
980
980
|
#
|
981
|
-
# bucket.public_access_prevention = :
|
982
|
-
# bucket.public_access_prevention #=> "
|
981
|
+
# bucket.public_access_prevention = :inherited
|
982
|
+
# bucket.public_access_prevention #=> "inherited"
|
983
983
|
#
|
984
984
|
def public_access_prevention= new_public_access_prevention
|
985
985
|
@gapi.iam_configuration ||= API::Bucket::IamConfiguration.new
|
@@ -1011,11 +1011,11 @@ module Google
|
|
1011
1011
|
end
|
1012
1012
|
|
1013
1013
|
##
|
1014
|
-
# Whether the value for Public Access Prevention in the bucket's IAM configuration is `
|
1014
|
+
# Whether the value for Public Access Prevention in the bucket's IAM configuration is `inherited`. The default
|
1015
1015
|
# is `false`. This value can be modified by calling {Bucket#public_access_prevention=}.
|
1016
1016
|
#
|
1017
1017
|
# @return [Boolean] Returns `false` if the bucket has no IAM configuration or if Public Access Prevention is
|
1018
|
-
# not `
|
1018
|
+
# not `inherited` in the IAM configuration. Returns `true` if Public Access Prevention is `inherited` in
|
1019
1019
|
# the IAM configuration.
|
1020
1020
|
#
|
1021
1021
|
# @example
|
@@ -1025,14 +1025,16 @@ module Google
|
|
1025
1025
|
#
|
1026
1026
|
# bucket = storage.bucket "my-bucket"
|
1027
1027
|
#
|
1028
|
-
# bucket.public_access_prevention = :
|
1029
|
-
# bucket.
|
1028
|
+
# bucket.public_access_prevention = :inherited
|
1029
|
+
# bucket.public_access_prevention_inherited? # true
|
1030
1030
|
#
|
1031
|
-
def
|
1031
|
+
def public_access_prevention_inherited?
|
1032
1032
|
return false unless @gapi.iam_configuration&.public_access_prevention
|
1033
|
-
@gapi.iam_configuration.public_access_prevention.to_s
|
1033
|
+
["inherited", "unspecified"].include? @gapi.iam_configuration.public_access_prevention.to_s
|
1034
1034
|
end
|
1035
1035
|
|
1036
|
+
alias public_access_prevention_unspecified? public_access_prevention_inherited?
|
1037
|
+
|
1036
1038
|
##
|
1037
1039
|
# Updates the bucket with changes made in the given block in a single
|
1038
1040
|
# PATCH request. The following attributes may be set: {#cors},
|
@@ -38,17 +38,18 @@ module Google
|
|
38
38
|
|
39
39
|
##
|
40
40
|
# Creates a new Service instance.
|
41
|
-
def initialize project, credentials,
|
42
|
-
|
41
|
+
def initialize project, credentials, retries: nil,
|
42
|
+
timeout: nil, open_timeout: nil, read_timeout: nil,
|
43
|
+
send_timeout: nil, host: nil, quota_project: nil
|
43
44
|
@project = project
|
44
45
|
@credentials = credentials
|
45
46
|
@service = API::StorageService.new
|
46
47
|
@service.client_options.application_name = "gcloud-ruby"
|
47
48
|
@service.client_options.application_version = \
|
48
49
|
Google::Cloud::Storage::VERSION
|
49
|
-
@service.client_options.open_timeout_sec = timeout
|
50
|
-
@service.client_options.read_timeout_sec = timeout
|
51
|
-
@service.client_options.send_timeout_sec = timeout
|
50
|
+
@service.client_options.open_timeout_sec = (open_timeout || timeout)
|
51
|
+
@service.client_options.read_timeout_sec = (read_timeout || timeout)
|
52
|
+
@service.client_options.send_timeout_sec = (send_timeout || timeout)
|
52
53
|
@service.client_options.transparent_gzip_decompression = false
|
53
54
|
@service.request_options.retries = retries || 3
|
54
55
|
@service.request_options.header ||= {}
|
data/lib/google/cloud/storage.rb
CHANGED
@@ -55,7 +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] timeout
|
58
|
+
# @param [Integer] timeout (default timeout) The max duration, in seconds, to wait before timing out. Optional.
|
59
|
+
# If left blank, the wait will be at most the time permitted by the underlying HTTP/RPC protocol.
|
60
|
+
# @param [Integer] open_timeout How long, in seconds, before failed connections time out. Optional.
|
61
|
+
# @param [Integer] read_timeout How long, in seconds, before requests time out. Optional.
|
62
|
+
# @param [Integer] send_timeout How long, in seconds, before receiving response from server times out. Optional.
|
59
63
|
# @param [String] endpoint Override of the endpoint host name. Optional.
|
60
64
|
# If the param is nil, uses the default endpoint.
|
61
65
|
# @param [String] project Alias for the `project_id` argument. Deprecated.
|
@@ -75,13 +79,18 @@ module Google
|
|
75
79
|
# bucket = storage.bucket "my-bucket"
|
76
80
|
# file = bucket.file "path/to/my-file.ext"
|
77
81
|
#
|
82
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
78
83
|
def self.new project_id: nil, credentials: nil, scope: nil, retries: nil,
|
79
|
-
timeout: nil,
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
84
|
+
timeout: nil, open_timeout: nil, read_timeout: nil,
|
85
|
+
send_timeout: nil, endpoint: nil, project: nil, keyfile: nil
|
86
|
+
scope ||= configure.scope
|
87
|
+
retries ||= configure.retries
|
88
|
+
timeout ||= configure.timeout
|
89
|
+
open_timeout ||= (configure.open_timeout || timeout)
|
90
|
+
read_timeout ||= (configure.read_timeout || timeout)
|
91
|
+
send_timeout ||= (configure.send_timeout || timeout)
|
92
|
+
endpoint ||= configure.endpoint
|
93
|
+
credentials ||= (keyfile || default_credentials(scope: scope))
|
85
94
|
|
86
95
|
unless credentials.is_a? Google::Auth::Credentials
|
87
96
|
credentials = Storage::Credentials.new credentials, scope: scope
|
@@ -93,11 +102,13 @@ module Google
|
|
93
102
|
Storage::Project.new(
|
94
103
|
Storage::Service.new(
|
95
104
|
project_id, credentials,
|
96
|
-
retries: retries, timeout: timeout,
|
97
|
-
|
105
|
+
retries: retries, timeout: timeout, open_timeout: open_timeout,
|
106
|
+
read_timeout: read_timeout, send_timeout: send_timeout,
|
107
|
+
host: endpoint, quota_project: configure.quota_project
|
98
108
|
)
|
99
109
|
)
|
100
110
|
end
|
111
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
101
112
|
|
102
113
|
##
|
103
114
|
# Creates an unauthenticated, anonymous client for retrieving public data
|
@@ -105,7 +116,11 @@ module Google
|
|
105
116
|
#
|
106
117
|
# @param [Integer] retries Number of times to retry requests on server
|
107
118
|
# error. The default value is `3`. Optional.
|
108
|
-
# @param [Integer] timeout
|
119
|
+
# @param [Integer] timeout (default timeout) The max duration, in seconds, to wait before timing out. Optional.
|
120
|
+
# If left blank, the wait will be at most the time permitted by the underlying HTTP/RPC protocol.
|
121
|
+
# @param [Integer] open_timeout How long, in seconds, before failed connections time out. Optional.
|
122
|
+
# @param [Integer] read_timeout How long, in seconds, before requests time out. Optional.
|
123
|
+
# @param [Integer] send_timeout How long, in seconds, before receiving response from server times out. Optional.
|
109
124
|
# @param [String] endpoint Override of the endpoint host name. Optional.
|
110
125
|
# If the param is nil, uses the default endpoint.
|
111
126
|
#
|
@@ -123,10 +138,15 @@ module Google
|
|
123
138
|
# downloaded.rewind
|
124
139
|
# downloaded.read #=> "Hello world!"
|
125
140
|
#
|
126
|
-
def self.anonymous retries: nil, timeout: nil,
|
141
|
+
def self.anonymous retries: nil, timeout: nil, open_timeout: nil,
|
142
|
+
read_timeout: nil, send_timeout: nil, endpoint: nil
|
143
|
+
open_timeout ||= timeout
|
144
|
+
read_timeout ||= timeout
|
145
|
+
send_timeout ||= timeout
|
127
146
|
Storage::Project.new(
|
128
147
|
Storage::Service.new(
|
129
|
-
nil, nil, retries: retries, timeout: timeout,
|
148
|
+
nil, nil, retries: retries, timeout: timeout, open_timeout: open_timeout,
|
149
|
+
read_timeout: read_timeout, send_timeout: send_timeout, host: endpoint
|
130
150
|
)
|
131
151
|
)
|
132
152
|
end
|
@@ -148,7 +168,11 @@ module Google
|
|
148
168
|
# the set of resources and operations that the connection can access.
|
149
169
|
# * `retries` - (Integer) Number of times to retry requests on server
|
150
170
|
# error.
|
151
|
-
# * `timeout` - (Integer)
|
171
|
+
# * `timeout` - (Integer) (default timeout) The max duration, in seconds, to wait before timing out.
|
172
|
+
# If left blank, the wait will be at most the time permitted by the underlying HTTP/RPC protocol.
|
173
|
+
# * `open_timeout` - (Integer) How long, in seconds, before failed connections time out.
|
174
|
+
# * `read_timeout` - (Integer) How long, in seconds, before requests time out.
|
175
|
+
# * `send_timeout` - (Integer) How long, in seconds, before receiving response from server times out.
|
152
176
|
#
|
153
177
|
# @return [Google::Cloud::Config] The configuration object the
|
154
178
|
# Google::Cloud::Storage library uses.
|
data/lib/google-cloud-storage.rb
CHANGED
@@ -45,7 +45,11 @@ 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
|
48
|
+
# @param [Integer] timeout (default timeout) The max duration, in seconds, to wait before timing out. Optional.
|
49
|
+
# If left blank, the wait will be at most the time permitted by the underlying HTTP/RPC protocol.
|
50
|
+
# @param [Integer] open_timeout How long, in seconds, before failed connections time out. Optional.
|
51
|
+
# @param [Integer] read_timeout How long, in seconds, before requests time out. Optional.
|
52
|
+
# @param [Integer] send_timeout How long, in seconds, before receiving response from server times out. Optional.
|
49
53
|
#
|
50
54
|
# @return [Google::Cloud::Storage::Project]
|
51
55
|
#
|
@@ -64,10 +68,13 @@ module Google
|
|
64
68
|
# readonly_scope = "https://www.googleapis.com/auth/devstorage.read_only"
|
65
69
|
# readonly_storage = gcloud.storage scope: readonly_scope
|
66
70
|
#
|
67
|
-
def storage scope: nil, retries: nil, timeout: nil
|
71
|
+
def storage scope: nil, retries: nil, timeout: nil, open_timeout: nil, read_timeout: nil, send_timeout: nil
|
68
72
|
Google::Cloud.storage @project, @keyfile, scope: scope,
|
69
73
|
retries: (retries || @retries),
|
70
|
-
timeout: (timeout || @timeout)
|
74
|
+
timeout: (timeout || @timeout),
|
75
|
+
open_timeout: (open_timeout || timeout),
|
76
|
+
read_timeout: (read_timeout || timeout),
|
77
|
+
send_timeout: (send_timeout || timeout)
|
71
78
|
end
|
72
79
|
|
73
80
|
##
|
@@ -93,7 +100,11 @@ module Google
|
|
93
100
|
# * `https://www.googleapis.com/auth/devstorage.full_control`
|
94
101
|
# @param [Integer] retries Number of times to retry requests on server
|
95
102
|
# error. The default value is `3`. Optional.
|
96
|
-
# @param [Integer] timeout
|
103
|
+
# @param [Integer] timeout (default timeout) The max duration, in seconds, to wait before timing out. Optional.
|
104
|
+
# If left blank, the wait will be at most the time permitted by the underlying HTTP/RPC protocol.
|
105
|
+
# @param [Integer] open_timeout How long, in seconds, before failed connections time out. Optional.
|
106
|
+
# @param [Integer] read_timeout How long, in seconds, before requests time out. Optional.
|
107
|
+
# @param [Integer] send_timeout How long, in seconds, before receiving response from server times out. Optional.
|
97
108
|
#
|
98
109
|
# @return [Google::Cloud::Storage::Project]
|
99
110
|
#
|
@@ -107,12 +118,16 @@ module Google
|
|
107
118
|
# file = bucket.file "path/to/my-file.ext"
|
108
119
|
#
|
109
120
|
def self.storage project_id = nil, credentials = nil, scope: nil,
|
110
|
-
retries: nil, timeout: nil
|
121
|
+
retries: nil, timeout: nil, open_timeout: nil, read_timeout: nil, send_timeout: nil
|
111
122
|
require "google/cloud/storage"
|
112
123
|
Google::Cloud::Storage.new project_id: project_id,
|
113
124
|
credentials: credentials,
|
114
|
-
scope: scope,
|
115
|
-
|
125
|
+
scope: scope,
|
126
|
+
retries: retries,
|
127
|
+
timeout: timeout,
|
128
|
+
open_timeout: (open_timeout || timeout),
|
129
|
+
read_timeout: (read_timeout || timeout),
|
130
|
+
send_timeout: (send_timeout || timeout)
|
116
131
|
end
|
117
132
|
end
|
118
133
|
end
|
@@ -139,6 +154,9 @@ Google::Cloud.configure.add_config! :storage do |config|
|
|
139
154
|
config.add_field! :quota_project, nil, match: String
|
140
155
|
config.add_field! :retries, nil, match: Integer
|
141
156
|
config.add_field! :timeout, nil, match: Integer
|
157
|
+
config.add_field! :open_timeout, nil, match: Integer
|
158
|
+
config.add_field! :read_timeout, nil, match: Integer
|
159
|
+
config.add_field! :send_timeout, nil, match: Integer
|
142
160
|
# TODO: Remove once discovery document is updated.
|
143
161
|
config.add_field! :endpoint, "https://storage.googleapis.com/", match: String
|
144
162
|
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.35.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-
|
12
|
+
date: 2021-12-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-cloud-core
|
@@ -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
|