hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/web/client/OzoneVolume.java
public OzoneBucket createBucket(String bucketName, String[] acls,
                                  StorageType storageType,
                                  OzoneConsts.Versioning versioning)
      throws OzoneException {

    HttpPost httpPost = null;
    try (CloseableHttpClient httpClient = newHttpClient()) {
      OzoneUtils.verifyResourceName(bucketName);
      URIBuilder builder = new URIBuilder(getClient().getEndPointURI());
      builder.setPath("/" + getVolumeName() + "/" + bucketName).build();

      httpPost = client.getHttpPost(null, builder.toString());
      if (acls != null) {
        for (String acl : acls) {
          httpPost
              .addHeader(Header.OZONE_ACLS, Header.OZONE_ACL_ADD + " " + acl);
        }
      }

      httpPost.addHeader(Header.OZONE_STORAGE_TYPE, storageType.toString());
      httpPost.addHeader(Header.OZONE_BUCKET_VERSIONING, versioning.toString());
      executeCreateBucket(httpPost, httpClient);
      return getBucket(bucketName);
    } catch (IOException | URISyntaxException | IllegalArgumentException ex) {
      throw new OzoneRestClientException(ex.getMessage(), ex);
    } finally {
      releaseConnection(httpPost);
    }
  }
/**
   * Create Bucket - Creates a bucket under a given volume.
   *
   * @param bucketName - Bucket Name
   * @param acls - Acls - User Acls
   * @param storageType - Storage Class
   * @param versioning - enable versioning support on a bucket.
   *
   *
   * @return - a Ozone Bucket Object
   */
Create Bucket - Creates a bucket under a given volume.

@return - a Ozone Bucket Object
Create Bucket - Creates a bucket under a given volume . @return - a Ozone Bucket Object
public OzoneBucket createBucket(String bucketName, String[] acls,
                                  StorageType storageType,
                                  OzoneConsts.Versioning versioning)
      throws OzoneException {
    HttpPost httpPost = null;
    try (CloseableHttpClient httpClient = newHttpClient()) {
      OzoneUtils.verifyResourceName(bucketName);
      URIBuilder builder = new URIBuilder(getClient().getEndPointURI());
      builder.setPath("/" + getVolumeName() + "/" + bucketName).build();
      httpPost = client.getHttpPost(null, builder.toString());
      if (acls != null) {
        for (String acl : acls) {
          httpPost
              .addHeader(Header.OZONE_ACLS, Header.OZONE_ACL_ADD + " " + acl);
        }
      }
      httpPost.addHeader(Header.OZONE_STORAGE_TYPE, storageType.toString());
      httpPost.addHeader(Header.OZONE_BUCKET_VERSIONING, versioning.toString());
      executeCreateBucket(httpPost, httpClient);
      return getBucket(bucketName);
    } catch (IOException | URISyntaxException | IllegalArgumentException ex) {
      throw new OzoneRestClientException(ex.getMessage(), ex);
    } finally {
      releaseConnection(httpPost);
    }
  }
public OzoneBucket createBucket ( String bucketName , String [ ] acls , StorageType storageType , OzoneConsts . Versioning versioning ) throws OzoneException { HttpPost httpPost = null ; try ( CloseableHttpClient httpClient = newHttpClient ( ) ) { OzoneUtils . verifyResourceName ( bucketName ) ; URIBuilder builder = new URIBuilder ( getClient ( ) . getEndPointURI ( ) ) ; builder . setPath ( "/" + getVolumeName ( ) + "/" + bucketName ) . build ( ) ; httpPost = client . getHttpPost ( null , builder . toString ( ) ) ; if ( acls != null ) { for ( String acl : acls ) { httpPost . addHeader ( Header . OZONE_ACLS , Header . OZONE_ACL_ADD + " " + acl ) ; } } httpPost . addHeader ( Header . OZONE_STORAGE_TYPE , storageType . toString ( ) ) ; httpPost . addHeader ( Header . OZONE_BUCKET_VERSIONING , versioning . toString ( ) ) ; executeCreateBucket ( httpPost , httpClient ) ; return getBucket ( bucketName ) ; } catch ( IOException | URISyntaxException | IllegalArgumentException ex ) { throw new OzoneRestClientException ( ex . getMessage ( ) , ex ) ; } finally { releaseConnection ( httpPost ) ; } }
Create Bucket - Creates a bucket under a given volume.
Create Bucket - Creates a bucket under a given volume .