smartbucket/ts/smartbucket.classes.smartbucket.ts

31 lines
663 B
TypeScript
Raw Normal View History

2018-09-14 16:07:20 +00:00
import * as plugins from './smartbucket.plugins';
export interface ISmartBucketConfig {
provider: 'google';
projectId: string;
bucketName: string;
2019-07-07 08:48:24 +00:00
}
2018-09-14 16:07:20 +00:00
export class SmartBucket {
config: ISmartBucketConfig;
2019-07-07 08:48:24 +00:00
private _googleBucket;
2018-09-14 16:07:20 +00:00
/**
* the constructor of SmartBucket
*/
constructor(configArg: ISmartBucketConfig) {
this.config = configArg;
}
/**
* initializes the Smartbucket
*/
async init() {
2019-07-07 08:48:24 +00:00
if (this.config.provider === 'google') {
2018-09-14 16:07:20 +00:00
const storage = new plugins.googleCloudStorage.Storage({
2019-07-07 08:48:24 +00:00
projectId: this.config.projectId
});
storage.createBucket(this.config.bucketName, () => {});
2018-09-14 16:07:20 +00:00
}
}
}