2929REQUIRED_KINESIS_SUBSCRIPTION_PARAMS = {u'stream' : basestring ,
3030 u'batch_size' : int ,
3131 u'starting_position' : basestring }
32+ REQUIRED_TRACING_MODES = ['Active' , 'PassThrough' ]
3233
3334DEFAULT_PARAMS = {u'requirements' : [], u'publish' : False ,
3435 u'alias' : None , u'alias_description' : None ,
3536 u'ignore' : [], u'extra_files' : [], u'vpc' : None ,
3637 u's3_bucket' : None , u's3_key' : None , u'runtime' : 'python2.7' ,
37- u'variables' : {}, u'subscription' : {}}
38+ u'variables' : {}, u'subscription' : {}, u'tracing' : {} }
3839
3940
4041class Config (object ):
@@ -51,6 +52,8 @@ def __init__(self, pth, config_file=None, role=None, variables=None):
5152 self ._validate_vpc ()
5253 if self ._config ['subscription' ]:
5354 self ._validate_subscription ()
55+ if self ._config ['tracing' ]:
56+ self ._validate_tracing ()
5457
5558 for param , clss in REQUIRED_PARAMS .items ():
5659 self ._validate (param , cls = clss )
@@ -126,6 +129,16 @@ def _validate_vpc(self):
126129 " strings. '%s' contains something else"
127130 % param )
128131
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+
129142 '''Validate the subscription configuration.
130143 All kinds of subscription will be validated here'''
131144 def _validate_subscription (self ):
0 commit comments