-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: Add preconditions to some samples #1600
Conversation
samples/snippets/src/main/java/com/example/storage/object/ComposeObject.java
Show resolved
Hide resolved
samples/snippets/src/main/java/com/example/storage/object/CopyObject.java
Show resolved
Hide resolved
samples/snippets/src/main/java/com/example/storage/object/CopyObject.java
Show resolved
Hide resolved
samples/snippets/src/main/java/com/example/storage/object/CopyOldVersionOfObject.java
Show resolved
Hide resolved
samples/snippets/src/main/java/com/example/storage/object/MoveObject.java
Show resolved
Hide resolved
samples/snippets/src/main/java/com/example/storage/object/UploadEncryptedObject.java
Show resolved
Hide resolved
samples/snippets/src/main/java/com/example/storage/object/UploadKmsEncryptedObject.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Overall.
Some minor formatting related comments. Also PTAL at the failing tests
// 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()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
// the object's generation number does not match your precondition. | ||
Storage.BlobSourceOption precondition = | ||
Storage.BlobSourceOption.generationMatch( | ||
storage.get(bucketName, objectName).getGeneration()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
// 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()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding the null checks!
🤖 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).
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