-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from harena-lab/development
Development
- Loading branch information
Showing
4 changed files
with
45 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import enums | ||
|
||
class ArenaLoggerDtoValidator(): | ||
@staticmethod | ||
def validateDto(message): | ||
if 'harena-log-stream-version' not in message : | ||
message['harena-log-stream-version'] = str(enums.StreamVersionSpecialCodes.NOT_IDENTIFIED.value) | ||
|
||
#TODO: create an exception handler with custom exceptions | ||
if 'harena-log-stream' not in message: | ||
raise ValueError('Message does not contains harena-log-stream') | ||
|
||
for harena_stream_log_value in message['harena-log-stream']: | ||
if 'topic' not in harena_stream_log_value: | ||
raise ValueError('One or more harena-log-stream items does not contains topic') | ||
break | ||
|
||
if 'payload' not in harena_stream_log_value: | ||
raise ValueError("One or more harena-log-stream items does not contains payload") | ||
break | ||
|
||
if not bool(harena_stream_log_value['payload']): | ||
raise ValueError("One or more harena-log-stream items does not contains key-value pair") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import enum | ||
|
||
class StreamVersionSpecialCodes(enum.Enum): | ||
NOT_IDENTIFIED = 99 | ||
ERROR = 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters