1 | import { Bucket, BucketFile } from './bucket-base';
|
2 | import { GcpBucketCfg, getGcpBucket } from './bucket-gcp';
|
3 | import { getAwsBucket, AwsBucketCfg } from './bucket-aws';
|
4 |
|
5 | export { Bucket, BucketFile };
|
6 |
|
7 |
|
8 | export async function getBucket(rawCfg: any): Promise<Bucket> {
|
9 |
|
10 |
|
11 | if (rawCfg.project_id) {
|
12 | return getGcpBucket(rawCfg as GcpBucketCfg);
|
13 | } else if (rawCfg.access_key_id) {
|
14 | return getAwsBucket(rawCfg as AwsBucketCfg);
|
15 | }
|
16 | else {
|
17 | throw new Error(`bucket config does not seem to be valid (only support Gcp and Aws for now)`);
|
18 | }
|
19 |
|
20 | }
|
21 |
|