Documentation ¶
Index ¶
- func Wait(ctx context.Context, c *Collector, obj types.ManagedObjectReference, ...) error
- func WaitForView(ctx context.Context, c *Collector, view types.ManagedObjectReference, ...) error
- type Collector
- func (p *Collector) Create(ctx context.Context) (*Collector, error)
- func (p *Collector) CreateFilter(ctx context.Context, req types.CreateFilter) error
- func (p *Collector) Destroy(ctx context.Context) error
- func (p Collector) Reference() types.ManagedObjectReference
- func (p *Collector) Retrieve(ctx context.Context, objs []types.ManagedObjectReference, ps []string, ...) error
- func (p *Collector) RetrieveOne(ctx context.Context, obj types.ManagedObjectReference, ps []string, ...) error
- func (p *Collector) RetrieveProperties(ctx context.Context, req types.RetrieveProperties) (*types.RetrievePropertiesResponse, error)
- func (p *Collector) RetrieveWithFilter(ctx context.Context, objs []types.ManagedObjectReference, ps []string, ...) error
- func (p *Collector) WaitForUpdates(ctx context.Context, v string) (*types.UpdateSet, error)
- type Filter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Wait ¶
func Wait(ctx context.Context, c *Collector, obj types.ManagedObjectReference, ps []string, f func([]types.PropertyChange) bool) error
Wait waits for any of the specified properties of the specified managed object to change. It calls the specified function for every update it receives. If this function returns false, it continues waiting for subsequent updates. If this function returns true, it stops waiting and returns.
To only receive updates for the specified managed object, the function creates a new property collector and calls CreateFilter. A new property collector is required because filters can only be added, not removed.
The newly created collector is destroyed before this function returns (both in case of success or error).
func WaitForView ¶ added in v0.5.0
func WaitForView(ctx context.Context, c *Collector, view types.ManagedObjectReference, obj types.ManagedObjectReference, ps []string, f func(types.ManagedObjectReference, []types.PropertyChange) bool) error
WaitForView waits for any of the specified properties of the managed objects in the View to change. It calls the specified function for every update it receives. If this function returns false, it continues waiting for subsequent updates. If this function returns true, it stops waiting and returns.
To only receive updates for the View's specified managed objects, the function creates a new property collector and calls CreateFilter. A new property collector is required because filters can only be added, not removed.
The newly created collector is destroyed before this function returns (both in case of success or error).
The code assumes that all objects in the View are the same type
Types ¶
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector models the PropertyCollector managed object.
For more information, see: http://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.wssdk.apiref.doc/vmodl.query.PropertyCollector.html
func DefaultCollector ¶
DefaultCollector returns the session's default property collector.
func (*Collector) Create ¶
Create creates a new session-specific Collector that can be used to retrieve property updates independent of any other Collector.
func (*Collector) CreateFilter ¶
func (Collector) Reference ¶
func (p Collector) Reference() types.ManagedObjectReference
func (*Collector) Retrieve ¶
func (p *Collector) Retrieve(ctx context.Context, objs []types.ManagedObjectReference, ps []string, dst interface{}) error
Retrieve loads properties for a slice of managed objects. The dst argument must be a pointer to a []interface{}, which is populated with the instances of the specified managed objects, with the relevant properties filled in. If the properties slice is nil, all properties are loaded.
func (*Collector) RetrieveOne ¶
func (p *Collector) RetrieveOne(ctx context.Context, obj types.ManagedObjectReference, ps []string, dst interface{}) error
RetrieveOne calls Retrieve with a single managed object reference.
func (*Collector) RetrieveProperties ¶
func (p *Collector) RetrieveProperties(ctx context.Context, req types.RetrieveProperties) (*types.RetrievePropertiesResponse, error)
func (*Collector) RetrieveWithFilter ¶ added in v0.14.0
func (p *Collector) RetrieveWithFilter(ctx context.Context, objs []types.ManagedObjectReference, ps []string, dst interface{}, filter Filter) error
RetrieveWithFilter populates dst as Retrieve does, but only for entities matching the given filter.
type Filter ¶ added in v0.14.0
Filter provides methods for matching against types.DynamicProperty
func (Filter) MatchObjectContent ¶ added in v0.14.0
func (f Filter) MatchObjectContent(objects []types.ObjectContent) []types.ManagedObjectReference
MatchObjectContent returns a list of ObjectContent.Obj where the ObjectContent.PropSet matches the Filter.
func (Filter) MatchProperty ¶ added in v0.14.0
func (f Filter) MatchProperty(prop types.DynamicProperty) bool
MatchProperty returns true if a Filter entry matches the given prop.
func (Filter) MatchPropertyList ¶ added in v0.14.0
func (f Filter) MatchPropertyList(props []types.DynamicProperty) bool
MatchPropertyList returns true if all given props match the Filter.