Documentation ¶
Index ¶
- Constants
- Variables
- func EqualEventTypeList(a, b []EventType) bool
- func EqualFilterRuleList(a, b []FilterRule) bool
- type Arn
- type Config
- type Configuration
- func (b *Configuration) AddLambda(lambdaConfig Config) bool
- func (b *Configuration) AddQueue(queueConfig Config) bool
- func (b *Configuration) AddTopic(topicConfig Config) bool
- func (b *Configuration) RemoveLambdaByArn(arn Arn)
- func (b *Configuration) RemoveLambdaByArnEventsPrefixSuffix(arn Arn, events []EventType, prefix, suffix string) error
- func (b *Configuration) RemoveQueueByArn(arn Arn)
- func (b *Configuration) RemoveQueueByArnEventsPrefixSuffix(arn Arn, events []EventType, prefix, suffix string) error
- func (b *Configuration) RemoveTopicByArn(arn Arn)
- func (b *Configuration) RemoveTopicByArnEventsPrefixSuffix(arn Arn, events []EventType, prefix, suffix string) error
- type Event
- type EventType
- type Filter
- type FilterRule
- type Info
- type LambdaConfig
- type QueueConfig
- type S3Key
- type TopicConfig
Constants ¶
const ( ObjectCreatedAll EventType = "s3:ObjectCreated:*" ObjectCreatedPut = "s3:ObjectCreated:Put" ObjectCreatedPost = "s3:ObjectCreated:Post" ObjectCreatedCopy = "s3:ObjectCreated:Copy" ObjectCreatedCompleteMultipartUpload = "s3:ObjectCreated:CompleteMultipartUpload" ObjectAccessedGet = "s3:ObjectAccessed:Get" ObjectAccessedHead = "s3:ObjectAccessed:Head" ObjectAccessedAll = "s3:ObjectAccessed:*" ObjectRemovedAll = "s3:ObjectRemoved:*" ObjectRemovedDelete = "s3:ObjectRemoved:Delete" ObjectRemovedDeleteMarkerCreated = "s3:ObjectRemoved:DeleteMarkerCreated" ObjectReducedRedundancyLostObject = "s3:ReducedRedundancyLostObject" BucketCreatedAll = "s3:BucketCreated:*" BucketRemovedAll = "s3:BucketRemoved:*" )
The role of all event types are described in :
http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html#notification-how-to-event-types-and-destinations
Variables ¶
var ( // ErrInvalidArnPrefix is returned when ARN string format does not start with 'arn' ErrInvalidArnPrefix = errors.New("invalid ARN format, must start with 'arn:'") // ErrInvalidArnFormat is returned when ARN string format is not valid ErrInvalidArnFormat = errors.New("invalid ARN format, must be 'arn:<partition>:<service>:<region>:<accountID>:<resource>'") )
var ErrNoConfigMatch = errors.New("no notification configuration matched")
ErrNoConfigMatch is returned when a notification configuration (sqs,sns,lambda) is not found when trying to delete
Functions ¶
func EqualEventTypeList ¶
EqualEventTypeList tells whether a and b contain the same events
func EqualFilterRuleList ¶
func EqualFilterRuleList(a, b []FilterRule) bool
EqualFilterRuleList tells whether a and b contain the same filters
Types ¶
type Arn ¶
Arn - holds ARN information that will be sent to the web service, ARN desciption can be found in http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html
func NewArn ¶
NewArn creates new ARN based on the given partition, service, region, account id and resource
func NewArnFromString ¶
NewArnFromString parses string representation of ARN into Arn object. Returns an error if the string format is incorrect.
type Config ¶
type Config struct { ID string `xml:"Id,omitempty"` Arn Arn `xml:"-"` Events []EventType `xml:"Event"` Filter *Filter `xml:"Filter,omitempty"` }
Config - represents one single notification configuration such as topic, queue or lambda configuration.
func (*Config) AddFilterPrefix ¶
AddFilterPrefix sets the prefix configuration to the current notification config
func (*Config) AddFilterSuffix ¶
AddFilterSuffix sets the suffix configuration to the current notification config
type Configuration ¶
type Configuration struct { XMLName xml.Name `xml:"NotificationConfiguration"` LambdaConfigs []LambdaConfig `xml:"CloudFunctionConfiguration"` TopicConfigs []TopicConfig `xml:"TopicConfiguration"` QueueConfigs []QueueConfig `xml:"QueueConfiguration"` }
Configuration - the struct that represents the whole XML to be sent to the web service
func (*Configuration) AddLambda ¶
func (b *Configuration) AddLambda(lambdaConfig Config) bool
AddLambda adds a given lambda config to the general bucket notification config
func (*Configuration) AddQueue ¶
func (b *Configuration) AddQueue(queueConfig Config) bool
AddQueue adds a given queue config to the general bucket notification config
func (*Configuration) AddTopic ¶
func (b *Configuration) AddTopic(topicConfig Config) bool
AddTopic adds a given topic config to the general bucket notification config
func (*Configuration) RemoveLambdaByArn ¶
func (b *Configuration) RemoveLambdaByArn(arn Arn)
RemoveLambdaByArn removes all lambda configurations that match the exact specified ARN
func (*Configuration) RemoveLambdaByArnEventsPrefixSuffix ¶
func (b *Configuration) RemoveLambdaByArnEventsPrefixSuffix(arn Arn, events []EventType, prefix, suffix string) error
RemoveLambdaByArnEventsPrefixSuffix removes a topic configuration that match the exact specified ARN, events, prefix and suffix
func (*Configuration) RemoveQueueByArn ¶
func (b *Configuration) RemoveQueueByArn(arn Arn)
RemoveQueueByArn removes all queue configurations that match the exact specified ARN
func (*Configuration) RemoveQueueByArnEventsPrefixSuffix ¶
func (b *Configuration) RemoveQueueByArnEventsPrefixSuffix(arn Arn, events []EventType, prefix, suffix string) error
RemoveQueueByArnEventsPrefixSuffix removes a queue configuration that match the exact specified ARN, events, prefix and suffix
func (*Configuration) RemoveTopicByArn ¶
func (b *Configuration) RemoveTopicByArn(arn Arn)
RemoveTopicByArn removes all topic configurations that match the exact specified ARN
func (*Configuration) RemoveTopicByArnEventsPrefixSuffix ¶
func (b *Configuration) RemoveTopicByArnEventsPrefixSuffix(arn Arn, events []EventType, prefix, suffix string) error
RemoveTopicByArnEventsPrefixSuffix removes a topic configuration that match the exact specified ARN, events, prefix and suffix
type Event ¶
type Event struct { EventVersion string `json:"eventVersion"` EventSource string `json:"eventSource"` AwsRegion string `json:"awsRegion"` EventTime string `json:"eventTime"` EventName string `json:"eventName"` UserIdentity identity `json:"userIdentity"` RequestParameters map[string]string `json:"requestParameters"` ResponseElements map[string]string `json:"responseElements"` S3 eventMeta `json:"s3"` Source sourceInfo `json:"source"` }
Event represents an Amazon an S3 bucket notification event.
type EventType ¶
type EventType string
EventType is a S3 notification event associated to the bucket notification configuration
type Filter ¶
type Filter struct {
S3Key S3Key `xml:"S3Key,omitempty"`
}
Filter - a tag in the notification xml structure which carries suffix/prefix filters
type FilterRule ¶
FilterRule - child of S3Key, a tag in the notification xml which carries suffix/prefix filters
type Info ¶
Info - represents the collection of notification events, additionally also reports errors if any while listening on bucket notifications.
type LambdaConfig ¶
LambdaConfig carries one single cloudfunction notification configuration
type QueueConfig ¶
QueueConfig carries one single queue notification configuration
type S3Key ¶
type S3Key struct {
FilterRules []FilterRule `xml:"FilterRule,omitempty"`
}
S3Key - child of Filter, a tag in the notification xml which carries suffix/prefix filters
type TopicConfig ¶
TopicConfig carries one single topic notification configuration