Class ConfigHelper

java.lang.Object
com.redhat.devtools.intellij.common.utils.ConfigHelper

public class ConfigHelper extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    areEqual(io.fabric8.kubernetes.api.model.Config thisConfig, io.fabric8.kubernetes.api.model.Config thatConfig)
    Returns true if the given Config and (client runtime) Config are equal.
    static boolean
    areEqual(io.fabric8.kubernetes.api.model.Config kubeConfig, io.fabric8.kubernetes.client.Config clientConfig)
    Returns true if the given Config and (client runtime) Config are equal.
    static boolean
    areEqual(io.fabric8.kubernetes.api.model.NamedContext thisContext, io.fabric8.kubernetes.api.model.NamedContext thatContext)
    Returns true if both given contexts are equal.
    static boolean
    areEqual(Collection<io.fabric8.kubernetes.api.model.NamedContext> these, Collection<io.fabric8.kubernetes.api.model.NamedContext> those)
     
    static boolean
    areEqualCurrentContext(io.fabric8.kubernetes.api.model.Config kubeConfig, io.fabric8.kubernetes.api.model.Config newKubeConfig)
    Returns true if the given Config and the new Config are equal.
    static boolean
    areEqualToken(io.fabric8.kubernetes.api.model.AuthInfo authInfo, io.fabric8.kubernetes.api.model.AuthInfo newAuthInfo)
    Returns true if the token in the given AuthInfo (that's retrieved from the kube config file) and the new AuthInfo (that's retrieved from the new kube config file) are equal.
    static boolean
    areEqualToken(io.fabric8.kubernetes.api.model.AuthInfo authInfo, io.fabric8.kubernetes.client.Config clientConfig)
    Returns true if the token in the given AuthInfo (that's retrieved from the kube config file) and Config (that's contains the runtime settings that the kubernetes-client is using) are equal.
    static boolean
    areEqualToken(io.fabric8.kubernetes.api.model.Config kubeConfig, io.fabric8.kubernetes.api.model.Config newKubeConfig)
    Returns true if the token in the given (kubernetes file) Config and the one in the new Kubernetes file Config are equal.
    static boolean
    areEqualToken(io.fabric8.kubernetes.api.model.Config kubeConfig, io.fabric8.kubernetes.client.Config clientConfig)
    Returns true if the token in the given (kubernetes file) Config and (client runtime) Config are equal.
    static io.fabric8.kubernetes.api.model.NamedContext
     
    static io.fabric8.kubernetes.api.model.NamedContext
    getCurrentContext(io.fabric8.kubernetes.api.model.Config config)
     
    static String
     
    static String
    getCurrentContextName(io.fabric8.kubernetes.api.model.Config config)
     
    static String
     
    static boolean
     
    static boolean
     
    static io.fabric8.kubernetes.api.model.Config
     
    static io.fabric8.kubernetes.api.model.Config
     
     
     
    static io.fabric8.kubernetes.api.model.Config
     
    static void
    saveKubeConfig(io.fabric8.kubernetes.api.model.Config config)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ConfigHelper

      public ConfigHelper()
  • Method Details

    • getKubeConfigPath

      public static String getKubeConfigPath()
    • saveKubeConfig

      public static void saveKubeConfig(io.fabric8.kubernetes.api.model.Config config) throws IOException
      Throws:
      IOException
    • safeLoadKubeConfig

      public static io.fabric8.kubernetes.api.model.Config safeLoadKubeConfig()
    • loadKubeConfig

      public static io.fabric8.kubernetes.api.model.Config loadKubeConfig() throws IOException
      Throws:
      IOException
    • loadKubeConfig

      public static io.fabric8.kubernetes.api.model.Config loadKubeConfig(String path) throws IOException
      Throws:
      IOException
    • isKubeConfigParsable

      public static boolean isKubeConfigParsable()
    • isKubeConfigParsable

      public static boolean isKubeConfigParsable(File kubeConfig)
    • loadToolsConfig

      public static ToolsConfig loadToolsConfig() throws IOException
      Throws:
      IOException
    • loadToolsConfig

      public static ToolsConfig loadToolsConfig(URL url) throws IOException
      Throws:
      IOException
    • getCurrentContext

      public static io.fabric8.kubernetes.api.model.NamedContext getCurrentContext()
    • getCurrentContext

      public static io.fabric8.kubernetes.api.model.NamedContext getCurrentContext(io.fabric8.kubernetes.api.model.Config config)
    • getCurrentContextName

      public static String getCurrentContextName(io.fabric8.kubernetes.api.model.Config config)
    • getCurrentContextName

      public static String getCurrentContextName()
    • areEqualCurrentContext

      public static boolean areEqualCurrentContext(io.fabric8.kubernetes.api.model.Config kubeConfig, io.fabric8.kubernetes.api.model.Config newKubeConfig)
      Returns true if the given Config and the new Config are equal. They are considered equal if they're equal in
      • current context (cluster, user, current namespace, extensions)
      • (authentication) token
      Parameters:
      kubeConfig - the (file) config to compare
      newKubeConfig - the (client, runtime) config to compare
      Returns:
      true if both configs are equal in context, contexts and token
    • areEqual

      public static boolean areEqual(io.fabric8.kubernetes.api.model.Config kubeConfig, io.fabric8.kubernetes.client.Config clientConfig)
      Returns true if the given Config and (client runtime) Config are equal. They are considered equal if they're equal in
      • current context (cluster, user, current namespace, extensions)
      • (existing) contexts
      • (authentication) token
      Parameters:
      kubeConfig - the (file) config to compare
      clientConfig - the (client, runtime) config to compare
      Returns:
      true if both configs are equal in context, contexts and token
    • areEqual

      public static boolean areEqual(io.fabric8.kubernetes.api.model.Config thisConfig, io.fabric8.kubernetes.api.model.Config thatConfig)
      Returns true if the given Config and (client runtime) Config are equal. They are considered equal if they're equal in
      • current context (cluster, user, current namespace, extensions)
      • (existing) contexts
      • (authentication) token
      Parameters:
      thisConfig - the first (file) config to compare
      thatConfig - the second (file) config to compare
      Returns:
      true if both configs are equal in context, contexts and token
    • areEqual

      public static boolean areEqual(io.fabric8.kubernetes.api.model.NamedContext thisContext, io.fabric8.kubernetes.api.model.NamedContext thatContext)
      Returns true if both given contexts are equal. They are considered equal if they're equal in
      • cluster
      • user
      • current namespace
      • extensions
      Parameters:
      thisContext - the first context to compare
      thatContext - the second context to compare
      Returns:
      true if both contexts are equal
      See Also:
      • NamedContext
      • Context
    • areEqual

      public static boolean areEqual(Collection<io.fabric8.kubernetes.api.model.NamedContext> these, Collection<io.fabric8.kubernetes.api.model.NamedContext> those)
    • areEqualToken

      public static boolean areEqualToken(io.fabric8.kubernetes.api.model.Config kubeConfig, io.fabric8.kubernetes.client.Config clientConfig)
      Returns true if the token in the given (kubernetes file) Config and (client runtime) Config are equal. Returns false otherwise.
      Parameters:
      kubeConfig - the (kube config) auth info that contains the token
      clientConfig - the (client) config that contains the token
      Returns:
      true if both tokens are equal, false otherwise
    • areEqualToken

      public static boolean areEqualToken(io.fabric8.kubernetes.api.model.Config kubeConfig, io.fabric8.kubernetes.api.model.Config newKubeConfig)
      Returns true if the token in the given (kubernetes file) Config and the one in the new Kubernetes file Config are equal. Returns false otherwise.
      Parameters:
      kubeConfig - the (kube config) auth info that contains the token
      newKubeConfig - the (client) config that contains the token
      Returns:
      true if both tokens are equal, false otherwise
    • areEqualToken

      public static boolean areEqualToken(io.fabric8.kubernetes.api.model.AuthInfo authInfo, io.fabric8.kubernetes.client.Config clientConfig)
      Returns true if the token in the given AuthInfo (that's retrieved from the kube config file) and Config (that's contains the runtime settings that the kubernetes-client is using) are equal. Returns false otherwise.
      Parameters:
      authInfo - the (kube config) auth info that contains the token
      clientConfig - the (client) config that contains the token
      Returns:
      true if both tokens are equal, false otherwise
    • areEqualToken

      public static boolean areEqualToken(io.fabric8.kubernetes.api.model.AuthInfo authInfo, io.fabric8.kubernetes.api.model.AuthInfo newAuthInfo)
      Returns true if the token in the given AuthInfo (that's retrieved from the kube config file) and the new AuthInfo (that's retrieved from the new kube config file) are equal. Returns false otherwise.
      Parameters:
      authInfo - the (kube config) auth info that contains the token
      newAuthInfo - the new (kube config) auth that contains the token
      Returns:
      true if both tokens are equal, false otherwise