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
Mitch Garnaat
2015-11-07 10:32:13 -0500
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7af8846e5d0b061d6d7246362a7ebb0a0cf68eb5
7af8846e
1 parent
02613db1
Allow an event source to be enabled/disabled
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
0 deletions
kappa/event_source.py
kappa/scripts/cli.py
kappa/event_source.py
View file @
7af8846
...
...
@@ -75,6 +75,30 @@ class KinesisEventSource(EventSource):
except
Exception
:
LOG
.
exception
(
'Unable to add event source'
)
def
enable
(
self
,
function
):
self
.
enabled
=
True
try
:
response
=
self
.
_lambda
.
call
(
'update_event_source_mapping'
,
FunctionName
=
function
.
name
,
Enabled
=
self
.
enabled
)
LOG
.
debug
(
response
)
except
Exception
:
LOG
.
exception
(
'Unable to enable event source'
)
def
disable
(
self
,
function
):
self
.
enabled
=
False
try
:
response
=
self
.
_lambda
.
call
(
'update_event_source_mapping'
,
FunctionName
=
function
.
name
,
Enabled
=
self
.
enabled
)
LOG
.
debug
(
response
)
except
Exception
:
LOG
.
exception
(
'Unable to disable event source'
)
def
update
(
self
,
function
):
response
=
None
uuid
=
self
.
_get_uuid
(
function
)
...
...
kappa/scripts/cli.py
View file @
7af8846
...
...
@@ -207,4 +207,26 @@ def update_event_sources(ctx):
click
.
echo
(
'done'
)
@cli.command
()
@click.pass_context
def
enable_event_sources
(
ctx
):
"""Enable event sources specified in the config file"""
context
=
Context
(
ctx
.
obj
[
'config'
],
ctx
.
obj
[
'environment'
],
ctx
.
obj
[
'debug'
],
ctx
.
obj
[
'force'
])
click
.
echo
(
'enabling event sources'
)
context
.
enable_event_sources
()
click
.
echo
(
'done'
)
@cli.command
()
@click.pass_context
def
disable_event_sources
(
ctx
):
"""Disable event sources specified in the config file"""
context
=
Context
(
ctx
.
obj
[
'config'
],
ctx
.
obj
[
'environment'
],
ctx
.
obj
[
'debug'
],
ctx
.
obj
[
'force'
])
click
.
echo
(
'enabling event sources'
)
context
.
disable_event_sources
()
click
.
echo
(
'done'
)
cli
(
obj
=
{})
...
...
Please
register
or
login
to post a comment