Class ConfigHelper
- java.lang.Object
-
- com.redhat.devtools.intellij.common.utils.ConfigHelper
-
public class ConfigHelper extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description ConfigHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanareEqual(io.fabric8.kubernetes.api.model.Config kubeConfig, io.fabric8.kubernetes.client.Config clientConfig)Returnstrueif the givenConfigand (client runtime)Configare equal.static booleanareEqual(io.fabric8.kubernetes.api.model.NamedContext thisContext, io.fabric8.kubernetes.api.model.NamedContext thatContext)Returnstrueif both given contexts are equal.static booleanareEqual(java.util.Collection<io.fabric8.kubernetes.api.model.NamedContext> these, java.util.Collection<io.fabric8.kubernetes.api.model.NamedContext> those)static booleanareEqualToken(io.fabric8.kubernetes.api.model.AuthInfo authInfo, io.fabric8.kubernetes.client.Config clientConfig)Returnstrueif the token in the givenAuthInfo(that's retrieved from the kube config file) andConfig(that's contains the runtime settings that the kubernetes-client is using) are equal.static booleanareEqualToken(io.fabric8.kubernetes.api.model.Config kubeConfig, io.fabric8.kubernetes.client.Config clientConfig)Returnstrueif the token in the given (kubernetes file)Configand (client runtime)Configare equal.static io.fabric8.kubernetes.api.model.NamedContextgetCurrentContext()static java.lang.StringgetKubeConfigPath()static booleanisKubeConfigParsable()static booleanisKubeConfigParsable(java.io.File kubeConfig)static io.fabric8.kubernetes.api.model.ConfigloadKubeConfig()static io.fabric8.kubernetes.api.model.ConfigloadKubeConfig(java.lang.String path)static ToolsConfigloadToolsConfig()static ToolsConfigloadToolsConfig(java.net.URL url)static io.fabric8.kubernetes.api.model.ConfigsafeLoadKubeConfig()static voidsaveKubeConfig(io.fabric8.kubernetes.api.model.Config config)
-
-
-
Method Detail
-
getKubeConfigPath
public static java.lang.String getKubeConfigPath()
-
saveKubeConfig
public static void saveKubeConfig(io.fabric8.kubernetes.api.model.Config config) throws java.io.IOException- Throws:
java.io.IOException
-
safeLoadKubeConfig
public static io.fabric8.kubernetes.api.model.Config safeLoadKubeConfig()
-
loadKubeConfig
public static io.fabric8.kubernetes.api.model.Config loadKubeConfig() throws java.io.IOException- Throws:
java.io.IOException
-
loadKubeConfig
public static io.fabric8.kubernetes.api.model.Config loadKubeConfig(java.lang.String path) throws java.io.IOException- Throws:
java.io.IOException
-
isKubeConfigParsable
public static boolean isKubeConfigParsable()
-
isKubeConfigParsable
public static boolean isKubeConfigParsable(java.io.File kubeConfig)
-
loadToolsConfig
public static ToolsConfig loadToolsConfig() throws java.io.IOException
- Throws:
java.io.IOException
-
loadToolsConfig
public static ToolsConfig loadToolsConfig(java.net.URL url) throws java.io.IOException
- Throws:
java.io.IOException
-
getCurrentContext
public static io.fabric8.kubernetes.api.model.NamedContext getCurrentContext()
-
areEqual
public static boolean areEqual(io.fabric8.kubernetes.api.model.Config kubeConfig, io.fabric8.kubernetes.client.Config clientConfig)Returnstrueif the givenConfigand (client runtime)Configare 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 compareclientConfig- 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.NamedContext thisContext, io.fabric8.kubernetes.api.model.NamedContext thatContext)Returnstrueif 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 comparethatContext- the second context to compare- Returns:
- true if both contexts are equal
- See Also:
NamedContext,Context
-
areEqual
public static boolean areEqual(java.util.Collection<io.fabric8.kubernetes.api.model.NamedContext> these, java.util.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)Returnstrueif the token in the given (kubernetes file)Configand (client runtime)Configare equal. Returnsfalseotherwise.- Parameters:
kubeConfig- the (kube config) auth info that contains the tokenclientConfig- 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)Returnstrueif the token in the givenAuthInfo(that's retrieved from the kube config file) andConfig(that's contains the runtime settings that the kubernetes-client is using) are equal. Returnsfalseotherwise.- Parameters:
authInfo- the (kube config) auth info that contains the tokenclientConfig- the (client) config that contains the token- Returns:
- true if both tokens are equal, false otherwise
-
-