Skip to content

Commit

Permalink
Check hid if uid is provided. (#159)
Browse files Browse the repository at this point in the history
Co-authored-by: PanekOndrej <[email protected]>
  • Loading branch information
iazehaf and PanekOndrej authored Aug 16, 2023
1 parent 8276bf1 commit 3067b72
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions src/ansys/optislang/core/server_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,9 +752,9 @@ def reset(actor_uid: str = None, hid: str = None, password: str = None) -> str:
Parameters
----------
actor_uid: str, opt
Actor uid entry.
Actor uid entry. A Hirearchical ID (hid) is required.
hid: str, opt
Hid entry.
Hid entry. The actor uid is required.
password : str, opt
Password.
Expand All @@ -763,6 +763,10 @@ def reset(actor_uid: str = None, hid: str = None, password: str = None) -> str:
str
JSON string of ``reset`` command.
"""
if actor_uid and hid is None:
raise ValueError("The Hirearchical ID (hid) is required.")
elif actor_uid is None and hid:
raise ValueError("The actor uid is required.")
return _to_json(
_gen_server_command(command=_RESET, actor_uid=actor_uid, hid=hid, password=password)
)
Expand All @@ -774,9 +778,9 @@ def restart(actor_uid: str = None, hid: str = None, password: str = None) -> str
Parameters
----------
actor_uid: str, opt
Actor uid entry.
Actor uid entry. A Hirearchical ID (hid) is required.
hid: str, opt
Hid entry.
Hid entry. The actor uid is required.
password : str, opt
Password.
Expand All @@ -785,6 +789,10 @@ def restart(actor_uid: str = None, hid: str = None, password: str = None) -> str
str
JSON string of ``restart`` command.
"""
if actor_uid and hid is None:
raise ValueError("The Hirearchical ID (hid) is required.")
elif actor_uid is None and hid:
raise ValueError("The actor uid is required.")
return _to_json(
_gen_server_command(command=_RESTART, actor_uid=actor_uid, hid=hid, password=password)
)
Expand Down Expand Up @@ -1316,9 +1324,9 @@ def stop(actor_uid: str = None, hid: str = None, password: str = None) -> str:
Parameters
----------
actor_uid: str, opt
Actor uid entry.
Actor uid entry. A Hirearchical ID (hid) is required.
hid: str, opt
Hid entry.
Hid entry. The actor uid is required.
password : str, opt
Password.
Expand All @@ -1327,6 +1335,11 @@ def stop(actor_uid: str = None, hid: str = None, password: str = None) -> str:
str
JSON string of ``stop`` command.
"""
if actor_uid and hid is None:
raise ValueError("The Hirearchical ID (hid) is required.")
elif actor_uid is None and hid:
raise ValueError("The actor uid is required.")

return _to_json(
_gen_server_command(command=_STOP, actor_uid=actor_uid, hid=hid, password=password)
)
Expand All @@ -1338,9 +1351,9 @@ def stop_gently(actor_uid: str = None, hid: str = None, password: str = None) ->
Parameters
----------
actor_uid: str, opt
Actor uid entry.
Actor uid entry. A Hirearchical ID (hid) is required.
hid: str, opt
Hid entry.
Hid entry. The actor uid is required.
password : str, opt
Password.
Expand All @@ -1349,6 +1362,10 @@ def stop_gently(actor_uid: str = None, hid: str = None, password: str = None) ->
str
JSON string of ``stop_gently`` command.
"""
if actor_uid and hid is None:
raise ValueError("The Hirearchical ID (hid) is required.")
elif actor_uid is None and hid:
raise ValueError("The actor uid is required.")
return _to_json(
_gen_server_command(command=_STOP_GENTLY, actor_uid=actor_uid, hid=hid, password=password)
)
Expand Down

0 comments on commit 3067b72

Please sign in to comment.