Documentation ¶
Index ¶
- func GetDatastores(ctx context.Context, s *session.Session, dsURLs map[string]*url.URL) (map[string]*Helper, error)
- func PathFromString(dsp string) (*object.DatastorePath, error)
- func Session(ctx context.Context, t *testing.T) *session.Session
- func TestName(suffix string) string
- func ToURL(ds string) (*url.URL, error)
- func URLtoDatastore(u *url.URL) (string, error)
- type Helper
- func DSsetup(t *testing.T) (context.Context, *Helper, func())
- func NewHelper(ctx context.Context, s *session.Session, ds *object.Datastore, rootdir string) (*Helper, error)
- func NewHelperFromSession(ctx context.Context, s *session.Session) *Helper
- func NewHelperFromURL(ctx context.Context, s *session.Session, u *url.URL) (*Helper, error)
- func (d *Helper) Download(ctx context.Context, pth string) (io.ReadCloser, error)
- func (d *Helper) IsVSAN(ctx context.Context) bool
- func (d *Helper) Ls(ctx context.Context, p string, match ...string) (*types.HostDatastoreBrowserSearchResults, error)
- func (d *Helper) LsDirs(ctx context.Context, p string) (*types.ArrayOfHostDatastoreBrowserSearchResults, error)
- func (d *Helper) Mkdir(ctx context.Context, createParentDirectories bool, dirs ...string) (string, error)
- func (d *Helper) Mv(ctx context.Context, fromPath, toPath string) error
- func (d *Helper) Rm(ctx context.Context, pth string) error
- func (d *Helper) Stat(ctx context.Context, pth string) (types.BaseFileInfo, error)
- func (d *Helper) Summary(ctx context.Context) (*types.DatastoreSummary, error)
- func (d *Helper) Upload(ctx context.Context, r io.Reader, pth string) error
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)
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 NewHelperFromURL ¶
func (*Helper) Ls ¶
func (d *Helper) Ls(ctx context.Context, p string, match ...string) (*types.HostDatastoreBrowserSearchResults, error)
The only URI that works on VC + VSAN. r, err := ds.Ls(ctx, "[vsanDatastore] /0ea65357-0494-d42d-2ede-000c292dc5b5")
func (*Helper) LsDirs ¶
func (d *Helper) LsDirs(ctx context.Context, p 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.