|
|
@ -59,7 +59,6 @@ import lombok.extern.slf4j.Slf4j; |
|
|
|
import com.aliyun.oss.OSS; |
|
|
|
import com.aliyun.oss.OSS; |
|
|
|
import com.aliyun.oss.OSSException; |
|
|
|
import com.aliyun.oss.OSSException; |
|
|
|
import com.aliyun.oss.ServiceException; |
|
|
|
import com.aliyun.oss.ServiceException; |
|
|
|
import com.aliyun.oss.model.Bucket; |
|
|
|
|
|
|
|
import com.aliyun.oss.model.DeleteObjectsRequest; |
|
|
|
import com.aliyun.oss.model.DeleteObjectsRequest; |
|
|
|
import com.aliyun.oss.model.ListObjectsV2Request; |
|
|
|
import com.aliyun.oss.model.ListObjectsV2Request; |
|
|
|
import com.aliyun.oss.model.ListObjectsV2Result; |
|
|
|
import com.aliyun.oss.model.ListObjectsV2Result; |
|
|
@ -509,17 +508,13 @@ public class OssStorageOperator implements Closeable, StorageOperate { |
|
|
|
throw new IllegalArgumentException("resource.alibaba.cloud.oss.bucket.name is empty"); |
|
|
|
throw new IllegalArgumentException("resource.alibaba.cloud.oss.bucket.name is empty"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Bucket existsBucket = ossClient.listBuckets() |
|
|
|
boolean existsBucket = ossClient.doesBucketExist(bucketName); |
|
|
|
.stream() |
|
|
|
if (!existsBucket) { |
|
|
|
.filter( |
|
|
|
throw new IllegalArgumentException( |
|
|
|
bucket -> bucket.getName().equals(bucketName)) |
|
|
|
"bucketName: " + bucketName + " is not exists, you need to create them by yourself"); |
|
|
|
.findFirst() |
|
|
|
} |
|
|
|
.orElseThrow(() -> { |
|
|
|
|
|
|
|
return new IllegalArgumentException( |
|
|
|
log.info("bucketName: {} has been found, the current regionName is {}", bucketName, region); |
|
|
|
"bucketName: " + bucketName + " does not exist, you need to create them by yourself"); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
log.info("bucketName: {} has been found, the current regionName is {}", existsBucket.getName(), region); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected void deleteDir(String directoryName) { |
|
|
|
protected void deleteDir(String directoryName) { |
|
|
|