Skip to content

Commit cc078b2

Browse files
authored
feat(audit_trail): add Kubernetes ACL resource (#770)
1 parent b2cce67 commit cc078b2

File tree

6 files changed

+56
-0
lines changed

6 files changed

+56
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
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 KubernetesACLInfo
56
from .types import KubernetesClusterInfo
67
from .types import KubernetesNodeInfo
78
from .types import KubernetesPoolInfo
@@ -20,6 +21,7 @@
2021
__all__ = [
2122
"ListEventsRequestOrderBy",
2223
"ResourceType",
24+
"KubernetesACLInfo",
2325
"KubernetesClusterInfo",
2426
"KubernetesNodeInfo",
2527
"KubernetesPoolInfo",

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

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

77
from .types import (
8+
KubernetesACLInfo,
89
KubernetesClusterInfo,
910
KubernetesNodeInfo,
1011
KubernetesPoolInfo,
@@ -19,6 +20,17 @@
1920
)
2021

2122

23+
def unmarshal_KubernetesACLInfo(data: Any) -> KubernetesACLInfo:
24+
if not isinstance(data, dict):
25+
raise TypeError(
26+
"Unmarshalling the type 'KubernetesACLInfo' failed as data isn't a dictionary."
27+
)
28+
29+
args: Dict[str, Any] = {}
30+
31+
return KubernetesACLInfo(**args)
32+
33+
2234
def unmarshal_KubernetesClusterInfo(data: Any) -> KubernetesClusterInfo:
2335
if not isinstance(data, dict):
2436
raise TypeError(
@@ -187,6 +199,12 @@ def unmarshal_Resource(data: Any) -> Resource:
187199
else:
188200
args["kube_node_info"] = None
189201

202+
field = data.get("kube_acl_info", None)
203+
if field is not None:
204+
args["kube_acl_info"] = unmarshal_KubernetesACLInfo(field)
205+
else:
206+
args["kube_acl_info"] = None
207+
190208
return Resource(**args)
191209

192210

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,17 @@ class ResourceType(str, Enum, metaclass=StrEnumMeta):
3030
KUBE_CLUSTER = "kube_cluster"
3131
KUBE_POOL = "kube_pool"
3232
KUBE_NODE = "kube_node"
33+
KUBE_ACL = "kube_acl"
3334

3435
def __str__(self) -> str:
3536
return str(self.value)
3637

3738

39+
@dataclass
40+
class KubernetesACLInfo:
41+
pass
42+
43+
3844
@dataclass
3945
class KubernetesClusterInfo:
4046
pass
@@ -93,6 +99,8 @@ class Resource:
9399

94100
kube_node_info: Optional[KubernetesNodeInfo]
95101

102+
kube_acl_info: Optional[KubernetesACLInfo]
103+
96104

97105
@dataclass
98106
class Event:

scaleway/scaleway/audit_trail/v1alpha1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
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 KubernetesACLInfo
56
from .types import KubernetesClusterInfo
67
from .types import KubernetesNodeInfo
78
from .types import KubernetesPoolInfo
@@ -20,6 +21,7 @@
2021
__all__ = [
2122
"ListEventsRequestOrderBy",
2223
"ResourceType",
24+
"KubernetesACLInfo",
2325
"KubernetesClusterInfo",
2426
"KubernetesNodeInfo",
2527
"KubernetesPoolInfo",

scaleway/scaleway/audit_trail/v1alpha1/marshalling.py

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

77
from .types import (
8+
KubernetesACLInfo,
89
KubernetesClusterInfo,
910
KubernetesNodeInfo,
1011
KubernetesPoolInfo,
@@ -19,6 +20,17 @@
1920
)
2021

2122

23+
def unmarshal_KubernetesACLInfo(data: Any) -> KubernetesACLInfo:
24+
if not isinstance(data, dict):
25+
raise TypeError(
26+
"Unmarshalling the type 'KubernetesACLInfo' failed as data isn't a dictionary."
27+
)
28+
29+
args: Dict[str, Any] = {}
30+
31+
return KubernetesACLInfo(**args)
32+
33+
2234
def unmarshal_KubernetesClusterInfo(data: Any) -> KubernetesClusterInfo:
2335
if not isinstance(data, dict):
2436
raise TypeError(
@@ -187,6 +199,12 @@ def unmarshal_Resource(data: Any) -> Resource:
187199
else:
188200
args["kube_node_info"] = None
189201

202+
field = data.get("kube_acl_info", None)
203+
if field is not None:
204+
args["kube_acl_info"] = unmarshal_KubernetesACLInfo(field)
205+
else:
206+
args["kube_acl_info"] = None
207+
190208
return Resource(**args)
191209

192210

scaleway/scaleway/audit_trail/v1alpha1/types.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,17 @@ class ResourceType(str, Enum, metaclass=StrEnumMeta):
3030
KUBE_CLUSTER = "kube_cluster"
3131
KUBE_POOL = "kube_pool"
3232
KUBE_NODE = "kube_node"
33+
KUBE_ACL = "kube_acl"
3334

3435
def __str__(self) -> str:
3536
return str(self.value)
3637

3738

39+
@dataclass
40+
class KubernetesACLInfo:
41+
pass
42+
43+
3844
@dataclass
3945
class KubernetesClusterInfo:
4046
pass
@@ -93,6 +99,8 @@ class Resource:
9399

94100
kube_node_info: Optional[KubernetesNodeInfo]
95101

102+
kube_acl_info: Optional[KubernetesACLInfo]
103+
96104

97105
@dataclass
98106
class Event:

0 commit comments

Comments
 (0)