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 — feat(storage): support gs:// copy/move dests by zbjornson · Pull Request #1416 · googleapis/google-cloud-node

Conversation

@zbjornson

@zbjornson zbjornson commented Jul 10, 2016

Copy link
Copy Markdown
Contributor

Fixes #1395 -- supports gs:// strings for specifying destination buckets.

I'm not totally thrilled with what I did on line 391 but I don't see a better way to create a new Bucket instance from File.js.

The string format testing with GS_URL_REGEXP.exec is both more specific and faster than using destination.indexOf("gs://").

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jul 10, 2016
@zbjornson

zbjornson commented Jul 10, 2016

Copy link
Copy Markdown
Contributor Author

Preferences for how to address the lint error (line length >80 chars)? Could break before the callback, move the dest string to a variable, shorten some names... -- all of which break the pattern of the other usage examples.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@stephenplusplus

stephenplusplus commented Jul 10, 2016

Copy link
Copy Markdown
Contributor

Thanks! Will check this out tomorrow.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@stephenplusplus stephenplusplus added the api: storage Issues related to the Cloud Storage API. label Jul 10, 2016
stephenplusplus
stephenplusplus reviewed Jul 11, 2016
View reviewed changes
Comment thread lib/storage/file.js Outdated
* // If you pass in a string starting with "gs://" for the destination, the
* // file is copied to the other bucket and under the new name provided.
* //-
* file.copy('gs://other-bucket/my-image-copy.png', function(err, copiedFile, apiResponse) {

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@stephenplusplus

stephenplusplus commented Jul 11, 2016 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

LGTM. Would you mind adding a system test? You can add one after this, "it should copy an existing file with a GS URL" (or something similar)

If you haven't run the system tests before, we have a guide on setting the right env vars: https://github.com/GoogleCloudPlatform/gcloud-node/blob/master/CONTRIBUTING.md#system-tests

Also, running the test will create a bucket and file under your account (then delete them), so it's understandable if you'd rather not run the tests. If you do, make sure you change the test you're working on to read:

it.only('...', function() {})

The only will prevent the other tests from running when you run npm run system-test

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coveralls

coveralls commented Jul 12, 2016 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling 0e8cf7b on zbjornson:1395-gs-urls into 0a6da60 on GoogleCloudPlatform:master.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@zbjornson

zbjornson commented Jul 12, 2016

Copy link
Copy Markdown
Contributor Author

Thanks for your review.

On the system test, how would you like to handle file/bucket cleanup? You have a special deleteBucket function that addresses eventual consistency on line 69. I could move that up a scope so that it's accessible to the individual tests, or not delete the new bucket and let the after-hook do the cleanup.

Also, is it unnecessary to assert on the contents of the other bucket?

it.only('should copy to another bucket given a gs:// URL', function(done) {
  var opts = { destination: 'CloudLogo' };
  bucket.upload(FILES.logo.path, opts, function(err, file) {
    assert.ifError(err);

    var otherBucket = storage.bucket(generateName());
    otherBucket.create(function (err) {
      assert.ifError(err);

      var destPath = 'gs://' + otherBucket.name + '/CloudLogoCopy';
      file.copy(destPath, function(err, copiedFile) {
        assert.ifError(err);

        otherBucket.getFiles(function (err, files) { // Necessary? >>
          assert.ifError(err);

          assert.equal(files.length, 1);
          var newFile = files[0];

          assert.equal(newFile.name, "CloudLogoCopy"); // << Necessary?

          async.parallel([
            file.delete.bind(file),
            newFile.delete.bind(newFile),
            otherBucket.delete.bind(otherBucket) // Needs eventual consistency protection
          ], done);
        });

      });
    });
  });
});
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@stephenplusplus

stephenplusplus commented Jul 12, 2016

Copy link
Copy Markdown
Contributor

For bucket cleanup, you can let the after hook take care of it.

And I like that you're checking that the new bucket received the file 👍

I'll just have some linting notes, but LGTM.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

stephenplusplus
stephenplusplus reviewed Jul 12, 2016
View reviewed changes
Comment thread lib/storage/file.js Outdated
destName = destination;
var parsedDestination = GS_URL_REGEXP.exec(destination);
if (parsedDestination !== null && parsedDestination.length === 3) {
destBucket = this.storage.bucket(parsedDestination[1])

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@zbjornson

zbjornson commented Jul 12, 2016

Copy link
Copy Markdown
Contributor Author

Sorry about all that, my linter apparently decided to retire.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

stephenplusplus
stephenplusplus reviewed Jul 12, 2016
View reviewed changes
Comment thread system-test/storage.js Outdated
assert.strictEqual(files.length, 1);
var newFile = files[0];

assert.equal(newFile.name, 'CloudLogoCopy');

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@stephenplusplus

stephenplusplus commented Jul 12, 2016

Copy link
Copy Markdown
Contributor

Haha, I'm sorry that I have to even comment on this little stuff. I wish it could just be auto-formatted.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@zbjornson
feat(storage): support gs:// copy/move dests
d387283
Fixes #1395
@zbjornson

zbjornson commented Jul 12, 2016

Copy link
Copy Markdown
Contributor Author

Squashed together... managed to swamp travis though 😢

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@stephenplusplus

stephenplusplus commented Jul 12, 2016

Copy link
Copy Markdown
Contributor

No problem. I canceled the queued, old builds.

zbjornson reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coveralls

coveralls commented Jul 12, 2016 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling d387283 on zbjornson:1395-gs-urls into 4bce495 on GoogleCloudPlatform:master.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@stephenplusplus

stephenplusplus commented Jul 12, 2016

Copy link
Copy Markdown
Contributor

Perfect! We intend to get a release out shortly with support for Bigtable (currently held up on #1424), so this will ship with that. Thanks very much :)

zbjornson reacted with thumbs up emoji zbjornson reacted with hooray emoji
All reactions
  • 👍 1 reaction
  • 🎉 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@stephenplusplus
stephenplusplus merged commit 79e0e28 into googleapis:master Jul 12, 2016
This was referenced Jul 11, 2023
[Snyk] Security upgrade google-gax from 0.13.5 to 3.6.1 takeratta/google-cloud-node#5
Open
[Snyk] Security upgrade google-gax from 0.13.5 to 3.6.1 takeratta/google-cloud-node#6
Open
This was referenced Jul 11, 2023
[Snyk] Security upgrade google-gax from 0.14.5 to 3.6.1 takeratta/google-cloud-node#7
Open
[Snyk] Security upgrade google-gax from 0.13.5 to 3.6.1 takeratta/google-cloud-node#11
Open
[Snyk] Security upgrade google-gax from 0.13.5 to 3.6.1 takeratta/google-cloud-node#12
Open
miguelvelezsa pushed a commit that referenced this pull request Jul 23, 2025
@release-please
chore(main): release 3.5.5 (#1416)
aa46733
🤖 I have created a release *beep* *boop*
---


## [3.5.5](https://togithub.com/googleapis/gax-nodejs/compare/v3.5.4...v3.5.5) (2023-02-03)


### Bug Fixes

* **deps:** Update dependency @grpc/grpc-js to ~1.8.0 ([#1389](https://togithub.com/googleapis/gax-nodejs/issues/1389)) ([41ad17a](https://togithub.com/googleapis/gax-nodejs/commit/41ad17a0cc94388417704f929e56fe56498319f5))
* **deps:** Update dependency protobufjs to v7.2.1 ([#1411](https://togithub.com/googleapis/gax-nodejs/issues/1411)) ([17c7372](https://togithub.com/googleapis/gax-nodejs/commit/17c7372a0601736227898495ad10fc61907667f8))
* Get rid of fs-extra ([#1418](https://togithub.com/googleapis/gax-nodejs/issues/1418)) ([082e006](https://togithub.com/googleapis/gax-nodejs/commit/082e0063227d8f59a9c88416265fdf4acafe8f6f))
* Include Long import in d.ts files ([#1379](https://togithub.com/googleapis/gax-nodejs/issues/1379)) ([8d9d684](https://togithub.com/googleapis/gax-nodejs/commit/8d9d6847ff6ee3de4ba4aed8540045cdc9bc6b64))

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
sofisl pushed a commit that referenced this pull request Feb 3, 2026
@zbjornson @stephenplusplus
feat(storage): support gs:// copy/move dests (#1416)
79b1a17
Fixes #1395
@sofisl sofisl mentioned this pull request Feb 3, 2026
migrate code from googleapis/nodejs-bigquery #7111
Merged
4 tasks
sofisl pushed a commit that referenced this pull request Feb 17, 2026
@release-please @gcf-owl-bot
chore(main): release 10.1.0 (#1416)
4219bb4
* chore(main): release 10.1.0

* 🦉 Updates from OwlBot post-processor

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

* 🦉 Updates from OwlBot post-processor

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

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
sofisl pushed a commit that referenced this pull request Feb 26, 2026
@olavloite
fix: add close method to Spanner client (#1416)
e30a24a
Adds a close method to the Spanner client that will (try to) clean up the resources
it has in use.

Towards #1306
sofisl pushed a commit that referenced this pull request Feb 26, 2026
@release-please
chore: release 5.11.1 (#1417)
9952070
🤖 I have created a release \*beep\* \*boop\*
---
### [5.11.1](https://www.github.com/googleapis/nodejs-spanner/compare/v5.11.0...v5.11.1) (2021-07-07)


### Bug Fixes

* add close method to Spanner client ([#1416](https://www.github.com/googleapis/nodejs-spanner/issues/1416)) ([69cd0b4](https://www.github.com/googleapis/nodejs-spanner/commit/69cd0b474ab6c836724813fd8bea88ec2e1ac9f5)), closes [#1306](https://www.github.com/googleapis/nodejs-spanner/issues/1306)
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
GautamSharda pushed a commit that referenced this pull request Mar 5, 2026
@gcf-owl-bot @losalex
feat: Log Analytics features of the Cloud Logging API (#1416)
c468b02
* feat: Log Analytics features of the Cloud Logging API
feat: Add ConfigServiceV2.CreateBucketAsync method for creating Log Buckets asynchronously
feat: Add ConfigServiceV2.UpdateBucketAsync method for creating Log Buckets asynchronously
feat: Add ConfigServiceV2.CreateLink method for creating linked datasets for Log Analytics Buckets
feat: Add ConfigServiceV2.DeleteLink method for deleting linked datasets
feat: Add ConfigServiceV2.ListLinks method for listing linked datasets
feat: Add ConfigServiceV2.GetLink methods for describing linked datasets
feat: Add LogBucket.analytics_enabled field that specifies whether Log Bucket's Analytics features are enabled
feat: Add LogBucket.index_configs field that contains a list of Log Bucket's indexed fields and related configuration data
docs: Documentation for the Log Analytics features of the Cloud Logging API

PiperOrigin-RevId: 529851525

Source-Link: googleapis/googleapis@1c7ee99

Source-Link: googleapis/googleapis-gen@4a2a3a0
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGEyYTNhMDViOTE4MDQzMzNhMWIzOWI2MzVkOGZlMjI0M2Q0YjRmZCJ9

* 🦉 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>
Co-authored-by: losalex <[email protected]>
GautamSharda pushed a commit that referenced this pull request Mar 11, 2026
@feywind @JustinBeckwith
fix: set only Publish to 5000ms (#1416)
1c06451
Co-authored-by: Justin Beckwith <[email protected]>
thiyaguk09 pushed a commit to thiyaguk09/google-cloud-node-fork that referenced this pull request Mar 18, 2026
@stephenplusplus @shaffeeullah
docs(samples): standardize samples (googleapis#1416)
cd36d40
* docs(samples): standardize samples

* revert package.json

* update sample var decl descriptions

* split duplicate example titles

* lint fix

* encrypt keys locally

* test encryption key handling

* lint fix

* pass key as string

* revert the way keys are used

Co-authored-by: Sameena Shaffeeullah <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

api: storage Issues related to the Cloud Storage API. cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@zbjornson @stephenplusplus @coveralls @googlebot
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.
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.