Search in sources :

Example 1 with ObsBucket

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

Example 2 with ObsBucket

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

Aggregations

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