Documentation
¶
Index ¶
- func FixKustomizationPreUnmarshallingNonFatal(data []byte) ([]byte, error)
- func IsKustomizationFile(path string) bool
- func TrimUrl(s string) string
- func UserName(repositoryURL string) string
- type Document
- func (doc *Document) Copy() *Document
- func (doc *Document) FromRelativePath(newFile string) (Document, error)
- func (doc *Document) GetDocument() *Document
- func (doc *Document) ID() string
- func (doc *Document) Path() string
- func (doc *Document) RepositoryFullName() string
- func (doc *Document) WasCached() bool
- type KustomizationDocument
- func (doc *KustomizationDocument) CollectDocuments(paths []string, fileType string) []*Document
- func (doc *KustomizationDocument) Copy() *KustomizationDocument
- func (doc *KustomizationDocument) GetResources(includeResources, includeTransformers, includeGenerators bool) ([]*Document, error)
- func (doc *KustomizationDocument) ParseYAML() error
- func (doc *KustomizationDocument) String() string
- type UniqueDocuments
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsKustomizationFile ¶
IsKustomizationFile determines whether a file path is a kustomization file
Types ¶
type Document ¶
type Document struct { RepositoryURL string `json:"repositoryUrl,omitempty"` // User makes it easy to aggregate data in the user level instead // of the repository level User string `json:"user,omitempty"` FilePath string `json:"filePath,omitempty"` DefaultBranch string `json:"defaultBranch,omitempty"` DocumentData string `json:"document,omitempty"` CreationTime *time.Time `json:"creationTime,omitempty"` IsSame bool `json:"-"` // FileType can be one of the following: // "generator", "transformer", "resource", "". FileType string `json:"fileType,omitempty"` }
func (*Document) FromRelativePath ¶
func (*Document) GetDocument ¶
Implements the CrawlerDocument interface.
func (*Document) RepositoryFullName ¶
type KustomizationDocument ¶
type KustomizationDocument struct { Document Kinds []string `json:"kinds,omitempty"` Identifiers []string `json:"identifiers,omitempty"` Values []string `json:"values,omitempty"` // contains filtered or unexported fields }
This document is meant to be used at the elasticsearch document type. Fields are serialized as-is to elasticsearch, where indices are built to facilitate text search queries. Identifiers, Values, FilePath, RepositoryURL and DocumentData are meant to be searched for text queries directly, while the other fields can either be used as a filter, or as additional metadata displayed in the UI.
The fields of the document and their purpose are listed below:
- DocumentData contains the contents of the kustomization file.
- Kinds Represents the kubernetes Kinds that are in this file.
- Identifiers are a list of (partial and full) identifier paths that can be found by users. Each part of a path is delimited by ":" e.g. spec:replicas.
- Values are a list of identifier paths and their values that can be found by search queries. The path is delimited by ":" and the value follows the "=" symbol e.g. spec:replicas=4.
- FilePath is the path of the file.
- RepositoryURL is the URL of the source repository.
- CreationTime is the time at which the file was created.
Representing each Identifier and Value as a flat string representation facilitates the use of complex text search features from elasticsearch such as fuzzy searching, regex, wildcards, etc.
func (*KustomizationDocument) CollectDocuments ¶
func (doc *KustomizationDocument) CollectDocuments( paths []string, fileType string) []*Document
CollectDocuments construct a Document for each path in paths, and return a slice of Document pointers.
func (*KustomizationDocument) Copy ¶
func (doc *KustomizationDocument) Copy() *KustomizationDocument
func (*KustomizationDocument) GetResources ¶
func (doc *KustomizationDocument) GetResources( includeResources, includeTransformers, includeGenerators bool) ([]*Document, error)
Implements the CrawlerDocument interface.
func (*KustomizationDocument) ParseYAML ¶
func (doc *KustomizationDocument) ParseYAML() error
ParseYAML parses doc.Document and sets the following fields of doc: Kinds, Values, Identifiers.
func (*KustomizationDocument) String ¶
func (doc *KustomizationDocument) String() string
type UniqueDocuments ¶
type UniqueDocuments struct {
// contains filtered or unexported fields
}
UniqueDocuments make sure a Document with a given ID appears only once
func NewUniqueDocuments ¶
func NewUniqueDocuments() UniqueDocuments
func (*UniqueDocuments) Add ¶
func (uds *UniqueDocuments) Add(d *Document)
func (*UniqueDocuments) AddDocuments ¶
func (uds *UniqueDocuments) AddDocuments(docs []*Document)
func (*UniqueDocuments) Documents ¶
func (uds *UniqueDocuments) Documents() []*Document