Skip to content

Commit

Permalink
feat: allow setting standard Bucket storage class (#873)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenplusplus committed Oct 7, 2019
1 parent 9ebface commit 12a99e9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/storage.ts
Expand Up @@ -71,6 +71,7 @@ export interface CreateBucketRequest {
regional?: boolean;
requesterPays?: boolean;
retentionPolicy?: object;
standard?: boolean;
userProject?: string;
location?: string;
}
Expand Down Expand Up @@ -485,6 +486,7 @@ export class Storage extends Service {
* @property {boolean} [requesterPays=false] **Early Access Testers Only**
* Force the use of the User Project metadata field to assign operational
* costs when an operation is made on a Bucket and its objects.
* @property {boolean} [standard=true] Specify the storage class as Standard.
* @property {string} [userProject] The ID of the project which will be billed
* for the request.
*/
Expand Down Expand Up @@ -590,6 +592,7 @@ export class Storage extends Service {
multiRegional: 'MULTI_REGIONAL',
nearline: 'NEARLINE',
regional: 'REGIONAL',
standard: 'STANDARD',
} as {[index: string]: string};

Object.keys(storageClasses).forEach(storageClass => {
Expand Down
9 changes: 9 additions & 0 deletions test/index.ts
Expand Up @@ -548,6 +548,15 @@ describe('Storage', () => {

storage.createBucket(BUCKET_NAME, {regional: true}, assert.ifError);
});

it('should expand metadata.standard', done => {
storage.request = (reqOpts: DecorateRequestOptions) => {
assert.strictEqual(reqOpts.json.storageClass, 'STANDARD');
done();
};

storage.createBucket(BUCKET_NAME, {standard: true}, assert.ifError);
});
});

describe('requesterPays', () => {
Expand Down

0 comments on commit 12a99e9

Please sign in to comment.