Skip to content

Commit 99f4096

Browse files
authored
feat(audit_trail): add support for Resources (#870)
1 parent bd6d794 commit 99f4096

File tree

4 files changed

+40
-18
lines changed

4 files changed

+40
-18
lines changed

scaleway-async/scaleway_async/audit_trail/v1alpha1/marshalling.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,6 @@ def unmarshal_Event(data: Any) -> Event:
251251
if field is not None:
252252
args["source_ip"] = field
253253

254-
field = data.get("product_name", None)
255-
if field is not None:
256-
args["product_name"] = field
257-
258254
field = data.get("recorded_at", None)
259255
if field is not None:
260256
args["recorded_at"] = (
@@ -281,6 +277,10 @@ def unmarshal_Event(data: Any) -> Event:
281277
else:
282278
args["user_agent"] = None
283279

280+
field = data.get("product_name", None)
281+
if field is not None:
282+
args["product_name"] = field
283+
284284
field = data.get("service_name", None)
285285
if field is not None:
286286
args["service_name"] = field
@@ -289,6 +289,12 @@ def unmarshal_Event(data: Any) -> Event:
289289
if field is not None:
290290
args["method_name"] = field
291291

292+
field = data.get("resources", None)
293+
if field is not None:
294+
args["resources"] = (
295+
[unmarshal_Resource(v) for v in field] if field is not None else None
296+
)
297+
292298
field = data.get("request_id", None)
293299
if field is not None:
294300
args["request_id"] = field

scaleway-async/scaleway_async/audit_trail/v1alpha1/types.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,6 @@ class Event:
145145
IP address at the origin of the event.
146146
"""
147147

148-
product_name: str
149-
"""
150-
Product name of the resource attached to the event.
151-
"""
152-
153148
recorded_at: Optional[datetime]
154149
"""
155150
Timestamp of the event.
@@ -170,6 +165,11 @@ class Event:
170165
User Agent at the origin of the event.
171166
"""
172167

168+
product_name: str
169+
"""
170+
Product name of the resource attached to the event.
171+
"""
172+
173173
service_name: str
174174
"""
175175
API name called to trigger the event.
@@ -180,6 +180,11 @@ class Event:
180180
API method called to trigger the event.
181181
"""
182182

183+
resources: List[Resource]
184+
"""
185+
Resources attached to the event.
186+
"""
187+
183188
request_id: str
184189
"""
185190
Unique identifier of the request at the origin of the event.

scaleway/scaleway/audit_trail/v1alpha1/marshalling.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,6 @@ def unmarshal_Event(data: Any) -> Event:
251251
if field is not None:
252252
args["source_ip"] = field
253253

254-
field = data.get("product_name", None)
255-
if field is not None:
256-
args["product_name"] = field
257-
258254
field = data.get("recorded_at", None)
259255
if field is not None:
260256
args["recorded_at"] = (
@@ -281,6 +277,10 @@ def unmarshal_Event(data: Any) -> Event:
281277
else:
282278
args["user_agent"] = None
283279

280+
field = data.get("product_name", None)
281+
if field is not None:
282+
args["product_name"] = field
283+
284284
field = data.get("service_name", None)
285285
if field is not None:
286286
args["service_name"] = field
@@ -289,6 +289,12 @@ def unmarshal_Event(data: Any) -> Event:
289289
if field is not None:
290290
args["method_name"] = field
291291

292+
field = data.get("resources", None)
293+
if field is not None:
294+
args["resources"] = (
295+
[unmarshal_Resource(v) for v in field] if field is not None else None
296+
)
297+
292298
field = data.get("request_id", None)
293299
if field is not None:
294300
args["request_id"] = field

scaleway/scaleway/audit_trail/v1alpha1/types.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,6 @@ class Event:
145145
IP address at the origin of the event.
146146
"""
147147

148-
product_name: str
149-
"""
150-
Product name of the resource attached to the event.
151-
"""
152-
153148
recorded_at: Optional[datetime]
154149
"""
155150
Timestamp of the event.
@@ -170,6 +165,11 @@ class Event:
170165
User Agent at the origin of the event.
171166
"""
172167

168+
product_name: str
169+
"""
170+
Product name of the resource attached to the event.
171+
"""
172+
173173
service_name: str
174174
"""
175175
API name called to trigger the event.
@@ -180,6 +180,11 @@ class Event:
180180
API method called to trigger the event.
181181
"""
182182

183+
resources: List[Resource]
184+
"""
185+
Resources attached to the event.
186+
"""
187+
183188
request_id: str
184189
"""
185190
Unique identifier of the request at the origin of the event.

0 commit comments

Comments
 (0)