google-cloud-storage 1.20.0 → 1.21.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 +12 -0
- data/lib/google-cloud-storage.rb +1 -0
- data/lib/google/cloud/storage.rb +25 -9
- data/lib/google/cloud/storage/bucket.rb +7 -3
- data/lib/google/cloud/storage/service.rb +3 -1
- data/lib/google/cloud/storage/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c5abd86d062d83810945e58bc049bcbb6486fd554fe85f0182de9279a6527e7
|
4
|
+
data.tar.gz: efb391f66a4848545305e88c989cc042d120c131943009d697480d5567273055
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0103fe81c68464ecc7303532cfe3a0248d281bb0daa21d8dd8d06c7ec232f85962ed18daa735c2e9dfc410a644fe535b7360836229ce20b1210e6eb4b550bd70
|
7
|
+
data.tar.gz: c610e4b15a52add81adcbd1c1a16ddb0dc994de12422154cd42e79f842fcbbe4ce5ea60014aedcd861169f1955d33950f4e6354196273501c906bb5f23793e34
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 1.21.0 / 2019-08-16
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* Support overriding of service endpoint
|
8
|
+
* Update documentation
|
9
|
+
|
10
|
+
#### Bug Fixes
|
11
|
+
|
12
|
+
* Fix Bucket Policy Only service bug temporarily
|
13
|
+
* Set UniformBucketLevelAccess to same value as BucketPolicyOnly
|
14
|
+
|
3
15
|
### 1.20.0 / 2019-08-08
|
4
16
|
|
5
17
|
* Add HmacKey
|
data/lib/google-cloud-storage.rb
CHANGED
@@ -138,4 +138,5 @@ Google::Cloud.configure.add_config! :storage do |config|
|
|
138
138
|
config.add_field! :scope, nil, match: [String, Array]
|
139
139
|
config.add_field! :retries, nil, match: Integer
|
140
140
|
config.add_field! :timeout, nil, match: Integer
|
141
|
+
config.add_field! :endpoint, nil, match: String
|
141
142
|
end
|
data/lib/google/cloud/storage.rb
CHANGED
@@ -56,6 +56,8 @@ module Google
|
|
56
56
|
# @param [Integer] retries Number of times to retry requests on server
|
57
57
|
# error. The default value is `3`. Optional.
|
58
58
|
# @param [Integer] timeout Default timeout to use in requests. Optional.
|
59
|
+
# @param [String] endpoint Override of the endpoint host name. Optional.
|
60
|
+
# If the param is nil, uses the default endpoint.
|
59
61
|
# @param [String] project Alias for the `project_id` argument. Deprecated.
|
60
62
|
# @param [String] keyfile Alias for the `credentials` argument.
|
61
63
|
# Deprecated.
|
@@ -74,26 +76,24 @@ module Google
|
|
74
76
|
# file = bucket.file "path/to/my-file.ext"
|
75
77
|
#
|
76
78
|
def self.new project_id: nil, credentials: nil, scope: nil, retries: nil,
|
77
|
-
timeout: nil, project: nil, keyfile: nil
|
78
|
-
project_id ||= (project || default_project_id)
|
79
|
+
timeout: nil, endpoint: nil, project: nil, keyfile: nil
|
79
80
|
scope ||= configure.scope
|
80
81
|
retries ||= configure.retries
|
81
82
|
timeout ||= configure.timeout
|
83
|
+
endpoint ||= configure.endpoint
|
82
84
|
credentials ||= (keyfile || default_credentials(scope: scope))
|
83
85
|
|
84
86
|
unless credentials.is_a? Google::Auth::Credentials
|
85
87
|
credentials = Storage::Credentials.new credentials, scope: scope
|
86
88
|
end
|
87
89
|
|
88
|
-
|
89
|
-
project_id ||= credentials.project_id
|
90
|
-
end
|
91
|
-
project_id = project_id.to_s # Always cast to a string
|
90
|
+
project_id = resolve_project_id(project_id || project, credentials)
|
92
91
|
raise ArgumentError, "project_id is missing" if project_id.empty?
|
93
92
|
|
94
93
|
Storage::Project.new(
|
95
94
|
Storage::Service.new(
|
96
|
-
project_id, credentials,
|
95
|
+
project_id, credentials,
|
96
|
+
retries: retries, timeout: timeout, host: endpoint
|
97
97
|
)
|
98
98
|
)
|
99
99
|
end
|
@@ -105,6 +105,8 @@ module Google
|
|
105
105
|
# @param [Integer] retries Number of times to retry requests on server
|
106
106
|
# error. The default value is `3`. Optional.
|
107
107
|
# @param [Integer] timeout Default timeout to use in requests. Optional.
|
108
|
+
# @param [String] endpoint Override of the endpoint host name. Optional.
|
109
|
+
# If the param is nil, uses the default endpoint.
|
108
110
|
#
|
109
111
|
# @return [Google::Cloud::Storage::Project]
|
110
112
|
#
|
@@ -120,9 +122,11 @@ module Google
|
|
120
122
|
# downloaded.rewind
|
121
123
|
# downloaded.read #=> "Hello world!"
|
122
124
|
#
|
123
|
-
def self.anonymous retries: nil, timeout: nil
|
125
|
+
def self.anonymous retries: nil, timeout: nil, endpoint: nil
|
124
126
|
Storage::Project.new(
|
125
|
-
Storage::Service.new(
|
127
|
+
Storage::Service.new(
|
128
|
+
nil, nil, retries: retries, timeout: timeout, host: endpoint
|
129
|
+
)
|
126
130
|
)
|
127
131
|
end
|
128
132
|
|
@@ -137,6 +141,8 @@ module Google
|
|
137
141
|
# the keyfile as a String, the contents of the keyfile as a Hash, or a
|
138
142
|
# Google::Auth::Credentials object. (See {Storage::Credentials}) (The
|
139
143
|
# parameter `keyfile` is considered deprecated, but may also be used.)
|
144
|
+
# * `endpoint` - (String) Override of the endpoint host name, or `nil`
|
145
|
+
# to use the default endpoint.
|
140
146
|
# * `scope` - (String, Array<String>) The OAuth 2.0 scopes controlling
|
141
147
|
# the set of resources and operations that the connection can access.
|
142
148
|
# * `retries` - (Integer) Number of times to retry requests on server
|
@@ -152,6 +158,16 @@ module Google
|
|
152
158
|
Google::Cloud.configure.storage
|
153
159
|
end
|
154
160
|
|
161
|
+
##
|
162
|
+
# @private Resolve project.
|
163
|
+
def self.resolve_project_id given_project, credentials
|
164
|
+
project_id = given_project || default_project_id
|
165
|
+
if credentials.respond_to? :project_id
|
166
|
+
project_id ||= credentials.project_id
|
167
|
+
end
|
168
|
+
project_id.to_s # Always cast to a string
|
169
|
+
end
|
170
|
+
|
155
171
|
##
|
156
172
|
# @private Default project.
|
157
173
|
def self.default_project_id
|
@@ -843,10 +843,14 @@ module Google
|
|
843
843
|
# puts bucket.policy_only_locked_at
|
844
844
|
#
|
845
845
|
def policy_only= new_policy_only
|
846
|
-
@gapi.iam_configuration ||= API::Bucket::IamConfiguration.new
|
847
|
-
|
848
|
-
|
846
|
+
@gapi.iam_configuration ||= API::Bucket::IamConfiguration.new
|
847
|
+
@gapi.iam_configuration.bucket_policy_only ||= \
|
848
|
+
API::Bucket::IamConfiguration::BucketPolicyOnly.new
|
849
|
+
@gapi.iam_configuration.uniform_bucket_level_access ||= \
|
850
|
+
API::Bucket::IamConfiguration::UniformBucketLevelAccess.new
|
849
851
|
@gapi.iam_configuration.bucket_policy_only.enabled = new_policy_only
|
852
|
+
@gapi.iam_configuration.uniform_bucket_level_access.enabled = \
|
853
|
+
new_policy_only
|
850
854
|
patch_gapi! :iam_configuration
|
851
855
|
end
|
852
856
|
|
@@ -38,7 +38,8 @@ module Google
|
|
38
38
|
|
39
39
|
##
|
40
40
|
# Creates a new Service instance.
|
41
|
-
def initialize project, credentials,
|
41
|
+
def initialize project, credentials,
|
42
|
+
retries: nil, timeout: nil, host: nil
|
42
43
|
@project = project
|
43
44
|
@credentials = credentials
|
44
45
|
@service = API::StorageService.new
|
@@ -55,6 +56,7 @@ module Google
|
|
55
56
|
"gl-ruby/#{RUBY_VERSION} gccl/#{Google::Cloud::Storage::VERSION}"
|
56
57
|
@service.request_options.header["Accept-Encoding"] = "gzip"
|
57
58
|
@service.authorization = @credentials.client if @credentials
|
59
|
+
@service.root_url = host if host
|
58
60
|
end
|
59
61
|
|
60
62
|
def service
|
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.21.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: 2019-08-
|
12
|
+
date: 2019-08-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-cloud-core
|