use of com.obs.services.model.ObsBucket in project ais-sdk by huaweicloudsdk.
the class SimpleObsClient method createBucket.
/**
* 创建桶
*
* @param bucketName 桶名称
*/
public void createBucket(String bucketName) {
ObsBucket obsBucket = obsClient.createBucket(bucketName, ClientContextUtils.getAuthInfo().getRegion());
System.out.println("Create bucket success. BucketName: " + obsBucket.getBucketName() + "; CreationDate: " + obsBucket.getCreationDate() + "; Location: " + obsBucket.getLocation());
}
use of com.obs.services.model.ObsBucket in project jeesuite-libs by vakinge.
the class HuaweicloudProvider method createBucket.
@Override
public void createBucket(String bucketName, boolean isPrivate) {
if (existsBucket(bucketName)) {
throw new RuntimeException("bucket[" + bucketName + "] 已经存在");
}
CreateBucketRequest request = new CreateBucketRequest(bucketName, conf.getRegionName());
ObsBucket bucket = new ObsBucket();
bucket.setBucketName(bucketName);
AccessControlList acl = null;
if (isPrivate) {
acl = AccessControlList.REST_CANNED_PRIVATE;
} else {
acl = AccessControlList.REST_CANNED_PUBLIC_READ;
}
request.setAcl(acl);
obsClient.createBucket(request);
}
Aggregations