Skip to content

Commit 643b00f

Browse files
feat(audit_trail): add account user and organization resources (#985)
Co-authored-by: Laure-di <[email protected]>
1 parent 5a6b1c1 commit 643b00f

File tree

6 files changed

+120
-0
lines changed

6 files changed

+120
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# If you have any remark or suggestion do not hesitate to open an issue.
33
from .types import ListEventsRequestOrderBy
44
from .types import ResourceType
5+
from .types import AccountOrganizationInfo
6+
from .types import AccountUserInfo
57
from .types import KeyManagerKeyInfo
68
from .types import KubernetesACLInfo
79
from .types import KubernetesClusterInfo
@@ -23,6 +25,8 @@
2325
__all__ = [
2426
"ListEventsRequestOrderBy",
2527
"ResourceType",
28+
"AccountOrganizationInfo",
29+
"AccountUserInfo",
2630
"KeyManagerKeyInfo",
2731
"KubernetesACLInfo",
2832
"KubernetesClusterInfo",

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

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from dateutil import parser
66

77
from .types import (
8+
AccountOrganizationInfo,
9+
AccountUserInfo,
810
KeyManagerKeyInfo,
911
KubernetesACLInfo,
1012
KubernetesClusterInfo,
@@ -22,6 +24,32 @@
2224
)
2325

2426

27+
def unmarshal_AccountOrganizationInfo(data: Any) -> AccountOrganizationInfo:
28+
if not isinstance(data, dict):
29+
raise TypeError(
30+
"Unmarshalling the type 'AccountOrganizationInfo' failed as data isn't a dictionary."
31+
)
32+
33+
args: Dict[str, Any] = {}
34+
35+
return AccountOrganizationInfo(**args)
36+
37+
38+
def unmarshal_AccountUserInfo(data: Any) -> AccountUserInfo:
39+
if not isinstance(data, dict):
40+
raise TypeError(
41+
"Unmarshalling the type 'AccountUserInfo' failed as data isn't a dictionary."
42+
)
43+
44+
args: Dict[str, Any] = {}
45+
46+
field = data.get("email", None)
47+
if field is not None:
48+
args["email"] = field
49+
50+
return AccountUserInfo(**args)
51+
52+
2553
def unmarshal_KeyManagerKeyInfo(data: Any) -> KeyManagerKeyInfo:
2654
if not isinstance(data, dict):
2755
raise TypeError(
@@ -244,6 +272,18 @@ def unmarshal_Resource(data: Any) -> Resource:
244272
else:
245273
args["key_manager_key_info"] = None
246274

275+
field = data.get("account_user_info", None)
276+
if field is not None:
277+
args["account_user_info"] = unmarshal_AccountUserInfo(field)
278+
else:
279+
args["account_user_info"] = None
280+
281+
field = data.get("account_organization_info", None)
282+
if field is not None:
283+
args["account_organization_info"] = unmarshal_AccountOrganizationInfo(field)
284+
else:
285+
args["account_organization_info"] = None
286+
247287
return Resource(**args)
248288

249289

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,23 @@ class ResourceType(str, Enum, metaclass=StrEnumMeta):
4242
SECRET_MANAGER_SECRET = "secret_manager_secret"
4343
SECRET_MANAGER_VERSION = "secret_manager_version"
4444
KEY_MANAGER_KEY = "key_manager_key"
45+
ACCOUNT_USER = "account_user"
46+
ACCOUNT_ORGANIZATION = "account_organization"
4547

4648
def __str__(self) -> str:
4749
return str(self.value)
4850

4951

52+
@dataclass
53+
class AccountOrganizationInfo:
54+
pass
55+
56+
57+
@dataclass
58+
class AccountUserInfo:
59+
email: str
60+
61+
5062
@dataclass
5163
class KeyManagerKeyInfo:
5264
pass
@@ -125,6 +137,10 @@ class Resource:
125137

126138
key_manager_key_info: Optional[KeyManagerKeyInfo]
127139

140+
account_user_info: Optional[AccountUserInfo]
141+
142+
account_organization_info: Optional[AccountOrganizationInfo]
143+
128144

129145
@dataclass
130146
class ProductService:

scaleway/scaleway/audit_trail/v1alpha1/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# If you have any remark or suggestion do not hesitate to open an issue.
33
from .types import ListEventsRequestOrderBy
44
from .types import ResourceType
5+
from .types import AccountOrganizationInfo
6+
from .types import AccountUserInfo
57
from .types import KeyManagerKeyInfo
68
from .types import KubernetesACLInfo
79
from .types import KubernetesClusterInfo
@@ -23,6 +25,8 @@
2325
__all__ = [
2426
"ListEventsRequestOrderBy",
2527
"ResourceType",
28+
"AccountOrganizationInfo",
29+
"AccountUserInfo",
2630
"KeyManagerKeyInfo",
2731
"KubernetesACLInfo",
2832
"KubernetesClusterInfo",

scaleway/scaleway/audit_trail/v1alpha1/marshalling.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from dateutil import parser
66

77
from .types import (
8+
AccountOrganizationInfo,
9+
AccountUserInfo,
810
KeyManagerKeyInfo,
911
KubernetesACLInfo,
1012
KubernetesClusterInfo,
@@ -22,6 +24,32 @@
2224
)
2325

2426

27+
def unmarshal_AccountOrganizationInfo(data: Any) -> AccountOrganizationInfo:
28+
if not isinstance(data, dict):
29+
raise TypeError(
30+
"Unmarshalling the type 'AccountOrganizationInfo' failed as data isn't a dictionary."
31+
)
32+
33+
args: Dict[str, Any] = {}
34+
35+
return AccountOrganizationInfo(**args)
36+
37+
38+
def unmarshal_AccountUserInfo(data: Any) -> AccountUserInfo:
39+
if not isinstance(data, dict):
40+
raise TypeError(
41+
"Unmarshalling the type 'AccountUserInfo' failed as data isn't a dictionary."
42+
)
43+
44+
args: Dict[str, Any] = {}
45+
46+
field = data.get("email", None)
47+
if field is not None:
48+
args["email"] = field
49+
50+
return AccountUserInfo(**args)
51+
52+
2553
def unmarshal_KeyManagerKeyInfo(data: Any) -> KeyManagerKeyInfo:
2654
if not isinstance(data, dict):
2755
raise TypeError(
@@ -244,6 +272,18 @@ def unmarshal_Resource(data: Any) -> Resource:
244272
else:
245273
args["key_manager_key_info"] = None
246274

275+
field = data.get("account_user_info", None)
276+
if field is not None:
277+
args["account_user_info"] = unmarshal_AccountUserInfo(field)
278+
else:
279+
args["account_user_info"] = None
280+
281+
field = data.get("account_organization_info", None)
282+
if field is not None:
283+
args["account_organization_info"] = unmarshal_AccountOrganizationInfo(field)
284+
else:
285+
args["account_organization_info"] = None
286+
247287
return Resource(**args)
248288

249289

scaleway/scaleway/audit_trail/v1alpha1/types.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,23 @@ class ResourceType(str, Enum, metaclass=StrEnumMeta):
4242
SECRET_MANAGER_SECRET = "secret_manager_secret"
4343
SECRET_MANAGER_VERSION = "secret_manager_version"
4444
KEY_MANAGER_KEY = "key_manager_key"
45+
ACCOUNT_USER = "account_user"
46+
ACCOUNT_ORGANIZATION = "account_organization"
4547

4648
def __str__(self) -> str:
4749
return str(self.value)
4850

4951

52+
@dataclass
53+
class AccountOrganizationInfo:
54+
pass
55+
56+
57+
@dataclass
58+
class AccountUserInfo:
59+
email: str
60+
61+
5062
@dataclass
5163
class KeyManagerKeyInfo:
5264
pass
@@ -125,6 +137,10 @@ class Resource:
125137

126138
key_manager_key_info: Optional[KeyManagerKeyInfo]
127139

140+
account_user_info: Optional[AccountUserInfo]
141+
142+
account_organization_info: Optional[AccountOrganizationInfo]
143+
128144

129145
@dataclass
130146
class ProductService:

0 commit comments

Comments
 (0)