notification

package
v7.0.12 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
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

View Source
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

func EqualEventTypeList(a, b []EventType) bool

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

type Arn struct {
	Partition string
	Service   string
	Region    string
	AccountID string
	Resource  string
}

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

func NewArn(partition, service, region, accountID, resource string) Arn

NewArn creates new ARN based on the given partition, service, region, account id and resource

func (Arn) String

func (arn Arn) String() string

String returns the string format of the ARN

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 NewConfig

func NewConfig(arn Arn) Config

NewConfig creates one notification config and sets the given ARN

func (*Config) AddEvents

func (t *Config) AddEvents(events ...EventType)

AddEvents adds one event to the current notification config

func (*Config) AddFilterPrefix

func (t *Config) AddFilterPrefix(prefix string)

AddFilterPrefix sets the prefix configuration to the current notification config

func (*Config) AddFilterSuffix

func (t *Config) AddFilterSuffix(suffix string)

AddFilterSuffix sets the suffix configuration to the current notification config

func (*Config) Equal

func (t *Config) Equal(events []EventType, prefix, suffix string) bool

Equal returns whether this `Config` is equal to another defined by the passed parameters

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

type FilterRule struct {
	Name  string `xml:"Name"`
	Value string `xml:"Value"`
}

FilterRule - child of S3Key, a tag in the notification xml which carries suffix/prefix filters

type Info

type Info struct {
	Records []Event
	Err     error
}

Info - represents the collection of notification events, additionally also reports errors if any while listening on bucket notifications.

type LambdaConfig

type LambdaConfig struct {
	Config
	Lambda string `xml:"CloudFunction"`
}

LambdaConfig carries one single cloudfunction notification configuration

type QueueConfig

type QueueConfig struct {
	Config
	Queue string `xml:"Queue"`
}

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

type TopicConfig struct {
	Config
	Topic string `xml:"Topic"`
}

TopicConfig carries one single topic notification configuration

Jump to

Keyboard shortcuts

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