module AWS::S3::Client::Validators

def dns_compatible_bucket_name?(bucket_name)

Returns:
  • (Boolean) - Returns true if the given bucket name may be
def dns_compatible_bucket_name?(bucket_name)
  return false if
    !valid_bucket_name?(bucket_name) or
    # Bucket names should not contain underscores (_)
    bucket_name["_"] or
    # Bucket names should be between 3 and 63 characters long
    bucket_name.size > 63 or
    # Bucket names should not end with a dash
    bucket_name[-1,1] == '-' or
    # Bucket names cannot contain two, adjacent periods
    bucket_name['..'] or
    # Bucket names cannot contain dashes next to periods
    # (e.g., "my-.bucket.com" and "my.-bucket" are invalid)
    (bucket_name['-.'] || bucket_name['.-'])
  true
end