Skip to content

Commit 12a99e9

Browse files
feat: allow setting standard Bucket storage class (#873)
1 parent 9ebface commit 12a99e9

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/storage.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export interface CreateBucketRequest {
7171
regional?: boolean;
7272
requesterPays?: boolean;
7373
retentionPolicy?: object;
74+
standard?: boolean;
7475
userProject?: string;
7576
location?: string;
7677
}
@@ -485,6 +486,7 @@ export class Storage extends Service {
485486
* @property {boolean} [requesterPays=false] **Early Access Testers Only**
486487
* Force the use of the User Project metadata field to assign operational
487488
* costs when an operation is made on a Bucket and its objects.
489+
* @property {boolean} [standard=true] Specify the storage class as Standard.
488490
* @property {string} [userProject] The ID of the project which will be billed
489491
* for the request.
490492
*/
@@ -590,6 +592,7 @@ export class Storage extends Service {
590592
multiRegional: 'MULTI_REGIONAL',
591593
nearline: 'NEARLINE',
592594
regional: 'REGIONAL',
595+
standard: 'STANDARD',
593596
} as {[index: string]: string};
594597

595598
Object.keys(storageClasses).forEach(storageClass => {

test/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,15 @@ describe('Storage', () => {
548548

549549
storage.createBucket(BUCKET_NAME, {regional: true}, assert.ifError);
550550
});
551+
552+
it('should expand metadata.standard', done => {
553+
storage.request = (reqOpts: DecorateRequestOptions) => {
554+
assert.strictEqual(reqOpts.json.storageClass, 'STANDARD');
555+
done();
556+
};
557+
558+
storage.createBucket(BUCKET_NAME, {standard: true}, assert.ifError);
559+
});
551560
});
552561

553562
describe('requesterPays', () => {

0 commit comments

Comments
 (0)