29
29
REQUIRED_KINESIS_SUBSCRIPTION_PARAMS = {u'stream' : basestring ,
30
30
u'batch_size' : int ,
31
31
u'starting_position' : basestring }
32
+ REQUIRED_TRACING_MODES = ['Active' , 'PassThrough' ]
32
33
33
34
DEFAULT_PARAMS = {u'requirements' : [], u'publish' : False ,
34
35
u'alias' : None , u'alias_description' : None ,
35
36
u'ignore' : [], u'extra_files' : [], u'vpc' : None ,
36
37
u's3_bucket' : None , u's3_key' : None , u'runtime' : 'python2.7' ,
37
- u'variables' : {}, u'subscription' : {}}
38
+ u'variables' : {}, u'subscription' : {}, u'tracing' : {} }
38
39
39
40
40
41
class Config (object ):
@@ -51,6 +52,8 @@ def __init__(self, pth, config_file=None, role=None, variables=None):
51
52
self ._validate_vpc ()
52
53
if self ._config ['subscription' ]:
53
54
self ._validate_subscription ()
55
+ if self ._config ['tracing' ]:
56
+ self ._validate_tracing ()
54
57
55
58
for param , clss in REQUIRED_PARAMS .items ():
56
59
self ._validate (param , cls = clss )
@@ -126,6 +129,16 @@ def _validate_vpc(self):
126
129
" strings. '%s' contains something else"
127
130
% param )
128
131
132
+ '''Validate the tracing configuration'''
133
+ def _validate_tracing (self ):
134
+ if len (self ._config ['tracing' ]) > 1 :
135
+ raise TypeError ("Tracing Config can only contain one item" )
136
+ if not self ._config ['tracing' ].get ('Mode' ):
137
+ raise TypeError ("Tracing Config must contain the `Mode` key" )
138
+ if self ._config ['tracing' ]['Mode' ] not in REQUIRED_TRACING_MODES :
139
+ raise TypeError ("Tracing Config Mode must be one of {}" .format (
140
+ ', ' .join (REQUIRED_TRACING_MODES )))
141
+
129
142
'''Validate the subscription configuration.
130
143
All kinds of subscription will be validated here'''
131
144
def _validate_subscription (self ):
0 commit comments