Documentation ¶
Overview ¶
Package replacer provide common replacer implementation
Index ¶
- type ListResult
- type ReplaceResult
- type Replacer
- func (r *Replacer) ListInFile(f io.Reader) (*ListResult, error)
- func (r *Replacer) ListPath(dir string) (*ListResult, error)
- func (r *Replacer) ListPathInFS(bfs billy.Filesystem, base string) (*ListResult, error)
- func (r *Replacer) ParseFile(ctx context.Context, f io.Reader) (bool, string, error)
- func (r *Replacer) ParsePath(ctx context.Context, dir string) (*ReplaceResult, error)
- func (r *Replacer) ParsePathInFS(ctx context.Context, bfs billy.Filesystem, base string) (*ReplaceResult, error)
- func (r *Replacer) ParseString(ctx context.Context, entityRef string) (*interfaces.EntityRef, error)
- func (r *Replacer) WithCacheDisabled() *Replacer
- func (r *Replacer) WithGitHubClient(client interfaces.REST) *Replacer
- func (r *Replacer) WithGitHubClientFromToken(token string) *Replacer
- func (r *Replacer) WithUserRegex(regex string) *Replacer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ListResult ¶
type ListResult struct { Processed []string Entities []interfaces.EntityRef }
ListResult holds the result of the list methods
type ReplaceResult ¶
ReplaceResult holds a slice of all processed files along with a map of their modified content
type Replacer ¶
type Replacer struct {
// contains filtered or unexported fields
}
Replacer is an object with methods to replace references with digests
func NewContainerImagesReplacer ¶
NewContainerImagesReplacer creates a new replacer for container images
func NewGitHubActionsReplacer ¶
NewGitHubActionsReplacer creates a new replacer for GitHub actions
func (*Replacer) ListInFile ¶
func (r *Replacer) ListInFile(f io.Reader) (*ListResult, error)
ListInFile lists all entities in the provided file
func (*Replacer) ListPath ¶
func (r *Replacer) ListPath(dir string) (*ListResult, error)
ListPath lists all entity references in the provided directory
func (*Replacer) ListPathInFS ¶
func (r *Replacer) ListPathInFS(bfs billy.Filesystem, base string) (*ListResult, error)
ListPathInFS lists all entity references in the provided file system
func (*Replacer) ParseFile ¶
ParseFile parses and replaces all entity references in the provided file
func (*Replacer) ParsePath ¶
ParsePath parses and replaces all entity references in the provided directory
func (*Replacer) ParsePathInFS ¶
func (r *Replacer) ParsePathInFS(ctx context.Context, bfs billy.Filesystem, base string) (*ReplaceResult, error)
ParsePathInFS parses and replaces all entity references in the provided file system
func (*Replacer) ParseString ¶
func (r *Replacer) ParseString(ctx context.Context, entityRef string) (*interfaces.EntityRef, error)
ParseString parses and returns the referenced entity pinned by its digest
func (*Replacer) WithCacheDisabled ¶
WithCacheDisabled disables caching
func (*Replacer) WithGitHubClient ¶
func (r *Replacer) WithGitHubClient(client interfaces.REST) *Replacer
WithGitHubClient sets the GitHub client to use
func (*Replacer) WithGitHubClientFromToken ¶
WithGitHubClientFromToken creates an authenticated GitHub client from a token
func (*Replacer) WithUserRegex ¶
WithUserRegex sets a user-provided regex for the parser