google-cloud-storage 1.29.2 → 1.47.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: ad286a8539024ffcee1d0239c7db682e3ddb4b6663e5e172354123fa607b96fc
4
- data.tar.gz: 29e8c237d1f891d46bddea92ff3151a08c11c32e936376f040d50159668a8f69
3
+ metadata.gz: fb6046c8eb979e1cbd733518d8fd242e1332813d6241f85e65b07f6d7d9e631f
4
+ data.tar.gz: 1124d71be6c1954b38f3fb6c8c3814891d9dd108fc0862f2c5436db18c111782
5
5
  SHA512:
6
- metadata.gz: b7121fbfee2ad413e88d6edfbe83c535a9b17173d2431919e72fed6e8f4eba4c94f84b64d588ade51f50d8f20556a8bef37c6ad8cdaeaca8d6fb58a280168825
7
- data.tar.gz: 0cb221a85541a6af70d8be63dd137915110eda09295e9711c566ec669bd574376a1f0125c4ebc559efa0a19268569dc74cd2548891400501d9af6bdfe62da8ce
6
+ metadata.gz: 2e8598d2cf01a52f20c7bd554b593d7049134a367f17571721e2779a0634013452ad42025c22d59f8542c030a411092c3f2f63edfe8489fee0a9dcb9ccb5c774
7
+ data.tar.gz: 4918a472cd83aab2c7d1a5ffe6be9957c0113686a00769f082522799fd9cc713c3315de8d8b2d87caa22b37d7d54c2c82702fb2b5b9e1ed30ef011319dc841cf
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"
@@ -111,15 +112,6 @@ those that produce
111
112
  post objects. For these methods, authentication using a service account JSON key file
112
113
  is required.
113
114
 
114
- [gce-how-to]: https://cloud.google.com/compute/docs/authentication#using
115
- [dev-console]: https://console.cloud.google.com/project
116
-
117
- [enable-apis]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/enable-apis.png
118
-
119
- [create-new-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account.png
120
- [create-new-service-account-existing-keys]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account-existing-keys.png
121
- [reuse-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/reuse-service-account.png
122
-
123
115
  ## Creating a Service Account
124
116
 
125
117
  Google Cloud requires a **Project ID** and **Service Account Credentials** to
@@ -129,31 +121,22 @@ connect to most services with google-cloud-storage.
129
121
  If you are not running this client on Google Compute Engine, you need a Google
130
122
  Developers service account.
131
123
 
132
- 1. Visit the [Google Developers Console][dev-console].
124
+ 1. Visit the [Google Cloud Console](https://console.cloud.google.com/project).
133
125
  1. Create a new project or click on an existing project.
134
- 1. Activate the slide-out navigation tray and select **API Manager**. From
126
+ 1. Activate the menu in the upper left and select **APIs & Services**. From
135
127
  here, you will enable the APIs that your application requires.
136
128
 
137
- ![Enable the APIs that your application requires][enable-apis]
138
-
139
129
  *Note: You may need to enable billing in order to use these services.*
140
130
 
141
131
  1. Select **Credentials** from the side navigation.
142
132
 
143
- You should see a screen like one of the following.
144
-
145
- ![Create a new service account][create-new-service-account]
146
-
147
- ![Create a new service account With Existing Keys][create-new-service-account-existing-keys]
148
-
149
- Find the "Add credentials" drop down and select "Service account" to be
150
- guided through downloading a new JSON key file.
151
-
152
- If you want to re-use an existing service account, you can easily generate a
153
- new key file. Just select the account you wish to re-use, and click "Generate
154
- new JSON key":
133
+ Find the "Create credentials" drop down near the top of the page, and select
134
+ "Service account" to be guided through downloading a new JSON key file.
155
135
 
156
- ![Re-use an existing service account][reuse-service-account]
136
+ If you want to re-use an existing service account, you can easily generate
137
+ a new key file. Just select the account you wish to re-use click the pencil
138
+ tool on the right side to edit the service account, select the **Keys** tab,
139
+ and then select **Add Key**.
157
140
 
158
141
  The key file you download will be used by this library to authenticate API
159
142
  requests and should be stored in a secure location.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,176 @@
1
1
  # Release History
2
2
 
3
+ ### 1.47.0 (2024-01-09)
4
+
5
+ #### Features
6
+
7
+ * support for object lock / retention ([#23732](https://github.com/googleapis/google-cloud-ruby/issues/23732))
8
+
9
+ ### 1.46.0 (2024-01-08)
10
+
11
+ #### Features
12
+
13
+ * support match_glob for Object.list
14
+
15
+ ### 1.45.0 (2023-11-06)
16
+
17
+ #### Features
18
+
19
+ * added autoclass v2.1 features ([#23483](https://github.com/googleapis/google-cloud-ruby/issues/23483))
20
+
21
+ ### 1.44.0 (2022-11-02)
22
+
23
+ #### Features
24
+
25
+ * support autoclass
26
+
27
+ ### 1.43.0 (2022-09-30)
28
+
29
+ #### Features
30
+
31
+ * Add retry conformance test ([#18230](https://github.com/googleapis/google-cloud-ruby/issues/18230))
32
+
33
+ ### 1.42.0 (2022-09-21)
34
+
35
+ #### Features
36
+
37
+ * send invocation_id header in all requests ([#19161](https://github.com/googleapis/google-cloud-ruby/issues/19161))
38
+
39
+ ### 1.41.0 (2022-09-16)
40
+
41
+ #### Features
42
+
43
+ * add retry support for non-idempotent operations ([#19134](https://github.com/googleapis/google-cloud-ruby/issues/19134))
44
+ #### Bug Fixes
45
+
46
+ * Correct options checks in retry operations ([#19135](https://github.com/googleapis/google-cloud-ruby/issues/19135))
47
+ * Update api for bucket update ([#19110](https://github.com/googleapis/google-cloud-ruby/issues/19110))
48
+
49
+ ### 1.40.0 (2022-09-13)
50
+
51
+ #### Features
52
+
53
+ * Update all patch bucket helper methods to accept preconditions ([#19117](https://github.com/googleapis/google-cloud-ruby/issues/19117))
54
+
55
+ ### 1.39.0 (2022-08-24)
56
+
57
+ #### Features
58
+
59
+ * add support for conditional idempotent operations ([#18834](https://github.com/googleapis/google-cloud-ruby/issues/18834))
60
+
61
+ ### 1.38.0 (2022-07-31)
62
+
63
+ #### Features
64
+
65
+ * Add support for dual region gcs buckets ([#18862](https://github.com/googleapis/google-cloud-ruby/issues/18862))
66
+
67
+ ### 1.37.0 (2022-06-30)
68
+
69
+ #### Features
70
+
71
+ * support OLM Prefix/Suffix ([#18190](https://github.com/googleapis/google-cloud-ruby/issues/18190))
72
+ * allow retry options to be configurable on client initialization ([#18332](https://github.com/googleapis/google-cloud-ruby/issues/18332))
73
+ #### Bug Fixes
74
+
75
+ * update object path parsing to handle hashes in them
76
+
77
+ ### 1.36.2 (2022-04-20)
78
+
79
+ #### Documentation
80
+
81
+ * Document support for dual region buckets
82
+
83
+ ### 1.36.1 / 2022-02-08
84
+
85
+ #### Documentation
86
+
87
+ * Update the RPO sample output. ([#17277](https://www.github.com/googleapis/google-cloud-ruby/issues/17277))
88
+
89
+ ### 1.36.0 / 2022-01-12
90
+
91
+ #### Features
92
+
93
+ * add support for RPO (turbo replication). ([#14407](https://www.github.com/googleapis/google-cloud-ruby/issues/14407))
94
+
95
+ ### 1.35.0 / 2021-12-08
96
+
97
+ #### Features
98
+
99
+ * changed PAP unspecified to inherited
100
+ * support for more client timeout options
101
+
102
+ #### Bug Fixes
103
+
104
+ * Update dependency on the addressable gem to 2.8 to remediate a vulnerability
105
+
106
+ ### 1.34.1 / 2021-07-08
107
+
108
+ #### Documentation
109
+
110
+ * Update AUTHENTICATION.md in handwritten packages
111
+
112
+ ### 1.34.0 / 2021-06-30
113
+
114
+ #### Features
115
+
116
+ * Add support for automatic crc32c and md5 upload verification
117
+ * Add checksum to Bucket#create_file
118
+
119
+ ### 1.33.0 / 2021-06-29
120
+
121
+ #### Features
122
+
123
+ * Add support for PublicAccessPrevention
124
+ * Add Bucket#public_access_prevention
125
+ * Add Bucket#public_access_prevention=
126
+ * Add Bucket#public_access_prevention_enforced?
127
+ * Add Bucket#public_access_prevention_unspecified?
128
+ * Add samples for PublicAccessPrevention
129
+
130
+ ### 1.32.0 / 2021-06-22
131
+
132
+ #### Features
133
+
134
+ * Add sources_if_generation_match to Bucket#compose
135
+ * Add support for (meta)generation preconditions to File operations
136
+ * Add if_(meta)generation_match options to Bucket#compose
137
+ * Add if_(meta)generation_(not_)match options to Bucket#create_file
138
+ * Add if_(meta)generation_(not_)match options to Bucket#file
139
+ * Add if_(meta)generation_(not_)match options to File#delete.
140
+ * Add if_(meta)generation_(not_)match options to File#rewrite
141
+ * Add generation and if_(meta)generation_(not_)match options to File#update
142
+ * Add generation and if_(meta)generation_(not_)match options to File::Acl predefined_acl methods
143
+
144
+ #### Bug Fixes
145
+
146
+ * Expand googleauth dependency to support future 1.x versions
147
+ * Update File::Verifier to test for File#to_path
148
+
149
+ ### 1.31.1 / 2021-05-19
150
+
151
+ #### Documentation
152
+
153
+ * Update IAMCredentialsService#sign_service_account_blob examples
154
+
155
+ ### 1.31.0 / 2021-03-10
156
+
157
+ #### Features
158
+
159
+ * Drop support for Ruby 2.4 and add support for Ruby 3.0
160
+
161
+ ### 1.30.0 / 2021-01-13
162
+
163
+ #### Features
164
+
165
+ * Replace google-api-client with specific client gems
166
+ * Remove google-api-client
167
+ * Add google-apis-iamcredentials_v1
168
+ * Add google-apis-storage_v1
169
+
170
+ #### Documentation
171
+
172
+ * Update Bucket#generate_signed_post_policy_v4 documentation
173
+
3
174
  ### 1.29.2 / 2020-12-14
4
175
 
5
176
  #### Bug Fixes
data/CONTRIBUTING.md CHANGED
@@ -24,7 +24,7 @@ be able to accept your pull requests.
24
24
  In order to use the google-cloud-storage console and run the project's tests,
25
25
  there is a small amount of setup:
26
26
 
27
- 1. Install Ruby. google-cloud-storage requires Ruby 2.4+. You may choose to
27
+ 1. Install Ruby. google-cloud-storage requires Ruby 2.5+. You may choose to
28
28
  manage your Ruby and gem installations with [RVM](https://rvm.io/),
29
29
  [rbenv](https://github.com/rbenv/rbenv), or
30
30
  [chruby](https://github.com/postmodern/chruby).
@@ -119,15 +119,14 @@ If you alter an example's title, you may encounter breaking tests.
119
119
  ### Storage Acceptance Tests
120
120
 
121
121
  The Storage acceptance tests interact with the live service API. Follow the
122
- instructions in the {file:AUTHENTICATION.md Authentication guide} for enabling
122
+ instructions in the {file:AUTHENTICATION.md Authentication Guide} for enabling
123
123
  the Storage API. Occasionally, some API features may not yet be generally
124
124
  available, making it difficult for some contributors to successfully run the
125
125
  entire acceptance test suite. However, please ensure that you do successfully
126
126
  run acceptance tests for any code areas covered by your pull request.
127
127
 
128
128
  To run the acceptance tests, first create and configure a project in the Google
129
- Developers Console, as described in the {file:AUTHENTICATION.md Authentication
130
- guide}. Be sure to download the JSON KEY file. Make note of the PROJECT_ID and
129
+ Developers Console, as described in the {file:AUTHENTICATION.md Authentication Guide}. Be sure to download the JSON KEY file. Make note of the PROJECT_ID and
131
130
  the KEYFILE location on your system.
132
131
 
133
132
  Before you can run the Storage acceptance tests, you must first create indexes
data/OVERVIEW.md CHANGED
@@ -563,6 +563,38 @@ require "google/cloud/storage"
563
563
  storage = Google::Cloud::Storage.new retries: 10, timeout: 120
564
564
  ```
565
565
 
566
+ The library by default retries all API requests which are always idempotent on a
567
+ "transient" error.
568
+
569
+ For API requests which are idempotent only if the some conditions are satisfied
570
+ (For ex. a file has the same "generation"), the library retries only if the
571
+ condition is specified.
572
+
573
+ Rather than using this default behaviour, you may choose to disable the retries
574
+ on your own.
575
+
576
+ You can pass `retries` as `0` to disable retries for all operations regardless
577
+ of their idempotencies.
578
+
579
+ ```ruby
580
+ require "google/cloud/storage"
581
+
582
+ storage = Google::Cloud::Storage.new retries: 0
583
+ ```
584
+
585
+ You can also disable retries for a particular operation by passing `retries` as
586
+ `0` in the `options` field.
587
+
588
+ ```ruby
589
+ require "google/cloud/storage"
590
+
591
+ storage = Google::Cloud::Storage.new
592
+ service = storage.service
593
+ service.get_bucket bucket_name, options: {retries: 0}
594
+ ```
595
+
596
+ For those API requests which are never idempotent, the library passes retries=0 by default, suppressing any retries.
597
+
566
598
  See the [Storage status and error
567
599
  codes](https://cloud.google.com/storage/docs/json_api/v1/status-codes)
568
600
  for a list of error conditions.
@@ -198,7 +198,7 @@ module Google
198
198
  gapi = @service.insert_bucket_acl @bucket, entity, "OWNER",
199
199
  user_project: user_project
200
200
  entity = gapi.entity
201
- @owners.push entity unless @owners.nil?
201
+ @owners&.push entity
202
202
  entity
203
203
  end
204
204
 
@@ -243,7 +243,7 @@ module Google
243
243
  gapi = @service.insert_bucket_acl @bucket, entity, "WRITER",
244
244
  user_project: user_project
245
245
  entity = gapi.entity
246
- @writers.push entity unless @writers.nil?
246
+ @writers&.push entity
247
247
  entity
248
248
  end
249
249
 
@@ -288,7 +288,7 @@ module Google
288
288
  gapi = @service.insert_bucket_acl @bucket, entity, "READER",
289
289
  user_project: user_project
290
290
  entity = gapi.entity
291
- @readers.push entity unless @readers.nil?
291
+ @readers&.push entity
292
292
  entity
293
293
  end
294
294
 
@@ -323,9 +323,9 @@ module Google
323
323
  def delete entity
324
324
  @service.delete_bucket_acl @bucket, entity,
325
325
  user_project: user_project
326
- @owners.delete entity unless @owners.nil?
327
- @writers.delete entity unless @writers.nil?
328
- @readers.delete entity unless @readers.nil?
326
+ @owners&.delete entity
327
+ @writers&.delete entity
328
+ @readers&.delete entity
329
329
  true
330
330
  end
331
331
 
@@ -349,8 +349,8 @@ module Google
349
349
  #
350
350
  # bucket.acl.auth!
351
351
  #
352
- def auth!
353
- update_predefined_acl! "authenticatedRead"
352
+ def auth! if_metageneration_match: nil
353
+ update_predefined_acl! "authenticatedRead", if_metageneration_match: if_metageneration_match
354
354
  end
355
355
  alias authenticatedRead! auth!
356
356
  alias auth_read! auth!
@@ -370,8 +370,8 @@ module Google
370
370
  #
371
371
  # bucket.acl.private!
372
372
  #
373
- def private!
374
- update_predefined_acl! "private"
373
+ def private! if_metageneration_match: nil
374
+ update_predefined_acl! "private", if_metageneration_match: if_metageneration_match
375
375
  end
376
376
 
377
377
  ##
@@ -387,8 +387,8 @@ module Google
387
387
  #
388
388
  # bucket.acl.project_private!
389
389
  #
390
- def project_private!
391
- update_predefined_acl! "projectPrivate"
390
+ def project_private! if_metageneration_match: nil
391
+ update_predefined_acl! "projectPrivate", if_metageneration_match: if_metageneration_match
392
392
  end
393
393
  alias projectPrivate! project_private!
394
394
 
@@ -405,8 +405,8 @@ module Google
405
405
  #
406
406
  # bucket.acl.public!
407
407
  #
408
- def public!
409
- update_predefined_acl! "publicRead"
408
+ def public! if_metageneration_match: nil
409
+ update_predefined_acl! "publicRead", if_metageneration_match: if_metageneration_match
410
410
  end
411
411
  alias publicRead! public!
412
412
  alias public_read! public!
@@ -423,8 +423,8 @@ module Google
423
423
  #
424
424
  # bucket.acl.public_write!
425
425
  #
426
- def public_write!
427
- update_predefined_acl! "publicReadWrite"
426
+ def public_write! if_metageneration_match: nil
427
+ update_predefined_acl! "publicReadWrite", if_metageneration_match: if_metageneration_match
428
428
  end
429
429
  alias publicReadWrite! public_write!
430
430
 
@@ -437,16 +437,16 @@ module Google
437
437
  self
438
438
  end
439
439
 
440
- def update_predefined_acl! acl_role
440
+ def update_predefined_acl! acl_role, if_metageneration_match: nil
441
441
  @service.patch_bucket @bucket, predefined_acl: acl_role,
442
- user_project: user_project
442
+ user_project: user_project,
443
+ if_metageneration_match: if_metageneration_match
443
444
  clear!
444
445
  end
445
446
 
446
447
  def entities_from_acls acls, role
447
448
  selected = acls.select { |acl| acl.role == role }
448
- entities = selected.map(&:entity)
449
- entities
449
+ selected.map(&:entity)
450
450
  end
451
451
  end
452
452
 
@@ -614,7 +614,7 @@ module Google
614
614
  gapi = @service.insert_default_acl @bucket, entity, "OWNER",
615
615
  user_project: user_project
616
616
  entity = gapi.entity
617
- @owners.push entity unless @owners.nil?
617
+ @owners&.push entity
618
618
  entity
619
619
  end
620
620
 
@@ -657,7 +657,7 @@ module Google
657
657
  gapi = @service.insert_default_acl @bucket, entity, "READER",
658
658
  user_project: user_project
659
659
  entity = gapi.entity
660
- @readers.push entity unless @readers.nil?
660
+ @readers&.push entity
661
661
  entity
662
662
  end
663
663
 
@@ -690,8 +690,8 @@ module Google
690
690
  def delete entity
691
691
  @service.delete_default_acl @bucket, entity,
692
692
  user_project: user_project
693
- @owners.delete entity unless @owners.nil?
694
- @readers.delete entity unless @readers.nil?
693
+ @owners&.delete entity
694
+ @readers&.delete entity
695
695
  true
696
696
  end
697
697
 
@@ -715,8 +715,8 @@ module Google
715
715
  #
716
716
  # bucket.default_acl.auth!
717
717
  #
718
- def auth!
719
- update_predefined_default_acl! "authenticatedRead"
718
+ def auth! if_metageneration_match: nil
719
+ update_predefined_default_acl! "authenticatedRead", if_metageneration_match: if_metageneration_match
720
720
  end
721
721
  alias authenticatedRead! auth!
722
722
  alias auth_read! auth!
@@ -736,8 +736,8 @@ module Google
736
736
  #
737
737
  # bucket.default_acl.owner_full!
738
738
  #
739
- def owner_full!
740
- update_predefined_default_acl! "bucketOwnerFullControl"
739
+ def owner_full! if_metageneration_match: nil
740
+ update_predefined_default_acl! "bucketOwnerFullControl", if_metageneration_match: if_metageneration_match
741
741
  end
742
742
  alias bucketOwnerFullControl! owner_full!
743
743
 
@@ -754,8 +754,8 @@ module Google
754
754
  #
755
755
  # bucket.default_acl.owner_read!
756
756
  #
757
- def owner_read!
758
- update_predefined_default_acl! "bucketOwnerRead"
757
+ def owner_read! if_metageneration_match: nil
758
+ update_predefined_default_acl! "bucketOwnerRead", if_metageneration_match: if_metageneration_match
759
759
  end
760
760
  alias bucketOwnerRead! owner_read!
761
761
 
@@ -772,8 +772,8 @@ module Google
772
772
  #
773
773
  # bucket.default_acl.private!
774
774
  #
775
- def private!
776
- update_predefined_default_acl! "private"
775
+ def private! if_metageneration_match: nil
776
+ update_predefined_default_acl! "private", if_metageneration_match: if_metageneration_match
777
777
  end
778
778
 
779
779
  ##
@@ -789,8 +789,8 @@ module Google
789
789
  #
790
790
  # bucket.default_acl.project_private!
791
791
  #
792
- def project_private!
793
- update_predefined_default_acl! "projectPrivate"
792
+ def project_private! if_metageneration_match: nil
793
+ update_predefined_default_acl! "projectPrivate", if_metageneration_match: if_metageneration_match
794
794
  end
795
795
  alias projectPrivate! project_private!
796
796
 
@@ -807,8 +807,8 @@ module Google
807
807
  #
808
808
  # bucket.default_acl.public!
809
809
  #
810
- def public!
811
- update_predefined_default_acl! "publicRead"
810
+ def public! if_metageneration_match: nil
811
+ update_predefined_default_acl! "publicRead", if_metageneration_match: if_metageneration_match
812
812
  end
813
813
  alias publicRead! public!
814
814
  alias public_read! public!
@@ -821,16 +821,16 @@ module Google
821
821
  self
822
822
  end
823
823
 
824
- def update_predefined_default_acl! acl_role
824
+ def update_predefined_default_acl! acl_role, if_metageneration_match: nil
825
825
  @service.patch_bucket @bucket, predefined_default_acl: acl_role,
826
- user_project: user_project
826
+ user_project: user_project,
827
+ if_metageneration_match: if_metageneration_match
827
828
  clear!
828
829
  end
829
830
 
830
831
  def entities_from_acls acls, role
831
832
  selected = acls.select { |acl| acl.role == role }
832
- entities = selected.map(&:entity)
833
- entities
833
+ selected.map(&:entity)
834
834
  end
835
835
  end
836
836
  end
@@ -172,7 +172,10 @@ module Google
172
172
  # rule.max_age #=> 3600
173
173
  #
174
174
  class Rule
175
- attr_accessor :origin, :methods, :headers, :max_age
175
+ attr_accessor :origin
176
+ attr_accessor :methods
177
+ attr_accessor :headers
178
+ attr_accessor :max_age
176
179
 
177
180
  # @private
178
181
  def initialize origin, methods, headers: nil, max_age: nil