/** Returns the current context in the given config */
 public static Context getCurrentContext(Config config) {
   String contextName = config.getCurrentContext();
   if (contextName != null) {
     List<NamedContext> contexts = config.getContexts();
     if (contexts != null) {
       for (NamedContext context : contexts) {
         if (contextName.equals(context.getName())) {
           return context.getContext();
         }
       }
     }
   }
   return null;
 }
 /** Returns the current {@link Cluster} for the current context */
 public static Cluster getCluster(Config config, Context context) {
   Cluster cluster = null;
   if (config != null && context != null) {
     String clusterName = context.getCluster();
     if (clusterName != null) {
       List<NamedCluster> clusters = config.getClusters();
       if (clusters != null) {
         for (NamedCluster namedCluster : clusters) {
           if (clusterName.equals(namedCluster.getName())) {
             cluster = namedCluster.getCluster();
           }
         }
       }
     }
   }
   return cluster;
 }
 /** Returns the current {@link AuthInfo} for the current context and user */
 public static AuthInfo getUserAuthInfo(Config config, Context context) {
   AuthInfo authInfo = null;
   if (config != null && context != null) {
     String user = context.getUser();
     if (user != null) {
       List<NamedAuthInfo> users = config.getUsers();
       if (users != null) {
         for (NamedAuthInfo namedAuthInfo : users) {
           if (user.equals(namedAuthInfo.getName())) {
             authInfo = namedAuthInfo.getUser();
           }
         }
       }
     }
   }
   return authInfo;
 }