Documentation ¶
Index ¶
- Variables
- func ConvertNameToKey(name string) string
- func CopyFileToTarStream(stream *tar.Writer, path string, header *tar.Header) error
- func DownloadFile(filepath string, url string, progressEvent progressDelegate) error
- func JSONMarshal(input interface{}) ([]byte, error)
- func LoadLicenseFiles(filename string, targz io.Reader, prefixFilters ...string) (map[string][]byte, error)
- func NewMarshalAdapter(m Marshaler) interface{}
- func SanitizeDockerName(name string) string
- func TargzIterate(filename string, targz io.Reader, fn func(*tar.Reader, *tar.Header) error) error
- func TempDir(dir, prefix string) (name string, err error)
- func ValidatePath(path string, shouldBeDir bool, pathDescription string) error
- func WriteToTarStream(stream *tar.Writer, data []byte, header tar.Header) error
- type Marshaler
- type ModelGrapher
- type SyncedWriter
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultLicensePrefixFilters for LoadLicenseFiles, NOTICE and LICENSE DefaultLicensePrefixFilters = []string{"LICENSE", "NOTICE"} )
Functions ¶
func ConvertNameToKey ¶
ConvertNameToKey transforms a parameter name into a key acceptable to kube.
func CopyFileToTarStream ¶
CopyFileToTarStream writes a file to a tar stream
func DownloadFile ¶
DownloadFile will download a url to a local file. It's efficient because it will write as it downloads and not load the whole file into memory.
func JSONMarshal ¶
JSONMarshal marshals an arbitrary map to JSON; this only exists because JSON.Marshal insists on having maps that have string (and not interface{}) keys
func LoadLicenseFiles ¶
func LoadLicenseFiles(filename string, targz io.Reader, prefixFilters ...string) (map[string][]byte, error)
LoadLicenseFiles iterates through a tar.gz file looking for anything that matches prefixFilters. Filename is for error generation only.
func NewMarshalAdapter ¶
func NewMarshalAdapter(m Marshaler) interface{}
NewMarshalAdapter creates a new adapter for JSON/YAML marshalling
func SanitizeDockerName ¶
SanitizeDockerName makes a string conform with the rules for Docker names
func TargzIterate ¶
TargzIterate iterates over the files it finds in a tar.gz file and calls a callback for each file encountered. Filename is only used for error generation.
func TempDir ¶
TempDir overrides the default TempDir, since Docker needs this to be in your user folder.
func ValidatePath ¶
ValidatePath validates that a path (file or dir) exists
Types ¶
type Marshaler ¶
type Marshaler interface {
Marshal() (interface{}, error)
}
The Marshaler interface is implemented by types which require custom marshalling support for dumping as JSON / YAML
type ModelGrapher ¶
type ModelGrapher interface { // GraphNode inserts a new node into the graph GraphNode(nodeName string, attrs map[string]string) error // GraphEdge inserts a new edge into the graph GraphEdge(fromNode, toNode string, attrs map[string]string) error }
ModelGrapher is an interface to emit dependency graphs of the various elements for troubleshooting purposes. It must accept emitting the same node / edge multiple times.
type SyncedWriter ¶
type SyncedWriter struct {
// contains filtered or unexported fields
}
SyncedWriter is a io.Writer with a mutex to guard writing from multiple threads
func NewSyncedWriter ¶
func NewSyncedWriter(writer io.Writer) *SyncedWriter
NewSyncedWriter returns a SyncedWriter which wraps the given io.Writer