function createS3Bucket(bucketName, region = DEFAULT_REGION) {
    const createBuckerParams = {
        Bucket: bucketName
    };
    return spinner(
        new Promise((resolve, reject) =>
            s3
                .headBucket({
                    Bucket: bucketName
                })
                .promise()
                .catch(error => {
                    if (error.code !== 'NotFound') {
                        reject(
                            new Error(
                                `The S3 Bucket ${chalk.bold(bucketName)} in region ${chalk.bold(
                                    region
                                )} already exists and you don't have access to it. Error code: ${chalk.bold(error.code)}`
                            )
                        );
                    }
                })
                .then(() =>
                    s3
                        .createBucket(createBuckerParams)
                        .promise()
                        .then(resolve)
                        .catch(error =>
                            reject(
                                new Error(
                                    `There was an error during the creation of the S3 Bucket ${chalk.bold(
                                        bucketName
                                    )} in region ${chalk.bold(region)}`
                                )
                            )
                        )
                )
        )
    );
}
function createS3Bucket(bucketName, region = DEFAULT_REGION) {
    const createBuckerParams = {
        Bucket: bucketName
    };
    return spinner(
        new Promise((resolve, reject) =>
            s3
                .headBucket({
                    Bucket: bucketName
                })
                .promise()
                .catch(error => {
                    if (error.code !== 'NotFound') {
                        reject(
                            new Error(
                                `The S3 Bucket ${chalk.bold(bucketName)} in region ${chalk.bold(
                                    region
                                )} already exists and you don't have access to it. Error code: ${chalk.bold(error.code)}`
                            )
                        );
                    }
                })
                .then(() =>
                    s3
                        .createBucket(createBuckerParams)
                        .promise()
                        .then(resolve)
                        .catch(error =>
                            reject(
                                new Error(
                                    `There was an error during the creation of the S3 Bucket ${chalk.bold(
                                        bucketName
                                    )} in region ${chalk.bold(region)}`
                                )
                            )
                        )
                )
        )
    );
}
function createS3Bucket ( bucketName , region = DEFAULT_REGION ) { const createBuckerParams = { Bucket : bucketName } ; return spinner ( new Promise ( ( resolve , reject ) => s3 . headBucket ( { Bucket : bucketName } ) . promise ( ) . catch ( error => { if ( error . code !== 'NotFound' ) { reject ( new Error ( ` ${ chalk . bold ( bucketName ) } ${ chalk . bold ( region ) } ${ chalk . bold ( error . code ) } ` ) ) ; } } ) . then ( ( ) => s3 . createBucket ( createBuckerParams ) . promise ( ) . then ( resolve ) . catch ( error => reject ( new Error ( ` ${ chalk . bold ( bucketName ) } ${ chalk . bold ( region ) } ` ) ) ) ) ) ) ; }
Create a S3 Bucket in said region with said bucketBaseName.
the bucketBaseName will be used to create a
@param bucketName the name of the bucket to create.
@param region the region to create the bucket in.
@returns {Promise}
Create a S3 Bucket in said region with said bucketBaseName . the bucketBaseName will be used to create a
Creates an S3 Bucket