importer

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2018 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyImage

func CopyImage(dest, endpoint, accessKey, secKey string) error

CopyImage copies the source endpoint (vm image) to the provided destination path.

func ParseEndpoint

func ParseEndpoint(endpt string) (*url.URL, error)

ParseEndpoint parses the required endpoint and return the url struct.

func ParseEnvVar

func ParseEnvVar(envVarName string, decode bool) (string, error)

ParseEnvVar provides a wrapper to attempt to fetch the specified env var

func SaveStream

func SaveStream(stream io.ReadCloser, dest string) (int64, error)

SaveStream reads from a stream and saves data to dest

func StreamDataToFile

func StreamDataToFile(dataReader io.Reader, filePath string) error

StreamDataToFile provides a function to stream the specified io.Reader to the specified local file

Types

type DataStream

type DataStream struct {
	Readers []reader

	Size int64
	// contains filtered or unexported fields
}

DataStream implements the ReadCloser interface

func NewDataStream

func NewDataStream(endpt, accKey, secKey string) (*DataStream, error)

NewDataStream returns a DataStream object after validating the endpoint and constructing the reader/closer chain. Note: the caller must close the `Readers` in reverse order. See Close().

func (*DataStream) Close

func (d *DataStream) Close() error

Close all readers.

func (*DataStream) Read

func (d *DataStream) Read(buf []byte) (int, error)

Read from top-most reader. Note: ReadFull is needed since there may be intermediate, smaller multi-readers in the reader stack, and we need to be able to fill buf.

type DataStreamInterface

type DataStreamInterface interface {
	Read(p []byte) (int, error)
	Close() error
	// contains filtered or unexported methods
}

DataStreamInterface provides our interface definition required to fulfill a DataStream

Jump to

Keyboard shortcuts

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