def subscribe(self):
try:<EOL><INDENT>LOG.debug('<STR_LIT>')<EOL>if self.starting_position_ts:<EOL><INDENT>self._lambda_client.create_event_source_mapping(<EOL>EventSourceArn=self.stream_name,<EOL>FunctionName=self.function_name,<EOL>BatchSize=self.batch_size,<EOL>StartingPosition=self.starting_position,<EOL>StartingPositionTimestamp=self.starting_position_ts)<EOL><DEDENT>else:<EOL><INDENT>self._lambda_client.create_event_source_mapping(<EOL>EventSourceArn=self.stream_name,<EOL>FunctionName=self.function_name,<EOL>BatchSize=self.batch_size,<EOL>StartingPosition=self.starting_position)<EOL><DEDENT>LOG.debug('<STR_LIT>')<EOL><DEDENT>except botocore.exceptions.ClientError as ex:<EOL><INDENT>response_code = ex.response['<STR_LIT>']['<STR_LIT>']<EOL>if response_code == '<STR_LIT>':<EOL><INDENT>LOG.debug('<STR_LIT>')<EOL>resp = self._lambda_client.list_event_source_mappings(<EOL>FunctionName=self.function_name,<EOL>EventSourceArn=self.stream_name)<EOL>uuid = resp['<STR_LIT>'][<NUM_LIT:0>]['<STR_LIT>']<EOL>self._lambda_client.update_event_source_mapping(<EOL>UUID=uuid,<EOL>FunctionName=self.function_name,<EOL>Enabled=True,<EOL>BatchSize=self.batch_size)<EOL><DEDENT>else:<EOL><INDENT>LOG.error('<STR_LIT>' % str(ex))<EOL>raise ex<EOL><DEDENT><DEDENT>
Subscribes the lambda to the Kinesis stream