Documentation
¶
Index ¶
- type Index
- func (idx *Index) Add(entry *ResourceEntry) error
- func (idx *Index) Get(gvk schema.GroupVersionKind, namespace, name string) (*ResourceEntry, bool)
- func (idx *Index) GetByFile(filePath string) []*ResourceEntry
- func (idx *Index) GetCommitSHA() string
- func (idx *Index) GetRepoPath() string
- func (idx *Index) List(gvk schema.GroupVersionKind) []*ResourceEntry
- func (idx *Index) ListAll() []*ResourceEntry
- func (idx *Index) RemoveEntriesForFile(filePath string)
- func (idx *Index) SetCommitSHA(sha string)
- func (idx *Index) Stats() IndexStats
- func (idx *Index) ToSerializable() *SerializableIndex
- type IndexStats
- type ResourceEntry
- func (r *ResourceEntry) GetNestedMap(fields ...string) map[string]interface{}
- func (r *ResourceEntry) GetNestedSlice(fields ...string) []interface{}
- func (r *ResourceEntry) GetNestedString(fields ...string) string
- func (r *ResourceEntry) Name() string
- func (r *ResourceEntry) Namespace() string
- func (r *ResourceEntry) NamespacedName() string
- type SerializableIndex
- type SerializableResource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
Index is a generic resource index that provides fast lookups by GVK and file path
func (*Index) Add ¶
func (idx *Index) Add(entry *ResourceEntry) error
Add adds a resource entry to the index
func (*Index) Get ¶
func (idx *Index) Get(gvk schema.GroupVersionKind, namespace, name string) (*ResourceEntry, bool)
Get retrieves a resource by GVK and namespaced name
func (*Index) GetByFile ¶
func (idx *Index) GetByFile(filePath string) []*ResourceEntry
GetByFile returns all resources from a specific file
func (*Index) GetCommitSHA ¶
GetCommitSHA returns the commit SHA
func (*Index) GetRepoPath ¶
GetRepoPath returns the repository path
func (*Index) List ¶
func (idx *Index) List(gvk schema.GroupVersionKind) []*ResourceEntry
List returns all resources of a specific GVK
func (*Index) ListAll ¶
func (idx *Index) ListAll() []*ResourceEntry
ListAll returns all resources across all GVKs
func (*Index) RemoveEntriesForFile ¶
RemoveEntriesForFile removes all entries associated with a file
func (*Index) SetCommitSHA ¶
SetCommitSHA sets the commit SHA
func (*Index) Stats ¶
func (idx *Index) Stats() IndexStats
Stats returns generic statistics about the index
func (*Index) ToSerializable ¶
func (idx *Index) ToSerializable() *SerializableIndex
ToSerializable converts the Index to a serializable format
type IndexStats ¶
type IndexStats struct {
TotalResources int
TotalFiles int
GVKCounts map[string]int // Kind -> count
}
IndexStats holds generic statistics about the index
type ResourceEntry ¶
type ResourceEntry struct {
Resource *unstructured.Unstructured
FilePath string
}
ResourceEntry holds a resource with its source file path
func (*ResourceEntry) GetNestedMap ¶
func (r *ResourceEntry) GetNestedMap(fields ...string) map[string]interface{}
GetNestedMap safely extracts a nested map from the resource
func (*ResourceEntry) GetNestedSlice ¶
func (r *ResourceEntry) GetNestedSlice(fields ...string) []interface{}
GetNestedSlice safely extracts a nested slice from the resource
func (*ResourceEntry) GetNestedString ¶
func (r *ResourceEntry) GetNestedString(fields ...string) string
GetNestedString safely extracts a nested string value from the resource
func (*ResourceEntry) Namespace ¶
func (r *ResourceEntry) Namespace() string
Namespace returns the resource namespace
func (*ResourceEntry) NamespacedName ¶
func (r *ResourceEntry) NamespacedName() string
NamespacedName returns the namespaced name in the format "namespace/name"
type SerializableIndex ¶
type SerializableIndex struct {
Resources []SerializableResource `json:"resources"`
RepoPath string `json:"repoPath"`
CommitSHA string `json:"commitSHA"`
}
SerializableIndex is the JSON-friendly version of Index
func (*SerializableIndex) ToIndex ¶
func (si *SerializableIndex) ToIndex(repoPath string) *Index
ToIndex converts a SerializableIndex back to an Index
type SerializableResource ¶
type SerializableResource struct {
GVK string `json:"gvk"` // "openchoreo.dev/v1alpha1/Component"
Namespace string `json:"namespace"`
Name string `json:"name"`
FilePath string `json:"filePath"`
Object map[string]interface{} `json:"object"` // Full resource
}
SerializableResource is a JSON-friendly representation of a resource entry