notification

package
v1.33.1 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EventFinalize is triggered when an object is added.
	EventFinalize EventType = "OBJECT_FINALIZE"
	// EventDelete is triggered when an object is deleted.
	EventDelete = "OBJECT_DELETE"
	// EventMetadata is triggered when an object's metadata is changed.
	EventMetadata = "OBJECT_METADATA_UPDATE"
	// EventArchive bucket versioning must be enabled. is triggered when an object becomes the non current version
	EventArchive = "OBJECT_ARCHIVE"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EventManager

type EventManager interface {
	Trigger(o *backend.Object, eventType EventType, extraEventAttr map[string]string)
}

type EventManagerOptions

type EventManagerOptions struct {
	// ProjectID is the project ID containing the pubsub topic.
	ProjectID string
	// TopicName is the pubsub topic name to publish events on.
	TopicName string
	// ObjectPrefix, if not empty, only objects having this prefix will generate
	// trigger events.
	ObjectPrefix string
	// NotifyOn determines what events to trigger.
	NotifyOn EventNotificationOptions
}

EventManagerOptions determines what events are triggered and where.

type EventNotificationOptions

type EventNotificationOptions struct {
	Finalize       bool
	Delete         bool
	MetadataUpdate bool
	Archive        bool
}

EventNotificationOptions contains flags for events, that if true, will create trigger notifications when they occur.

type EventType

type EventType string

EventType is the type of event to trigger. The descriptions of the events can be found here: https://cloud.google.com/storage/docs/pubsub-notifications#events.

type PubsubEventManager

type PubsubEventManager struct {
	// contains filtered or unexported fields
}

PubsubEventManager checks if an event should be published.

func NewPubsubEventManager

func NewPubsubEventManager(options EventManagerOptions, w io.Writer) (*PubsubEventManager, error)

func (*PubsubEventManager) Trigger

func (m *PubsubEventManager) Trigger(o *backend.Object, eventType EventType, extraEventAttr map[string]string)

Trigger checks if an event should be triggered. If so, it publishes the event to a pubsub queue.

Jump to

Keyboard shortcuts

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