Documentation ¶
Index ¶
- Constants
- func IsEventError(err error) bool
- func NewPattern(prefix, suffix string) (pattern string)
- func ValidateFilterRuleValue(value string) error
- type ARN
- type Bucket
- type Config
- type ErrARNNotFound
- type ErrDuplicateEventName
- type ErrDuplicateQueueConfiguration
- type ErrFilterNamePrefix
- type ErrFilterNameSuffix
- type ErrInvalidARN
- type ErrInvalidEventName
- type ErrInvalidFilterName
- type ErrInvalidFilterValue
- type ErrUnknownRegion
- type ErrUnsupportedConfiguration
- type Event
- type FilterRule
- type FilterRuleList
- type Identity
- type Log
- type Metadata
- type Name
- func (name Name) Expand() []Name
- func (name Name) MarshalJSON() ([]byte, error)
- func (name Name) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (name Name) Mask() uint64
- func (name Name) String() string
- func (name *Name) UnmarshalJSON(data []byte) error
- func (name *Name) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- type Object
- type Queue
- type Rules
- type RulesMap
- type S3Key
- type Source
- type Target
- type TargetID
- type TargetIDResult
- type TargetIDSet
- type TargetList
- func (list *TargetList) Add(targets ...Target) error
- func (list *TargetList) Exists(id TargetID) bool
- func (list *TargetList) List() []TargetID
- func (list *TargetList) Remove(targetIDSet TargetIDSet)
- func (list *TargetList) Send(event Event, targetIDset TargetIDSet, resCh chan<- TargetIDResult)
- func (list *TargetList) TargetMap() map[TargetID]Target
- func (list *TargetList) Targets() []Target
Constants ¶
const ( // NamespaceFormat - namespace log format used in some event targets. NamespaceFormat = "namespace" // AccessFormat - access log format used in some event targets. AccessFormat = "access" // AMZTimeFormat - event time format. AMZTimeFormat = "2006-01-02T15:04:05.000Z" )
Variables ¶
This section is empty.
Functions ¶
func IsEventError ¶
IsEventError - checks whether given error is event error or not.
func NewPattern ¶
NewPattern - create new pattern for prefix/suffix.
func ValidateFilterRuleValue ¶
ValidateFilterRuleValue - checks if given value is filter rule value or not.
Types ¶
type ARN ¶
type ARN struct { TargetID // contains filtered or unexported fields }
ARN - SQS resource name representation.
func (ARN) MarshalXML ¶
MarshalXML - encodes to XML data.
func (*ARN) UnmarshalXML ¶
UnmarshalXML - decodes XML data.
type Bucket ¶
type Bucket struct { Name string `json:"name"` OwnerIdentity Identity `json:"ownerIdentity"` ARN string `json:"arn"` }
Bucket represents bucket metadata of the event.
type Config ¶
type Config struct { XMLNS string `xml:"xmlns,attr,omitempty"` XMLName xml.Name `xml:"NotificationConfiguration"` QueueList []Queue `xml:"QueueConfiguration,omitempty"` LambdaList []lambda `xml:"CloudFunctionConfiguration,omitempty"` TopicList []topic `xml:"TopicConfiguration,omitempty"` }
Config - notification configuration described in http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html
func ParseConfig ¶
ParseConfig - parses data in reader to notification configuration.
func (*Config) ToRulesMap ¶
ToRulesMap - converts all queue configuration to RulesMap.
func (*Config) UnmarshalXML ¶
UnmarshalXML - decodes XML data.
type ErrARNNotFound ¶
type ErrARNNotFound struct {
ARN ARN
}
ErrARNNotFound - ARN not found error.
func (ErrARNNotFound) Error ¶
func (err ErrARNNotFound) Error() string
type ErrDuplicateEventName ¶
type ErrDuplicateEventName struct {
EventName Name
}
ErrDuplicateEventName - duplicate event name error.
func (ErrDuplicateEventName) Error ¶
func (err ErrDuplicateEventName) Error() string
type ErrDuplicateQueueConfiguration ¶
type ErrDuplicateQueueConfiguration struct {
Queue Queue
}
ErrDuplicateQueueConfiguration - duplicate queue configuration error.
func (ErrDuplicateQueueConfiguration) Error ¶
func (err ErrDuplicateQueueConfiguration) Error() string
type ErrFilterNamePrefix ¶
type ErrFilterNamePrefix struct{}
ErrFilterNamePrefix - more than one prefix usage error.
func (ErrFilterNamePrefix) Error ¶
func (err ErrFilterNamePrefix) Error() string
type ErrFilterNameSuffix ¶
type ErrFilterNameSuffix struct{}
ErrFilterNameSuffix - more than one suffix usage error.
func (ErrFilterNameSuffix) Error ¶
func (err ErrFilterNameSuffix) Error() string
type ErrInvalidARN ¶
type ErrInvalidARN struct {
ARN string
}
ErrInvalidARN - invalid ARN error.
func (ErrInvalidARN) Error ¶
func (err ErrInvalidARN) Error() string
type ErrInvalidEventName ¶
type ErrInvalidEventName struct {
Name string
}
ErrInvalidEventName - invalid event name error.
func (ErrInvalidEventName) Error ¶
func (err ErrInvalidEventName) Error() string
type ErrInvalidFilterName ¶
type ErrInvalidFilterName struct {
FilterName string
}
ErrInvalidFilterName - invalid filter name error.
func (ErrInvalidFilterName) Error ¶
func (err ErrInvalidFilterName) Error() string
type ErrInvalidFilterValue ¶
type ErrInvalidFilterValue struct {
FilterValue string
}
ErrInvalidFilterValue - invalid filter value error.
func (ErrInvalidFilterValue) Error ¶
func (err ErrInvalidFilterValue) Error() string
type ErrUnknownRegion ¶
type ErrUnknownRegion struct {
Region string
}
ErrUnknownRegion - unknown region error.
func (ErrUnknownRegion) Error ¶
func (err ErrUnknownRegion) Error() string
type ErrUnsupportedConfiguration ¶
type ErrUnsupportedConfiguration struct{}
ErrUnsupportedConfiguration - unsupported configuration error.
func (ErrUnsupportedConfiguration) Error ¶
func (err ErrUnsupportedConfiguration) Error() string
type Event ¶
type Event struct { EventVersion string `json:"eventVersion"` EventSource string `json:"eventSource"` AwsRegion string `json:"awsRegion"` EventTime string `json:"eventTime"` EventName Name `json:"eventName"` UserIdentity Identity `json:"userIdentity"` RequestParameters map[string]string `json:"requestParameters"` ResponseElements map[string]string `json:"responseElements"` S3 Metadata `json:"s3"` Source Source `json:"source"` Type madmin.TraceType `json:"-"` }
Event represents event notification information defined in http://docs.aws.amazon.com/AmazonS3/latest/dev/notification-content-structure.html.
type FilterRule ¶
FilterRule - represents elements inside <FilterRule>...</FilterRule>
func (FilterRule) MarshalXML ¶
func (filter FilterRule) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements a custom marshaller to support `omitempty` feature.
func (*FilterRule) UnmarshalXML ¶
func (filter *FilterRule) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML - decodes XML data.
type FilterRuleList ¶
type FilterRuleList struct {
Rules []FilterRule `xml:"FilterRule,omitempty"`
}
FilterRuleList - represents multiple <FilterRule>...</FilterRule>
func (FilterRuleList) Pattern ¶
func (ruleList FilterRuleList) Pattern() string
Pattern - returns pattern using prefix and suffix values.
func (*FilterRuleList) UnmarshalXML ¶
func (ruleList *FilterRuleList) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML - decodes XML data.
type Identity ¶
type Identity struct {
PrincipalID string `json:"principalId"`
}
Identity represents access key who caused the event.
type Metadata ¶
type Metadata struct { SchemaVersion string `json:"s3SchemaVersion"` ConfigurationID string `json:"configurationId"` Bucket Bucket `json:"bucket"` Object Object `json:"object"` }
Metadata represents event metadata.
type Name ¶
type Name int
Name - event type enum. Refer http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html#notification-how-to-event-types-and-destinations for most basic values we have since extend this and its not really much applicable other than a reference point. "s3:Replication:OperationCompletedReplication" is a MinIO extension.
const ( ObjectAccessedGet Name = 1 + iota ObjectAccessedGetRetention ObjectAccessedGetLegalHold ObjectAccessedHead ObjectCreatedCompleteMultipartUpload ObjectCreatedCopy ObjectCreatedPost ObjectCreatedPut ObjectCreatedPutRetention ObjectCreatedPutLegalHold ObjectCreatedPutTagging ObjectCreatedDeleteTagging ObjectRemovedDelete ObjectRemovedDeleteMarkerCreated BucketCreated BucketRemoved ObjectReplicationFailed ObjectReplicationComplete ObjectReplicationMissedThreshold ObjectReplicationReplicatedAfterThreshold ObjectReplicationNotTracked ObjectRestorePostInitiated ObjectRestorePostCompleted ObjectTransitionFailed ObjectTransitionComplete ObjectAccessedAll ObjectCreatedAll ObjectRemovedAll ObjectReplicationAll ObjectRestorePostAll ObjectTransitionAll )
Values of event Name
func (Name) MarshalJSON ¶
MarshalJSON - encodes to JSON data.
func (Name) MarshalXML ¶
MarshalXML - encodes to XML data.
func (*Name) UnmarshalJSON ¶
UnmarshalJSON - decodes JSON data.
func (*Name) UnmarshalXML ¶
UnmarshalXML - decodes XML data.
type Object ¶
type Object struct { Key string `json:"key"` Size int64 `json:"size,omitempty"` ETag string `json:"eTag,omitempty"` ContentType string `json:"contentType,omitempty"` UserMetadata map[string]string `json:"userMetadata,omitempty"` VersionID string `json:"versionId,omitempty"` Sequencer string `json:"sequencer"` }
Object represents object metadata of the event.
type Queue ¶
type Queue struct { ARN ARN `xml:"Queue"` // contains filtered or unexported fields }
Queue - represents elements inside <QueueConfiguration>
func (Queue) ToRulesMap ¶
ToRulesMap - converts Queue to RulesMap
func (*Queue) UnmarshalXML ¶
UnmarshalXML - decodes XML data.
type Rules ¶
type Rules map[string]TargetIDSet
Rules - event rules
func (Rules) Difference ¶
Difference - returns diffrence with given rules as new rules.
func (Rules) Match ¶
func (rules Rules) Match(objectName string) TargetIDSet
Match - returns TargetIDSet matching object name in rules.
func (Rules) MatchSimple ¶
MatchSimple - returns true one of the matching object name in rules.
type RulesMap ¶
RulesMap - map of rules for every event name.
func NewRulesMap ¶
NewRulesMap - creates new rules map with given values.
func (RulesMap) Match ¶
func (rulesMap RulesMap) Match(eventName Name, objectName string) TargetIDSet
Match - returns TargetIDSet matching object name and event name in rules map.
func (RulesMap) MatchSimple ¶
MatchSimple - returns true if matching object name and event name in rules map.
type S3Key ¶
type S3Key struct {
RuleList FilterRuleList `xml:"S3Key,omitempty" json:"S3Key,omitempty"`
}
S3Key - represents elements inside <S3Key>...</S3Key>
func (S3Key) MarshalXML ¶
MarshalXML implements a custom marshaller to support `omitempty` feature.
type Source ¶
type Source struct { Host string `json:"host"` Port string `json:"port"` UserAgent string `json:"userAgent"` }
Source represents client information who triggered the event.
type Target ¶
type Target interface { ID() TargetID IsActive() (bool, error) Save(Event) error Send(string) error Close() error }
Target - event target interface
type TargetID ¶
TargetID - holds identification and name strings of notification target.
func (TargetID) MarshalJSON ¶
MarshalJSON - encodes to JSON data.
func (*TargetID) UnmarshalJSON ¶
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 ¶
TargetList - holds list of targets indexed by target ID.
func (*TargetList) Add ¶
func (list *TargetList) Add(targets ...Target) error
Add - adds unique target to target list.
func (*TargetList) Exists ¶
func (list *TargetList) Exists(id TargetID) bool
Exists - checks whether target by target ID exists or not.
func (*TargetList) List ¶
func (list *TargetList) List() []TargetID
List - returns available target IDs.
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, targetIDset TargetIDSet, resCh chan<- TargetIDResult)
Send - sends events to targets identified by target IDs.
func (*TargetList) TargetMap ¶
func (list *TargetList) TargetMap() map[TargetID]Target
TargetMap - returns available targets.