Skip to content
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

Storage: Emulate directly listing with delim and prefix #1049

Closed
fondberg opened this issue Jun 10, 2016 · 4 comments
Closed

Storage: Emulate directly listing with delim and prefix #1049

fondberg opened this issue Jun 10, 2016 · 4 comments
Assignees

Comments

@fondberg
Copy link

Anyone knows if it is possible to use prefix and delimiter options at the same time like the following raw REST URL

https://www.googleapis.com/storage/v1/b/clientbuilds/o?delimiter=%2F&prefix=dir1%2Fdir2%2F&key={YOUR_API_KEY}

(above is from https://developers.google.com/apis-explorer/#p/storage/v1/storage.objects.list?)
Results from this is:

{
 "kind": "storage#objects",
 "prefixes": [
  "dir1/dir2/6893940/",
  "dir1/dir2/6893942/"
 ]
}

Setting the prefix I know how to do with Storage.BlobListOption.prefix("dir1/dir2/")but I looked in the code and can't really understand how to set the delimiter

@mziccard
Copy link
Contributor

mziccard commented Jun 10, 2016

You can use the Storage.BlobListOption.currentDirectory() option.

Quoting from the javadoc:

If specified, results are returned in a directory-like mode. Blobs whose names, after a possible prefix(String), do not contain the '/' delimiter are returned as is. Blobs whose names, after a possible prefix(String), contain the '/' delimiter, will have their name truncated after the delimiter and will be returned as Blob objects where only BlobInfo.blobId(), BlobInfo.size() and BlobInfo.isDirectory() are set. For such directory blobs, BlobId.generation() returns null, BlobInfo.size() returns 0 while BlobInfo.isDirectory() returns true. Duplicate directory blobs are omitted.

@fondberg
Copy link
Author

So currentDirectory translates to delimiter= in the actual request?
If so it is what I want, however I wouldn't mind this option exposed the same way the other parameters are exposed.
Any reasoning why this parameter isn't exposed as BlobListOption.delimiter(String)?

@mziccard
Copy link
Contributor

mziccard commented Jun 11, 2016

So currentDirectory translates to delimiter= in the actual request?

Yes, currentDirectory translates to delimiter=/.

This was thoroughly discussed with service owners here. Based on service usage, custom delimiters (i.e. delimiters other than /) are not used. Also, as far as I know, there are plans to deprecate the use of delimiters other than /. Please @Capstan correct me if I am wrong.

@fondberg
Copy link
Author

@mziccard thanks for the answer. Google should update the documentation which isn't very clear:
delimiter: (String) - Returns results in a directory-like mode. items will contain only objects whose names, aside from the prefix, do not contain delimiter. Objects whose names, aside from the prefix, contain delimiter will have their name, truncated after the delimiter, returned in prefixes. Duplicate prefixes are omitted. (string)

github-actions bot pushed a commit that referenced this issue Sep 19, 2022
🤖 I have created a release *beep* *boop*
---


### Updating meta-information for bleeding-edge SNAPSHOT release.

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
github-actions bot pushed a commit that referenced this issue Oct 10, 2022
…telligence-bom to v2.2.13 (#1049)

[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.google.cloud:google-cloud-video-intelligence-bom](https://github.com/googleapis/java-video-intelligence) | `2.2.12` -> `2.2.13` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-video-intelligence-bom/2.2.13/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-video-intelligence-bom/2.2.13/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-video-intelligence-bom/2.2.13/compatibility-slim/2.2.12)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-video-intelligence-bom/2.2.13/confidence-slim/2.2.12)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Renovate will not automatically rebase this PR, because other commits have been found.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. ⚠ **Warning**: custom changes will be lost.

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-video-intelligence).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4yMjIuMyIsInVwZGF0ZWRJblZlciI6IjMyLjIyMi4zIn0=-->
github-actions bot pushed a commit that referenced this issue Nov 16, 2022
…onfig to v1.5.4 (#1049)

* build(deps): update dependency com.google.cloud:google-cloud-shared-config to v1.5.4

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants