asset

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2022 License: Apache-2.0 Imports: 8 Imported by: 15

Documentation

Overview

Copyright Red Hat

Copyright Red Hat

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendItNotExists added in v1.2.2

func AppendItNotExists(a []string, e string) []string

func Delete added in v1.2.2

func Delete(a []string, e string) []string

func ExtractAssets added in v1.2.2

func ExtractAssets(r ScenarioReader, prefix, dir string, excluded []string, headerFile string) error

func ToJSON added in v1.2.2

func ToJSON(b []byte) ([]byte, error)

Types

type MemFS added in v1.2.2

type MemFS struct {
	// contains filtered or unexported fields
}

func NewMemFSReader added in v1.2.2

func NewMemFSReader() *MemFS

func (*MemFS) AddAsset added in v1.2.2

func (r *MemFS) AddAsset(fileName string, data []byte)

func (*MemFS) AddAssetsFromScenarioReader added in v1.2.2

func (r *MemFS) AddAssetsFromScenarioReader(reader ScenarioReader, headerFile string) error

func (*MemFS) Asset added in v1.2.2

func (r *MemFS) Asset(name string) ([]byte, error)

func (*MemFS) AssetNames added in v1.2.2

func (r *MemFS) AssetNames(prefixes, excluded []string, headerFile string) ([]string, error)

type ScenarioReader

type ScenarioReader interface {
	// Retrieve an asset from the data source
	Asset(templatePath string) ([]byte, error)
	// List all available assets in the data source
	// with a prefix of one of the name in the files array
	// if the prefix array is nil, the prefix will not be tested
	// excluding the name in the excluded array
	AssetNames(prefixes, excluded []string, headerFile string) ([]string, error)
}

type ScenarioResourcesReader

type ScenarioResourcesReader struct {
	// contains filtered or unexported fields
}

func NewScenarioResourcesReader

func NewScenarioResourcesReader(files *embed.FS) *ScenarioResourcesReader

func (*ScenarioResourcesReader) Asset

func (r *ScenarioResourcesReader) Asset(name string) ([]byte, error)

func (*ScenarioResourcesReader) AssetNames

func (r *ScenarioResourcesReader) AssetNames(prefixes, excluded []string, headerFile string) ([]string, error)

type YamlFileReader

type YamlFileReader struct {
	// contains filtered or unexported fields
}

YamlFileReader defines a reader for yaml files

func NewDirectoriesReader

func NewDirectoriesReader(
	header string,
	paths []string,
) (*YamlFileReader, error)

NewDirectoriesReader constructs a new YamlFileReader

func (*YamlFileReader) Asset

func (r *YamlFileReader) Asset(
	name string,
) ([]byte, error)

Asset returns an asset

func (*YamlFileReader) AssetNames

func (r *YamlFileReader) AssetNames(prefixes, excluded []string, headerFile string) ([]string, error)

AssetNames returns the name of all assets

Jump to

Keyboard shortcuts

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