public enum BucketNameUtils extends java.lang.Enum<BucketNameUtils>
Modifier and Type | Field and Description |
---|---|
private static java.util.regex.Pattern |
ipAddressPattern |
private static int |
MAX_BUCKET_NAME_LENGTH |
private static int |
MIN_BUCKET_NAME_LENGTH |
Modifier and Type | Method and Description |
---|---|
private static boolean |
exception(boolean exception,
java.lang.String message)
If 'exception' is true, throw an IllegalArgumentException with the given
message.
|
static boolean |
isDNSBucketName(java.lang.String bucketName)
Convience method that allows the DNS rules to be altered for different SDKs.
|
static boolean |
isValidV2BucketName(java.lang.String bucketName)
Returns true if the specified bucket name can be addressed using V2,
virtual host style, addressing.
|
private static boolean |
isValidV2BucketName(java.lang.String bucketName,
boolean throwOnError)
Validate whether the given input is a valid bucket name.
|
static void |
validateBucketName(java.lang.String bucketName)
Validates that the specified bucket name is valid for Amazon S3 V2 naming
(i.e.
|
static BucketNameUtils |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static BucketNameUtils[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
private static final int MIN_BUCKET_NAME_LENGTH
private static final int MAX_BUCKET_NAME_LENGTH
private static final java.util.regex.Pattern ipAddressPattern
public static BucketNameUtils[] values()
for (BucketNameUtils c : BucketNameUtils.values()) System.out.println(c);
public static BucketNameUtils valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic static void validateBucketName(java.lang.String bucketName)
S3 bucket naming guidelines are specified in http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html? BucketRestrictions.html
bucketName
- The bucket name to validate.java.lang.IllegalArgumentException
- If the specified bucket name doesn't follow Amazon S3's
guidelines.public static boolean isValidV2BucketName(java.lang.String bucketName)
bucketName
- The name of the bucket to check.public static boolean isDNSBucketName(java.lang.String bucketName)
private static boolean isValidV2BucketName(java.lang.String bucketName, boolean throwOnError)
bucketName
- the name of the bucketthrowOnError
- true to throw exceptions on failureprivate static boolean exception(boolean exception, java.lang.String message)
exception
- true to throw an exceptionmessage
- the message for the exception