asset

package
v0.0.0-...-ff7c0be Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ClusterCreationError is the error when terraform fails, implying infrastructure failures
	ClusterCreationError = "failed to create cluster"
	// InstallConfigError wraps all configuration errors in one single error
	InstallConfigError = "failed to create install config"
)

Variables

This section is empty.

Functions

func DeleteAssetFromDisk

func DeleteAssetFromDisk(asset WritableAsset, directory string) error

DeleteAssetFromDisk removes all the files for asset from disk. this is function is not safe for calling concurrently on the same directory.

func PersistToFile

func PersistToFile(asset WritableAsset, directory string) error

PersistToFile writes all of the files of the specified asset into the specified directory.

func SortFiles

func SortFiles(files []*File)

SortFiles sorts the specified files by file name.

Types

type Asset

type Asset interface {
	// Dependencies returns the assets upon which this asset directly depends.
	Dependencies() []Asset

	// Generate generates this asset given the states of its parent assets.
	Generate(Parents) error

	// Name returns the human-friendly name of the asset.
	Name() string
}

Asset used to install OpenShift.

type File

type File struct {
	// Filename is the name of the file.
	Filename string
	// Data is the contents of the file.
	Data []byte
}

File is a file for an Asset.

type FileFetcher

type FileFetcher interface {
	// FetchByName returns the file with the given name.
	FetchByName(string) (*File, error)
	// FetchByPattern returns the files whose name match the given glob.
	FetchByPattern(pattern string) ([]*File, error)
}

FileFetcher fetches the asset files from disk.

type FileWriter

type FileWriter interface {
	PersistToFile(directory string) error
}

FileWriter interface is used to write all the files in the specified location

func NewDefaultFileWriter

func NewDefaultFileWriter(a WritableAsset) FileWriter

NewDefaultFileWriter create a new adapter to expose the default implementation as a FileWriter

type Parents

type Parents map[reflect.Type]Asset

Parents is the collection of assets upon which another asset is directly dependent.

func (Parents) Add

func (p Parents) Add(assets ...Asset)

Add adds the specified assets to the parents collection.

func (Parents) Get

func (p Parents) Get(assets ...Asset)

Get populates the state of the specified assets with the state stored in the parents collection.

type Store

type Store interface {
	// Fetch retrieves the state of the given asset, generating it and its
	// dependencies if necessary. When purging consumed assets, none of the
	// assets in assetsToPreserve will be purged.
	Fetch(assetToFetch Asset, assetsToPreserve ...WritableAsset) error

	// Destroy removes the asset from all its internal state and also from
	// disk if possible.
	Destroy(Asset) error

	// DestroyState removes everything from the internal state and the internal
	// state file
	DestroyState() error

	// Load retrieves the state of the given asset but does not generate it if it
	// does not exist and instead will return nil if not found.
	Load(Asset) (Asset, error)
}

Store is a store for the states of assets.

type WritableAsset

type WritableAsset interface {
	Asset

	// Files returns the files to write.
	Files() []*File

	// Load returns the on-disk asset if it exists.
	// The asset object should be changed only when it's loaded successfully.
	Load(FileFetcher) (found bool, err error)
}

WritableAsset is an Asset that has files that can be written to disk. It can also be loaded from disk.

Directories

Path Synopsis
aws
Package aws extracts AWS metadata from install configurations.
Package aws extracts AWS metadata from install configurations.
Package installconfig generates the install config assets based on its dependencies.
Package installconfig generates the install config assets based on its dependencies.
aws

Jump to

Keyboard shortcuts

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