Skip to content
Closed
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 @@ -17,6 +17,7 @@
from .types import SecretManagerSecretInfo
from .types import SecretManagerSecretVersionInfo
from .types import EventPrincipal
from .types import EventSystem
from .types import Resource
from .types import ProductService
from .types import Event
Expand Down Expand Up @@ -45,6 +46,7 @@
"SecretManagerSecretInfo",
"SecretManagerSecretVersionInfo",
"EventPrincipal",
"EventSystem",
"Resource",
"ProductService",
"Event",
Expand Down
44 changes: 43 additions & 1 deletion scaleway-async/scaleway_async/audit_trail/v1alpha1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,62 @@
# If you have any remark or suggestion do not hesitate to open an issue.

from datetime import datetime
from typing import Optional
from typing import Any, Awaitable, Dict, List, Optional, Union

from scaleway_core.api import API
from scaleway_core.bridge import (
Money,
Region as ScwRegion,
ScwFile,
ServiceInfo,
TimeSeries,
TimeSeriesPoint,
Zone as ScwZone,
marshal_Money,
unmarshal_Money,
marshal_ScwFile,
unmarshal_ScwFile,
unmarshal_ServiceInfo,
marshal_TimeSeries,
unmarshal_TimeSeries,
)
from scaleway_core.utils import (
OneOfPossibility,
WaitForOptions,
project_or_organization_id,
random_name,
resolve_one_of,
validate_path_param,
fetch_all_pages_async,
wait_for_resource_async,
)
from .types import (
ListEventsRequestOrderBy,
ResourceType,
AccountOrganizationInfo,
AccountProjectInfo,
AccountUserInfo,
AppleSiliconServerInfo,
BaremetalServerInfo,
BaremetalSettingInfo,
Event,
EventPrincipal,
EventSystem,
InstanceServerInfo,
KeyManagerKeyInfo,
KubernetesACLInfo,
KubernetesClusterInfo,
KubernetesNodeInfo,
KubernetesPoolInfo,
ListEventsRequest,
ListEventsResponse,
ListProductsRequest,
ListProductsResponse,
Product,
ProductService,
Resource,
SecretManagerSecretInfo,
SecretManagerSecretVersionInfo,
)
from .marshalling import (
unmarshal_ListEventsResponse,
Expand Down
88 changes: 67 additions & 21 deletions scaleway-async/scaleway_async/audit_trail/v1alpha1/marshalling.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,34 @@
# This file was automatically generated. DO NOT EDIT.
# If you have any remark or suggestion do not hesitate to open an issue.

from typing import Any, Dict
from decimal import Decimal
from datetime import datetime
from typing import Any, Dict, List, Optional
from dateutil import parser

from scaleway_core.profile import ProfileDefaults
from scaleway_core.bridge import (
Money,
Region as ScwRegion,
ScwFile,
ServiceInfo,
TimeSeries,
TimeSeriesPoint,
Zone as ScwZone,
unmarshal_Money,
marshal_Money,
marshal_ScwFile,
marshal_ServiceInfo,
marshal_TimeSeries,
unmarshal_TimeSeries,
)
from scaleway_core.utils import (
OneOfPossibility,
resolve_one_of,
)
from .types import (
ListEventsRequestOrderBy,
ResourceType,
AccountOrganizationInfo,
AccountProjectInfo,
AccountUserInfo,
Expand All @@ -20,6 +44,7 @@
SecretManagerSecretInfo,
SecretManagerSecretVersionInfo,
EventPrincipal,
EventSystem,
Resource,
Event,
ListEventsResponse,
Expand Down Expand Up @@ -268,6 +293,21 @@ def unmarshal_EventPrincipal(data: Any) -> EventPrincipal:
return EventPrincipal(**args)


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

args: Dict[str, Any] = {}

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

return EventSystem(**args)


def unmarshal_Resource(data: Any) -> Resource:
if not isinstance(data, dict):
raise TypeError(
Expand Down Expand Up @@ -445,6 +485,14 @@ def unmarshal_Event(data: Any) -> Event:
if field is not None:
args["product_name"] = field

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

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

field = data.get("recorded_at", None)
if field is not None:
args["recorded_at"] = (
Expand All @@ -459,26 +507,6 @@ def unmarshal_Event(data: Any) -> Event:
else:
args["principal"] = None

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

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

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

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

field = data.get("resources", None)
if field is not None:
args["resources"] = (
Expand All @@ -493,6 +521,24 @@ def unmarshal_Event(data: Any) -> Event:
if field is not None:
args["status_code"] = field

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

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

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

field = data.get("request_body", None)
if field is not None:
args["request_body"] = field
Expand Down
29 changes: 20 additions & 9 deletions scaleway-async/scaleway_async/audit_trail/v1alpha1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@
from __future__ import annotations

from dataclasses import dataclass
from decimal import Decimal
from datetime import datetime
from enum import Enum
from typing import Any, Dict, List, Optional

from scaleway_core.bridge import (
Money,
Region as ScwRegion,
ScwFile,
ServiceInfo,
TimeSeries,
TimeSeriesPoint,
Zone as ScwZone,
)
from scaleway_core.utils import (
StrEnumMeta,
Expand Down Expand Up @@ -141,6 +148,11 @@ class EventPrincipal:
id: str


@dataclass
class EventSystem:
name: str


@dataclass
class Resource:
id: str
Expand Down Expand Up @@ -224,14 +236,14 @@ class Event:
Product name of the resource attached to the event.
"""

recorded_at: Optional[datetime]
service_name: str
"""
Timestamp of the event.
API name called to trigger the event.
"""

principal: Optional[EventPrincipal]
recorded_at: Optional[datetime]
"""
User or IAM application at the origin of the event.
Timestamp of the event.
"""

project_id: Optional[str]
Expand All @@ -244,11 +256,6 @@ class Event:
User Agent at the origin of the event.
"""

service_name: str
"""
API name called to trigger the event.
"""

method_name: str
"""
API method called to trigger the event.
Expand All @@ -274,6 +281,10 @@ class Event:
Request at the origin of the event.
"""

principal: Optional[EventPrincipal]

system: Optional[EventSystem]


@dataclass
class Product:
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 @@ -17,6 +17,7 @@
from .types import SecretManagerSecretInfo
from .types import SecretManagerSecretVersionInfo
from .types import EventPrincipal
from .types import EventSystem
from .types import Resource
from .types import ProductService
from .types import Event
Expand Down Expand Up @@ -45,6 +46,7 @@
"SecretManagerSecretInfo",
"SecretManagerSecretVersionInfo",
"EventPrincipal",
"EventSystem",
"Resource",
"ProductService",
"Event",
Expand Down
44 changes: 43 additions & 1 deletion scaleway/scaleway/audit_trail/v1alpha1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,62 @@
# If you have any remark or suggestion do not hesitate to open an issue.

from datetime import datetime
from typing import Optional
from typing import Any, Awaitable, Dict, List, Optional, Union

from scaleway_core.api import API
from scaleway_core.bridge import (
Money,
Region as ScwRegion,
ScwFile,
ServiceInfo,
TimeSeries,
TimeSeriesPoint,
Zone as ScwZone,
marshal_Money,
unmarshal_Money,
marshal_ScwFile,
unmarshal_ScwFile,
unmarshal_ServiceInfo,
marshal_TimeSeries,
unmarshal_TimeSeries,
)
from scaleway_core.utils import (
OneOfPossibility,
WaitForOptions,
project_or_organization_id,
random_name,
resolve_one_of,
validate_path_param,
fetch_all_pages,
wait_for_resource,
)
from .types import (
ListEventsRequestOrderBy,
ResourceType,
AccountOrganizationInfo,
AccountProjectInfo,
AccountUserInfo,
AppleSiliconServerInfo,
BaremetalServerInfo,
BaremetalSettingInfo,
Event,
EventPrincipal,
EventSystem,
InstanceServerInfo,
KeyManagerKeyInfo,
KubernetesACLInfo,
KubernetesClusterInfo,
KubernetesNodeInfo,
KubernetesPoolInfo,
ListEventsRequest,
ListEventsResponse,
ListProductsRequest,
ListProductsResponse,
Product,
ProductService,
Resource,
SecretManagerSecretInfo,
SecretManagerSecretVersionInfo,
)
from .marshalling import (
unmarshal_ListEventsResponse,
Expand Down
Loading
Loading