Package dev.zucca_ops.kustomtrace.parser
Class KustomizeFileUtil
java.lang.Object
dev.zucca_ops.kustomtrace.parser.KustomizeFileUtil
Utility methods for Kustomize file and path conventions.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PathgetKustomizationFileFromAppDirectory(Path appPath) Resolves an application path (directory or direct kustomization file path) to the actual Kustomization definition file.static booleanisDirectory(Path path) Checks if the path exists and is a directory.static booleanChecks if the path exists and is a regular file.static booleanisKustomizationFileName(Path path) Checks if the path's filename is a standard Kustomization filename.static booleanChecks if the path likely represents a Kubernetes resource file (by extension) and is not a Kustomization file by name.
-
Constructor Details
-
KustomizeFileUtil
public KustomizeFileUtil()
-
-
Method Details
-
isFile
Checks if the path exists and is a regular file.- Parameters:
path- The path to check.- Returns:
trueif the path exists and is a regular file,falseotherwise.
-
isDirectory
Checks if the path exists and is a directory.- Parameters:
path- The path to check.- Returns:
trueif the path exists and is a directory,falseotherwise.
-
isKustomizationFileName
Checks if the path's filename is a standard Kustomization filename. (kustomization.yaml, kustomization.yml, or Kustomization).- Parameters:
path- The path to check.- Returns:
trueif the filename matches a Kustomization name.
-
isValidKubernetesResource
Checks if the path likely represents a Kubernetes resource file (by extension) and is not a Kustomization file by name.- Parameters:
path- The path to check.- Returns:
trueif it's likely a Kubernetes resource file.
-
getKustomizationFileFromAppDirectory
Resolves an application path (directory or direct kustomization file path) to the actual Kustomization definition file. Searches for "kustomization.yaml", "kustomization.yml", "Kustomization" in order.- Parameters:
appPath- The application path (directory or kustomization file).- Returns:
- The resolved
Pathto the kustomization file. - Throws:
NotAnAppException- if no valid kustomization file is found.
-