Skip to content

Commit

Permalink
[BUGFIX] PLAT 2455: pilot log reading
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 5b209d0e8cbb82f2a310b15bbdceca081d1c954f
  • Loading branch information
mikeknep committed Nov 13, 2024
1 parent 4c50961 commit e576480
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 3 deletions.
26 changes: 25 additions & 1 deletion src/gretel_client/rest_v1/api/logs_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@

from typing import Any, Dict, List, Optional, Tuple, Union

from pydantic import Field, StrictFloat, StrictInt, StrictStr, validate_call
from pydantic import (
Field,
field_validator,
StrictFloat,
StrictInt,
StrictStr,
validate_call,
)
from typing_extensions import Annotated

from gretel_client.rest_v1.api_client import ApiClient, RequestSerialized
Expand Down Expand Up @@ -312,6 +319,7 @@ def get_logs(
query: Optional[StrictStr] = None,
limit: Optional[StrictInt] = None,
page_token: Optional[StrictStr] = None,
level: Optional[StrictStr] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Expand All @@ -333,6 +341,8 @@ def get_logs(
:type limit: int
:param page_token:
:type page_token: str
:param level:
:type level: str
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
Expand All @@ -359,6 +369,7 @@ def get_logs(
query=query,
limit=limit,
page_token=page_token,
level=level,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
Expand All @@ -383,6 +394,7 @@ def get_logs_with_http_info(
query: Optional[StrictStr] = None,
limit: Optional[StrictInt] = None,
page_token: Optional[StrictStr] = None,
level: Optional[StrictStr] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Expand All @@ -404,6 +416,8 @@ def get_logs_with_http_info(
:type limit: int
:param page_token:
:type page_token: str
:param level:
:type level: str
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
Expand All @@ -430,6 +444,7 @@ def get_logs_with_http_info(
query=query,
limit=limit,
page_token=page_token,
level=level,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
Expand All @@ -454,6 +469,7 @@ def get_logs_without_preload_content(
query: Optional[StrictStr] = None,
limit: Optional[StrictInt] = None,
page_token: Optional[StrictStr] = None,
level: Optional[StrictStr] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Expand All @@ -475,6 +491,8 @@ def get_logs_without_preload_content(
:type limit: int
:param page_token:
:type page_token: str
:param level:
:type level: str
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
Expand All @@ -501,6 +519,7 @@ def get_logs_without_preload_content(
query=query,
limit=limit,
page_token=page_token,
level=level,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
Expand All @@ -520,6 +539,7 @@ def _get_logs_serialize(
query,
limit,
page_token,
level,
_request_auth,
_content_type,
_headers,
Expand Down Expand Up @@ -551,6 +571,10 @@ def _get_logs_serialize(

_query_params.append(("page_token", page_token))

if level is not None:

_query_params.append(("level", level))

# process the header parameters
# process the form parameters
# process the body parameter
Expand Down
17 changes: 15 additions & 2 deletions src/gretel_client/rest_v1/models/log_envelope.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ class LogEnvelope(BaseModel):
ts: Optional[datetime] = Field(
default=None, description="The timestamp for the associated log message."
)
__properties: ClassVar[List[str]] = ["msg", "ts"]
level: Optional[StrictStr] = Field(
default=None, description="The level for the log message."
)
marker: Optional[StrictStr] = Field(
default=None, description="An optional marker set on the message"
)
__properties: ClassVar[List[str]] = ["msg", "ts", "level", "marker"]

model_config = ConfigDict(
populate_by_name=True,
Expand Down Expand Up @@ -87,5 +93,12 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
if not isinstance(obj, dict):
return cls.model_validate(obj)

_obj = cls.model_validate({"msg": obj.get("msg"), "ts": obj.get("ts")})
_obj = cls.model_validate(
{
"msg": obj.get("msg"),
"ts": obj.get("ts"),
"level": obj.get("level"),
"marker": obj.get("marker"),
}
)
return _obj

0 comments on commit e576480

Please sign in to comment.