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 Hash(name string) string
- 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 PrefixString(str, prefix, separator string) string
- func QuoteList(words []string) []string
- func SanitizeDockerName(name string) string
- func StringInSlice(needle string, haystack []string) bool
- 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 WordList(words []string, conjunction string) string
- 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 PrefixString ¶
PrefixString prefixes the provided 'str' with 'prefix' using 'separator' between them.
func SanitizeDockerName ¶
SanitizeDockerName makes a string conform with the rules for Docker names
func StringInSlice ¶
StringInSlice checks if the given string is in the given string slice, ignoring case differences.
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
func WordList ¶
WordList returns a string of all words in the 'words' slice. For 2 or more words the last word is prefixed by `conjunction`, and if there are at least 3 words, then they are separated by the oxford comma.
WordList([]string{"foo", "bar"}, "and") => "foo and bar" WordList([]string{"foo", "bar", "baz"}, "or") => "foo, bar, or baz"
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