Check bucket name length at CreateBucket

Check that s3 bucket names follow the documented length restriction:

'Bucket names must be at least 3 and no more than 63 characters long.'

See https://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html
This commit is contained in:
Jon Michaelchuck 2018-11-22 06:08:03 -06:00
commit fb7e52becc
3 changed files with 31 additions and 2 deletions

View file

@ -178,3 +178,13 @@ class InvalidStorageClass(S3ClientError):
"InvalidStorageClass",
"The storage class you specified is not valid",
*args, **kwargs)
class InvalidBucketName(S3ClientError):
code = 400
def __init__(self, *args, **kwargs):
super(InvalidBucketName, self).__init__(
"InvalidBucketName",
"The specified bucket is not valid.",
*args, **kwargs)