util

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2018 License: Apache-2.0 Imports: 23 Imported by: 17

Documentation

Index

Constants

View Source
const LatestTag string = ":latest"

Variables

This section is empty.

Functions

func CheckSameFile

func CheckSameFile(f1name, f2name string) (bool, error)

func CheckTar

func CheckTar(image string) bool

func CleanupImage

func CleanupImage(image Image)

func GetFileContents added in v0.5.1

func GetFileContents(path string) (*string, error)

GetFileContents returns the contents of a file at the specified path

func GetFileSystemFromReference added in v0.7.0

func GetFileSystemFromReference(ref types.ImageReference, imgSrc types.ImageSource, path string, whitelist []string) error

func GetImageLayers

func GetImageLayers(pathToImage string) []string

func GetSize

func GetSize(path string) int64

func HasFilepathPrefix added in v0.7.0

func HasFilepathPrefix(path, prefix string) bool

HasFilepathPrefix checks if the given file path begins with prefix

func HasTag added in v0.8.0

func HasTag(image string) bool

checks to see if an image string contains a tag.

func IsTar

func IsTar(path string) bool

func NewClient

func NewClient() (*client.Client, error)

func UnTar

func UnTar(r io.Reader, target string, whitelist []string) error

UnTar takes in a path to a tar file and writes the untarred version to the provided target. Only untars one level, does not untar nested tars.

Types

type CloudPrepper

type CloudPrepper struct {
	Source      string
	Client      *client.Client
	ImageSource types.ImageSource
}

CloudPrepper prepares images sourced from a Cloud registry

func (*CloudPrepper) GetConfig

func (p *CloudPrepper) GetConfig() (ConfigSchema, error)

func (*CloudPrepper) GetFileSystem

func (p *CloudPrepper) GetFileSystem() (string, error)

func (*CloudPrepper) GetImage

func (p *CloudPrepper) GetImage() (Image, error)

func (*CloudPrepper) GetSource

func (p *CloudPrepper) GetSource() string

func (*CloudPrepper) Name

func (p *CloudPrepper) Name() string

func (*CloudPrepper) SetSource added in v0.8.0

func (p *CloudPrepper) SetSource(source string)

type ConfigObject

type ConfigObject struct {
	Env          []string            `json:"Env"`
	Entrypoint   []string            `json:"Entrypoint"`
	ExposedPorts map[string]struct{} `json:"ExposedPorts"`
	Cmd          []string            `json:"Cmd"`
	Volumes      map[string]struct{} `json:"Volumes"`
	Workdir      string              `json:"WorkingDir"`
	Labels       map[string]string   `json:"Labels"`
}

type ConfigSchema

type ConfigSchema struct {
	Config  ConfigObject       `json:"config"`
	History []ImageHistoryItem `json:"history"`
}

type DaemonPrepper

type DaemonPrepper struct {
	Source string
	Client *client.Client
}

func (*DaemonPrepper) GetConfig

func (p *DaemonPrepper) GetConfig() (ConfigSchema, error)

func (*DaemonPrepper) GetFileSystem

func (p *DaemonPrepper) GetFileSystem() (string, error)

func (*DaemonPrepper) GetHistory

func (p *DaemonPrepper) GetHistory() []ImageHistoryItem

func (*DaemonPrepper) GetImage

func (p *DaemonPrepper) GetImage() (Image, error)

func (*DaemonPrepper) GetSource

func (p *DaemonPrepper) GetSource() string

func (*DaemonPrepper) Name

func (p *DaemonPrepper) Name() string

func (*DaemonPrepper) SetSource added in v0.8.0

func (p *DaemonPrepper) SetSource(source string)

type Directory

type Directory struct {
	Root    string
	Content []string
}

Directory stores a representation of a file directory.

func GetDirectory

func GetDirectory(path string, deep bool) (Directory, error)

GetDirectoryContents converts the directory starting at the provided path into a Directory struct.

type DirectoryEntry

type DirectoryEntry struct {
	Name string
	Size int64
}

func CreateDirectoryEntries

func CreateDirectoryEntries(root string, entryNames []string) (entries []DirectoryEntry)

func GetDirectoryEntries

func GetDirectoryEntries(d Directory) []DirectoryEntry

type Event

type Event struct {
	Status         string `json:"status"`
	Error          string `json:"error"`
	Progress       string `json:"progress"`
	ProgressDetail struct {
		Current int `json:"current"`
		Total   int `json:"total"`
	} `json:"progressDetail"`
}

type Image

type Image struct {
	Source string
	FSPath string
	Config ConfigSchema
	Type   ImageType
}

func (*Image) GetName added in v0.7.0

func (i *Image) GetName() string

func (*Image) GetRemoteDigest added in v0.7.0

func (i *Image) GetRemoteDigest() (string, error)

func (*Image) IsCloud added in v0.7.0

func (i *Image) IsCloud() bool

func (*Image) IsDaemon added in v0.7.0

func (i *Image) IsDaemon() bool

func (*Image) IsTar added in v0.7.0

func (i *Image) IsTar() bool

type ImageHistoryItem

type ImageHistoryItem struct {
	CreatedBy string `json:"created_by"`
}

type ImageType added in v0.7.0

type ImageType int
const (
	ImageTypeTar ImageType = iota
	ImageTypeDaemon
	ImageTypeCloud
)

type Prepper

type Prepper interface {
	Name() string
	GetConfig() (ConfigSchema, error)
	GetFileSystem() (string, error)
	GetImage() (Image, error)
	GetSource() string
	SetSource(string)
}

type TarPrepper

type TarPrepper struct {
	Source string
	Client *client.Client
}

func (*TarPrepper) GetConfig

func (p *TarPrepper) GetConfig() (ConfigSchema, error)

func (*TarPrepper) GetFileSystem

func (p *TarPrepper) GetFileSystem() (string, error)

func (*TarPrepper) GetImage

func (p *TarPrepper) GetImage() (Image, error)

func (*TarPrepper) GetSource

func (p *TarPrepper) GetSource() string

func (*TarPrepper) Name

func (p *TarPrepper) Name() string

func (*TarPrepper) SetSource added in v0.8.0

func (p *TarPrepper) SetSource(source string)

Jump to

Keyboard shortcuts

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