ibee-cli 0.5.0__tar.gz → 0.5.1__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 (37) hide show
  1. {ibee_cli-0.5.0/src/ibee_cli.egg-info → ibee_cli-0.5.1}/PKG-INFO +1 -1
  2. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/pyproject.toml +1 -1
  3. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/src/ibee_cli/__init__.py +1 -1
  4. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/src/ibee_cli/render.py +6 -2
  5. {ibee_cli-0.5.0 → ibee_cli-0.5.1/src/ibee_cli.egg-info}/PKG-INFO +1 -1
  6. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/tests/test_cli_core.py +1 -1
  7. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/tests/test_networking_commands.py +32 -2
  8. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/LICENSE +0 -0
  9. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/README.md +0 -0
  10. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/setup.cfg +0 -0
  11. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/src/ibee_cli/commands/__init__.py +0 -0
  12. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/src/ibee_cli/commands/billing.py +0 -0
  13. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/src/ibee_cli/commands/block_storage.py +0 -0
  14. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/src/ibee_cli/commands/buckets.py +0 -0
  15. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/src/ibee_cli/commands/cdn.py +0 -0
  16. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/src/ibee_cli/commands/compute.py +0 -0
  17. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/src/ibee_cli/commands/console.py +0 -0
  18. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/src/ibee_cli/commands/firewalls.py +0 -0
  19. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/src/ibee_cli/commands/gpus.py +0 -0
  20. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/src/ibee_cli/commands/load_balancers.py +0 -0
  21. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/src/ibee_cli/commands/networking.py +0 -0
  22. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/src/ibee_cli/commands/ops.py +0 -0
  23. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/src/ibee_cli/commands/reserved_ips.py +0 -0
  24. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/src/ibee_cli/commands/secrets.py +0 -0
  25. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/src/ibee_cli/commands/vm_lifecycle.py +0 -0
  26. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/src/ibee_cli/commands/vms.py +0 -0
  27. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/src/ibee_cli/context.py +0 -0
  28. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/src/ibee_cli/helpers.py +0 -0
  29. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/src/ibee_cli/main.py +0 -0
  30. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/src/ibee_cli.egg-info/SOURCES.txt +0 -0
  31. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/src/ibee_cli.egg-info/dependency_links.txt +0 -0
  32. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/src/ibee_cli.egg-info/entry_points.txt +0 -0
  33. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/src/ibee_cli.egg-info/requires.txt +0 -0
  34. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/src/ibee_cli.egg-info/top_level.txt +0 -0
  35. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/tests/test_secret_store_commands.py +0 -0
  36. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/tests/test_storage_commands.py +0 -0
  37. {ibee_cli-0.5.0 → ibee_cli-0.5.1}/tests/test_vm_commands.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ibee-cli
3
- Version: 0.5.0
3
+ Version: 0.5.1
4
4
  Summary: Official command-line interface for the IBEE Solutions cloud platform
5
5
  Author-email: IBEE Solutions <support@ibee.ai>
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ibee-cli"
7
- version = "0.5.0"
7
+ version = "0.5.1"
8
8
  description = "Official command-line interface for the IBEE Solutions cloud platform"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -1,3 +1,3 @@
1
1
  """IBEE Solutions command-line interface."""
2
2
 
3
- __version__ = "0.5.0"
3
+ __version__ = "0.5.1"
@@ -216,10 +216,14 @@ def to_yaml(payload: Any) -> str:
216
216
  # ---------------------------------------------------------------------------
217
217
 
218
218
 
219
- def _items(data: Any) -> list[Any]:
219
+ def _items(data: Any, id_field: Optional[str] = None) -> list[Any]:
220
220
  if isinstance(data, list):
221
221
  return data
222
222
  if isinstance(data, dict):
223
+ if id_field and data.get(id_field) not in (None, ""):
224
+ # One object that carries the command's id (a firewall group, a load
225
+ # balancer): its nested ``rules`` or ``subnets`` are not the result.
226
+ return [data]
223
227
  for key in COLLECTION_KEYS:
224
228
  if isinstance(data.get(key), list):
225
229
  return data[key]
@@ -241,7 +245,7 @@ def _identifier(item: Any, id_field: Optional[str]) -> Optional[str]:
241
245
  def identifiers(payload: Any, id_field: Optional[str] = None) -> list[str]:
242
246
  """Identifiers for ``-o id``: one per item of a collection, or one for an object."""
243
247
  ids = []
244
- for item in _items(to_data(payload)):
248
+ for item in _items(to_data(payload), id_field):
245
249
  value = _identifier(item, id_field)
246
250
  if value is not None:
247
251
  ids.append(value)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ibee-cli
3
- Version: 0.5.0
3
+ Version: 0.5.1
4
4
  Summary: Official command-line interface for the IBEE Solutions cloud platform
5
5
  Author-email: IBEE Solutions <support@ibee.ai>
6
6
  License-Expression: MIT
@@ -29,7 +29,7 @@ def test_help_and_version() -> None:
29
29
  for group in ("billing", "block-storage", "buckets", "cdn", "secrets", "vms", "gpus", "console", "vpcs",
30
30
  "reserved-ips", "firewalls", "load-balancers", "compute", "ops"):
31
31
  assert group in result.output
32
- assert runner.invoke(app, ["--version"]).output.strip() == f"ibee-cli {__version__}" == "ibee-cli 0.5.0"
32
+ assert runner.invoke(app, ["--version"]).output.strip() == f"ibee-cli {__version__}" == "ibee-cli 0.5.1"
33
33
 
34
34
 
35
35
  def test_missing_token_and_workspace_are_usage_errors(monkeypatch: pytest.MonkeyPatch) -> None:
@@ -10,9 +10,11 @@ import json
10
10
 
11
11
  import pytest
12
12
  from click import unstyle
13
- from _net_fixtures import FW, LB, NAT_CATALOG, RIP, RIP_CATALOG, V, WS, gateway_record, group, lb, pf_rule, plain, rip, run, vpc
13
+ from _net_fixtures import (
14
+ FW, LB, NAT_CATALOG, RIP, RIP_CATALOG, V, WS, gateway_record, group, lb, pf_rule, plain, rip, run, subnet, vpc,
15
+ )
14
16
 
15
- from ibee_cli.render import EXIT_CODES
17
+ from ibee_cli.render import EXIT_CODES, identifiers
16
18
 
17
19
  BACKENDS = [{"type": "ip", "target": "10.0.0.5", "port": 80, "weight": 5}, {"target": "web.internal", "port": 8080}]
18
20
 
@@ -153,6 +155,34 @@ def test_load_balancer_create_sends_json_backends_unchanged(gw):
153
155
  assert gw.last("POST", f"{LB}/l7").json == {"name": "web", "protocol": "https", "backends": BACKENDS}
154
156
 
155
157
 
158
+ L7_RULES = [{"priority": 1, "path_prefix": "/api", "backends": BACKENDS[:1]}]
159
+
160
+
161
+ @pytest.mark.parametrize(
162
+ "args, method, path, record, expected",
163
+ [
164
+ (["firewalls", "create", "web"], "POST", FW, group(), "fw-1"),
165
+ (["firewalls", "get", "fw-1"], "GET", f"{FW}/fw-1", group(), "fw-1"),
166
+ (["load-balancers", "create-l7", "web", "--backends", json.dumps(BACKENDS)], "POST", f"{LB}/l7",
167
+ lb(backends=BACKENDS, rules=L7_RULES), "lb-1"),
168
+ (["load-balancers", "create-l7", "web", "--backends", "[]"], "POST", f"{LB}/l7", lb(rules=[]), "lb-1"),
169
+ (["vpcs", "get", "vpc-1"], "GET", V, vpc(subnets=[subnet(), subnet(subnet_id="sub-2")]), "vpc-1"),
170
+ ],
171
+ )
172
+ def test_id_output_prints_the_object_id_not_its_nested_list(gw, args, method, path, record, expected):
173
+ gw.on(method, path, (200, record))
174
+
175
+ result = run(["-o", "id", *args])
176
+ assert result.exit_code == 0, result.output
177
+ assert result.stdout.splitlines() == [expected]
178
+
179
+
180
+ def test_id_output_still_prints_one_id_per_collection_item():
181
+ groups = {"groups": [group(), group(firewall_group_id="fw-2")]}
182
+ assert identifiers(groups, "firewall_group_id") == ["fw-1", "fw-2"]
183
+ assert identifiers({"rules": group()["rules"]}) == ["sys-1", "r-1"]
184
+
185
+
156
186
  def test_load_balancer_repeatable_backend_and_routing(gw):
157
187
  gw.on("POST", f"{LB}/l4", (201, lb(layer="l4", protocol="tcp")))
158
188
 
File without changes
File without changes
File without changes
File without changes