package finder
import "github.com/vmware/govmomi/vapi/library/finder"
Index ¶
- type FindResult
- type Finder
- func NewFinder(m *library.Manager) *Finder
- func (f *Finder) Find( ctx context.Context, ipath ...string) ([]FindResult, error)
- type PathFinder
- func NewPathFinder(m *library.Manager, c *vim25.Client) *PathFinder
- func (f *PathFinder) Path(ctx context.Context, r FindResult) (string, error)
- func (f *PathFinder) ResolveLibraryItemStorage( ctx context.Context, datacenter *object.Datacenter, datastoreMap map[string]mo.Datastore, storage []library.Storage) error
Types ¶
type FindResult ¶
type FindResult interface { // GetParent returns the parent of the find result. If the find result // is a Library then this function will return nil. GetParent() FindResult // GetPath returns the inventory path of the find result. GetPath() string // GetID returns the ID of the find result. GetID() string // GetName returns the name of the find result. GetName() string // GetResult gets the underlying library object. GetResult() interface{} }
FindResult is the type of object returned from a Find operation.
type Finder ¶
Finder is a helper object for finding content library objects by their inventory paths: /LIBRARY/ITEM/FILE.
Wildcard characters `*` and `?` are both supported. However, the use of a wildcard character in the search string results in a full listing of that part of the path's server-side items.
Path parts that do not use wildcard characters rely on server-side Find functions to find the path token by its name. Ironically finding one item with a direct path takes longer than if a wildcard is used because of the multiple round-trips. Direct paths will be more performant on systems that have numerous items.
func NewFinder ¶
NewFinder returns a new Finder.
func (*Finder) Find ¶
Find finds one or more items that match the provided inventory path(s).
type PathFinder ¶
type PathFinder struct {
// contains filtered or unexported fields
}
PathFinder is used to find the Datastore path of a library.Library, library.Item or library.File.
func NewPathFinder ¶
func NewPathFinder(m *library.Manager, c *vim25.Client) *PathFinder
NewPathFinder creates a new PathFinder instance.
func (*PathFinder) Path ¶
func (f *PathFinder) Path(ctx context.Context, r FindResult) (string, error)
Path returns the absolute datastore path for a Library, Item or File. The cache is used by DatastoreName().
func (*PathFinder) ResolveLibraryItemStorage ¶
func (f *PathFinder) ResolveLibraryItemStorage( ctx context.Context, datacenter *object.Datacenter, datastoreMap map[string]mo.Datastore, storage []library.Storage) error
ResolveLibraryItemStorage transforms the StorageURIs field in the provided storage items from a datastore URL, ex. "ds:///vmfs/volumes/DATASTORE_UUID/contentlib-LIB_UUID/ITEM_UUID/file.vmdk", to the format that includes the datastore name, ex. "[DATASTORE_NAME] contentlib-LIB_UUID/ITEM_UUID/file.vmdk".
If datastoreMap is provided, then it will be updated with the datastores involved in the resolver. The properties name, summary.url, and capability.topLevelDirectoryCreateSupported will be available after the resolver completes.
If a storage item resides on a datastore that does not support the creation of top-level directories, then this means the datastore is vSAN and the storage item path needs to be further converted. If this occurs, then the datacenter to which the datastore belongs is required. If the datacenter parameter is non-nil, it is used, otherwise the datacenter for each datastore is resolved as needed. It is much more efficient to send in the datacenter if it is known ahead of time that the content library is stored on a vSAN datastore.
Source Files ¶
- Version
- v0.48.1 (latest)
- Published
- Feb 11, 2025
- Platform
- linux/amd64
- Imports
- 13 packages
- Last checked
- 2 months ago –
Tools for package owners.