Documentation ¶
Index ¶
- Constants
- Variables
- type Bundle
- func (b *Bundle) Glob(pattern string) ([]string, error)
- func (b *Bundle) Open(name string) (fs.File, error)
- func (b *Bundle) ReadDir(name string) ([]fs.DirEntry, error)
- func (b *Bundle) ReadFile(name string) ([]byte, error)
- func (b *Bundle) Stat(path string) (fs.FileInfo, error)
- func (b *Bundle) Sub(dir string) (*Bundle, error)
- func (b *Bundle) WalkDir(root string, fn fs.WalkDirFunc) error
- type BundleFn
- type Bundler
- type FS
- type Maintainer
- type Metadata
- type MetadataResolver
- type PatternMatcher
Constants ¶
const DefaultMetadataFile = "bundle.json"
Variables ¶
var DefaultMatcher = filepath.Match
Functions ¶
This section is empty.
Types ¶
type Bundle ¶
type Bundle struct { // Prefix contains the prefix for a subtree of the FS. Prefix string // Matcher is an implementation of PatternMatcher interface used by Bundle.Glob(). Matcher PatternMatcher // Metadata includes optional metadata for content bundled in Bundle.FS. Metadata FS }
func New ¶
New returns a new Bundle object which encapsulates the provided FS and filepath.Match as the default pattern matcher. List of BundleFn are applied if provided.
func (*Bundle) ReadDir ¶
ReadDir reads the named directory and returns a list of directory entries sorted by filename. Implements fs.ReadDirFS interface.
type BundleFn ¶
BundleFn defines transformer function for Bundle.
func WithDefaultMetadataFile ¶
func WithDefaultMetadataFile() BundleFn
WithDefaultMetadataFile lookup for bundle.json in root of Bundle.FS to populate Bundle.Metadata.
func WithMatcher ¶
func WithMatcher(m PatternMatcher) BundleFn
WithMatcher sets the PatternMatcher to be used by Bundle.Glob().
func WithMetadata ¶
WithMetadata uses meta to populate Bundle.Metadata.
func WithMetadataFile ¶
WithDefaultMetadataFile lookup for bundle.json at path in Bundle.FS to populate Bundle.Metadata.
func WithMetadataResolver ¶
func WithMetadataResolver(resolver MetadataResolver) BundleFn
WithMetadataResolver invokes the MetadataResolver to populate the Bundle.Metadata.
func WithPrefix ¶
WithPrefix set the filesystem prefix for fs.FS which alters the path used for lookup operations. It comes handy in cases where only a subtree of the FS is expected to be access without exposing the whole filesystem structure.
type Maintainer ¶
type Maintainer struct { Name string `json:"name"` Email string `json:"email"` URL string `json:"url"` }
Maintainer contains the contact information for a maintainer defined in Metadata.
type Metadata ¶
type Metadata struct { Name string `json:"name"` Version string `json:"version"` Description string `json:"description"` License string `json:"license,omitempty"` Maintainers []Maintainer `json:"maintainers,omitempty"` Parameters map[string]interface{} `json:"parameters,omitempty"` }
Metadata contains information about the package bundled in Bundle.FS. It partially implements the format defined by the Cloud Native Application Bundle specification, however it is not limited to it.
func NewMetadataFromRawBytes ¶
type MetadataResolver ¶
MetadataResolver returns a Metadata object by reading the content of the Bundle. It is meant to be used to retrieve metadata for Bundle in formats other than bundle.json supported by default.
type PatternMatcher ¶
PatternMatcher custom file path pattern matcher for use-cases where the default filepath.Match is not sufficient.