use of com.obs.services.model.TemporarySignatureRequest in project jeesuite-libs by vakinge.
the class HuaweicloudProvider method generatePresignedUrl.
@Override
protected String generatePresignedUrl(String bucketName, String fileKey, int expireInSeconds) {
// 默认5分钟, 最长7天
if (!exists(bucketName, fileKey)) {
throw new JeesuiteBaseException("对象[bucketName=" + bucketName + ",fileKey=" + fileKey + "]不存在");
}
TemporarySignatureRequest req = new TemporarySignatureRequest(HttpMethodEnum.GET, expireInSeconds);
req.setBucketName(bucketName);
req.setObjectKey(fileKey);
TemporarySignatureResponse res = obsClient.createTemporarySignature(req);
String signedUrl = res.getSignedUrl();
return signedUrl;
}
use of com.obs.services.model.TemporarySignatureRequest in project ais-sdk by huaweicloudsdk.
the class SimpleObsClient method generateSignedUrl.
protected String generateSignedUrl(HttpMethodEnum method, String bucketName, String objectKey, long expireTime) {
TemporarySignatureRequest req = new TemporarySignatureRequest(method, expireTime);
req.setBucketName(bucketName);
req.setObjectKey(objectKey);
TemporarySignatureResponse res = obsClient.createTemporarySignature(req);
System.out.println("temporary signature url:");
System.out.println("\t" + res.getSignedUrl());
return res.getSignedUrl();
}
Aggregations