Skip to content
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
7 changes: 6 additions & 1 deletion simvue/api/objects/alert/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ def __init__(self, identifier: str | None = None, **kwargs) -> None:
"""Retrieve an alert from the Simvue server by identifier"""
self._label = "alert"
super().__init__(identifier=identifier, **kwargs)
self._local_only_args = ["frequency", "pattern", "aggregation"]
self._local_only_args = [
"frequency",
"pattern",
"aggregation",
"status",
]

def compare(self, other: "AlertBase") -> bool:
"""Compare this alert to another"""
Expand Down
8 changes: 4 additions & 4 deletions simvue/api/objects/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def __init__(
# For simvue object initialisation, unlike the server there is no nested
# arguments, however this means that there are extra keys during post which
# need removing, this attribute handles that and should be set in subclasses.
self._local_only_args: list[str] = []
self._local_only_args: list[str] = ["created"]

self._identifier: str | None = (
identifier if identifier is not None else f"offline_{uuid.uuid1()}"
Expand Down Expand Up @@ -636,13 +636,13 @@ def _post_batch(
def _post_single(
self, *, is_json: bool = True, data: list | dict | None = None, **kwargs
) -> dict[str, typing.Any] | list[dict[str, typing.Any]]:
if not is_json:
kwargs = msgpack.packb(data or kwargs, use_bin_type=True)

# Remove any extra keys
for key in self._local_only_args:
_ = (data or kwargs).pop(key, None)

if not is_json:
kwargs = msgpack.packb(data or kwargs, use_bin_type=True)

_response = sv_post(
url=f"{self._base_url}",
headers=self._headers | {"Content-Type": "application/msgpack"},
Expand Down
7 changes: 7 additions & 0 deletions simvue/api/objects/storage/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ def __init__(self, identifier: str | None = None, **kwargs) -> None:
"""Initialise an S3Storage instance attaching a configuration"""
self.config = Config(self)
super().__init__(identifier, **kwargs)
self._local_only_args: list[str] = [
"endpoint_url",
"region_name",
"access_key_id",
"secret_access_key",
"bucket",
]

@classmethod
@pydantic.validate_call
Expand Down
Loading