GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Make Storage.update() rename an object · Issue #2672 · googleapis/google-cloud-java

Make Storage.update() rename an object #2672

New issue
Copy link
New issue
Copy link
Closed
Closed
Make Storage.update() rename an object#2672
Copy link
Assignees
pongad
Labels
api: storageIssues related to the Cloud Storage API.priority: p2Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.type: questionRequest for information or clarification. Not an issue.

Description

@joaoandremartins
joaoandremartins
opened on Dec 1, 2017
Issue body actions

I expected the following call to rename an object. Unfortunately, its behaviour is not the expected, and it's very different from other similar calls like setMetadata().

Storage gcs = ...;

gcs.update(BlobInfo.newBuilder("existingBucket", "existingObject")
				.setBlobId(BlobId.of("existingBucket", "newObject"))
				.build());

AFAICT, this tries to make a dummy update to gs://existingBucket/newObject, which fails because the URI doesn't exist.
Logically, the behaviour of this call should be to rename the object, which is what I want to do, and appears to be impossible as per this: gsutil mv copies and removes, which ideally we would avoid doing.

Is there any way to rename a file that doesn't involve copying and removing?
If not, then I'd like to request one.

Activity

  1. yihanzhen commented on Dec 1, 2017

    @yihanzhen
    yihanzhen
    on Dec 1, 2017
    Contributor
    More actions

    @joaoandremartins Please refer to this code snippet from the Storage interface to update metadata of a blob:

    String bucketName = "my_unique_bucket";
    String blobName = "my_blob_name";
    String newBlobName = "new_blob_name";
    Blob blob = storage.get(bucketName, blobName);
    BlobInfo updatedInfo = blob.toBuilder()
        .setBlobId(BlobId.of(bucketName, newBlobName))
        .build();
    storage.update(updatedInfo);
    

    Feel free to repost if that does not solve your problem.

  2. yihanzhen
    self-assigned this
    on Dec 1, 2017
  3. joaoandremartins commented on Dec 1, 2017

    @joaoandremartins
    joaoandremartins
    on Dec 1, 2017
    Author
    More actions

    @hzyi-google thanks for the help.

    Unfortunately, that didn't work. I'm still getting a Not found error.

    As I mentioned in my report,setBlobId() isn't having the desired effect. This should be looked into.

  4. yihanzhen commented on Dec 1, 2017

    @yihanzhen
    yihanzhen
    on Dec 1, 2017
    Contributor
    More actions

    @joaoandremartins Thanks for the feedback. I'll take a further look.

  5. yihanzhen commented on Dec 1, 2017

    @yihanzhen
    yihanzhen
    on Dec 1, 2017
    Contributor
    More actions

    It seems that Object#update is only used to update the metadata per here. Therefore additional changes have to be made outside the client library for this request. Can you tell a look as well @neozwu ?

  6. vchudnov-g
    added
    api: storageIssues related to the Cloud Storage API.
    type: questionRequest for information or clarification. Not an issue.
    on Dec 13, 2017
  7. pongad commented on Jan 22, 2018

    @pongad
    pongad
    on Jan 22, 2018
    Contributor
    More actions

    IIUC, Storage objects cannot be "renamed". To rename, you must copy to the new place and delete the original. This doc provides some code samples.

  8. pongad
    closed this as completedon Jan 22, 2018
  9. joaoandremartins commented on Jan 22, 2018

    @joaoandremartins
    joaoandremartins
    on Jan 22, 2018
    Author
    More actions

    I understand that renaming is currently impossible.
    This issue is a feature request to have it implemented eventually -- why are you closing it?

  10. yihanzhen
    added
    type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
    priority: p2Moderately-important priority. Fix may not be included in next release.
    on Jan 22, 2018
  11. yihanzhen commented on Jan 22, 2018

    @yihanzhen
    yihanzhen
    on Jan 22, 2018
    Contributor
    More actions

    @joaoandremartins I marked this issue as a feature request and added it to the backlog (Though I believe there is a chance that GCS does not allow renaming objects by design). Comments and discussion are still welcome here.

  12. joaoandremartins commented on Jan 22, 2018

    @joaoandremartins
    joaoandremartins
    on Jan 22, 2018
    Author
    More actions

    Thanks a lot for the explanation @hzyi-google

    If it's impossible to rename things by design in GCS, then feel free to do however you like with this issue. Having to pay for operations just to rename an object doesn't feel right, though.

  13. pongad commented on Jan 23, 2018

    @pongad
    pongad
    on Jan 23, 2018
    Contributor
    More actions

    @joaoandremartins I'm sorry I didn't communicate clearly. The Storage API itself provides no way to rename objects. @hzyi-google Thank you for adding this to feature backlog.

  14. theacodes
    unassigned
    yihanzhen
    on Sep 28, 2018
  15. JustinBeckwith
    assigned
    pongad
    on Feb 1, 2021
  16. suztomo
    added a commit that references this issue on Mar 9, 2026

    feat: Add missing storage related fields to Table, TableInfo and Stan…

    This issue will close once commit e3003f4 is merged into the 'main' branch.
    e3003f4
  17. chingor13
    added 3 commits that reference this issue on Mar 24, 2026

    deps: update google api dependencies (#2672)

    a1b1bac

    chore(main): release 2.41.0 (#2820)

    86b29e1

    chore: Update generation configuration at Sun Aug 18 02:16:53 UTC 2024 (

    202a26e
  18. meltsufin
    added 2 commits that reference this issue on Apr 29, 2026

    feat: Enable Subscriber StreamingPull keepalives by increasing the St…

    18a592d

    feat: Enable Subscriber StreamingPull keepalives by increasing the St…

    409c9f4
  19. rahul2393
    added 2 commits that reference this issue on May 21, 2026

    fix: Add missing break; to PROTO and ENUM value type check (googleapi…

    5761dca

    chore(main): release 2.67.0 (googleapis#2678)

    76077a5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @pongad
    pongad

Labels

api: storageIssues related to the Cloud Storage API.priority: p2Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.