event

package
v0.0.0-...-a6a3a47 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ARN

type ARN struct {
	TargetID
	// contains filtered or unexported fields
}

ARN - SQS resource name representation.

func ParseARN

func ParseARN(s string) (*ARN, error)

ParseARN - parses string to ARN.

func (ARN) String

func (arn ARN) String() string

String - returns string representation.

type ErrARNNotFound

type ErrARNNotFound struct {
	ARN ARN
}

ErrARNNotFound - ARN not found error.

func (ErrARNNotFound) Error

func (err ErrARNNotFound) Error() string

type ErrInvalidARN

type ErrInvalidARN struct {
	ARN string
}

ErrInvalidARN - invalid ARN error.

func (ErrInvalidARN) Error

func (err ErrInvalidARN) Error() string

type ErrUnknownRegion

type ErrUnknownRegion struct {
	Region string
}

ErrUnknownRegion - unknown region error.

func (ErrUnknownRegion) Error

func (err ErrUnknownRegion) Error() string

type Event

type Event struct {
	ProtocolVersion  string            `json:"protocolVersion"`
	GetObjectContext *GetObjectContext `json:"getObjectContext"`
	UserIdentity     Identity          `json:"userIdentity"`
	UserRequest      UserRequest       `json:"userRequest"`
}

Event represents lambda function event, this is undocumented in AWS S3. This structure bases itself on this structure but there is no binding.

{
  "xAmzRequestId": "a2871150-1df5-4dc9-ad9f-3da283ca1bf3",
  "getObjectContext": {
    "outputRoute": "...",
    "outputToken": "...",
    "inputS3Url": "<presignedURL>"
  },
  "configuration": { // not useful in MinIO
    "accessPointArn": "...",
    "supportingAccessPointArn": "...",
    "payload": ""
  },
  "userRequest": {
    "url": "...",
    "headers": {
      "Host": "...",
      "X-Amz-Content-SHA256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
    }
  },
  "userIdentity": {
    "type": "IAMUser",
    "principalId": "AIDAJF5MO57RFXQCE5ZNC",
    "arn": "...",
    "accountId": "...",
    "accessKeyId": "AKIA3WNQJCXE2DYPAU7R"
  },
  "protocolVersion": "1.00"
}

type GetObjectContext

type GetObjectContext struct {
	OutputRoute string `json:"outputRoute"`
	OutputToken string `json:"outputToken"`
	InputS3URL  string `json:"inputS3Url"`
}

GetObjectContext provides the necessary details to perform download of the object, and return back the processed response to the server.

type Identity

type Identity struct {
	Type        string `json:"type"`
	PrincipalID string `json:"principalId"`
	AccessKeyID string `json:"accessKeyId"`
}

Identity represents access key who caused the event.

type Target

type Target interface {
	ID() TargetID
	IsActive() (bool, error)
	Send(Event) (*http.Response, error)
	Stat() TargetStat
	Close() error
}

Target - lambda target interface

type TargetID

type TargetID struct {
	ID   string
	Name string
}

TargetID - holds identification and name strings of notification target.

func (TargetID) MarshalJSON

func (tid TargetID) MarshalJSON() ([]byte, error)

MarshalJSON - encodes to JSON data.

func (TargetID) String

func (tid TargetID) String() string

String - returns string representation.

func (TargetID) ToARN

func (tid TargetID) ToARN(region string) ARN

ToARN - converts to ARN.

func (*TargetID) UnmarshalJSON

func (tid *TargetID) UnmarshalJSON(data []byte) error

UnmarshalJSON - decodes JSON data.

type TargetIDResult

type TargetIDResult struct {
	// ID where the remove or send were initiated.
	ID TargetID
	// Stores any error while removing a target or while sending an event.
	Err error
}

TargetIDResult returns result of Remove/Send operation, sets err if any for the associated TargetID

type TargetIDSet

type TargetIDSet map[TargetID]struct{}

TargetIDSet - Set representation of TargetIDs.

func NewTargetIDSet

func NewTargetIDSet(targetIDs ...TargetID) TargetIDSet

NewTargetIDSet - creates new TargetID set with given TargetIDs.

func (TargetIDSet) Clone

func (set TargetIDSet) Clone() TargetIDSet

Clone - returns copy of this set.

func (TargetIDSet) Difference

func (set TargetIDSet) Difference(sset TargetIDSet) TargetIDSet

Difference - returns diffrence with given set as new set.

func (TargetIDSet) IsEmpty

func (set TargetIDSet) IsEmpty() bool

IsEmpty returns true if the set is empty.

func (TargetIDSet) Union

func (set TargetIDSet) Union(sset TargetIDSet) TargetIDSet

Union - returns union with given set as new set.

type TargetList

type TargetList struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

TargetList - holds list of targets indexed by target ID.

func NewTargetList

func NewTargetList() *TargetList

NewTargetList - creates TargetList.

func (*TargetList) Add

func (list *TargetList) Add(targets ...Target) error

Add - adds unique target to target list.

func (*TargetList) Empty

func (list *TargetList) Empty() bool

Empty returns true if targetList is empty.

func (*TargetList) List

func (list *TargetList) List(region string) []ARN

List - returns available target IDs.

func (*TargetList) Lookup

func (list *TargetList) Lookup(arnStr string) (Target, error)

Lookup - checks whether target by target ID exists is valid or not.

func (*TargetList) Remove

func (list *TargetList) Remove(targetIDSet TargetIDSet)

Remove - closes and removes targets by given target IDs.

func (*TargetList) Send

func (list *TargetList) Send(event Event, id TargetID) (*http.Response, error)

Send - sends events to targets identified by target IDs.

func (*TargetList) Stats

func (list *TargetList) Stats() TargetStats

Stats returns stats for targets.

func (*TargetList) TargetMap

func (list *TargetList) TargetMap() map[TargetID]Target

TargetMap - returns available targets.

func (*TargetList) Targets

func (list *TargetList) Targets() []Target

Targets - list all targets

type TargetStat

type TargetStat struct {
	ID             TargetID
	ActiveRequests int64
	TotalRequests  int64
	FailedRequests int64
}

TargetStat is the stats of a single target.

type TargetStats

type TargetStats struct {
	TargetStats map[string]TargetStat
}

TargetStats is a collection of stats for multiple targets.

type UserRequest

type UserRequest struct {
	URL     string      `json:"url"`
	Headers http.Header `json:"headers"`
}

UserRequest user request headers

Jump to

Keyboard shortcuts

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