google-cloud-storage 1.54.0 → 1.55.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 67fa1effce117003750f759eba79de92380616365652f2a19ba49b1986c75634
4
- data.tar.gz: 9729e6dc51f15a9a5e2e0370771f980908f9d6284973503c9c4d4c1e561b8d84
3
+ metadata.gz: b88969084fc97975cbd8423d11ea1d02c6a0d4ef77361214cfa86b225d6e2721
4
+ data.tar.gz: 53efca6d4100e617c4cb435091d4c8a4912b7520eecbe4a643ee50b161c34c85
5
5
  SHA512:
6
- metadata.gz: ec9022c921c0714ebf7f47131c745c113bb0480a34a376ca10055ccdee024821a518d1a87f742486118d7fb3e570beaeef5746f12676d5790e6ae697439dabd9
7
- data.tar.gz: d5e57fd75d565a8328cf79ce42374883e4da7f875c7fd9571e928f9648c05578bee5743d68465819f3e5d488469d277749aecebd44810198fd1a1ca0cac6f3c3
6
+ metadata.gz: 3842107e2b0e9eafd47eff5df012f9f133ebb510c3017af5bbc804b40b254d8db8d0b5ce1eb5da7d28ee673192a10dfe6114f1532038b128b84fbc06843d299d
7
+ data.tar.gz: 17cd1eefbadbdab56c424a013a17d64e1747d0fbc042a73dbfaa6f47bf0b416bdbc40928e8712633c56833275881852cd932c9b1c668fc81cd2950487099c2e6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Release History
2
2
 
3
+ ### 1.55.0 (2025-02-13)
4
+
5
+ #### Features
6
+
7
+ * Soft deleted Bucket Restore ([#28138](https://github.com/googleapis/google-cloud-ruby/issues/28138))
8
+ #### Documentation
9
+
10
+ * updating the encryption key GCS sample ([#28815](https://github.com/googleapis/google-cloud-ruby/issues/28815))
11
+
3
12
  ### 1.54.0 (2024-12-11)
4
13
 
5
14
  #### Features
@@ -72,7 +72,8 @@ module Google
72
72
  return nil unless next?
73
73
  ensure_service!
74
74
  gapi = @service.list_buckets prefix: @prefix, token: @token,
75
- max: @max, user_project: @user_project
75
+ max: @max, user_project: @user_project,
76
+ soft_deleted: @soft_deleted
76
77
  Bucket::List.from_gapi gapi, @service, @prefix, @max,
77
78
  user_project: @user_project
78
79
  end
@@ -146,7 +147,7 @@ module Google
146
147
  # @private New Bucket::List from a Google API Client
147
148
  # Google::Apis::StorageV1::Buckets object.
148
149
  def self.from_gapi gapi_list, service, prefix = nil, max = nil,
149
- user_project: nil
150
+ user_project: nil, soft_deleted: nil
150
151
  buckets = new(Array(gapi_list.items).map do |gapi_object|
151
152
  Bucket.from_gapi gapi_object, service, user_project: user_project
152
153
  end)
@@ -155,6 +156,7 @@ module Google
155
156
  buckets.instance_variable_set :@prefix, prefix
156
157
  buckets.instance_variable_set :@max, max
157
158
  buckets.instance_variable_set :@user_project, user_project
159
+ buckets.instance_variable_set :@soft_deleted, soft_deleted
158
160
  buckets
159
161
  end
160
162
 
@@ -982,7 +982,7 @@ module Google
982
982
  #
983
983
  def uniform_bucket_level_access= new_uniform_bucket_level_access
984
984
  @gapi.iam_configuration ||= API::Bucket::IamConfiguration.new
985
- @gapi.iam_configuration.uniform_bucket_level_access ||= \
985
+ @gapi.iam_configuration.uniform_bucket_level_access ||=
986
986
  API::Bucket::IamConfiguration::UniformBucketLevelAccess.new
987
987
  @gapi.iam_configuration.uniform_bucket_level_access.enabled = new_uniform_bucket_level_access
988
988
  patch_gapi! :iam_configuration
@@ -2280,6 +2280,31 @@ module Google
2280
2280
  end
2281
2281
  end
2282
2282
 
2283
+ # Fetches generation of the bucket
2284
+ # @example
2285
+ # require "google/cloud/storage"
2286
+ # storage = Google::Cloud::Storage.new
2287
+ # bucket = storage.bucket "my-bucket"
2288
+ # generation= bucket.generation
2289
+ def generation
2290
+ @gapi.generation
2291
+ end
2292
+
2293
+ # Fetches soft_delete_time of a soft deleted bucket
2294
+ # @example
2295
+ # bucket.delete
2296
+ # bucket.soft_delete_time
2297
+ def soft_delete_time
2298
+ @gapi.soft_delete_time
2299
+ end
2300
+
2301
+ # Fetches hard_delete_time of a soft deleted bucket
2302
+ # @example
2303
+ # bucket.hard_delete_time
2304
+ def hard_delete_time
2305
+ @gapi.hard_delete_time
2306
+ end
2307
+
2283
2308
  ##
2284
2309
  # Generate a PostObject that includes the fields and URL to
2285
2310
  # upload objects via HTML forms.
@@ -99,8 +99,7 @@ module Google
99
99
  # @return [String] The service account email address.
100
100
  #
101
101
  def service_account_email
102
- @service_account_email ||= \
103
- service.project_service_account.email_address
102
+ @service_account_email ||= service.project_service_account.email_address
104
103
  end
105
104
 
106
105
  ##
@@ -193,11 +192,20 @@ module Google
193
192
  # puts bucket.name
194
193
  # end
195
194
  #
196
- def buckets prefix: nil, token: nil, max: nil, user_project: nil
195
+ # @example Retrieve soft deleted buckets
196
+ # require "google/cloud/storage"
197
+ #
198
+ # storage = Google::Cloud::Storage.new
199
+ #
200
+ # soft_deleted_buckets = storage.buckets soft_deleted: true
201
+ # soft_deleted_buckets.each do |bucket|
202
+ # puts bucket.name
203
+ # end
204
+ def buckets prefix: nil, token: nil, max: nil, user_project: nil, soft_deleted: nil
197
205
  gapi = service.list_buckets \
198
- prefix: prefix, token: token, max: max, user_project: user_project
206
+ prefix: prefix, token: token, max: max, user_project: user_project, soft_deleted: soft_deleted
199
207
  Bucket::List.from_gapi \
200
- gapi, service, prefix, max, user_project: user_project
208
+ gapi, service, prefix, max, user_project: user_project, soft_deleted: soft_deleted
201
209
  end
202
210
  alias find_buckets buckets
203
211
 
@@ -223,6 +231,10 @@ module Google
223
231
  # account, transit costs will be billed to the given project. This
224
232
  # parameter is required with requester pays-enabled buckets. The
225
233
  # default is `nil`.
234
+ # @param [Integer] generation generation no of bucket
235
+ # on whether the bucket's current metageneration matches the given value.
236
+ # @param [Boolean] soft_deleted If true, returns the soft-deleted bucket.
237
+ # This parameter is required if generation is specified.
226
238
  #
227
239
  # The value provided will be applied to all operations on the returned
228
240
  # bucket instance and its files.
@@ -256,9 +268,20 @@ module Google
256
268
  # bucket = storage.bucket "other-project-bucket",
257
269
  # user_project: "my-other-project"
258
270
  # files = bucket.files # Billed to "my-other-project"
271
+ # @example With `soft_deleted` set to true and generation specified:
272
+ # require "google/cloud/storage"
273
+ #
274
+ # storage = Google::Cloud::Storage.new
275
+ #
276
+ # bucket = storage.bucket "my-bucket",
277
+ # soft_deleted: true,
278
+ # generation: 1234567889
279
+ # puts bucket.name
259
280
  #
260
281
  def bucket bucket_name,
261
282
  skip_lookup: false,
283
+ generation: nil,
284
+ soft_deleted: nil,
262
285
  if_metageneration_match: nil,
263
286
  if_metageneration_not_match: nil,
264
287
  user_project: nil
@@ -269,7 +292,10 @@ module Google
269
292
  gapi = service.get_bucket bucket_name,
270
293
  if_metageneration_match: if_metageneration_match,
271
294
  if_metageneration_not_match: if_metageneration_not_match,
272
- user_project: user_project
295
+ user_project: user_project,
296
+ soft_deleted: soft_deleted,
297
+ generation: generation
298
+
273
299
  Bucket.from_gapi gapi, service, user_project: user_project
274
300
  rescue Google::Cloud::NotFoundError
275
301
  nil
@@ -554,6 +580,32 @@ module Google
554
580
  max: max, user_project: user_project
555
581
  end
556
582
 
583
+ ##
584
+ # Restores a soft deleted bucket with bucket name and generation.
585
+ #
586
+ # @param [String] bucket_name Name of the bucket.
587
+ # @param [Fixnum] generation Generation of the bucket.
588
+ #
589
+ # @return [Google::Cloud::Storage::Bucket, nil] Returns nil if bucket
590
+ # does not exist
591
+ #
592
+ # @example
593
+ # require "google/cloud/storage"
594
+ #
595
+ # storage = Google::Cloud::Storage.new
596
+ # generation= 123
597
+ #
598
+ # bucket = storage.restore_bucket "my-bucket", generation
599
+ # puts bucket.name
600
+ #
601
+ def restore_bucket bucket_name,
602
+ generation,
603
+ options: {}
604
+ gapi = service.restore_bucket bucket_name, generation,
605
+ options: options
606
+ Bucket.from_gapi gapi, service
607
+ end
608
+
557
609
  ##
558
610
  # Generates a signed URL. See [Signed
559
611
  # URLs](https://cloud.google.com/storage/docs/access-control/signed-urls)
@@ -55,15 +55,14 @@ module Google
55
55
  @credentials = credentials
56
56
  @service = API::StorageService.new
57
57
  @service.client_options.application_name = "gcloud-ruby"
58
- @service.client_options.application_version = \
59
- Google::Cloud::Storage::VERSION
58
+ @service.client_options.application_version = Google::Cloud::Storage::VERSION
60
59
  @service.client_options.open_timeout_sec = (open_timeout || timeout)
61
60
  @service.client_options.read_timeout_sec = (read_timeout || timeout)
62
61
  @service.client_options.send_timeout_sec = (send_timeout || timeout)
63
62
  @service.client_options.transparent_gzip_decompression = false
64
63
  @service.request_options.retries = retries || 3
65
64
  @service.request_options.header ||= {}
66
- @service.request_options.header["x-goog-api-client"] = \
65
+ @service.request_options.header["x-goog-api-client"] =
67
66
  "gl-ruby/#{RUBY_VERSION} gccl/#{Google::Cloud::Storage::VERSION}"
68
67
  @service.request_options.header["Accept-Encoding"] = "gzip"
69
68
  @service.request_options.quota_project = quota_project if quota_project
@@ -97,11 +96,12 @@ module Google
97
96
 
98
97
  ##
99
98
  # Retrieves a list of buckets for the given project.
100
- def list_buckets prefix: nil, token: nil, max: nil, user_project: nil, options: {}
99
+ def list_buckets prefix: nil, token: nil, max: nil, user_project: nil, soft_deleted: nil, options: {}
101
100
  execute do
102
101
  service.list_buckets \
103
102
  @project, prefix: prefix, page_token: token, max_results: max,
104
- user_project: user_project(user_project), options: options
103
+ user_project: user_project(user_project),
104
+ soft_deleted: soft_deleted, options: options
105
105
  end
106
106
  end
107
107
 
@@ -112,12 +112,16 @@ module Google
112
112
  if_metageneration_match: nil,
113
113
  if_metageneration_not_match: nil,
114
114
  user_project: nil,
115
+ soft_deleted: nil,
116
+ generation: nil,
115
117
  options: {}
116
118
  execute do
117
119
  service.get_bucket bucket_name,
118
120
  if_metageneration_match: if_metageneration_match,
119
121
  if_metageneration_not_match: if_metageneration_not_match,
120
122
  user_project: user_project(user_project),
123
+ soft_deleted: soft_deleted,
124
+ generation: generation,
121
125
  options: options
122
126
  end
123
127
  end
@@ -654,6 +658,17 @@ module Google
654
658
  end
655
659
  end
656
660
 
661
+ ##
662
+ # Restore soft deleted bucket
663
+ def restore_bucket bucket_name,
664
+ generation,
665
+ options: {}
666
+ execute do
667
+ service.restore_bucket bucket_name, generation,
668
+ options: options
669
+ end
670
+ end
671
+
657
672
  ##
658
673
  # Restores a soft-deleted object.
659
674
  def restore_file bucket_name,
@@ -895,8 +910,7 @@ module Google
895
910
  headers = (options[:header] ||= {})
896
911
  headers["x-goog-#{source}encryption-algorithm"] = "AES256"
897
912
  headers["x-goog-#{source}encryption-key"] = Base64.strict_encode64 key
898
- headers["x-goog-#{source}encryption-key-sha256"] = \
899
- Base64.strict_encode64 key_sha256
913
+ headers["x-goog-#{source}encryption-key-sha256"] = Base64.strict_encode64 key_sha256
900
914
  options
901
915
  end
902
916
 
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Storage
19
- VERSION = "1.54.0".freeze
19
+ VERSION = "1.55.0".freeze
20
20
  end
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-storage
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.54.0
4
+ version: 1.55.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Moore
8
8
  - Chris Smith
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2024-12-11 00:00:00.000000000 Z
11
+ date: 2025-02-13 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: google-cloud-core
@@ -57,16 +56,16 @@ dependencies:
57
56
  name: google-apis-storage_v1
58
57
  requirement: !ruby/object:Gem::Requirement
59
58
  requirements:
60
- - - "~>"
59
+ - - ">="
61
60
  - !ruby/object:Gem::Version
62
- version: '0.38'
61
+ version: '0.42'
63
62
  type: :runtime
64
63
  prerelease: false
65
64
  version_requirements: !ruby/object:Gem::Requirement
66
65
  requirements:
67
- - - "~>"
66
+ - - ">="
68
67
  - !ruby/object:Gem::Version
69
- version: '0.38'
68
+ version: '0.42'
70
69
  - !ruby/object:Gem::Dependency
71
70
  name: googleauth
72
71
  requirement: !ruby/object:Gem::Requirement
@@ -325,7 +324,6 @@ homepage: https://github.com/googleapis/google-cloud-ruby/tree/master/google-clo
325
324
  licenses:
326
325
  - Apache-2.0
327
326
  metadata: {}
328
- post_install_message:
329
327
  rdoc_options: []
330
328
  require_paths:
331
329
  - lib
@@ -340,8 +338,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
340
338
  - !ruby/object:Gem::Version
341
339
  version: '0'
342
340
  requirements: []
343
- rubygems_version: 3.5.23
344
- signing_key:
341
+ rubygems_version: 3.6.3
345
342
  specification_version: 4
346
343
  summary: API Client library for Google Cloud Storage
347
344
  test_files: []