Skip to content

Commit 92a1f3a

Browse files
committed
feat: update generated APIs
1 parent 2efc032 commit 92a1f3a

File tree

8 files changed

+814
-94
lines changed

8 files changed

+814
-94
lines changed

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

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# This file was automatically generated. DO NOT EDIT.
22
# If you have any remark or suggestion do not hesitate to open an issue.
3+
from .types import AuthenticationEventFailureReason
4+
from .types import AuthenticationEventMFAType
5+
from .types import AuthenticationEventMethod
6+
from .types import AuthenticationEventOrigin
7+
from .types import AuthenticationEventResult
8+
from .types import ListAuthenticationEventsRequestOrderBy
39
from .types import ListEventsRequestOrderBy
410
from .types import ResourceType
511
from .types import AccountOrganizationInfo
@@ -24,19 +30,28 @@
2430
from .types import LoadBalancerRouteInfo
2531
from .types import SecretManagerSecretInfo
2632
from .types import SecretManagerSecretVersionInfo
33+
from .types import Resource
2734
from .types import EventPrincipal
2835
from .types import EventSystem
29-
from .types import Resource
3036
from .types import ProductService
37+
from .types import AuthenticationEvent
3138
from .types import Event
3239
from .types import Product
40+
from .types import ListAuthenticationEventsRequest
41+
from .types import ListAuthenticationEventsResponse
3342
from .types import ListEventsRequest
3443
from .types import ListEventsResponse
3544
from .types import ListProductsRequest
3645
from .types import ListProductsResponse
3746
from .api import AuditTrailV1Alpha1API
3847

3948
__all__ = [
49+
"AuthenticationEventFailureReason",
50+
"AuthenticationEventMFAType",
51+
"AuthenticationEventMethod",
52+
"AuthenticationEventOrigin",
53+
"AuthenticationEventResult",
54+
"ListAuthenticationEventsRequestOrderBy",
4055
"ListEventsRequestOrderBy",
4156
"ResourceType",
4257
"AccountOrganizationInfo",
@@ -61,12 +76,15 @@
6176
"LoadBalancerRouteInfo",
6277
"SecretManagerSecretInfo",
6378
"SecretManagerSecretVersionInfo",
79+
"Resource",
6480
"EventPrincipal",
6581
"EventSystem",
66-
"Resource",
6782
"ProductService",
83+
"AuthenticationEvent",
6884
"Event",
6985
"Product",
86+
"ListAuthenticationEventsRequest",
87+
"ListAuthenticationEventsResponse",
7088
"ListEventsRequest",
7189
"ListEventsResponse",
7290
"ListProductsRequest",

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

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@
1212
validate_path_param,
1313
)
1414
from .types import (
15+
ListAuthenticationEventsRequestOrderBy,
1516
ListEventsRequestOrderBy,
1617
ResourceType,
18+
ListAuthenticationEventsResponse,
1719
ListEventsResponse,
1820
ListProductsResponse,
1921
)
2022
from .marshalling import (
23+
unmarshal_ListAuthenticationEventsResponse,
2124
unmarshal_ListEventsResponse,
2225
unmarshal_ListProductsResponse,
2326
)
@@ -45,6 +48,8 @@ async def list_events(
4548
product_name: Optional[str] = None,
4649
service_name: Optional[str] = None,
4750
resource_id: Optional[str] = None,
51+
principal_id: Optional[str] = None,
52+
source_ip: Optional[str] = None,
4853
) -> ListEventsResponse:
4954
"""
5055
List events.
@@ -63,6 +68,8 @@ async def list_events(
6368
:param product_name: (Optional) Name of the Scaleway product in a hyphenated format.
6469
:param service_name: (Optional) Name of the service of the API call performed.
6570
:param resource_id: (Optional) ID of the Scaleway resource.
71+
:param principal_id: (Optional) ID of the User or IAM application at the origin of the event.
72+
:param source_ip: (Optional) IP address at the origin of the event.
6673
:return: :class:`ListEventsResponse <ListEventsResponse>`
6774
6875
Usage:
@@ -85,20 +92,72 @@ async def list_events(
8592
or self.client.default_organization_id,
8693
"page_size": page_size or self.client.default_page_size,
8794
"page_token": page_token,
95+
"principal_id": principal_id,
8896
"product_name": product_name,
8997
"project_id": project_id or self.client.default_project_id,
9098
"recorded_after": recorded_after,
9199
"recorded_before": recorded_before,
92100
"resource_id": resource_id,
93101
"resource_type": resource_type,
94102
"service_name": service_name,
103+
"source_ip": source_ip,
95104
"status": status,
96105
},
97106
)
98107

99108
self._throw_on_error(res)
100109
return unmarshal_ListEventsResponse(res.json())
101110

111+
async def list_authentication_events(
112+
self,
113+
*,
114+
region: Optional[ScwRegion] = None,
115+
organization_id: Optional[str] = None,
116+
recorded_after: Optional[datetime] = None,
117+
recorded_before: Optional[datetime] = None,
118+
order_by: Optional[ListAuthenticationEventsRequestOrderBy] = None,
119+
page_size: Optional[int] = None,
120+
page_token: Optional[str] = None,
121+
) -> ListAuthenticationEventsResponse:
122+
"""
123+
List authentication events.
124+
Retrieve the list of Audit Trail authentication events for a Scaleway Organization. You must specify the `organization_id`.
125+
:param region: Region to target. If none is passed will use default region from the config.
126+
:param organization_id:
127+
:param recorded_after:
128+
:param recorded_before:
129+
:param order_by:
130+
:param page_size:
131+
:param page_token:
132+
:return: :class:`ListAuthenticationEventsResponse <ListAuthenticationEventsResponse>`
133+
134+
Usage:
135+
::
136+
137+
result = await api.list_authentication_events()
138+
"""
139+
140+
param_region = validate_path_param(
141+
"region", region or self.client.default_region
142+
)
143+
144+
res = self._request(
145+
"GET",
146+
f"/audit-trail/v1alpha1/regions/{param_region}/authentication-events",
147+
params={
148+
"order_by": order_by,
149+
"organization_id": organization_id
150+
or self.client.default_organization_id,
151+
"page_size": page_size or self.client.default_page_size,
152+
"page_token": page_token,
153+
"recorded_after": recorded_after,
154+
"recorded_before": recorded_before,
155+
},
156+
)
157+
158+
self._throw_on_error(res)
159+
return unmarshal_ListAuthenticationEventsResponse(res.json())
160+
102161
async def list_products(
103162
self,
104163
*,

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

Lines changed: 161 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
from dateutil import parser
66

77
from .types import (
8+
AuthenticationEventFailureReason,
9+
AuthenticationEventMFAType,
10+
AuthenticationEventMethod,
11+
AuthenticationEventOrigin,
12+
AuthenticationEventResult,
813
AccountOrganizationInfo,
914
AccountProjectInfo,
1015
AccountUserInfo,
@@ -27,15 +32,20 @@
2732
LoadBalancerRouteInfo,
2833
SecretManagerSecretInfo,
2934
SecretManagerSecretVersionInfo,
35+
Resource,
36+
AuthenticationEvent,
37+
ListAuthenticationEventsResponse,
3038
EventPrincipal,
3139
EventSystem,
32-
Resource,
3340
Event,
3441
ListEventsResponse,
3542
ProductService,
3643
Product,
3744
ListProductsResponse,
3845
)
46+
from ...std.types import (
47+
CountryCode as StdCountryCode,
48+
)
3949

4050

4151
def unmarshal_AccountOrganizationInfo(data: Any) -> AccountOrganizationInfo:
@@ -456,40 +466,6 @@ def unmarshal_SecretManagerSecretVersionInfo(
456466
return SecretManagerSecretVersionInfo(**args)
457467

458468

459-
def unmarshal_EventPrincipal(data: Any) -> EventPrincipal:
460-
if not isinstance(data, dict):
461-
raise TypeError(
462-
"Unmarshalling the type 'EventPrincipal' failed as data isn't a dictionary."
463-
)
464-
465-
args: Dict[str, Any] = {}
466-
467-
field = data.get("id", None)
468-
if field is not None:
469-
args["id"] = field
470-
else:
471-
args["id"] = None
472-
473-
return EventPrincipal(**args)
474-
475-
476-
def unmarshal_EventSystem(data: Any) -> EventSystem:
477-
if not isinstance(data, dict):
478-
raise TypeError(
479-
"Unmarshalling the type 'EventSystem' failed as data isn't a dictionary."
480-
)
481-
482-
args: Dict[str, Any] = {}
483-
484-
field = data.get("name", None)
485-
if field is not None:
486-
args["name"] = field
487-
else:
488-
args["name"] = None
489-
490-
return EventSystem(**args)
491-
492-
493469
def unmarshal_Resource(data: Any) -> Resource:
494470
if not isinstance(data, dict):
495471
raise TypeError(
@@ -693,6 +669,156 @@ def unmarshal_Resource(data: Any) -> Resource:
693669
return Resource(**args)
694670

695671

672+
def unmarshal_AuthenticationEvent(data: Any) -> AuthenticationEvent:
673+
if not isinstance(data, dict):
674+
raise TypeError(
675+
"Unmarshalling the type 'AuthenticationEvent' failed as data isn't a dictionary."
676+
)
677+
678+
args: Dict[str, Any] = {}
679+
680+
field = data.get("id", None)
681+
if field is not None:
682+
args["id"] = field
683+
else:
684+
args["id"] = None
685+
686+
field = data.get("organization_id", None)
687+
if field is not None:
688+
args["organization_id"] = field
689+
else:
690+
args["organization_id"] = None
691+
692+
field = data.get("source_ip", None)
693+
if field is not None:
694+
args["source_ip"] = field
695+
else:
696+
args["source_ip"] = None
697+
698+
field = data.get("resources", None)
699+
if field is not None:
700+
args["resources"] = (
701+
[unmarshal_Resource(v) for v in field] if field is not None else None
702+
)
703+
else:
704+
args["resources"] = []
705+
706+
field = data.get("result", None)
707+
if field is not None:
708+
args["result"] = field
709+
else:
710+
args["result"] = AuthenticationEventResult.UNKNOWN_RESULT
711+
712+
field = data.get("method", None)
713+
if field is not None:
714+
args["method"] = field
715+
else:
716+
args["method"] = AuthenticationEventMethod.UNKNOWN_METHOD
717+
718+
field = data.get("origin", None)
719+
if field is not None:
720+
args["origin"] = field
721+
else:
722+
args["origin"] = AuthenticationEventOrigin.UNKNOWN_ORIGIN
723+
724+
field = data.get("recorded_at", None)
725+
if field is not None:
726+
args["recorded_at"] = (
727+
parser.isoparse(field) if isinstance(field, str) else field
728+
)
729+
else:
730+
args["recorded_at"] = None
731+
732+
field = data.get("user_agent", None)
733+
if field is not None:
734+
args["user_agent"] = field
735+
else:
736+
args["user_agent"] = None
737+
738+
field = data.get("failure_reason", None)
739+
if field is not None:
740+
args["failure_reason"] = field
741+
else:
742+
args["failure_reason"] = AuthenticationEventFailureReason.UNKNOWN_FAILURE_REASON
743+
744+
field = data.get("country_code", None)
745+
if field is not None:
746+
args["country_code"] = field
747+
else:
748+
args["country_code"] = StdCountryCode.UNKNOWN_COUNTRY_CODE
749+
750+
field = data.get("mfa_type", None)
751+
if field is not None:
752+
args["mfa_type"] = field
753+
else:
754+
args["mfa_type"] = AuthenticationEventMFAType.UNKNOWN_MFA_TYPE
755+
756+
return AuthenticationEvent(**args)
757+
758+
759+
def unmarshal_ListAuthenticationEventsResponse(
760+
data: Any,
761+
) -> ListAuthenticationEventsResponse:
762+
if not isinstance(data, dict):
763+
raise TypeError(
764+
"Unmarshalling the type 'ListAuthenticationEventsResponse' failed as data isn't a dictionary."
765+
)
766+
767+
args: Dict[str, Any] = {}
768+
769+
field = data.get("events", None)
770+
if field is not None:
771+
args["events"] = (
772+
[unmarshal_AuthenticationEvent(v) for v in field]
773+
if field is not None
774+
else None
775+
)
776+
else:
777+
args["events"] = None
778+
779+
field = data.get("next_page_token", None)
780+
if field is not None:
781+
args["next_page_token"] = field
782+
else:
783+
args["next_page_token"] = None
784+
785+
return ListAuthenticationEventsResponse(**args)
786+
787+
788+
def unmarshal_EventPrincipal(data: Any) -> EventPrincipal:
789+
if not isinstance(data, dict):
790+
raise TypeError(
791+
"Unmarshalling the type 'EventPrincipal' failed as data isn't a dictionary."
792+
)
793+
794+
args: Dict[str, Any] = {}
795+
796+
field = data.get("id", None)
797+
if field is not None:
798+
args["id"] = field
799+
else:
800+
args["id"] = None
801+
802+
return EventPrincipal(**args)
803+
804+
805+
def unmarshal_EventSystem(data: Any) -> EventSystem:
806+
if not isinstance(data, dict):
807+
raise TypeError(
808+
"Unmarshalling the type 'EventSystem' failed as data isn't a dictionary."
809+
)
810+
811+
args: Dict[str, Any] = {}
812+
813+
field = data.get("name", None)
814+
if field is not None:
815+
args["name"] = field
816+
else:
817+
args["name"] = None
818+
819+
return EventSystem(**args)
820+
821+
696822
def unmarshal_Event(data: Any) -> Event:
697823
if not isinstance(data, dict):
698824
raise TypeError(

0 commit comments

Comments
 (0)