File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ from dataclasses import dataclass , field
2
+ from datetime import datetime
3
+ from enum import auto
4
+
5
+ from marshmallow_dataclass import class_schema
6
+ from strenum import SnakeCaseStrEnum
7
+
8
+ from pygitguardian .models import Base , BaseSchema
9
+
10
+
11
+ class ScanStatus (SnakeCaseStrEnum ):
12
+ PENDING = auto ()
13
+ RUNNING = auto ()
14
+ CANCELED = auto ()
15
+ FAILED = auto ()
16
+ TOO_LARGE = auto ()
17
+ TIMEOUT = auto ()
18
+ FINISHED = auto ()
19
+
20
+
21
+ @dataclass
22
+ class Scan (Base ):
23
+ date : datetime
24
+ status : ScanStatus = field (metadata = {"by_value" : True })
25
+
26
+
27
+ ScanSchema = class_schema (Scan , BaseSchema )
28
+
29
+
30
+ class SourceHealth (SnakeCaseStrEnum ):
31
+ SAFE = auto ()
32
+ UNKNOWN = auto ()
33
+ AT_RISK = auto ()
34
+
35
+
36
+ @dataclass
37
+ class Source (Base ):
38
+ id : int
39
+ url : str
40
+ type : str # TODO: Reserved word
41
+ full_name : str
42
+ health : SourceHealth = field (metadata = {"by_value" : True })
43
+ open_incidents_count : int # TODO: Type documented as "number" - what's the difference?
44
+ closed_incidents_count : int # TODO: Also "number"
45
+ visibility : str # TODO: Really? str
46
+ external_id : str
47
+ last_scan : Scan
48
+
49
+
50
+ SourceSchema = class_schema (Source , BaseSchema )
You can’t perform that action at this time.
0 commit comments