49 lines
1.3 KiB
JavaScript
49 lines
1.3 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.HuaweiYunInstance = void 0;
|
|
const Huawei_1 = require("./service/huawei/Huawei");
|
|
Object.defineProperty(exports, "HuaweiYunInstance", { enumerable: true, get: function () { return Huawei_1.HuaweiYunInstance; } });
|
|
/**
|
|
* 华为云SDK主类
|
|
* 用于管理华为云OBS实例
|
|
*/
|
|
class HuaweiYunSDK {
|
|
huaweiMap; // OBS实例映射
|
|
constructor() {
|
|
this.huaweiMap = {};
|
|
}
|
|
/**
|
|
* 获取或创建华为云实例
|
|
* @param accessKey Access Key ID
|
|
* @param accessSecret Access Key Secret
|
|
* @returns 华为云实例
|
|
*/
|
|
getInstance(accessKey, accessSecret) {
|
|
if (this.huaweiMap[accessKey]) {
|
|
return this.huaweiMap[accessKey];
|
|
}
|
|
const instance = new Huawei_1.HuaweiYunInstance(accessKey, accessSecret);
|
|
Object.assign(this.huaweiMap, {
|
|
[accessKey]: instance,
|
|
});
|
|
return instance;
|
|
}
|
|
/**
|
|
* 移除指定的华为云实例
|
|
* @param accessKey Access Key ID
|
|
*/
|
|
removeInstance(accessKey) {
|
|
if (this.huaweiMap[accessKey]) {
|
|
delete this.huaweiMap[accessKey];
|
|
}
|
|
}
|
|
/**
|
|
* 清除所有实例
|
|
*/
|
|
clearAllInstances() {
|
|
this.huaweiMap = {};
|
|
}
|
|
}
|
|
const SDK = new HuaweiYunSDK();
|
|
exports.default = SDK;
|