public AWSCredentials getCredentials ( String profileName ) { final AWSCredentialsProvider provider = credentialProviderCache . get ( profileName ) ; if ( provider != null ) { return provider . getCredentials ( ) ; } else { BasicProfile profile = allProfiles . getProfile ( profileName ) ; if ( profile == null ) { throw new IllegalArgumentException ( "No AWS profile named '" + profileName + "'" ) ; } final AWSCredentialsProvider newProvider = fromProfile ( profile ) ; credentialProviderCache . put ( profileName , newProvider ) ; return newProvider . getCredentials ( ) ; } }
Returns the AWS credentials for the specified profile .