-
Notifications
You must be signed in to change notification settings - Fork 394
Expand file tree
/
Copy pathenums.py
More file actions
88 lines (69 loc) · 2.28 KB
/
enums.py
File metadata and controls
88 lines (69 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
from enum import Enum
class AwsEventSource(Enum):
AWS = "aws"
CLOUDTRAIL = "cloudtrail"
CLOUDWATCH = "cloudwatch"
ELASTICSEARCH = "elasticsearch"
FARGATE = "fargate"
GUARDDUTY = "guardduty"
KINESIS = "kinesis"
LAMBDA = "lambda"
MARIADB = "mariadb"
MSK = "msk"
MYSQL = "mysql"
POSTGRESQL = "postgresql"
S3 = "s3"
SNS = "sns"
STEPFUNCTION = "stepfunction"
WAF = "waf"
def __str__(self):
return f"{self.value}"
@staticmethod
def cloudwatch_sources():
return [
AwsEventSource.CLOUDTRAIL,
AwsEventSource.ELASTICSEARCH,
AwsEventSource.FARGATE,
AwsEventSource.MSK,
]
class AwsS3EventSourceKeyword(Enum):
def __init__(self, string, event_source):
self.string = string
self.event_source = event_source
# e.g. 2020/10/02/21/aws-waf-logs-testing-1-2020-10-02-21-25-30-x123x-x456x or AWSLogs/123456779121/WAFLogs/us-east-1/xxxxxx-waf/2022/10/11/14/10/123456779121_waflogs_us-east-1_xxxxx-waf_20221011T1410Z_12756524.log.gz
WAF_0 = ("aws-waf-logs", AwsEventSource.WAF)
WAF_1 = ("waflogs", AwsEventSource.WAF)
GUARDDUTY = ("guardduty", AwsEventSource.GUARDDUTY)
KINESIS = ("amazon_kinesis", AwsEventSource.KINESIS)
MSK = ("amazon_msk", AwsEventSource.MSK)
def __str__(self):
return f"{self.string}"
class AwsCwEventSourcePrefix(Enum):
def __init__(self, string, event_source):
self.string = string
self.event_source = event_source
# e.g. /aws/codebuild/my-project
CLOUDTRAIL = ("_CloudTrail_", AwsEventSource.CLOUDTRAIL)
# e.g. /aws/kinesisfirehose/dev
KINESIS = ("/aws/kinesis", AwsEventSource.KINESIS)
# e.g. /aws/lambda/helloDatadog
LAMBDA = ("/aws/lambda", AwsEventSource.LAMBDA)
# e.g. sns/us-east-1/123456779121/SnsTopicX
SNS = ("sns/", AwsEventSource.SNS)
def __str__(self):
return f"{self.string}"
class AwsEventType(Enum):
AWSLOGS = "awslogs"
EVENTS = "events"
KINESIS = "kinesis"
S3 = "s3"
SNS = "sns"
UNKNOWN = "unknown"
def __str__(self):
return f"{self.value}"
class AwsEventTypeKeyword(Enum):
MESSAGE = "Message"
RECORDS = "Records"
SNS = "Sns"
def __str__(self):
return f"{self.value}"