utils

package
v0.0.0-...-9b2ac06 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadResourceFromYaml

func LoadResourceFromYaml(fs FileSystem, filepath kubeserial.ResourceSpecPath, data interface{}) error

Types

type File

type File interface {
	io.Closer
	io.Reader
	io.ReaderAt
	io.Seeker
	io.Writer
	Stat() (os.FileInfo, error)
}

File interface describes File structure.

type FileSystem

type FileSystem interface {
	Open(name string) (File, error)
	Stat(name string) (os.FileInfo, error)
}

FileSystem interface describes FS methods used inside KubeSerial implementation.

type InMemoryFS

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

InMemoryFS implements fileSystem using afero.

func NewInMemoryFS

func NewInMemoryFS() *InMemoryFS

NewInMemoryFS returns new instance of InMemoryFS.

func (*InMemoryFS) AddFileFromHostPath

func (f *InMemoryFS) AddFileFromHostPath(path string) error

AddFileFromHostPath takes file path of file inside test-assets and places it inside /config dir in mem fs.

func (*InMemoryFS) Create

func (f *InMemoryFS) Create(name string) (File, error)

Create takes file name, creates File under this name and returns it for usage.

func (*InMemoryFS) Open

func (f *InMemoryFS) Open(name string) (File, error)

Open takes file name and returns File from filesystem.

func (*InMemoryFS) Stat

func (f *InMemoryFS) Stat(name string) (os.FileInfo, error)

Stat takes file name and returns os.FileInfo of File.

type OsFS

type OsFS struct{}

OsFS implements fileSystem using the local disk.

func NewOSFS

func NewOSFS() *OsFS

NewOSFS returns new instance of OsFS.

func (*OsFS) Open

func (f *OsFS) Open(name string) (File, error)

Open takes file name and returns File from filesystem.

func (*OsFS) Stat

func (f *OsFS) Stat(name string) (os.FileInfo, error)

Stat takes file name and returns os.FileInfo of File.

Jump to

Keyboard shortcuts

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