Skip to content

feat(serverless): add timestamps to function resources #720

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 2 commits into from
Oct 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
48 changes: 33 additions & 15 deletions scaleway-async/scaleway_async/function/v1beta1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,30 @@ def unmarshal_Function(data: Any) -> Function:
else None
)

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

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

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

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

field = data.get("region", None)
if field is not None:
args["region"] = field
Expand All @@ -225,29 +249,23 @@ def unmarshal_Function(data: Any) -> Function:
if field is not None:
args["sandbox"] = field

field = data.get("timeout", None)
field = data.get("created_at", None)
if field is not None:
args["timeout"] = field
args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field
else:
args["timeout"] = None
args["created_at"] = None

field = data.get("error_message", None)
field = data.get("updated_at", None)
if field is not None:
args["error_message"] = field
args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field
else:
args["error_message"] = None
args["updated_at"] = None

field = data.get("build_message", None)
field = data.get("ready_at", None)
if field is not None:
args["build_message"] = field
args["ready_at"] = parser.isoparse(field) if isinstance(field, str) else field
else:
args["build_message"] = None

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

return Function(**args)

Expand Down
37 changes: 26 additions & 11 deletions scaleway-async/scaleway_async/function/v1beta1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,26 @@ class Function:
Secret environment variables of the function.
"""

timeout: Optional[str]
"""
Request processing time limit for the function.
"""

error_message: Optional[str]
"""
Error message if the function is in "error" state.
"""

build_message: Optional[str]
"""
Description of the current build step.
"""

description: Optional[str]
"""
Description of the function.
"""

region: Region
"""
Region in which the function is deployed.
Expand All @@ -538,24 +558,19 @@ class Function:
Execution environment of the function.
"""

timeout: Optional[str]
created_at: Optional[datetime]
"""
Request processing time limit for the function.
Creation date of the function.
"""

error_message: Optional[str]
updated_at: Optional[datetime]
"""
Error message if the function is in "error" state.
Last update date of the function.
"""

build_message: Optional[str]
"""
Description of the current build step.
ready_at: Optional[datetime]
"""

description: Optional[str]
"""
Description of the function.
Last date when the function was successfully deployed and set to ready.
"""


Expand Down
48 changes: 33 additions & 15 deletions scaleway/scaleway/function/v1beta1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,30 @@ def unmarshal_Function(data: Any) -> Function:
else None
)

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

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

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

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

field = data.get("region", None)
if field is not None:
args["region"] = field
Expand All @@ -225,29 +249,23 @@ def unmarshal_Function(data: Any) -> Function:
if field is not None:
args["sandbox"] = field

field = data.get("timeout", None)
field = data.get("created_at", None)
if field is not None:
args["timeout"] = field
args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field
else:
args["timeout"] = None
args["created_at"] = None

field = data.get("error_message", None)
field = data.get("updated_at", None)
if field is not None:
args["error_message"] = field
args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field
else:
args["error_message"] = None
args["updated_at"] = None

field = data.get("build_message", None)
field = data.get("ready_at", None)
if field is not None:
args["build_message"] = field
args["ready_at"] = parser.isoparse(field) if isinstance(field, str) else field
else:
args["build_message"] = None

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

return Function(**args)

Expand Down
37 changes: 26 additions & 11 deletions scaleway/scaleway/function/v1beta1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,26 @@ class Function:
Secret environment variables of the function.
"""

timeout: Optional[str]
"""
Request processing time limit for the function.
"""

error_message: Optional[str]
"""
Error message if the function is in "error" state.
"""

build_message: Optional[str]
"""
Description of the current build step.
"""

description: Optional[str]
"""
Description of the function.
"""

region: Region
"""
Region in which the function is deployed.
Expand All @@ -538,24 +558,19 @@ class Function:
Execution environment of the function.
"""

timeout: Optional[str]
created_at: Optional[datetime]
"""
Request processing time limit for the function.
Creation date of the function.
"""

error_message: Optional[str]
updated_at: Optional[datetime]
"""
Error message if the function is in "error" state.
Last update date of the function.
"""

build_message: Optional[str]
"""
Description of the current build step.
ready_at: Optional[datetime]
"""

description: Optional[str]
"""
Description of the function.
Last date when the function was successfully deployed and set to ready.
"""


Expand Down