Class KustomizeFileUtil

java.lang.Object
dev.zucca_ops.kustomtrace.parser.KustomizeFileUtil

public class KustomizeFileUtil extends Object
Utility methods for Kustomize file and path conventions.
  • Constructor Details

    • KustomizeFileUtil

      public KustomizeFileUtil()
  • Method Details

    • isFile

      public static boolean isFile(Path path)
      Checks if the path exists and is a regular file.
      Parameters:
      path - The path to check.
      Returns:
      true if the path exists and is a regular file, false otherwise.
    • isDirectory

      public static boolean isDirectory(Path path)
      Checks if the path exists and is a directory.
      Parameters:
      path - The path to check.
      Returns:
      true if the path exists and is a directory, false otherwise.
    • isKustomizationFileName

      public static boolean isKustomizationFileName(Path path)
      Checks if the path's filename is a standard Kustomization filename. (kustomization.yaml, kustomization.yml, or Kustomization).
      Parameters:
      path - The path to check.
      Returns:
      true if the filename matches a Kustomization name.
    • isValidKubernetesResource

      public static boolean isValidKubernetesResource(Path path)
      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:
      true if it's likely a Kubernetes resource file.
    • getKustomizationFileFromAppDirectory

      public static Path getKustomizationFileFromAppDirectory(Path appPath) throws NotAnAppException
      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 Path to the kustomization file.
      Throws:
      NotAnAppException - if no valid kustomization file is found.