docs: Add preconditions to some samples#1600
Merged
JesseLovelace merged 7 commits intomainfrom Sep 23, 2022
Merged
Conversation
Shabirmean
reviewed
Aug 31, 2022
samples/snippets/src/main/java/com/example/storage/object/ComposeObject.java
Show resolved
Hide resolved
Shabirmean
reviewed
Aug 31, 2022
samples/snippets/src/main/java/com/example/storage/object/CopyObject.java
Show resolved
Hide resolved
Shabirmean
reviewed
Aug 31, 2022
samples/snippets/src/main/java/com/example/storage/object/CopyObject.java
Show resolved
Hide resolved
Shabirmean
reviewed
Aug 31, 2022
samples/snippets/src/main/java/com/example/storage/object/CopyOldVersionOfObject.java
Show resolved
Hide resolved
Shabirmean
reviewed
Aug 31, 2022
samples/snippets/src/main/java/com/example/storage/object/MoveObject.java
Show resolved
Hide resolved
Shabirmean
reviewed
Aug 31, 2022
samples/snippets/src/main/java/com/example/storage/object/UploadEncryptedObject.java
Show resolved
Hide resolved
Shabirmean
reviewed
Aug 31, 2022
samples/snippets/src/main/java/com/example/storage/object/UploadKmsEncryptedObject.java
Show resolved
Hide resolved
Shabirmean
reviewed
Aug 31, 2022
Shabirmean
left a comment
There was a problem hiding this comment.
LGTM Overall.
Some minor formatting related comments. Also PTAL at the failing tests
BenWhitehead
reviewed
Sep 6, 2022
| // conditions and data corruptions. The request to upload returns a 412 error if | ||
| // the object's generation number does not match your precondition. | ||
| Storage.BlobSourceOption precondition = | ||
| Storage.BlobSourceOption.generationMatch(storage.get(blobId).getGeneration()); |
Collaborator
There was a problem hiding this comment.
This could 404 and return null if there isn't an object for blobId. Possibly move it to it's own line to ease debugging?
| // conditions and data corruptions. The request to upload returns a 412 error if | ||
| // the object's generation number does not match your precondition. | ||
| Storage.BlobSourceOption precondition = | ||
| Storage.BlobSourceOption.generationMatch(storage.get(blobId).getGeneration()); |
| // the object's generation number does not match your precondition. | ||
| Storage.BlobSourceOption precondition = | ||
| Storage.BlobSourceOption.generationMatch( | ||
| storage.get(bucketName, objectName).getGeneration()); |
| // conditions and data corruptions. The request to upload returns a 412 error if | ||
| // the object's generation number does not match your precondition. | ||
| Storage.BlobSourceOption precondition = | ||
| Storage.BlobSourceOption.generationMatch(storage.get(blobId).getGeneration()); |
BenWhitehead
approved these changes
Sep 7, 2022
Collaborator
BenWhitehead
left a comment
There was a problem hiding this comment.
Thanks for adding the null checks!
Shabirmean
approved these changes
Sep 10, 2022
gcf-merge-on-green bot
pushed a commit
that referenced
this pull request
Oct 4, 2022
🤖 I have created a release *beep* *boop* --- ## [2.13.0](https://togithub.com/googleapis/java-storage/compare/v2.12.0...v2.13.0) (2022-10-03) ### Features * Regenerate gapic storage v2 client as of googleapis/googleapis@844d0f7 ([#1673](https://togithub.com/googleapis/java-storage/issues/1673)) ([bd818b3](https://togithub.com/googleapis/java-storage/commit/bd818b311186c37ceb527630ed56755d89e2b71b)) ### Documentation * Add preconditions to some samples ([#1600](https://togithub.com/googleapis/java-storage/issues/1600)) ([4b3be44](https://togithub.com/googleapis/java-storage/commit/4b3be44bd4c53613f08bbd01d3b4a9ded419565d)) ### Dependencies * Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.4 ([#1685](https://togithub.com/googleapis/java-storage/issues/1685)) ([3d8f550](https://togithub.com/googleapis/java-storage/commit/3d8f550e4d646a7d4bda6f9e74bc5996d573d5b4)) * Update dependency gcp-releasetool to v1.8.9 ([#1684](https://togithub.com/googleapis/java-storage/issues/1684)) ([54a5159](https://togithub.com/googleapis/java-storage/commit/54a5159707efd6a2d4abd0273ab7c279f507005b)) * Update dependency importlib-metadata to v4.13.0 ([#1682](https://togithub.com/googleapis/java-storage/issues/1682)) ([2487aff](https://togithub.com/googleapis/java-storage/commit/2487affad5a1adf1c39589d8f8a976c7f245b0c9)) * Update dependency importlib-metadata to v5 ([#1683](https://togithub.com/googleapis/java-storage/issues/1683)) ([020fe8c](https://togithub.com/googleapis/java-storage/commit/020fe8ce7991e8c72135a2912f615ed50cc68fd4)) * Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.14 ([#1643](https://togithub.com/googleapis/java-storage/issues/1643)) ([ab3a198](https://togithub.com/googleapis/java-storage/commit/ab3a198115ae637710982f838231d2d36c029486)) * Update dependency org.junit.vintage:junit-vintage-engine to v5.9.1 ([#1635](https://togithub.com/googleapis/java-storage/issues/1635)) ([ba85ab6](https://togithub.com/googleapis/java-storage/commit/ba85ab6ce9304b4c426538d2bacc99ef73ed2b0e)) --- This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds preconditions to some Java samples. This is half the samples that need to be added, @sydney-munro is going to do the other half