events

package
v0.0.0-...-56e929e Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2019 License: MIT Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewVCenterClient

func NewVCenterClient(ctx context.Context, user string, pass string, vcenterURL string, insecure bool) (*govmomi.Client, error)

NewVCenterClient returns a govmomi.Client to connect to vCenter

func Stream

func Stream(ctx context.Context, c *vim25.Client, controller ofsdk.Controller) error

Stream is the main logic, blocking to receive and handle events from vCenter

Types

type EventReceiver

type EventReceiver struct{}

EventReceiver implements ResponseSubscriber to validate function invocation and return status

func NewEventReceiver

func NewEventReceiver() *EventReceiver

NewEventReceiver returns an EventReceiver which implements the ResponseSubscriber interface to print status information for each function invokation

func (*EventReceiver) Response

func (e *EventReceiver) Response(res ofsdk.InvokerResponse)

Response prints status information for each function invokation

type OutboundEvent

type OutboundEvent struct {
	Topic    string `json:"topic,omitempty"`
	Category string `json:"category,omitempty"`
	Source   string `json:"source"`

	UserName               string                         `json:"userName,omitempty"`
	CreatedTime            time.Time                      `json:"createdTime,omitempty"`
	ObjectName             string                         `json:"objectName,omitempty"`
	ManagedObjectReference *vtypes.ManagedObjectReference `json:"managedObjectReference,omitempty"`
}

OutboundEvent is the JSON object sent to subscribed functions If the ManagedObjectReference for an event cannot be retrieved, it will be nil and thus not marshaled into the JSON OutboundEvent It's the receivers responsibility to check whether managedObjectReference key is present in the JSON message payload ObjectName is the name of the object as it appears in vCenter - uniqueness is only guaranteed at the folder level, if applicable, where this object resides

Jump to

Keyboard shortcuts

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