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 — storage: add storage class enums by callmehiphop · Pull Request #787 · googleapis/google-cloud-node

Conversation

@callmehiphop

@callmehiphop callmehiphop commented Aug 7, 2015

Copy link
Copy Markdown
Contributor

Closes #779

Implemented per conversation in original issue, however it might be better to group these together for documentation purposes. The current implementation creates links for both dra and nearline, where I imagine it would be better to lump them together into a single property to consolidate the documentation on storage classes.

e.g.

var metadata = {
  storageClass: gcs.type.nearline
};

Sorry, something went wrong.

Uh oh!

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

All reactions
@callmehiphop callmehiphop added the api: storage Issues related to the Cloud Storage API. label Aug 7, 2015
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Aug 7, 2015
@stephenplusplus

stephenplusplus commented Aug 10, 2015

Copy link
Copy Markdown
Contributor

Thanks for doing this!

Even though I wanted all lowercase, I'm not sure that was a good call. Constants always want to be loud, and we already have gcs.acl.READER_ROLE and such. Should we maybe do that here: gcs.storageClass.DRA?

Another thing, ACLs are available for buckets and files, so it made sense to have them sit atop both at the Storage class level. With storageClass, however, this is only used when creating a bucket. Should it be localized as such: gcs.bucket.storageClass.DRA?

Example:

var gcloud = require('gcloud');
var gcs = gcloud.gcs({ projectId: 'grape-spaceship-123' });

gcs.createBucket({
  storageClass: gcs.bucket.storageClass.DRA
}, function(err, bucket, apiResponse) {});

I really don't prefer this constant system over just a property on the metadata object:

var gcloud = require('gcloud');
var gcs = gcloud.gcs({ projectId: 'grape-spaceship-123' });

gcs.createBucket({
  dra: true
}, function(err, bucket, apiResponse) {});

Or best-guessing from storageClass input:

var gcloud = require('gcloud');
var gcs = gcloud.gcs({ projectId: 'grape-spaceship-123' });

gcs.createBucket({
  storageClass: 'dra' // => we expand this to `DURABLE_REDUCED_AVAILABILITY`
}, function(err, bucket, apiResponse) {});

@jgeewax which approach do you think is best here?

All reactions

Sorry, something went wrong.

Uh oh!

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

@callmehiphop

callmehiphop commented Aug 14, 2015

Copy link
Copy Markdown
Contributor Author

So I ended up just uppercasing the constant names to DRA and NEARLINE, somehow this magically hoisted the property names in the documentation, so I think this is the way to go.

gcs.createBucket({
  storageClass: gcs.DRA
}, callback);
All reactions

Sorry, something went wrong.

Uh oh!

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

@stephenplusplus

stephenplusplus commented Aug 14, 2015

Copy link
Copy Markdown
Contributor

I strongly think we should go with the second suggestion above. That's the easiest solution for the user, and won't inflate our API. These constants only affect createBucket and can only be used there.

All reactions

Sorry, something went wrong.

Uh oh!

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

@callmehiphop

callmehiphop commented Aug 14, 2015

Copy link
Copy Markdown
Contributor Author

I think we could easily support both? If we use the metadata property version we'll still need to have an alias to the expanded version.

What are your feelings on something like

Storage.DRA = 'DURABLE_REDUCED_AVAILABILITY';

Storage.prototype.createBucket = function(name, metadata, callback) {
  var body = extend(metadata, { name: name });
  ['dra', 'nearline'].forEach(function(storageClass) {
    if (body[storageClass]) {
      delete body[storageClass];
      body.storageClass = Storage[storageClass.toUpperCase()];
    }
  });
  this.makeReq_('POST, '', null, body, callback);
};
All reactions

Sorry, something went wrong.

Uh oh!

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

@stephenplusplus

stephenplusplus commented Aug 14, 2015

Copy link
Copy Markdown
Contributor

I still think it's overkill. We can keep the expanded version in a map local to the createBucket function. This is a very small use case, I don't think we should stuff random metadata properties on the "global" Storage class.

All reactions

Sorry, something went wrong.

Uh oh!

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

@callmehiphop

callmehiphop commented Aug 14, 2015

Copy link
Copy Markdown
Contributor Author

@stephenplusplus Ok, I changed it to metadata properties. I updated the documentation to show they are optional properties and added links to the official doc for each. I also added a couple of unit tests for each.

Would you prefer reduce over forEach?

All reactions

Sorry, something went wrong.

Uh oh!

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

@stephenplusplus

stephenplusplus commented Aug 14, 2015

Copy link
Copy Markdown
Contributor

Yay! Can you just add "@"resources for https://cloud.google.com/storage/docs/storage-classes, Nearline, and DRA?

All reactions

Sorry, something went wrong.

Uh oh!

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

@stephenplusplus

stephenplusplus commented Aug 14, 2015

Copy link
Copy Markdown
Contributor

I think how you have it is good. I would have probably just done:

if (body.dra) {
  body.storageClass = 'DUR...';
  delete body.dra;
}

if (body.nearline) {
  body.storageClass = 'NEARLINE';
  delete body.nearline;
}

So any fanciness you have is good with me :)

All reactions

Sorry, something went wrong.

Uh oh!

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

@callmehiphop

callmehiphop commented Aug 14, 2015

Copy link
Copy Markdown
Contributor Author

Yay! Can you just add "@"resources for https://cloud.google.com/storage/docs/storage-classes, Nearline, and DRA?

done!

All reactions

Sorry, something went wrong.

Uh oh!

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

@callmehiphop
storage: add storage class enums
5dd3151
uppercased constants

changed constants to metadata properties

added resource links
stephenplusplus added a commit that referenced this pull request Aug 14, 2015
@stephenplusplus
Merge pull request #787 from callmehiphop/storage-class
0b901c1
storage: add storage class enums
@stephenplusplus
stephenplusplus merged commit 0b901c1 into googleapis:master Aug 14, 2015
@stephenplusplus

stephenplusplus commented Aug 14, 2015

Copy link
Copy Markdown
Contributor

Thanks!

All reactions

Sorry, something went wrong.

Uh oh!

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

@callmehiphop
callmehiphop deleted the storage-class branch August 18, 2015 19:53
@sofisl sofisl mentioned this pull request Nov 11, 2022
migrate code from googleapis/nodejs-dialogflow #3546
Merged
4 tasks
sofisl pushed a commit that referenced this pull request Nov 11, 2022
@yoshi-automation
build: sync autosynth sha (#787)
5ea72b9
@sofisl sofisl mentioned this pull request Jan 10, 2023
migrate code from googleapis/nodejs-dlp #3837
Merged
4 tasks
sofisl pushed a commit that referenced this pull request Jan 10, 2023
@renovate-bot
chore(deps): update dependency sinon to v15 (#787)
f9b06c3
sofisl pushed a commit that referenced this pull request Jan 24, 2023
@gcf-owl-bot
feat: add total_billed_time response field (#787)
3ffbf89
Committer: @cherba
PiperOrigin-RevId: 389755489
sofisl pushed a commit that referenced this pull request Jan 24, 2023
@release-please
chore: release 4.6.0 (#788)
3ff4e92
🤖 I have created a release \*beep\* \*boop\*
---
## [4.6.0](https://www.github.com/googleapis/nodejs-speech/compare/v4.5.6...v4.6.0) (2021-08-10)


### Features

* add total_billed_time response field ([#787](https://www.github.com/googleapis/nodejs-speech/issues/787)) ([171cba0](https://www.github.com/googleapis/nodejs-speech/commit/171cba0bb8f7bd12ab96f296824e0acf7a0698d7))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
sofisl pushed a commit that referenced this pull request Jan 25, 2023
@gcf-owl-bot
feat: add total_billed_time response field (#787)
04e2c39
Committer: @cherba
PiperOrigin-RevId: 389755489
sofisl pushed a commit that referenced this pull request Jan 25, 2023
@release-please
chore: release 4.6.0 (#788)
c13f905
🤖 I have created a release \*beep\* \*boop\*
---
## [4.6.0](https://www.github.com/googleapis/nodejs-speech/compare/v4.5.6...v4.6.0) (2021-08-10)


### Features

* add total_billed_time response field ([#787](https://www.github.com/googleapis/nodejs-speech/issues/787)) ([171cba0](https://www.github.com/googleapis/nodejs-speech/commit/171cba0bb8f7bd12ab96f296824e0acf7a0698d7))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
miguelvelezsa pushed a commit that referenced this pull request Jul 23, 2025
@JustinBeckwith
build: remove unused codecov config (#787)
4089c70
sofisl pushed a commit that referenced this pull request Feb 25, 2026
@JustinBeckwith
docs: use the jsdoc-fresh theme (#787)
11a336d
sofisl pushed a commit that referenced this pull request Feb 26, 2026
@renovate-bot Benjamin E. Coe
chore(deps): update dependency mocha to v7 (#787)
dda2066
GautamSharda pushed a commit that referenced this pull request Mar 12, 2026
@renovate-bot
chore(deps): update dependency @types/tmp to v0.2.4 (#787)
e592f8a
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@types/tmp](https://togithub.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/tmp) ([source](https://togithub.com/DefinitelyTyped/DefinitelyTyped)) | [`0.2.3` -> `0.2.4`](https://renovatebot.com/diffs/npm/@types%2ftmp/0.2.3/0.2.4) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@types%2ftmp/0.2.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@types%2ftmp/0.2.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@types%2ftmp/0.2.3/0.2.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@types%2ftmp/0.2.3/0.2.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: Branch creation - "after 9am and before 3pm" (UTC), Automerge - At any time (no schedule defined).

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

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

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

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/googleapis/nodejs-common).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi44My4wIiwidXBkYXRlZEluVmVyIjoiMzYuODMuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->
thiyaguk09 pushed a commit to thiyaguk09/google-cloud-node-fork that referenced this pull request Mar 18, 2026
@JustinBeckwith
docs: use the jsdoc-fresh theme (googleapis#787)
8d2a22e
GautamSharda pushed a commit that referenced this pull request Mar 23, 2026
@AVaksman
refactor: remove use of retry-request in favor of gax stream (#787)
46ae407
GautamSharda pushed a commit that referenced this pull request Mar 25, 2026
@AVaksman @GautamSharda
refactor: remove use of retry-request in favor of gax stream (#787)
2a1ea09
shivanee-p pushed a commit that referenced this pull request Mar 27, 2026
@AVaksman @shivanee-p
refactor: remove use of retry-request in favor of gax stream (#787)
7003d4c
thiyaguk09 pushed a commit to thiyaguk09/google-cloud-node-fork that referenced this pull request May 5, 2026
@AVaksman @thiyaguk09
refactor: remove use of retry-request in favor of gax stream (googlea…
cc9343a
…pis#787)
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.

3 participants

@callmehiphop @stephenplusplus @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.