Skip to content

feat(audit_trail): add Kubernetes ACL resource #770

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# If you have any remark or suggestion do not hesitate to open an issue.
from .types import ListEventsRequestOrderBy
from .types import ResourceType
from .types import KubernetesACLInfo
from .types import KubernetesClusterInfo
from .types import KubernetesNodeInfo
from .types import KubernetesPoolInfo
Expand All @@ -20,6 +21,7 @@
__all__ = [
"ListEventsRequestOrderBy",
"ResourceType",
"KubernetesACLInfo",
"KubernetesClusterInfo",
"KubernetesNodeInfo",
"KubernetesPoolInfo",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from dateutil import parser

from .types import (
KubernetesACLInfo,
KubernetesClusterInfo,
KubernetesNodeInfo,
KubernetesPoolInfo,
Expand All @@ -19,6 +20,17 @@
)


def unmarshal_KubernetesACLInfo(data: Any) -> KubernetesACLInfo:
if not isinstance(data, dict):
raise TypeError(
"Unmarshalling the type 'KubernetesACLInfo' failed as data isn't a dictionary."
)

args: Dict[str, Any] = {}

return KubernetesACLInfo(**args)


def unmarshal_KubernetesClusterInfo(data: Any) -> KubernetesClusterInfo:
if not isinstance(data, dict):
raise TypeError(
Expand Down Expand Up @@ -187,6 +199,12 @@ def unmarshal_Resource(data: Any) -> Resource:
else:
args["kube_node_info"] = None

field = data.get("kube_acl_info", None)
if field is not None:
args["kube_acl_info"] = unmarshal_KubernetesACLInfo(field)
else:
args["kube_acl_info"] = None

return Resource(**args)


Expand Down
8 changes: 8 additions & 0 deletions scaleway-async/scaleway_async/audit_trail/v1alpha1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,17 @@ class ResourceType(str, Enum, metaclass=StrEnumMeta):
KUBE_CLUSTER = "kube_cluster"
KUBE_POOL = "kube_pool"
KUBE_NODE = "kube_node"
KUBE_ACL = "kube_acl"

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


@dataclass
class KubernetesACLInfo:
pass


@dataclass
class KubernetesClusterInfo:
pass
Expand Down Expand Up @@ -93,6 +99,8 @@ class Resource:

kube_node_info: Optional[KubernetesNodeInfo]

kube_acl_info: Optional[KubernetesACLInfo]


@dataclass
class Event:
Expand Down
2 changes: 2 additions & 0 deletions scaleway/scaleway/audit_trail/v1alpha1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# If you have any remark or suggestion do not hesitate to open an issue.
from .types import ListEventsRequestOrderBy
from .types import ResourceType
from .types import KubernetesACLInfo
from .types import KubernetesClusterInfo
from .types import KubernetesNodeInfo
from .types import KubernetesPoolInfo
Expand All @@ -20,6 +21,7 @@
__all__ = [
"ListEventsRequestOrderBy",
"ResourceType",
"KubernetesACLInfo",
"KubernetesClusterInfo",
"KubernetesNodeInfo",
"KubernetesPoolInfo",
Expand Down
18 changes: 18 additions & 0 deletions scaleway/scaleway/audit_trail/v1alpha1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from dateutil import parser

from .types import (
KubernetesACLInfo,
KubernetesClusterInfo,
KubernetesNodeInfo,
KubernetesPoolInfo,
Expand All @@ -19,6 +20,17 @@
)


def unmarshal_KubernetesACLInfo(data: Any) -> KubernetesACLInfo:
if not isinstance(data, dict):
raise TypeError(
"Unmarshalling the type 'KubernetesACLInfo' failed as data isn't a dictionary."
)

args: Dict[str, Any] = {}

return KubernetesACLInfo(**args)


def unmarshal_KubernetesClusterInfo(data: Any) -> KubernetesClusterInfo:
if not isinstance(data, dict):
raise TypeError(
Expand Down Expand Up @@ -187,6 +199,12 @@ def unmarshal_Resource(data: Any) -> Resource:
else:
args["kube_node_info"] = None

field = data.get("kube_acl_info", None)
if field is not None:
args["kube_acl_info"] = unmarshal_KubernetesACLInfo(field)
else:
args["kube_acl_info"] = None

return Resource(**args)


Expand Down
8 changes: 8 additions & 0 deletions scaleway/scaleway/audit_trail/v1alpha1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,17 @@ class ResourceType(str, Enum, metaclass=StrEnumMeta):
KUBE_CLUSTER = "kube_cluster"
KUBE_POOL = "kube_pool"
KUBE_NODE = "kube_node"
KUBE_ACL = "kube_acl"

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


@dataclass
class KubernetesACLInfo:
pass


@dataclass
class KubernetesClusterInfo:
pass
Expand Down Expand Up @@ -93,6 +99,8 @@ class Resource:

kube_node_info: Optional[KubernetesNodeInfo]

kube_acl_info: Optional[KubernetesACLInfo]


@dataclass
class Event:
Expand Down