util

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2016 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Archive

func Archive(root string, filename string, excludes []string) error

Archive makes a tar.gz file consists of file tree

func Basename

func Basename(filename string) string

Basename computes the basename of a given filename.

func CreateURL

func CreateURL(bucket, group, name string) *url.URL

CreateURL creates a valid URL for uploaing object.

Types

type FileInfo

type FileInfo struct {
	Name        string
	Path        string
	TimeCreated time.Time
	Size        uint64
}

FileInfo defines file information structure.

func NewFileInfo

func NewFileInfo(f *storage.Object) *FileInfo

NewFileInfo creates a file info from an object.

type InstanceBuilder

type InstanceBuilder struct {
	Project     string
	Zone        string
	MachineType string
	// contains filtered or unexported fields
}

InstanceBuilder maintains configurations to create new instances.

func NewInstanceBuilder

func NewInstanceBuilder(project string) (*InstanceBuilder, error)

NewInstanceBuilder creates a new instance builder associated with a given project.

func (*InstanceBuilder) AvailableMachineTypes

func (b *InstanceBuilder) AvailableMachineTypes() ([]MachineType, error)

AvailableMachineTypes returns a slice of machie type names.

func (*InstanceBuilder) AvailableZones

func (b *InstanceBuilder) AvailableZones() ([]Zone, error)

AvailableZones returns a slice of zone names.

func (*InstanceBuilder) CreateInstance

func (b *InstanceBuilder) CreateInstance(name string, metadata []*MetadataItem, disksize int64) (err error)

CreateInstance creates a new instance based on the bilder's configuration.

func (*InstanceBuilder) DeleteInstance

func (b *InstanceBuilder) DeleteInstance(name string) (err error)

DeleteInstance deletes a given named instance.

type MachineType

type MachineType struct {
	Name        string
	Description string
}

MachineType defines a structure of machine type infoemation.

type MetadataItem

type MetadataItem struct {
	Key   string
	Value string
}

MetadataItem has Key and Value properties.

type Storage

type Storage struct {
	BucketName string
	// contains filtered or unexported fields
}

Storage object.

func NewStorage

func NewStorage(project, bucket string) (s *Storage, err error)

NewStorage creates a new Storage object named a given bucket name. If the given bucket does not exsits, it will be created.

func (*Storage) Delete

func (s *Storage) Delete(name string) error

Delete deletes a given file.

func (*Storage) Download

func (s *Storage) Download(filename string, out io.Writer) (err error)

Download downloads a file and write it to a given writer.

func (*Storage) List

func (s *Storage) List(prefix string, resCh chan<- *FileInfo, errCh chan<- error)

List is a goroutine to list up files in a bucket.

func (*Storage) Status

func (s *Storage) Status(filename string) (*FileInfo, error)

Status returns a file status of an object.

func (*Storage) Upload

func (s *Storage) Upload(in io.Reader, location *url.URL) error

Upload a file to a location.

type Zone

type Zone struct {
	Name   string
	Status string
}

Zone defines a structure of zone information.

Jump to

Keyboard shortcuts

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