google-cloud-storage 1.33.0 → 1.36.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6900463b2861e35e33cef3bda84de638f0f9e7d80e8424755f5eef311bd20352
4
- data.tar.gz: 6469082cd9d6b158a71a808874104e20128187c4c611a0fe71dbd80b0f68e54e
3
+ metadata.gz: 70af6e7a7384139db86fc433215199b3a0f6f03fdc36bf2712e3e3e5d5b8b4b5
4
+ data.tar.gz: 34d028c9cc7b0125861db575ca23cc18601bdfb0f72642d491097f97f4f6a41b
5
5
  SHA512:
6
- metadata.gz: 4d32314a8813b66cf6ec488be10c8ac174cb71a54d175cff9f33809a529f4851ff2482a43c646f114c91cac4bf7fbc90cc4135caab85d1a55ab8c732f11c1c5f
7
- data.tar.gz: '08382f70eb5759b7ccb98ac0bb793bed114bd3fcc24b6ca8e3ecc02af2e60540f1761d36133d8299b043155d260d9a659ab2d5b0cda6a27eb40ead70d7b7d6d1'
6
+ metadata.gz: cbee86e3123720e8bc8a74daf22cdcf1f5fdfb111279a00d0b4e8f50fd508b92b952651fcdf5efcb3e612be84fc00fec7e897571b62c05917c7ed6a0ccddc40a
7
+ data.tar.gz: d8c4f3820eb06abb5913623b6e04e42a66e51fb961a046ce99eb78b44b1adca85ec1159018c6b14689e0bcd58807d3f476eb6d945fd01bb7cdf6b69d928ecf23
data/AUTHENTICATION.md CHANGED
@@ -77,7 +77,8 @@ storage = Google::Cloud::Storage.new
77
77
 
78
78
  ### Configuration
79
79
 
80
- The **Project ID** and **Credentials JSON** can be configured instead of placing them in environment variables or providing them as arguments.
80
+ The **Project ID** and the path to the **Credentials JSON** file can be configured
81
+ instead of placing them in environment variables or providing them as arguments.
81
82
 
82
83
  ```ruby
83
84
  require "google/cloud/storage"
data/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # Release History
2
2
 
3
+ ### 1.36.0 / 2022-01-12
4
+
5
+ #### Features
6
+
7
+ * add support for RPO (turbo replication). ([#14407](https://www.github.com/googleapis/google-cloud-ruby/issues/14407))
8
+
9
+ ### 1.35.0 / 2021-12-08
10
+
11
+ #### Features
12
+
13
+ * changed PAP unspecified to inherited
14
+ * support for more client timeout options
15
+
16
+ #### Bug Fixes
17
+
18
+ * Update dependency on the addressable gem to 2.8 to remediate a vulnerability
19
+
20
+ ### 1.34.1 / 2021-07-08
21
+
22
+ #### Documentation
23
+
24
+ * Update AUTHENTICATION.md in handwritten packages
25
+
26
+ ### 1.34.0 / 2021-06-30
27
+
28
+ #### Features
29
+
30
+ * Add support for automatic crc32c and md5 upload verification
31
+ * Add checksum to Bucket#create_file
32
+
3
33
  ### 1.33.0 / 2021-06-29
4
34
 
5
35
  #### Features
@@ -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, `unspecified` and
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, `unspecified` and `enforced` are supported. Returns `nil` if the bucket has
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, `unspecified` and `enforced` are supported. When set to `enforced`, Public Access
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 unspecified:
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 = :unspecified
982
- # bucket.public_access_prevention #=> "unspecified"
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 `unspecified`. The default
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 `unspecified` in the IAM configuration. Returns `true` if Public Access Prevention is `unspecified` in
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,12 +1025,70 @@ module Google
1025
1025
  #
1026
1026
  # bucket = storage.bucket "my-bucket"
1027
1027
  #
1028
- # bucket.public_access_prevention = :unspecified
1029
- # bucket.public_access_prevention_unspecified? # true
1028
+ # bucket.public_access_prevention = :inherited
1029
+ # bucket.public_access_prevention_inherited? # true
1030
1030
  #
1031
- def public_access_prevention_unspecified?
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 == "unspecified"
1033
+ ["inherited", "unspecified"].include? @gapi.iam_configuration.public_access_prevention.to_s
1034
+ end
1035
+
1036
+ alias public_access_prevention_unspecified? public_access_prevention_inherited?
1037
+
1038
+ ##
1039
+ # Recovery Point Objective (RPO) is another attribute of a bucket, it measures how long it takes for a set of
1040
+ # updates to be asynchronously copied to the other region.
1041
+ # Currently, `DEFAULT` and `ASYNC_TURBO` are supported. When set to `ASYNC_TURBO`, Turbo Replication is enabled
1042
+ # for a bucket. `DEFAULT` is used to reset rpo on an existing bucket with rpo set to `ASYNC_TURBO`.
1043
+ # This value can be modified by calling {#rpo=}.
1044
+ #
1045
+ # @return [String, nil] Currently, `DEFAULT` and `ASYNC_TURBO` are supported. Returns `nil` if the bucket has
1046
+ # no RPO.
1047
+ #
1048
+ # @example
1049
+ # require "google/cloud/storage"
1050
+ #
1051
+ # storage = Google::Cloud::Storage.new
1052
+ #
1053
+ # bucket = storage.bucket "my-bucket"
1054
+ #
1055
+ # bucket.rpo = :DEFAULT
1056
+ # bucket.rpo #=> "DEFAULT"
1057
+ #
1058
+ def rpo
1059
+ @gapi.rpo
1060
+ end
1061
+
1062
+ ##
1063
+ # Sets the value for Recovery Point Objective (RPO) in the bucket. This value can be queried by calling {#rpo}.
1064
+ #
1065
+ # @param [Symbol, String] new_rpo The bucket's new Recovery Point Objective metadata.
1066
+ # Currently, `DEFAULT` and `ASYNC_TURBO` are supported. When set to `ASYNC_TURBO`, Turbo Replication
1067
+ # is enabled for a bucket.
1068
+ #
1069
+ # @example Set RPO to DEFAULT:
1070
+ # require "google/cloud/storage"
1071
+ #
1072
+ # storage = Google::Cloud::Storage.new
1073
+ #
1074
+ # bucket = storage.bucket "my-bucket"
1075
+ #
1076
+ # bucket.rpo = :DEFAULT
1077
+ # bucket.rpo #=> "DEFAULT"
1078
+ #
1079
+ # @example Set RPO to ASYNC_TURBO:
1080
+ # require "google/cloud/storage"
1081
+ #
1082
+ # storage = Google::Cloud::Storage.new
1083
+ #
1084
+ # bucket = storage.bucket "my-bucket"
1085
+ #
1086
+ # bucket.rpo = :ASYNC_TURBO
1087
+ # bucket.rpo #=> "ASYNC_TURBO"
1088
+ #
1089
+ def rpo= new_rpo
1090
+ @gapi.rpo = new_rpo&.to_s
1091
+ patch_gapi! :rpo
1034
1092
  end
1035
1093
 
1036
1094
  ##
@@ -1332,16 +1390,34 @@ module Google
1332
1390
  # changed to a time in the future. If custom_time must be unset, you
1333
1391
  # must either perform a rewrite operation, or upload the data again
1334
1392
  # and create a new file.
1393
+ # @param [Symbol, nil] checksum The type of checksum for the client to
1394
+ # automatically calculate and send with the create request to verify
1395
+ # the integrity of the object. If provided, Cloud Storage will only
1396
+ # create the file if the value calculated by the client matches the
1397
+ # value calculated by the service.
1398
+ #
1399
+ # Acceptable values are:
1400
+ #
1401
+ # * `md5` - Calculate and provide a checksum using the MD5 hash.
1402
+ # * `crc32c` - Calculate and provide a checksum using the CRC32c hash.
1403
+ # * `all` - Calculate and provide checksums for all available verifications.
1404
+ #
1405
+ # Optional. The default is `nil`. Do not provide if also providing a
1406
+ # corresponding `crc32c` or `md5` argument. See
1407
+ # [Validation](https://cloud.google.com/storage/docs/hashes-etags)
1408
+ # for more information.
1335
1409
  # @param [String] crc32c The CRC32c checksum of the file data, as
1336
1410
  # described in [RFC 4960, Appendix
1337
1411
  # B](http://tools.ietf.org/html/rfc4960#appendix-B).
1338
1412
  # If provided, Cloud Storage will only create the file if the value
1339
- # matches the value calculated by the service. See
1413
+ # matches the value calculated by the service. Do not provide if also
1414
+ # providing a `checksum: :crc32c` or `checksum: :all` argument. See
1340
1415
  # [Validation](https://cloud.google.com/storage/docs/hashes-etags)
1341
1416
  # for more information.
1342
1417
  # @param [String] md5 The MD5 hash of the file data. If provided, Cloud
1343
1418
  # Storage will only create the file if the value matches the value
1344
- # calculated by the service. See
1419
+ # calculated by the service. Do not provide if also providing a
1420
+ # `checksum: :md5` or `checksum: :all` argument. See
1345
1421
  # [Validation](https://cloud.google.com/storage/docs/hashes-etags) for
1346
1422
  # more information.
1347
1423
  # @param [Hash] metadata A hash of custom, user-provided web-safe keys
@@ -1473,6 +1549,7 @@ module Google
1473
1549
  content_language: nil,
1474
1550
  content_type: nil,
1475
1551
  custom_time: nil,
1552
+ checksum: nil,
1476
1553
  crc32c: nil,
1477
1554
  md5: nil,
1478
1555
  metadata: nil,
@@ -1490,7 +1567,8 @@ module Google
1490
1567
  path ||= file.path if file.respond_to? :path
1491
1568
  path ||= file if file.is_a? String
1492
1569
  raise ArgumentError, "must provide path" if path.nil?
1493
-
1570
+ crc32c = crc32c_for file, checksum, crc32c
1571
+ md5 = md5_for file, checksum, md5
1494
1572
 
1495
1573
  gapi = service.insert_file name,
1496
1574
  file,
@@ -2821,6 +2899,18 @@ module Google
2821
2899
  raise ArgumentError, "cannot find file #{file}"
2822
2900
  end
2823
2901
 
2902
+ def crc32c_for source, checksum, crc32c
2903
+ return crc32c unless [:crc32c, :all].include? checksum
2904
+ raise ArgumentError, "'checksum: :crc32c' or 'checksum: :all' is present with 'crc32c' arg" if crc32c
2905
+ File::Verifier.crc32c_for source
2906
+ end
2907
+
2908
+ def md5_for source, checksum, md5
2909
+ return md5 unless [:md5, :all].include? checksum
2910
+ raise ArgumentError, "'checksum: :md5' or 'checksum: :all' is present with 'md5' arg" if md5
2911
+ File::Verifier.md5_for source
2912
+ end
2913
+
2824
2914
  ##
2825
2915
  # Yielded to a block to accumulate changes for a patch request.
2826
2916
  class Updater < Bucket
@@ -364,11 +364,18 @@ module Google
364
364
  # b.lifecycle.add_set_storage_class_rule "COLDLINE", age: 10
365
365
  # end
366
366
  #
367
- def create_bucket bucket_name, acl: nil, default_acl: nil,
368
- location: nil, storage_class: nil,
369
- logging_bucket: nil, logging_prefix: nil,
370
- website_main: nil, website_404: nil, versioning: nil,
371
- requester_pays: nil, user_project: nil
367
+ def create_bucket bucket_name,
368
+ acl: nil,
369
+ default_acl: nil,
370
+ location: nil,
371
+ storage_class: nil,
372
+ logging_bucket: nil,
373
+ logging_prefix: nil,
374
+ website_main: nil,
375
+ website_404: nil,
376
+ versioning: nil,
377
+ requester_pays: nil,
378
+ user_project: nil
372
379
  params = {
373
380
  name: bucket_name,
374
381
  location: location
@@ -38,17 +38,18 @@ module Google
38
38
 
39
39
  ##
40
40
  # Creates a new Service instance.
41
- def initialize project, credentials,
42
- retries: nil, timeout: nil, host: nil, quota_project: nil
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 ||= {}
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Storage
19
- VERSION = "1.33.0".freeze
19
+ VERSION = "1.36.0".freeze
20
20
  end
21
21
  end
22
22
  end
@@ -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 Default timeout to use in requests. Optional.
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, 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))
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, host: endpoint,
97
- quota_project: configure.quota_project
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 Default timeout to use in requests. Optional.
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, endpoint: 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, host: endpoint
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) Default timeout to use in requests.
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.
@@ -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 Default timeout to use in requests. Optional.
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 Default timeout to use in requests. Optional.
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, retries: retries,
115
- timeout: timeout
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.33.0
4
+ version: 1.36.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-06-29 00:00:00.000000000 Z
12
+ date: 2022-01-12 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.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
@@ -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.2.17
321
+ rubygems_version: 3.3.4
322
322
  signing_key:
323
323
  specification_version: 4
324
324
  summary: API Client library for Google Cloud Storage