inspect

package
v1.12.4-rc1 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Inspect added in v1.12.0

func Inspect(out io.Writer, references []string, tmplStr string, getRef GetRefFunc) error

Inspect fetches objects by reference using GetRefFunc and writes the json representation to the output writer.

Types

type GetRefFunc added in v1.12.0

type GetRefFunc func(ref string) (interface{}, []byte, error)

GetRefFunc is a function which used by Inspect to fetch an object from a reference

type IndentedInspector

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

IndentedInspector uses a buffer to stop the indented representation of an element.

func (*IndentedInspector) Flush

func (i *IndentedInspector) Flush() error

Flush write the result of inspecting all elements into the output stream.

func (*IndentedInspector) Inspect

func (i *IndentedInspector) Inspect(typedElement interface{}, rawElement []byte) error

Inspect writes the raw element with an indented json format.

type Inspector

type Inspector interface {
	Inspect(typedElement interface{}, rawElement []byte) error
	Flush() error
}

Inspector defines an interface to implement to process elements

func NewIndentedInspector

func NewIndentedInspector(outputStream io.Writer) Inspector

NewIndentedInspector generates a new IndentedInspector.

func NewTemplateInspector

func NewTemplateInspector(outputStream io.Writer, tmpl *template.Template) Inspector

NewTemplateInspector creates a new inspector with a template.

func NewTemplateInspectorFromString added in v1.12.0

func NewTemplateInspectorFromString(out io.Writer, tmplStr string) (Inspector, error)

NewTemplateInspectorFromString creates a new TemplateInspector from a string which is compiled into a template.

type TemplateInspector

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

TemplateInspector uses a text template to inspect elements.

func (*TemplateInspector) Flush

func (i *TemplateInspector) Flush() error

Flush write the result of inspecting all elements into the output stream.

func (*TemplateInspector) Inspect

func (i *TemplateInspector) Inspect(typedElement interface{}, rawElement []byte) error

Inspect executes the inspect template. It decodes the raw element into a map if the initial execution fails. This allows docker cli to parse inspect structs injected with Swarm fields.

Jump to

Keyboard shortcuts

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