def bucket_create()

in files/default/rgw_s3_api.py [0:0]


def bucket_create(conn, bucket_name, location=Location.DEFAULT, policy=None, headers=None, make_public=False, verbose=False):
    if not conn or not bucket_name:
        if verbose:
            print('Connection and/or bucket name not valid - unable to create.')
        return None

    bucket = None

    try:
        bucket = conn.create_bucket(bucket_name, location=location, policy=policy, headers=headers)
        if make_public:
            bucket.make_public(recursive=True, headers=headers)

        if bucket and verbose:
            print('Bucket %s created.' % bucket_name)
    except BaseException, e:
        print(e.message)

    return bucket