public static void validateClusterName(String clusterName) {
    if (clusterName == null) {
      throw new IllegalArgumentException("Invalid arguments, cluster name should not be null");
    }
    if (clusterName.isEmpty()) {
      throw new IllegalArgumentException("Invalid arguments, cluster name should not be empty");
    }
    Matcher mtch = CLUSTER_NAME_PTRN.matcher(clusterName);
    if(!mtch.matches()){
      throw new IllegalArgumentException("Invalid arguments, cluster name should contains only alphabetical, numeric, '_' and '-' characters and length 1-100 characters");
    }
  }
validate cluster name character and length requirements and throw IllegalArgumentException if not valid.
<p>
Character Requirements
<p>
A through Z
a through z
0 through 9
_ (underscore)
- (dash)
Length Requirements
<p>
Minimum: 1 character
Maximum: 100 characters
@see AmbariManagementControllerImpl#CLUSTER_NAME_VALIDATION_REGEXP

@param clusterName name to validate
@throws IllegalArgumentException if validation result
ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java