qapu-cli 0.77.0__tar.gz → 0.78.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/PKG-INFO +1 -1
  2. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/pyproject.toml +1 -1
  3. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/qapu_cli/command_packages.py +3 -0
  4. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/qapu_cli/main.py +58 -4
  5. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/qapu_cli.egg-info/PKG-INFO +1 -1
  6. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/README.md +0 -0
  7. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/qapu_cli/__init__.py +0 -0
  8. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/qapu_cli/client.py +0 -0
  9. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/qapu_cli/tui/__init__.py +0 -0
  10. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/qapu_cli/tui/app.py +0 -0
  11. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/qapu_cli/tui/app.tcss +0 -0
  12. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/qapu_cli/tui/data.py +0 -0
  13. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/qapu_cli/tui/rendering.py +0 -0
  14. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/qapu_cli/tui/screens/__init__.py +0 -0
  15. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/qapu_cli/tui/screens/catalog.py +0 -0
  16. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/qapu_cli/tui/screens/catalog_form.py +0 -0
  17. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/qapu_cli/tui/screens/catalog_picker.py +0 -0
  18. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/qapu_cli/tui/screens/confirm.py +0 -0
  19. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/qapu_cli/tui/screens/dashboard.py +0 -0
  20. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/qapu_cli/tui/screens/device_authorization.py +0 -0
  21. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/qapu_cli/tui/screens/device_edit.py +0 -0
  22. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/qapu_cli/tui/screens/device_list.py +0 -0
  23. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/qapu_cli/tui/screens/equipment_form.py +0 -0
  24. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/qapu_cli/tui/screens/group_detail.py +0 -0
  25. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/qapu_cli/tui/screens/group_form.py +0 -0
  26. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/qapu_cli/tui/screens/group_list.py +0 -0
  27. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/qapu_cli/tui/screens/infrastructure.py +0 -0
  28. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/qapu_cli/tui/widgets/__init__.py +0 -0
  29. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/qapu_cli/tui/widgets/device_table.py +0 -0
  30. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/qapu_cli/visibility.py +0 -0
  31. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/qapu_cli.egg-info/SOURCES.txt +0 -0
  32. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/qapu_cli.egg-info/dependency_links.txt +0 -0
  33. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/qapu_cli.egg-info/entry_points.txt +0 -0
  34. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/qapu_cli.egg-info/requires.txt +0 -0
  35. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/qapu_cli.egg-info/top_level.txt +0 -0
  36. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/setup.cfg +0 -0
  37. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/tests/test_command_packages_complete.py +0 -0
  38. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/tests/test_login.py +0 -0
  39. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/tests/test_logout.py +0 -0
  40. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/tests/test_tui_authorization.py +0 -0
  41. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/tests/test_tui_catalog.py +0 -0
  42. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/tests/test_tui_device_edit.py +0 -0
  43. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/tests/test_tui_electrical_parent.py +0 -0
  44. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/tests/test_tui_groups.py +0 -0
  45. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/tests/test_tui_infrastructure.py +0 -0
  46. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/tests/test_tui_smoke.py +0 -0
  47. {qapu_cli-0.77.0 → qapu_cli-0.78.0}/tests/test_visibility.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: qapu-cli
3
- Version: 0.77.0
3
+ Version: 0.78.0
4
4
  Summary: CLI client for the Qapu API - built for the Hermes agent, but usable by anyone talking to api.ovoo.com.tr from outside the Swarm.
5
5
  Author: OVOO Technology
6
6
  Classifier: Programming Language :: Python :: 3
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "qapu-cli"
3
- version = "0.77.0"
3
+ version = "0.78.0"
4
4
  description = "CLI client for the Qapu API - built for the Hermes agent, but usable by anyone talking to api.ovoo.com.tr from outside the Swarm."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -200,8 +200,11 @@ COMMAND_REQUIRED_PACKAGES: dict[str, frozenset[str]] = {
200
200
  "score_watch": frozenset({"scores:read", "telemetry:read"}),
201
201
  "setting_get": frozenset({"settings:read"}),
202
202
  "setting_update": frozenset({"settings:write"}),
203
+ "sim_add": frozenset({"hardware-catalog:write"}),
204
+ "sim_delete": frozenset({"hardware-catalog:write"}),
203
205
  "sim_get": frozenset({"hardware-catalog:read"}),
204
206
  "sim_list": frozenset({"hardware-catalog:read"}),
207
+ "sim_update": frozenset({"hardware-catalog:write"}),
205
208
  "site_add": frozenset({"infrastructure:write"}),
206
209
  "site_context": frozenset({"infrastructure:read"}),
207
210
  "site_delete": frozenset({"infrastructure:write"}),
@@ -4277,7 +4277,6 @@ def sim_list(
4277
4277
  as_json: bool = typer.Option(False, "--json"),
4278
4278
  operator_id: Optional[int] = typer.Option(None, "--operator-id"),
4279
4279
  active: Optional[bool] = typer.Option(None, "--active/--inactive"),
4280
- online: Optional[bool] = typer.Option(None, "--online/--offline"),
4281
4280
  limit: Optional[int] = typer.Option(None, "--limit"),
4282
4281
  ):
4283
4282
  """List the SIM inventory (GET /hermes/sims)."""
@@ -4286,15 +4285,13 @@ def sim_list(
4286
4285
  params["operator_id"] = operator_id
4287
4286
  if active is not None:
4288
4287
  params["active"] = active
4289
- if online is not None:
4290
- params["online"] = online
4291
4288
  items: list[dict[str, Any]] = client.get("/hermes/sims", params=params)
4292
4289
  if limit is not None:
4293
4290
  items = items[:limit]
4294
4291
  if as_json:
4295
4292
  typer.echo(json.dumps(items, indent=2))
4296
4293
  return
4297
- _print_paginated(items, _simple_table_builder([("ICCID", "ICCID"), ("NUMBER", "Number"), ("OPERATOR", "Operator.MNC_Operator"), ("STATIC_IP", "Static_IP"), ("STATUS", "Status")]), limit=limit, noun="SIM")
4294
+ _print_paginated(items, _simple_table_builder([("ICCID", "ICCID"), ("NUMBER", "Number"), ("OPERATOR", "Operator.MNC_Brand"), ("APN", "APN"), ("INSTITUTIONAL", "Institutional"), ("STATIC_IP", "Static_IP"), ("STATUS", "Status")]), limit=limit, noun="SIM")
4298
4295
 
4299
4296
 
4300
4297
  # Get One SIM's Detail
@@ -4308,6 +4305,63 @@ def sim_get(iccid: str = typer.Argument(...), as_json: bool = typer.Option(False
4308
4305
  _print_detail(result)
4309
4306
 
4310
4307
 
4308
+ # SIM Body From CLI Options - Only What was Given
4309
+ def _sim_body(operator_id: Optional[int], number: Optional[str], static_ip: Optional[str], apn: Optional[str], institutional: Optional[bool], active: Optional[bool]) -> dict[str, Any]:
4310
+ body: dict[str, Any] = {}
4311
+ if operator_id is not None:
4312
+ body["Operator"] = {"ID": operator_id}
4313
+ for key, value in (("Number", number), ("Static_IP", static_ip), ("APN", apn), ("Institutional", institutional), ("Status", active)):
4314
+ if value is not None:
4315
+ body[key] = value
4316
+ return body
4317
+
4318
+
4319
+ # Add a SIM
4320
+ @sim_app.command("add")
4321
+ def sim_add(
4322
+ iccid: str = typer.Argument(..., help="ICCID (18-22 digits)."),
4323
+ operator_id: Optional[int] = typer.Option(None, "--operator-id", help="GSM operator ID (e.g. 28601 Turkcell); defaults to Unknown until the device reports it."),
4324
+ number: Optional[str] = typer.Option(None, "--number"),
4325
+ static_ip: Optional[str] = typer.Option(None, "--static-ip"),
4326
+ apn: Optional[str] = typer.Option(None, "--apn"),
4327
+ institutional: Optional[bool] = typer.Option(None, "--institutional/--not-institutional", help="SIM supplied by a customer institution."),
4328
+ active: Optional[bool] = typer.Option(None, "--active/--inactive"),
4329
+ ):
4330
+ """Add a SIM (POST /hermes/sims)."""
4331
+ result = client.post("/hermes/sims", json_body={"ICCID": iccid, **_sim_body(operator_id, number, static_ip, apn, institutional, active)})
4332
+ typer.echo(result.get("Message", result))
4333
+
4334
+
4335
+ # Update a SIM
4336
+ @sim_app.command("update")
4337
+ def sim_update(
4338
+ iccid: str = typer.Argument(...),
4339
+ operator_id: Optional[int] = typer.Option(None, "--operator-id"),
4340
+ number: Optional[str] = typer.Option(None, "--number"),
4341
+ static_ip: Optional[str] = typer.Option(None, "--static-ip"),
4342
+ apn: Optional[str] = typer.Option(None, "--apn"),
4343
+ institutional: Optional[bool] = typer.Option(None, "--institutional/--not-institutional"),
4344
+ active: Optional[bool] = typer.Option(None, "--active/--inactive"),
4345
+ ):
4346
+ """Update a SIM - only the options given change (PUT /hermes/sims/{iccid}). APN/operator are also refreshed from the device's own reports."""
4347
+ body = _sim_body(operator_id, number, static_ip, apn, institutional, active)
4348
+ if not body:
4349
+ typer.echo("Nothing to update - give at least one option.")
4350
+ raise typer.Exit(1)
4351
+ result = client.put(f"/hermes/sims/{iccid}", json_body=body)
4352
+ typer.echo(result.get("Message", result))
4353
+
4354
+
4355
+ # Delete a SIM - Refused by the API if a Device or any Stored Packet Uses it
4356
+ @sim_app.command("delete")
4357
+ def sim_delete(iccid: str = typer.Argument(...), yes: bool = typer.Option(False, "--yes", "-y", help="Skip the confirmation prompt.")):
4358
+ """Delete an unused SIM (DELETE /hermes/sims/{iccid}). A SIM used by a device or any stored packet can't be deleted - deactivate it with `qapu sim update ICCID --inactive`."""
4359
+ if not yes and not typer.confirm(f"Delete SIM {iccid}?"):
4360
+ raise typer.Exit(0)
4361
+ result = client.delete(f"/hermes/sims/{iccid}")
4362
+ typer.echo(result.get("Message", result))
4363
+
4364
+
4311
4365
  # List Firmware Versions
4312
4366
  @firmware_app.command("list")
4313
4367
  def firmware_list(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: qapu-cli
3
- Version: 0.77.0
3
+ Version: 0.78.0
4
4
  Summary: CLI client for the Qapu API - built for the Hermes agent, but usable by anyone talking to api.ovoo.com.tr from outside the Swarm.
5
5
  Author: OVOO Technology
6
6
  Classifier: Programming Language :: Python :: 3
File without changes
File without changes
File without changes
File without changes
File without changes