Class KustomFile

java.lang.Object
dev.zucca_ops.kustomtrace.model.GraphNode
dev.zucca_ops.kustomtrace.model.KustomFile

public class KustomFile extends GraphNode
Represents a regular Kubernetes manifest file (e.g., YAML or JSON) as a node in the Kustomize dependency graph. It can contain one or more Kubernetes resources.
  • Constructor Details

    • KustomFile

      public KustomFile(Path path)
      Constructs a KustomFile node.
      Parameters:
      path - The file system path to this file.
  • Method Details

    • isKustomization

      public boolean isKustomization()
      Indicates that this node is not a Kustomization.
      Specified by:
      isKustomization in class GraphNode
      Returns:
      Always false.
    • isKustomFile

      public boolean isKustomFile()
      Indicates that this node is a KustomFile.
      Specified by:
      isKustomFile in class GraphNode
      Returns:
      Always true.
    • getResource

      public KustomResource getResource()
      Gets the first Kubernetes resource found in this file, or a default "Undefined" resource if the file contains no parsed resources.

      Note: Kustomize files can contain multiple resources. This method provides a simplified way to access one, primarily for scenarios where only one is expected or any will do. For all resources, use getResources().

      Returns:
      The first KustomResource, or an "Undefined" resource if none exist.
    • getResources

      public List<KustomResource> getResources()
      Gets all Kubernetes resources parsed from this file.
      Returns:
      An unmodifiable list of KustomResources.
    • addResource

      public void addResource(KustomResource resource)
      Adds a parsed Kubernetes resource to this file.