public static String validateKubernetesId ( String currentValue , String description ) throws IllegalArgumentException { if ( StringUtils . isBlank ( currentValue ) ) { throw new IllegalArgumentException ( "No " + description + " is specified!" ) ; } int size = currentValue . length ( ) ; for ( int i = 0 ; i < size ; i ++ ) { char ch = currentValue . charAt ( i ) ; if ( Character . isUpperCase ( ch ) ) { throw new IllegalArgumentException ( "Invalid upper case letter '" + ch + "' at index " + i + " for " + description + " value: " + currentValue ) ; } } return currentValue ; }
Validates that the given value is valid according to the kubernetes ID parsing rules throwing an exception if not .