Skip to content

Commit

Permalink
feat(audit_trail): add key manager to resource api (scaleway#853)
Browse files Browse the repository at this point in the history
  • Loading branch information
scaleway-bot authored Feb 11, 2025
1 parent 661db26 commit 44203be
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 0 deletions.
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 KeyManagerKeyInfo
from .types import KubernetesACLInfo
from .types import KubernetesClusterInfo
from .types import KubernetesNodeInfo
Expand All @@ -22,6 +23,7 @@
__all__ = [
"ListEventsRequestOrderBy",
"ResourceType",
"KeyManagerKeyInfo",
"KubernetesACLInfo",
"KubernetesClusterInfo",
"KubernetesNodeInfo",
Expand Down
18 changes: 18 additions & 0 deletions scaleway-async/scaleway_async/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 (
KeyManagerKeyInfo,
KubernetesACLInfo,
KubernetesClusterInfo,
KubernetesNodeInfo,
Expand All @@ -21,6 +22,17 @@
)


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

args: Dict[str, Any] = {}

return KeyManagerKeyInfo(**args)


def unmarshal_KubernetesACLInfo(data: Any) -> KubernetesACLInfo:
if not isinstance(data, dict):
raise TypeError(
Expand Down Expand Up @@ -206,6 +218,12 @@ def unmarshal_Resource(data: Any) -> Resource:
else:
args["kube_acl_info"] = None

field = data.get("keym_key_info", None)
if field is not None:
args["keym_key_info"] = unmarshal_KeyManagerKeyInfo(field)
else:
args["keym_key_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 @@ -31,11 +31,17 @@ class ResourceType(str, Enum, metaclass=StrEnumMeta):
KUBE_POOL = "kube_pool"
KUBE_NODE = "kube_node"
KUBE_ACL = "kube_acl"
KEYM_KEY = "keym_key"

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


@dataclass
class KeyManagerKeyInfo:
pass


@dataclass
class KubernetesACLInfo:
pass
Expand Down Expand Up @@ -101,6 +107,8 @@ class Resource:

kube_acl_info: Optional[KubernetesACLInfo]

keym_key_info: Optional[KeyManagerKeyInfo]


@dataclass
class ProductService:
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 KeyManagerKeyInfo
from .types import KubernetesACLInfo
from .types import KubernetesClusterInfo
from .types import KubernetesNodeInfo
Expand All @@ -22,6 +23,7 @@
__all__ = [
"ListEventsRequestOrderBy",
"ResourceType",
"KeyManagerKeyInfo",
"KubernetesACLInfo",
"KubernetesClusterInfo",
"KubernetesNodeInfo",
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 (
KeyManagerKeyInfo,
KubernetesACLInfo,
KubernetesClusterInfo,
KubernetesNodeInfo,
Expand All @@ -21,6 +22,17 @@
)


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

args: Dict[str, Any] = {}

return KeyManagerKeyInfo(**args)


def unmarshal_KubernetesACLInfo(data: Any) -> KubernetesACLInfo:
if not isinstance(data, dict):
raise TypeError(
Expand Down Expand Up @@ -206,6 +218,12 @@ def unmarshal_Resource(data: Any) -> Resource:
else:
args["kube_acl_info"] = None

field = data.get("keym_key_info", None)
if field is not None:
args["keym_key_info"] = unmarshal_KeyManagerKeyInfo(field)
else:
args["keym_key_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 @@ -31,11 +31,17 @@ class ResourceType(str, Enum, metaclass=StrEnumMeta):
KUBE_POOL = "kube_pool"
KUBE_NODE = "kube_node"
KUBE_ACL = "kube_acl"
KEYM_KEY = "keym_key"

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


@dataclass
class KeyManagerKeyInfo:
pass


@dataclass
class KubernetesACLInfo:
pass
Expand Down Expand Up @@ -101,6 +107,8 @@ class Resource:

kube_acl_info: Optional[KubernetesACLInfo]

keym_key_info: Optional[KeyManagerKeyInfo]


@dataclass
class ProductService:
Expand Down

0 comments on commit 44203be

Please sign in to comment.