Documentation ¶
Index ¶
- Constants
- func RegisterFileType(f FileType)
- type Bundle
- func (b Bundle) Agents() []Host
- func (b Bundle) ForEachDirectory(fileTypeName FileTypeName, do func(d Directory) (stop bool))
- func (b Bundle) ForEachFile(fileTypeName FileTypeName, do func(f File) (stop bool))
- func (b Bundle) Masters() []Host
- func (b Bundle) PublicAgents() []Host
- func (b Bundle) ReadAnyJSON(typeName FileTypeName, v interface{}) error
- type ContentType
- type DirType
- type Directory
- type File
- type FileType
- type FileTypeName
- type Host
- type IP
Constants ¶
const ( // DTRoot is a bundle root directory DTRoot DirType = "root" // DTMaster directory DTMaster = "master" // DTAgent directory DTAgent = "agent" // DTPublicAgent directory DTPublicAgent = "public agent" )
const ( // CTJson represents CTJson files. CTJson ContentType = "JSON" // CTJournal represents CTJournal files. CTJournal = "journal" // CTDmesg represents dmesg files. CTDmesg = "dmesg" // CTOutput is a output of a command. CTOutput = "output" //CTOther file types CTOther = "other" )
Variables ¶
This section is empty.
Functions ¶
func RegisterFileType ¶
func RegisterFileType(f FileType)
RegisterFileType adds the file type to the file type registry. It panics if the file type with the same name is already registered.
Types ¶
type Bundle ¶
Bundle describes DC/OS diagnostics bundle.
func (Bundle) ForEachDirectory ¶ added in v2.6.0
func (b Bundle) ForEachDirectory(fileTypeName FileTypeName, do func(d Directory) (stop bool))
ForEachDirectory finds all the bundle directories which contain a given type and pass them one by one to the do function. It stops if the do function returns true.
func (Bundle) ForEachFile ¶ added in v2.6.0
func (b Bundle) ForEachFile(fileTypeName FileTypeName, do func(f File) (stop bool))
ForEachFile finds all the files of a given type and pass them one by one to the do function. It stops if the do function returns true.
func (Bundle) PublicAgents ¶
func (Bundle) ReadAnyJSON ¶ added in v2.9.0
func (b Bundle) ReadAnyJSON(typeName FileTypeName, v interface{}) error
ReadAnyJSON reads JSON files of a given file in each directory. The function returns nil after the first successful read or the last read error if it couldn't ready any files.
type ContentType ¶
type ContentType string
ContentType defines type of the content in the bundle file.
type Directory ¶ added in v2.6.0
func (Directory) OpenFile ¶ added in v2.6.0
func (d Directory) OpenFile(typeName FileTypeName) (File, error)
OpenFile opens the files of the typeName file type. If the file is not found, it tries to open it from a correspondent .gzip archive. If the .gzip archive is not found as well then returns an error. Caller is responsible for closing the file.
func (Directory) ReadJSON ¶ added in v2.6.0
func (d Directory) ReadJSON(typeName FileTypeName, v interface{}) error
ReadJSON reads JSON-encoded data from the bundle file and stores the result in the value pointed to by v.
type File ¶
type File interface { io.ReadCloser Name() string }
File is a safe way to access bundle files.
type FileType ¶
type FileType struct { Name FileTypeName `yaml:"name"` ContentType ContentType `yaml:"contentType"` Paths []string `yaml:"paths"` Description string `yaml:"description"` // DirTypes defines on which host types this file can be found. // For example, dcos-marathon.service file can be found only on the masters. DirTypes []DirType `yaml:"dirTypes"` }
FileType Describes a kind of files in the bundle (e.g. dcos-marathon.service).
func GetFileType ¶
func GetFileType(typeName FileTypeName) FileType
GetFileType returns a file type by its name. It panics if the file type is not in the registry.
type FileTypeName ¶ added in v2.2.0
type FileTypeName string