36 lines
1023 B
TypeScript
36 lines
1023 B
TypeScript
import * as plugins from './plugins.js';
|
|
import { Bucket } from './classes.bucket.js';
|
|
|
|
export class SmartBucket {
|
|
public config: plugins.tsclass.storage.IS3Descriptor;
|
|
|
|
public minioClient: plugins.minio.Client;
|
|
|
|
/**
|
|
* the constructor of SmartBucket
|
|
*/
|
|
constructor(configArg: plugins.tsclass.storage.IS3Descriptor) {
|
|
this.config = configArg;
|
|
this.minioClient = new plugins.minio.Client({
|
|
endPoint: this.config.endpoint,
|
|
port: configArg.port || 443,
|
|
useSSL: configArg.useSsl !== undefined ? configArg.useSsl : true,
|
|
accessKey: this.config.accessKey,
|
|
secretKey: this.config.accessSecret,
|
|
});
|
|
}
|
|
|
|
public async createBucket(bucketNameArg: string) {
|
|
const bucket = await Bucket.createBucketByName(this, bucketNameArg);
|
|
return bucket;
|
|
}
|
|
|
|
public async removeBucket(bucketName: string) {
|
|
await Bucket.removeBucketByName(this, bucketName);
|
|
}
|
|
|
|
public async getBucketByName(bucketName: string) {
|
|
return Bucket.getBucketByName(this, bucketName);
|
|
}
|
|
}
|