Skip to content

Commit 75831be

Browse files
Kevin Alliolikallioli
authored andcommitted
release: v1.0.3 — CloudKitty (rating) support
New ``orca rating`` command group covering CloudKitty. Validated live against Infomaniak (dc3-a, non-admin user). End-user surface (no admin role needed): - rating info — CloudKitty collector + metrics config - rating metric-list / metric-show — rated metrics catalogue - rating summary — project rating total, with --begin/--end/--groupby/ --filters; default window = start of month → now - rating dataframes — raw rated records; tries /v2/dataframes then falls back to /v1/storage/dataframes (Infomaniak exposes only v1) - rating quote — pre-deployment price estimate via POST to /v1/rating/quote Admin surface: - rating module-list / module-show / module-enable / module-disable / module-set-priority (hashmap / pyscripts / noop). module-* uses a fetch-merge-PUT pattern because CloudKitty PUT requires the full representation. - rating hashmap service-list/create/delete - rating hashmap field-list/create/delete - rating hashmap mapping-list/create/delete (value → price; flat/rate; field- or service-level) - rating hashmap threshold-list/create/delete (tiered pricing) - rating hashmap group-list/create/delete Additional fixes discovered during the live test: - rating metric-show: path is /v1/info/metrics/{id} (plural); CloudKitty returns 405 on the singular /v1/info/metric/{id} - validate_id: pass through None so the callback is safe on optional Click parameters (needed by rating-hashmap --field-id/--service-id/ --group-id filters) Coverage: rating.py at 95 %; total coverage 85.73 % (2167 tests).
1 parent 151b96a commit 75831be

7 files changed

Lines changed: 990 additions & 2 deletions

File tree

orca_cli/commands/rating.py

Lines changed: 607 additions & 0 deletions
Large diffs are not rendered by default.

orca_cli/core/client.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,11 @@ def alarming_url(self) -> str:
331331
"""Aodh (alarming) public endpoint."""
332332
return self._endpoint_for("alarming")
333333

334+
@property
335+
def rating_url(self) -> str:
336+
"""CloudKitty (rating) public endpoint."""
337+
return self._endpoint_for("rating")
338+
334339
# ── Generic HTTP helpers ──────────────────────────────────────────────────
335340

336341
def _headers(self, extra: Optional[Dict[str, str]] = None,

orca_cli/core/validators.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ def validate_id(ctx: click.Context, param: click.Parameter, value: str) -> str:
1313
- Bare hex UUID: 32 hex chars (e.g. Keystone project/user IDs).
1414
- Numeric ID (e.g. flavor IDs on older clouds, quota resources).
1515
"""
16+
# Pass through None so the callback is safe on optional parameters
17+
# (Click calls callbacks even when the option was not supplied).
18+
if value is None:
19+
return value
1620
uuid_pattern = re.compile(
1721
r"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
1822
re.IGNORECASE,

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
66
name = "orca-openstackclient"
7-
version = "1.0.2"
7+
version = "1.0.3"
88
description = "orca — OpenStack Rich Command-line Alternative"
99
authors = ["Kevin Allioli"]
1010
license = "Apache-2.0"

tests/test_cli_registration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"overview", "profile", "project", "qos", "quota", "recordset", "region", "role", "secret",
1616
"security-group", "server", "server-group", "service", "setup", "stack", "subnet-pool",
1717
"trust", "trunk", "usage",
18-
"user", "volume", "watch", "zone", "placement", "alarm",
18+
"user", "volume", "watch", "zone", "placement", "alarm", "rating",
1919
"policy", "identity-provider", "federation-protocol", "mapping", "service-provider",
2020
"limit", "registered-limit", "access-rule", "token", "endpoint-group",
2121
]

0 commit comments

Comments
 (0)