replacer

package
v0.0.20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package replacer provide common replacer implementation

Index

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

type ReplaceResult struct {
	Processed []string
	Modified  map[string]string
}

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

func NewContainerImagesReplacer(cfg *config.Config) *Replacer

NewContainerImagesReplacer creates a new replacer for container images

func NewGitHubActionsReplacer

func NewGitHubActionsReplacer(cfg *config.Config) *Replacer

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

func (r *Replacer) ParseFile(ctx context.Context, f io.Reader) (bool, string, error)

ParseFile parses and replaces all entity references in the provided file

func (*Replacer) ParsePath

func (r *Replacer) ParsePath(ctx context.Context, dir string) (*ReplaceResult, error)

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

func (r *Replacer) WithCacheDisabled() *Replacer

WithCacheDisabled disables caching

func (*Replacer) WithGitHubClient

func (r *Replacer) WithGitHubClient(client interfaces.REST) *Replacer

WithGitHubClient sets the GitHub client to use

func (*Replacer) WithGitHubClientFromToken

func (r *Replacer) WithGitHubClientFromToken(token string) *Replacer

WithGitHubClientFromToken creates an authenticated GitHub client from a token

func (*Replacer) WithUserRegex

func (r *Replacer) WithUserRegex(regex string) *Replacer

WithUserRegex sets a user-provided regex for the parser

Directories

Path Synopsis
Package actions provides utilities to work with GitHub Actions.
Package actions provides utilities to work with GitHub Actions.
Package image provides utilities to work with container images.
Package image provides utilities to work with container images.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL