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) 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 TargetIDErr
- type TargetIDSet
- type TargetList
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:05Z" )
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 { 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"` }
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) 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
const ( ObjectAccessedAll Name = 1 + iota ObjectAccessedGet ObjectAccessedHead ObjectCreatedAll ObjectCreatedCompleteMultipartUpload ObjectCreatedCopy ObjectCreatedPost ObjectCreatedPut ObjectRemovedAll ObjectRemovedDelete )
Values of 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.
type RulesMap ¶
RulesMap - map of rules for every event name.
func NewRulesMap ¶
NewRulesMap - creates new rules map with given values.
type S3Key ¶
type S3Key struct {
RuleList FilterRuleList `xml:"S3Key,omitempty" json:"S3Key,omitempty"`
}
S3Key - represents elements inside <S3Key>...</S3Key>
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 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 TargetIDErr ¶
type TargetIDErr 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 }
TargetIDErr returns error associated for a 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) String ¶
func (set TargetIDSet) String() string
String - returns string representation.
func (TargetIDSet) ToSlice ¶
func (set TargetIDSet) ToSlice() []TargetID
ToSlice - returns TargetID slice from TargetIDSet.
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(target 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(targetids ...TargetID) <-chan TargetIDErr
Remove - closes and removes targets by given target IDs.
func (*TargetList) Send ¶
func (list *TargetList) Send(event Event, targetIDs ...TargetID) <-chan TargetIDErr
Send - sends events to targets identified by target IDs.