-
Notifications
You must be signed in to change notification settings - Fork 567
feat(storage): move_object within hns bucket #29391
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
Merged
bajajneha27
merged 15 commits into
googleapis:main
from
shubhangi-google:move_object_hns_bucket
Apr 14, 2025
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
a560d8b
move_object functioanlity working
shubhangi-google 6ae30b3
adding doc
shubhangi-google dde9e8d
fixing lint issue
shubhangi-google 1841e87
fixing lint issue
shubhangi-google 0c28b1e
removing test case for nin hns bucket
shubhangi-google b3f8633
Update google-cloud-storage/samples/acceptance/buckets_test.rb
thiyaguk09 024c368
Update google-cloud-storage/lib/google/cloud/storage/bucket.rb
thiyaguk09 fe3cb11
fixed naming convention
thiyaguk09 3659df8
fixing naming convention
shubhangi-google f544fda
changing comments
shubhangi-google 4f7efa3
fixing lint issue
shubhangi-google a58a39d
fix name
shubhangi-google da9a43f
Update google-cloud-storage/lib/google/cloud/storage/service.rb
shubhangi-google eff2294
Update google-cloud-storage/samples/acceptance/buckets_test.rb
shubhangi-google c6ff862
updating comment
shubhangi-google File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # Copyright 2025 Google LLC | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| # [START storage_move_object] | ||
bajajneha27 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| def move_object bucket_name:, source_file_name:, destination_file_name: | ||
| # The ID of your GCS bucket | ||
| # bucket_name = "your-unique-bucket-name" | ||
|
|
||
| # The name of your GCS object | ||
| # source_file_name = "your-file-name" | ||
|
|
||
| # The new object name which you want to craete | ||
| # destination_file_name = "your-new-file-name" | ||
|
|
||
| require "google/cloud/storage" | ||
|
|
||
| storage = Google::Cloud::Storage.new | ||
| bucket = storage.bucket bucket_name, skip_lookup: true | ||
|
|
||
| bucket.move_file source_file_name, destination_file_name | ||
| fetch_file = bucket.file destination_file_name | ||
| puts "New File #{fetch_file.name} created\n" | ||
| end | ||
| # [END storage_move_object] | ||
|
|
||
| if $PROGRAM_NAME == __FILE__ | ||
| move_object bucket_name: ARGV.shift, source_file_name: ARGV.shift, | ||
| destination_file_name: ARGV.shift | ||
| end | ||
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
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.