Skip to content

Commit ce02a97

Browse files
authored
feat(audit_trail): add baremetal resources (#1113)
1 parent 61dd811 commit ce02a97

File tree

6 files changed

+204
-0
lines changed

6 files changed

+204
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
from .types import ListEventsRequestOrderBy
44
from .types import ResourceType
55
from .types import AccountOrganizationInfo
6+
from .types import AccountProjectInfo
67
from .types import AccountUserInfo
78
from .types import AppleSiliconServerInfo
9+
from .types import BaremetalServerInfo
10+
from .types import BaremetalSettingInfo
811
from .types import InstanceServerInfo
912
from .types import KeyManagerKeyInfo
1013
from .types import KubernetesACLInfo
@@ -28,8 +31,11 @@
2831
"ListEventsRequestOrderBy",
2932
"ResourceType",
3033
"AccountOrganizationInfo",
34+
"AccountProjectInfo",
3135
"AccountUserInfo",
3236
"AppleSiliconServerInfo",
37+
"BaremetalServerInfo",
38+
"BaremetalSettingInfo",
3339
"InstanceServerInfo",
3440
"KeyManagerKeyInfo",
3541
"KubernetesACLInfo",

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

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@
66

77
from .types import (
88
AccountOrganizationInfo,
9+
AccountProjectInfo,
910
AccountUserInfo,
1011
AppleSiliconServerInfo,
12+
BaremetalServerInfo,
13+
BaremetalSettingInfo,
1114
InstanceServerInfo,
1215
KeyManagerKeyInfo,
1316
KubernetesACLInfo,
@@ -37,6 +40,21 @@ def unmarshal_AccountOrganizationInfo(data: Any) -> AccountOrganizationInfo:
3740
return AccountOrganizationInfo(**args)
3841

3942

43+
def unmarshal_AccountProjectInfo(data: Any) -> AccountProjectInfo:
44+
if not isinstance(data, dict):
45+
raise TypeError(
46+
"Unmarshalling the type 'AccountProjectInfo' failed as data isn't a dictionary."
47+
)
48+
49+
args: Dict[str, Any] = {}
50+
51+
field = data.get("description", None)
52+
if field is not None:
53+
args["description"] = field
54+
55+
return AccountProjectInfo(**args)
56+
57+
4058
def unmarshal_AccountUserInfo(data: Any) -> AccountUserInfo:
4159
if not isinstance(data, dict):
4260
raise TypeError(
@@ -77,6 +95,40 @@ def unmarshal_AppleSiliconServerInfo(data: Any) -> AppleSiliconServerInfo:
7795
return AppleSiliconServerInfo(**args)
7896

7997

98+
def unmarshal_BaremetalServerInfo(data: Any) -> BaremetalServerInfo:
99+
if not isinstance(data, dict):
100+
raise TypeError(
101+
"Unmarshalling the type 'BaremetalServerInfo' failed as data isn't a dictionary."
102+
)
103+
104+
args: Dict[str, Any] = {}
105+
106+
field = data.get("description", None)
107+
if field is not None:
108+
args["description"] = field
109+
110+
field = data.get("tags", None)
111+
if field is not None:
112+
args["tags"] = field
113+
114+
return BaremetalServerInfo(**args)
115+
116+
117+
def unmarshal_BaremetalSettingInfo(data: Any) -> BaremetalSettingInfo:
118+
if not isinstance(data, dict):
119+
raise TypeError(
120+
"Unmarshalling the type 'BaremetalSettingInfo' failed as data isn't a dictionary."
121+
)
122+
123+
args: Dict[str, Any] = {}
124+
125+
field = data.get("type", None)
126+
if field is not None:
127+
args["type_"] = field
128+
129+
return BaremetalSettingInfo(**args)
130+
131+
80132
def unmarshal_InstanceServerInfo(data: Any) -> InstanceServerInfo:
81133
if not isinstance(data, dict):
82134
raise TypeError(
@@ -344,6 +396,24 @@ def unmarshal_Resource(data: Any) -> Resource:
344396
else:
345397
args["apple_silicon_server_info"] = None
346398

399+
field = data.get("account_project_info", None)
400+
if field is not None:
401+
args["account_project_info"] = unmarshal_AccountProjectInfo(field)
402+
else:
403+
args["account_project_info"] = None
404+
405+
field = data.get("baremetal_server_info", None)
406+
if field is not None:
407+
args["baremetal_server_info"] = unmarshal_BaremetalServerInfo(field)
408+
else:
409+
args["baremetal_server_info"] = None
410+
411+
field = data.get("baremetal_setting_info", None)
412+
if field is not None:
413+
args["baremetal_setting_info"] = unmarshal_BaremetalSettingInfo(field)
414+
else:
415+
args["baremetal_setting_info"] = None
416+
347417
return Resource(**args)
348418

349419

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,11 @@ class ResourceType(str, Enum, metaclass=StrEnumMeta):
4444
KEY_MANAGER_KEY = "key_manager_key"
4545
ACCOUNT_USER = "account_user"
4646
ACCOUNT_ORGANIZATION = "account_organization"
47+
ACCOUNT_PROJECT = "account_project"
4748
INSTANCE_SERVER = "instance_server"
4849
APPLE_SILICON_SERVER = "apple_silicon_server"
50+
BAREMETAL_SERVER = "baremetal_server"
51+
BAREMETAL_SETTING = "baremetal_setting"
4952

5053
def __str__(self) -> str:
5154
return str(self.value)
@@ -56,6 +59,11 @@ class AccountOrganizationInfo:
5659
pass
5760

5861

62+
@dataclass
63+
class AccountProjectInfo:
64+
description: str
65+
66+
5967
@dataclass
6068
class AccountUserInfo:
6169
email: str
@@ -70,6 +78,18 @@ class AppleSiliconServerInfo:
7078
name: str
7179

7280

81+
@dataclass
82+
class BaremetalServerInfo:
83+
description: str
84+
85+
tags: List[str]
86+
87+
88+
@dataclass
89+
class BaremetalSettingInfo:
90+
type_: str
91+
92+
7393
@dataclass
7494
class InstanceServerInfo:
7595
name: str
@@ -163,6 +183,12 @@ class Resource:
163183

164184
apple_silicon_server_info: Optional[AppleSiliconServerInfo]
165185

186+
account_project_info: Optional[AccountProjectInfo]
187+
188+
baremetal_server_info: Optional[BaremetalServerInfo]
189+
190+
baremetal_setting_info: Optional[BaremetalSettingInfo]
191+
166192

167193
@dataclass
168194
class ProductService:

scaleway/scaleway/audit_trail/v1alpha1/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
from .types import ListEventsRequestOrderBy
44
from .types import ResourceType
55
from .types import AccountOrganizationInfo
6+
from .types import AccountProjectInfo
67
from .types import AccountUserInfo
78
from .types import AppleSiliconServerInfo
9+
from .types import BaremetalServerInfo
10+
from .types import BaremetalSettingInfo
811
from .types import InstanceServerInfo
912
from .types import KeyManagerKeyInfo
1013
from .types import KubernetesACLInfo
@@ -28,8 +31,11 @@
2831
"ListEventsRequestOrderBy",
2932
"ResourceType",
3033
"AccountOrganizationInfo",
34+
"AccountProjectInfo",
3135
"AccountUserInfo",
3236
"AppleSiliconServerInfo",
37+
"BaremetalServerInfo",
38+
"BaremetalSettingInfo",
3339
"InstanceServerInfo",
3440
"KeyManagerKeyInfo",
3541
"KubernetesACLInfo",

scaleway/scaleway/audit_trail/v1alpha1/marshalling.py

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@
66

77
from .types import (
88
AccountOrganizationInfo,
9+
AccountProjectInfo,
910
AccountUserInfo,
1011
AppleSiliconServerInfo,
12+
BaremetalServerInfo,
13+
BaremetalSettingInfo,
1114
InstanceServerInfo,
1215
KeyManagerKeyInfo,
1316
KubernetesACLInfo,
@@ -37,6 +40,21 @@ def unmarshal_AccountOrganizationInfo(data: Any) -> AccountOrganizationInfo:
3740
return AccountOrganizationInfo(**args)
3841

3942

43+
def unmarshal_AccountProjectInfo(data: Any) -> AccountProjectInfo:
44+
if not isinstance(data, dict):
45+
raise TypeError(
46+
"Unmarshalling the type 'AccountProjectInfo' failed as data isn't a dictionary."
47+
)
48+
49+
args: Dict[str, Any] = {}
50+
51+
field = data.get("description", None)
52+
if field is not None:
53+
args["description"] = field
54+
55+
return AccountProjectInfo(**args)
56+
57+
4058
def unmarshal_AccountUserInfo(data: Any) -> AccountUserInfo:
4159
if not isinstance(data, dict):
4260
raise TypeError(
@@ -77,6 +95,40 @@ def unmarshal_AppleSiliconServerInfo(data: Any) -> AppleSiliconServerInfo:
7795
return AppleSiliconServerInfo(**args)
7896

7997

98+
def unmarshal_BaremetalServerInfo(data: Any) -> BaremetalServerInfo:
99+
if not isinstance(data, dict):
100+
raise TypeError(
101+
"Unmarshalling the type 'BaremetalServerInfo' failed as data isn't a dictionary."
102+
)
103+
104+
args: Dict[str, Any] = {}
105+
106+
field = data.get("description", None)
107+
if field is not None:
108+
args["description"] = field
109+
110+
field = data.get("tags", None)
111+
if field is not None:
112+
args["tags"] = field
113+
114+
return BaremetalServerInfo(**args)
115+
116+
117+
def unmarshal_BaremetalSettingInfo(data: Any) -> BaremetalSettingInfo:
118+
if not isinstance(data, dict):
119+
raise TypeError(
120+
"Unmarshalling the type 'BaremetalSettingInfo' failed as data isn't a dictionary."
121+
)
122+
123+
args: Dict[str, Any] = {}
124+
125+
field = data.get("type", None)
126+
if field is not None:
127+
args["type_"] = field
128+
129+
return BaremetalSettingInfo(**args)
130+
131+
80132
def unmarshal_InstanceServerInfo(data: Any) -> InstanceServerInfo:
81133
if not isinstance(data, dict):
82134
raise TypeError(
@@ -344,6 +396,24 @@ def unmarshal_Resource(data: Any) -> Resource:
344396
else:
345397
args["apple_silicon_server_info"] = None
346398

399+
field = data.get("account_project_info", None)
400+
if field is not None:
401+
args["account_project_info"] = unmarshal_AccountProjectInfo(field)
402+
else:
403+
args["account_project_info"] = None
404+
405+
field = data.get("baremetal_server_info", None)
406+
if field is not None:
407+
args["baremetal_server_info"] = unmarshal_BaremetalServerInfo(field)
408+
else:
409+
args["baremetal_server_info"] = None
410+
411+
field = data.get("baremetal_setting_info", None)
412+
if field is not None:
413+
args["baremetal_setting_info"] = unmarshal_BaremetalSettingInfo(field)
414+
else:
415+
args["baremetal_setting_info"] = None
416+
347417
return Resource(**args)
348418

349419

scaleway/scaleway/audit_trail/v1alpha1/types.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,11 @@ class ResourceType(str, Enum, metaclass=StrEnumMeta):
4444
KEY_MANAGER_KEY = "key_manager_key"
4545
ACCOUNT_USER = "account_user"
4646
ACCOUNT_ORGANIZATION = "account_organization"
47+
ACCOUNT_PROJECT = "account_project"
4748
INSTANCE_SERVER = "instance_server"
4849
APPLE_SILICON_SERVER = "apple_silicon_server"
50+
BAREMETAL_SERVER = "baremetal_server"
51+
BAREMETAL_SETTING = "baremetal_setting"
4952

5053
def __str__(self) -> str:
5154
return str(self.value)
@@ -56,6 +59,11 @@ class AccountOrganizationInfo:
5659
pass
5760

5861

62+
@dataclass
63+
class AccountProjectInfo:
64+
description: str
65+
66+
5967
@dataclass
6068
class AccountUserInfo:
6169
email: str
@@ -70,6 +78,18 @@ class AppleSiliconServerInfo:
7078
name: str
7179

7280

81+
@dataclass
82+
class BaremetalServerInfo:
83+
description: str
84+
85+
tags: List[str]
86+
87+
88+
@dataclass
89+
class BaremetalSettingInfo:
90+
type_: str
91+
92+
7393
@dataclass
7494
class InstanceServerInfo:
7595
name: str
@@ -163,6 +183,12 @@ class Resource:
163183

164184
apple_silicon_server_info: Optional[AppleSiliconServerInfo]
165185

186+
account_project_info: Optional[AccountProjectInfo]
187+
188+
baremetal_server_info: Optional[BaremetalServerInfo]
189+
190+
baremetal_setting_info: Optional[BaremetalSettingInfo]
191+
166192

167193
@dataclass
168194
class ProductService:

0 commit comments

Comments
 (0)