s3event

package
v0.0.0-...-936ba1f Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigurationId

type ConfigurationId string
const (
	ConfigurationIdKafka   ConfigurationId = "kafka-global"
	ConfigurationIdNats    ConfigurationId = "nats-global"
	ConfigurationIdWebhook ConfigurationId = "webhook-global"
)

This field will be changed after implementing per bucket notifications

type EventConfig

type EventConfig struct {
	KafkaURL             string
	KafkaTopic           string
	KafkaTopicKey        string
	NatsURL              string
	NatsTopic            string
	WebhookURL           string
	FilterConfigFilePath string
}

type EventFields

type EventFields struct {
	Records []EventSchema
}

type EventFilter

type EventFilter map[EventType]bool

func (EventFilter) Filter

func (ef EventFilter) Filter(event EventType) bool

func (EventFilter) Validate

func (ef EventFilter) Validate() error

type EventGlacierData

type EventGlacierData struct {
	RestoreEventData EventRestoreData `json:"restoreEventData"`
}

type EventMeta

type EventMeta struct {
	BucketOwner string
	EventName   EventType
	ObjectSize  int64
	ObjectETag  *string
	VersionId   *string
}

type EventObjectData

type EventObjectData struct {
	Key       string  `json:"key"`
	Size      int64   `json:"size"`
	ETag      *string `json:"eTag"`
	VersionId *string `json:"versionId"`
	Sequencer string  `json:"sequencer"`
}

type EventRequestParams

type EventRequestParams struct {
	SourceIPAddress string `json:"sourceIPAddress"`
}

type EventResponseElements

type EventResponseElements struct {
	RequestId string `json:"x-amz-request-id"`
	HostId    string `json:"x-amz-id-2"`
}

type EventRestoreData

type EventRestoreData struct {
	LifecycleRestorationExpiryTime string `json:"lifecycleRestorationExpiryTime"`
	LifecycleRestoreStorageClass   string `json:"lifecycleRestoreStorageClass"`
}

type EventS3BucketData

type EventS3BucketData struct {
	Name          string            `json:"name"`
	OwnerIdentity EventUserIdentity `json:"ownerIdentity"`
	Arn           string            `json:"arn"`
}

type EventS3Data

type EventS3Data struct {
	S3SchemaVersion string            `json:"s3SchemaVersion"`
	ConfigurationId ConfigurationId   `json:"configurationId"`
	Bucket          EventS3BucketData `json:"bucket"`
	Object          EventObjectData   `json:"object"`
}

type EventSchema

type EventSchema struct {
	EventVersion      string                `json:"eventVersion"`
	EventSource       string                `json:"eventSource"`
	AwsRegion         string                `json:"awsRegion"`
	EventTime         string                `json:"eventTime"`
	EventName         EventType             `json:"eventName"`
	UserIdentity      EventUserIdentity     `json:"userIdentity"`
	RequestParameters EventRequestParams    `json:"requestParameters"`
	ResponseElements  EventResponseElements `json:"responseElements"`
	S3                EventS3Data           `json:"s3"`
	GlacierEventData  EventGlacierData      `json:"glacierEventData"`
}

type EventType

type EventType string
const (
	EventObjectCreated           EventType = "s3:ObjectCreated:*" // ObjectCreated
	EventObjectCreatedPut        EventType = "s3:ObjectCreated:Put"
	EventObjectCreatedPost       EventType = "s3:ObjectCreated:Post"
	EventObjectCreatedCopy       EventType = "s3:ObjectCreated:Copy"
	EventCompleteMultipartUpload EventType = "s3:ObjectCreated:CompleteMultipartUpload"
	EventObjectDeleted           EventType = "s3:ObjectRemoved:Delete" // ObjectRemoved
	EventObjectTagging           EventType = "s3:ObjectTagging:*"      // ObjectTagging
	EventObjectTaggingPut        EventType = "s3:ObjectTagging:Put"
	EventObjectTaggingDelete     EventType = "s3:ObjectTagging:Delete"
	EventObjectAclPut            EventType = "s3:ObjectAcl:Put"
	EventObjectRestore           EventType = "s3:ObjectRestore:*" // ObjectRestore
	EventObjectRestorePost       EventType = "s3:ObjectRestore:Post"
	EventObjectRestoreCompleted  EventType = "s3:ObjectRestore:Completed"
)

func (EventType) IsValid

func (event EventType) IsValid() bool

type EventUserIdentity

type EventUserIdentity struct {
	PrincipalId string `json:"PrincipalId"`
}

type Kafka

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

func (*Kafka) Close

func (ks *Kafka) Close() error

func (*Kafka) SendEvent

func (ks *Kafka) SendEvent(ctx *fiber.Ctx, meta EventMeta)

type NatsEventSender

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

func (*NatsEventSender) Close

func (ns *NatsEventSender) Close() error

func (*NatsEventSender) SendEvent

func (ns *NatsEventSender) SendEvent(ctx *fiber.Ctx, meta EventMeta)

type S3EventSender

type S3EventSender interface {
	SendEvent(ctx *fiber.Ctx, meta EventMeta)
	Close() error
}

func InitEventSender

func InitEventSender(cfg *EventConfig) (S3EventSender, error)

func InitKafkaEventService

func InitKafkaEventService(url, topic, key string, filter EventFilter) (S3EventSender, error)

func InitNatsEventService

func InitNatsEventService(url, topic string, filter EventFilter) (S3EventSender, error)

func InitWebhookEventSender

func InitWebhookEventSender(url string, filter EventFilter) (S3EventSender, error)

type Webhook

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

func (*Webhook) Close

func (w *Webhook) Close() error

func (*Webhook) SendEvent

func (w *Webhook) SendEvent(ctx *fiber.Ctx, meta EventMeta)

Jump to

Keyboard shortcuts

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