Search in sources :

Example 1 with CreateBucketRequest

use of com.obs.services.model.CreateBucketRequest 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);
}
Also used : AccessControlList(com.obs.services.model.AccessControlList) CreateBucketRequest(com.obs.services.model.CreateBucketRequest) ObsBucket(com.obs.services.model.ObsBucket)

Aggregations

AccessControlList (com.obs.services.model.AccessControlList)1 CreateBucketRequest (com.obs.services.model.CreateBucketRequest)1 ObsBucket (com.obs.services.model.ObsBucket)1