-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.py
109 lines (87 loc) · 4.36 KB
/
models.py
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
"""Model definitions for the Vilocify API"""
# SPDX-FileCopyrightText: 2025 Siemens AG
# SPDX-License-Identifier: MIT
from vilocify.jsonapy import Action, Attribute, Model, RelationshipToMany, RelationshipToOne
class Component(Model):
vendor = Attribute[str | None]("vendor")
name = Attribute[str | None]("name")
version = Attribute[str | None]("version")
url = Attribute[str | None]("url")
created_at = Attribute[str]("createdAt")
updated_at = Attribute[str]("updatedAt")
eol_on = Attribute[str | None]("endOfLifeOn")
is_eol = Attribute[bool]("endOfLife")
active = Attribute[bool]("active")
deactivated_at = Attribute[str | None]("deactivatedAt")
deactivation_reason = Attribute[str | None]("deactivationReason")
monitoring_lists: RelationshipToMany["MonitoringList"] = RelationshipToMany("MonitoringList")
notifications: RelationshipToMany["Notification"] = RelationshipToMany("Notification")
class Membership(Model):
username = Attribute[str]("userName", serialize_on=(Action.CREATE,))
email = Attribute[str]("userEmail", serialize_on=(Action.CREATE,))
role = Attribute[str]("role", serialize_on=(Action.CREATE,))
expires_at = Attribute[str | None]("expiresAt")
invitation_state = Attribute[str]("invitationState", serialize_on=())
created_at = Attribute[str]("createdAt", serialize_on=())
updated_at = Attribute[str]("updatedAt", serialize_on=())
class ComponentRequest(Model):
vendor = Attribute[str | None]("vendor")
name = Attribute[str]("name")
version = Attribute[str]("version")
comment = Attribute[str | None]("comment")
prioritized = Attribute[bool]("prioritized")
security_url = Attribute[str | None]("securityUrl")
component_url = Attribute[str | None]("componentUrl")
state = Attribute[str]("state", serialize_on=())
rejection_reasons = Attribute[list[str] | None]("rejectionReasons", serialize_on=())
created_at = Attribute[str]("createdAt", serialize_on=())
updated_at = Attribute[str]("updatedAt", serialize_on=())
component = RelationshipToOne(Component)
membership = RelationshipToOne(Membership)
class Vulnerability(Model):
@classmethod
def jsonapi_type_name(cls) -> str:
return "vulnerabilities"
cve = Attribute[str | None]("cve")
cwe = Attribute[str | None]("cwe")
description = Attribute[str]("description")
cvss = Attribute[list[dict]]("cvss")
mitigating_factor = Attribute[str | None]("mitigatingFactor")
note = Attribute[str | None]("note")
deleted = Attribute[bool]("deleted")
class Notification(Model):
title = Attribute[str]("title")
priority = Attribute[str]("priority")
action = Attribute[str]("action")
solution = Attribute[str]("solution")
description = Attribute[str]("description")
vendor_affected_components = Attribute[str]("vendorAffectedComponents")
references = Attribute[list[str]]("references")
advisories = Attribute[list[dict[str, str]]]("advisories")
cves = Attribute[list[str]]("cves")
attack_vector = Attribute[str | None]("attackVector")
cvss = Attribute[str | None]("cvss")
history = Attribute[list[dict]]("history")
type = Attribute[str]("type")
third_party_published_on = Attribute[str]("thirdPartyPublishedOn")
created_at = Attribute[str]("createdAt")
updated_at = Attribute[str]("updatedAt")
vulnerabilities = RelationshipToMany(Vulnerability)
components = RelationshipToMany(Component)
class MonitoringList(Model):
name = Attribute[str]("name")
comment = Attribute[str | None]("comment")
active = Attribute[bool]("active")
created_at = Attribute[str]("createdAt", serialize_on=())
updated_at = Attribute[str]("updatedAt", serialize_on=())
components = RelationshipToMany(Component)
subscriptions: RelationshipToMany["Subscription"] = RelationshipToMany("Subscription")
parents: RelationshipToMany["MonitoringList"] = RelationshipToMany("MonitoringList", "parents")
children: RelationshipToMany["MonitoringList"] = RelationshipToMany("MonitoringList", "children")
class Subscription(Model):
role = Attribute[str]("role")
priorities = Attribute[list[str]]("priorities")
created_at = Attribute[str]("createdAt", serialize_on=())
updated_at = Attribute[str]("updatedAt", serialize_on=())
membership = RelationshipToOne(Membership)
monitoring_list = RelationshipToOne(MonitoringList)