Toggle navigation
Toggle navigation
This project
Loading...
Sign in
서승완
/
kappa
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
Matteo Sessa
2016-07-08 16:41:32 +1000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1b44d9f7f4361cdca96ec677a99d2c296fdf1415
1b44d9f7
1 parent
1bf4ae32
Add support for prefix/suffix filters on S3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
kappa/event_source/s3.py
samples/s3/config.yml
kappa/event_source/s3.py
View file @
1b44d9f
...
...
@@ -41,6 +41,16 @@ class S3EventSource(kappa.event_source.base.EventSource):
}
]
}
# Add S3 key filters
if
'key_filters'
in
self
.
_config
:
filters_spec
=
{
'Key'
:
{
'FilterRules'
:
[]
}
}
for
filter
in
self
.
_config
[
'key_filters'
]:
if
'type'
in
filter
and
'value'
in
filter
and
filter
[
'type'
]
in
(
'prefix'
,
'suffix'
):
rule
=
{
'Name'
:
filter
[
'type'
],
'Value'
:
filter
[
'value'
]
}
filters_spec
[
'Key'
][
'FilterRules'
]
.
append
(
rule
)
notification_spec
[
'LambdaFunctionConfigurations'
][
0
][
'Filter'
]
=
filters_spec
try
:
response
=
self
.
_s3
.
call
(
'put_bucket_notification_configuration'
,
...
...
samples/s3/config.yml
View file @
1b44d9f
...
...
@@ -34,3 +34,8 @@ lambda:
arn
:
arn:aws:s3:::test-1245812163
events
:
-
s3:ObjectCreated:*
key_filters
:
-
type
:
prefix
value
:
someprefix/
-
type
:
suffix
value
:
.zip
...
...
Please
register
or
login
to post a comment