Documentation ¶
Index ¶
- func Sort(events []types.BaseEvent)
- type HistoryCollector
- type Manager
- func (m Manager) Client() *vim25.Client
- func (m Manager) CreateCollectorForEvents(ctx context.Context, filter types.EventFilterSpec) (*HistoryCollector, error)
- func (m Manager) EventCategory(ctx context.Context, event types.BaseEvent) (string, error)
- func (m Manager) Events(ctx context.Context, objects []types.ManagedObjectReference, pageSize int32, ...) error
- func (m Manager) LogUserEvent(ctx context.Context, entity types.ManagedObjectReference, msg string) error
- func (m Manager) PostEvent(ctx context.Context, eventToPost types.BaseEvent, taskInfo ...types.TaskInfo) error
- func (m Manager) QueryEvents(ctx context.Context, filter types.EventFilterSpec) ([]types.BaseEvent, error)
- func (m Manager) Reference() types.ManagedObjectReference
- func (m Manager) RetrieveArgumentDescription(ctx context.Context, eventTypeID string) ([]types.EventArgDesc, error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HistoryCollector ¶
func (HistoryCollector) LatestPage ¶
func (HistoryCollector) ReadNextEvents ¶
func (HistoryCollector) ReadPreviousEvents ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (Manager) CreateCollectorForEvents ¶
func (m Manager) CreateCollectorForEvents(ctx context.Context, filter types.EventFilterSpec) (*HistoryCollector, error)
func (Manager) EventCategory ¶
EventCategory returns the category for an event, such as "info" or "error" for example.
func (Manager) Events ¶
func (m Manager) Events(ctx context.Context, objects []types.ManagedObjectReference, pageSize int32, tail bool, force bool, f func(types.ManagedObjectReference, []types.BaseEvent) error, kind ...string) error
Events gets the events from the specified object(s) and optionanlly tail the event stream
Example ¶
package main import ( "context" "fmt" "github.com/vmware/govmomi/event" "github.com/vmware/govmomi/find" "github.com/vmware/govmomi/simulator" "github.com/vmware/govmomi/vim25" "github.com/vmware/govmomi/vim25/mo" "github.com/vmware/govmomi/vim25/types" ) // ensure event.Manager implements the mo.Reference interface var _ mo.Reference = new(event.Manager) func main() { simulator.Run(func(ctx context.Context, c *vim25.Client) error { m := event.NewManager(c) vm, err := find.NewFinder(c).VirtualMachine(ctx, "DC0_H0_VM0") if err != nil { return err } objs := []types.ManagedObjectReference{vm.Reference()} return m.Events(ctx, objs, 10, false, false, func(ref types.ManagedObjectReference, events []types.BaseEvent) error { event.Sort(events) for _, event := range events { fmt.Printf("%T\n", event) } return nil }) }) }
Output: *types.VmBeingCreatedEvent *types.VmInstanceUuidAssignedEvent *types.VmUuidAssignedEvent *types.VmCreatedEvent *types.VmStartingEvent *types.VmPoweredOnEvent
func (Manager) LogUserEvent ¶
func (Manager) QueryEvents ¶
func (Manager) Reference ¶
func (m Manager) Reference() types.ManagedObjectReference
Reference returns the event.Manager MOID
func (Manager) RetrieveArgumentDescription ¶
Click to show internal directories.
Click to hide internal directories.