use of com.mizhousoft.tencent.RegionEnum in project cloud-sdk by mizhousoft.
the class COSObjectStorageServiceImpl method init.
public void init(COSProfile config) throws CloudSDKException {
validate(config);
COSCredentials cred = null;
if (StringUtils.isBlank(config.getSessionToken())) {
cred = new BasicCOSCredentials(config.getAccessKey(), config.getSecretKey());
} else {
cred = new BasicSessionCredentials(config.getAccessKey(), config.getSecretKey(), config.getSessionToken());
}
RegionEnum region = RegionEnum.get(config.getRegion());
ClientConfig clientConfig = new ClientConfig(new Region(region.getValue()));
clientConfig.setHttpProtocol(HttpProtocol.https);
COSClient cosClient = new COSClient(cred, clientConfig);
this.profile = config;
this.cosClient = cosClient;
LOG.info("Init cos client successfully.");
}
Aggregations