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

samples: upload without authentication #1711

Merged
merged 21 commits into from
Nov 22, 2021

Conversation

shaffeeullah
Copy link
Contributor

@shaffeeullah shaffeeullah commented Nov 10, 2021

This is the canonical sample for uploading data without authentication.
Tests to be written once we decide on the format of the sample.

Related customer issue: googleapis/gcs-resumable-upload#201

@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Nov 10, 2021
@snippet-bot
Copy link

snippet-bot bot commented Nov 10, 2021

Here is the summary of changes.

You are about to add 2 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@product-auto-label product-auto-label bot added api: storage Issues related to the googleapis/nodejs-storage API. samples Issues that are directly related to samples. labels Nov 10, 2021
@generated-files-bot
Copy link

Warning: This pull request is touching the following templated files:

samples/uploadWithoutAuth.js Outdated Show resolved Hide resolved
@@ -1855,6 +1856,23 @@ __Usage:__



### Upload Without Auth
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upload without authenticating

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is proper sentence case so it'll render correctly when added to docs. Also provides more detail as to what "auth" means.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is autogenerated by a bot and cannot be changed (without a ton of effort, like contacting the team that wrote the bot)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I can change the word "auth" to "authenticating" by renaming the file the sample is in. Do you think i should make that change?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be best to make that change. "Upload without auth" seems like it could imply many things (upload without authenticating, upload without OAuth, etc)

samples/uploadWithoutAuth.js Outdated Show resolved Hide resolved
samples/uploadWithoutAuth.js Outdated Show resolved Hide resolved
async function uploadWithoutAuthentication() {
const file = storage.bucket(bucketName).file(destFileName);
let location; // endpoint to which we should upload the file

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if this sample should be split into two separate samples as to not overload, but it's readable so not completely against it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if we separate this into two samples, we run the risk of someone missing one of the samples and only learning one way it could be done. It also depends on how the page is structured though. @cbonnie do you have thoughts here?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can definitely split this up into two samples and make it clear (in writing) that there's two ways to do the task.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could nest them in the same region block: https://cloud.google.com/storage/docs/listing-objects#code-samples is an example

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh cool! i didnt realize that. thanks for this example. i will make this change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@frankyn @cbonnie please take another look

@shaffeeullah shaffeeullah added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 18, 2021
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 18, 2021
},
});

// endpoint to which we should upload the file
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Endpoint"

@shaffeeullah shaffeeullah marked this pull request as ready for review November 19, 2021 21:35
@shaffeeullah shaffeeullah requested review from a team as code owners November 19, 2021 21:35
@shaffeeullah shaffeeullah merged commit db4e2df into main Nov 22, 2021
@shaffeeullah shaffeeullah deleted the shaffeeullah/uploadwithoutauth branch November 22, 2021 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the googleapis/nodejs-storage API. cla: yes This human has signed the Contributor License Agreement. samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants