feat: Add from and to storage url options for BlobId#888
Merged
JesseLovelace merged 2 commits intomasterfrom Jun 24, 2021
Merged
feat: Add from and to storage url options for BlobId#888JesseLovelace merged 2 commits intomasterfrom
JesseLovelace merged 2 commits intomasterfrom
Conversation
BenWhitehead
approved these changes
Jun 21, 2021
| * | ||
| * @param storageUrl the Storage url to create the blob from | ||
| */ | ||
| public static BlobId fromStorageUrl(String storageUrl) { |
Collaborator
There was a problem hiding this comment.
Maybe fromGsutilUri instead of storage? To my knowledge, there are many different types of storage URLs
https://storage.googleapis.com/bucket/blobhttps://storage.cloud.google.com/bucket/blob
In the cloud console these format of URI are labeled gsutil URI

Comment on lines
132
to
133
| String bucketName = storageUrl.split("/")[2]; | ||
| String blobName = storageUrl.split(bucketName + "/")[1]; |
Collaborator
There was a problem hiding this comment.
Possibly simplify string allocation and traversal?
Suggested change
| String bucketName = storageUrl.split("/")[2]; | |
| String blobName = storageUrl.split(bucketName + "/")[1]; | |
| int blobNameStartIndex = storageUrl.indexOf('/', 5); | |
| String bucketName = storageUrl.substring(5, blobNameStartIndex); | |
| String blobName = storageUrl.substring(blobNameStartIndex); |
gcf-merge-on-green bot
pushed a commit
that referenced
this pull request
Jun 28, 2021
🤖 I have created a release \*beep\* \*boop\* --- ## [1.117.0](https://www.github.com/googleapis/java-storage/compare/v1.116.0...v1.117.0) (2021-06-28) ### Features * Add from and to storage url options for BlobId ([#888](https://www.github.com/googleapis/java-storage/issues/888)) ([1876a58](https://www.github.com/googleapis/java-storage/commit/1876a580f904d095ca6621c1e2f38c3a6e253276)) * add support of public access prevention ([#636](https://www.github.com/googleapis/java-storage/issues/636)) ([3d1e482](https://www.github.com/googleapis/java-storage/commit/3d1e48208c44c35c8e3761913bcd05c438e81069)) ### Bug Fixes * Add `shopt -s nullglob` to dependencies script ([#894](https://www.github.com/googleapis/java-storage/issues/894)) ([901fd33](https://www.github.com/googleapis/java-storage/commit/901fd335c8d2f2e49844dee2adfa318a98ed99ba)) * Update dependencies.sh to not break on mac ([#879](https://www.github.com/googleapis/java-storage/issues/879)) ([bc6d1d9](https://www.github.com/googleapis/java-storage/commit/bc6d1d9e211fbbb1accd1019c8eed4bc55ca421c)) ### Documentation * add notice about broken OLM experience ([#898](https://www.github.com/googleapis/java-storage/issues/898)) ([73e7cdf](https://www.github.com/googleapis/java-storage/commit/73e7cdf162be76a8438160f4c7f2070fb6fb5ea6)) ### Dependencies * update dependency com.google.apis:google-api-services-storage to v1-rev20210127-1.31.5 ([#889](https://www.github.com/googleapis/java-storage/issues/889)) ([99138a4](https://www.github.com/googleapis/java-storage/commit/99138a4cd3523cc634e3c5283a775a1c245b6201)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.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 options for creating a blob ID from a storage url and vice versa. Fixes #868