datastore

package
v1.5.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2019 License: Apache-2.0 Imports: 17 Imported by: 89

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDatastores

func GetDatastores(ctx context.Context, s *session.Session, dsURLs map[string]*url.URL) (map[string]*Helper, error)

GetDatastores returns a map of datastores given a map of names and urls

func PathFromString

func PathFromString(dsp string) (*object.DatastorePath, error)

func TestName

func TestName(suffix string) string

TestName builds a unique datastore name

func ToURL

func ToURL(ds string) (*url.URL, error)

Converts `[datastore] /path` to ds:// URL

func URLtoDatastore

func URLtoDatastore(u *url.URL) (string, error)

Converts ds:// URL for datastores to datastore format ([datastore1] /path/to/thing)

Types

type Helper

type Helper struct {

	// The datastore url (including root) in "[dsname] /path" format.
	RootURL object.DatastorePath
	// contains filtered or unexported fields
}

Helper gives access to the datastore regardless of type (esx, esx + vc, or esx + vc + vsan). Also wraps paths to a given root directory

func NewHelper

func NewHelper(ctx context.Context, s *session.Session, ds *object.Datastore, rootdir string) (*Helper, error)

NewDatastore returns a Datastore. ctx is a context, s is an authenticated session ds is the vsphere datastore rootdir is the top level directory to root all data. If root does not exist, it will be created. If it already exists, NOOP. This cannot be empty.

func NewHelperFromSession

func NewHelperFromSession(ctx context.Context, s *session.Session) *Helper

func NewHelperFromURL

func NewHelperFromURL(ctx context.Context, s *session.Session, u *url.URL) (*Helper, error)

func (*Helper) Download

func (d *Helper) Download(ctx context.Context, pth string) (io.ReadCloser, error)

func (*Helper) GetFilesSize added in v1.5.0

func (d *Helper) GetFilesSize(ctx context.Context, p string, noscratch bool, match ...string) (int64, error)

func (*Helper) IsVSAN

func (d *Helper) IsVSAN(ctx context.Context) bool

func (*Helper) Ls

The only URI that works on VC + VSAN. r, err := ds.Ls(ctx, "[vsanDatastore] /0ea65357-0494-d42d-2ede-000c292dc5b5")

func (*Helper) LsDirs

func (*Helper) LsDirsWithPatterns added in v1.5.0

func (d *Helper) LsDirsWithPatterns(ctx context.Context, p string, match []string) (*types.ArrayOfHostDatastoreBrowserSearchResults, error)

LsDirs returns a list of dirents at the given path (relative to root)

func (*Helper) Mkdir

func (d *Helper) Mkdir(ctx context.Context, createParentDirectories bool, dirs ...string) (string, error)

Mkdir creates directories.

func (*Helper) Mv

func (d *Helper) Mv(ctx context.Context, fromPath, toPath string) error

func (*Helper) Rm

func (d *Helper) Rm(ctx context.Context, pth string) error

func (*Helper) Stat

func (d *Helper) Stat(ctx context.Context, pth string) (types.BaseFileInfo, error)

func (*Helper) Summary

func (d *Helper) Summary(ctx context.Context) (*types.DatastoreSummary, error)

func (*Helper) Upload

func (d *Helper) Upload(ctx context.Context, r io.Reader, pth string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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