Skip to content

feat: update generated APIs #1060

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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 @@ -345,6 +345,10 @@ def unmarshal_Event(data: Any) -> Event:
if field is not None:
args["source_ip"] = field

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

field = data.get("recorded_at", None)
if field is not None:
args["recorded_at"] = (
Expand All @@ -371,10 +375,6 @@ def unmarshal_Event(data: Any) -> Event:
else:
args["user_agent"] = None

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

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

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

field = data.get("request_body", None)
if field is not None:
args["request_body"] = field
Expand Down
15 changes: 5 additions & 10 deletions scaleway-async/scaleway_async/audit_trail/v1alpha1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ class Event:
IP address at the origin of the event.
"""

product_name: str
"""
Product name of the resource attached to the event.
"""

recorded_at: Optional[datetime]
"""
Timestamp of the event.
Expand All @@ -203,11 +208,6 @@ class Event:
User Agent at the origin of the event.
"""

product_name: str
"""
Product name of the resource attached to the event.
"""

service_name: str
"""
API name called to trigger the event.
Expand All @@ -233,11 +233,6 @@ class Event:
HTTP status code resulting of the API call.
"""

resource: Optional[Resource]
"""
Resource attached to the event.
"""

request_body: Optional[Dict[str, Any]]
"""
Request at the origin of the event.
Expand Down
7 changes: 7 additions & 0 deletions scaleway-core/scaleway_core/utils/resolve_one_of.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ def resolve_one_of(
# Get the first non-empty default
for possibility in possibilities:
if possibility.default is not None:
if possibility.marshal_func is not None:
# When no actual value, call with None as value
return {
possibility.param: possibility.marshal_func(
None, possibility.default
)
}
return {possibility.param: possibility.default}

# If required, raise an error
Expand Down
14 changes: 4 additions & 10 deletions scaleway/scaleway/audit_trail/v1alpha1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,10 @@ def unmarshal_Event(data: Any) -> Event:
if field is not None:
args["source_ip"] = field

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

field = data.get("recorded_at", None)
if field is not None:
args["recorded_at"] = (
Expand All @@ -371,10 +375,6 @@ def unmarshal_Event(data: Any) -> Event:
else:
args["user_agent"] = None

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

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

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

field = data.get("request_body", None)
if field is not None:
args["request_body"] = field
Expand Down
15 changes: 5 additions & 10 deletions scaleway/scaleway/audit_trail/v1alpha1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ class Event:
IP address at the origin of the event.
"""

product_name: str
"""
Product name of the resource attached to the event.
"""

recorded_at: Optional[datetime]
"""
Timestamp of the event.
Expand All @@ -203,11 +208,6 @@ class Event:
User Agent at the origin of the event.
"""

product_name: str
"""
Product name of the resource attached to the event.
"""

service_name: str
"""
API name called to trigger the event.
Expand All @@ -233,11 +233,6 @@ class Event:
HTTP status code resulting of the API call.
"""

resource: Optional[Resource]
"""
Resource attached to the event.
"""

request_body: Optional[Dict[str, Any]]
"""
Request at the origin of the event.
Expand Down
Loading