This is an automated email from the ASF dual-hosted git repository.

sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-releases-client.git


The following commit(s) were added to refs/heads/main by this push:
     new d294d30  Add commands to display and delete OpenPGP keys, and 
associated tests
d294d30 is described below

commit d294d30d8a3c156d0751fc3406f15a3f0d597c47
Author: Sean B. Palmer <[email protected]>
AuthorDate: Wed Jul 16 18:34:48 2025 +0100

    Add commands to display and delete OpenPGP keys, and associated tests
---
 pyproject.toml              |  4 ++--
 src/atrclient/client.py     | 25 +++++++++++++++++++++++++
 src/atrclient/models/api.py | 33 ++++++++++++++++++++++-----------
 tests/cli_keys.t            |  6 ++++++
 uv.lock                     |  4 ++--
 5 files changed, 57 insertions(+), 15 deletions(-)

diff --git a/pyproject.toml b/pyproject.toml
index 5aa836e..ccf0ab4 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -11,7 +11,7 @@ build-backend = "hatchling.build"
 
 [project]
 name            = "apache-trusted-releases"
-version         = "0.20250716.1616"
+version         = "0.20250716.1734"
 description     = "ATR CLI and Python API"
 readme          = "README.md"
 requires-python = ">=3.13"
@@ -72,4 +72,4 @@ select = [
 ]
 
 [tool.uv]
-exclude-newer = "2025-07-16T16:16:00Z"
+exclude-newer = "2025-07-16T17:34:00Z"
diff --git a/src/atrclient/client.py b/src/atrclient/client.py
index feaa676..ae5a0a7 100755
--- a/src/atrclient/client.py
+++ b/src/atrclient/client.py
@@ -170,6 +170,18 @@ def api_keys_add(api: ApiPost, args: 
models.api.KeysAddArgs) -> models.api.KeysA
     return models.api.validate_keys_add(response)
 
 
+@api_post("/keys/delete")
+def api_keys_delete(api: ApiPost, args: models.api.KeysDeleteArgs) -> 
models.api.KeysDeleteResults:
+    response = api.post(args)
+    return models.api.validate_keys_delete(response)
+
+
+@api_get("/keys/get")
+def api_keys_get(api: ApiGet, fingerprint: str) -> models.api.KeysGetResults:
+    response = api.get(fingerprint)
+    return models.api.validate_keys_get(response)
+
+
 @api_get("/keys/user")
 def api_keys_user(api: ApiGet, asf_uid: str) -> models.api.KeysUserResults:
     response = api.get(asf_uid)
@@ -621,6 +633,19 @@ def app_keys_add(path: str, committees: str = "", /) -> 
None:
         print(fingerprint)
 
 
+@APP_KEYS.command(name="delete", help="Delete an OpenPGP key.")
+def app_keys_delete(fingerprint: str, /) -> None:
+    keys_delete_args = models.api.KeysDeleteArgs(fingerprint=fingerprint)
+    keys_delete = api_keys_delete(keys_delete_args)
+    print(keys_delete.success)
+
+
+@APP_KEYS.command(name="get", help="Get an OpenPGP key.")
+def app_keys_get(fingerprint: str, /) -> None:
+    keys_get = api_keys_get(fingerprint)
+    print(keys_get.key.model_dump_json(indent=None))
+
+
 @APP_KEYS.command(name="user", help="List OpenPGP keys for a user.")
 def app_keys_user(asf_uid: str | None = None) -> None:
     if asf_uid is None:
diff --git a/src/atrclient/models/api.py b/src/atrclient/models/api.py
index be659ef..336ab2e 100644
--- a/src/atrclient/models/api.py
+++ b/src/atrclient/models/api.py
@@ -101,6 +101,18 @@ class JwtResults(schema.Strict):
     jwt: str
 
 
[email protected]
+class KeysQuery:
+    offset: int = 0
+    limit: int = 20
+
+
+class KeysResults(schema.Strict):
+    endpoint: Literal["/keys"] = schema.Field(alias="endpoint")
+    data: Sequence[sql.PublicSigningKey]
+    count: int
+
+
 class KeysAddArgs(schema.Strict):
     asfuid: str
     key: str
@@ -113,21 +125,18 @@ class KeysAddResults(schema.Strict):
     fingerprints: list[str]
 
 
[email protected]
-class KeysQuery:
-    offset: int = 0
-    limit: int = 20
+class KeysCommitteeResults(schema.Strict):
+    endpoint: Literal["/keys/committee"] = schema.Field(alias="endpoint")
+    keys: Sequence[sql.PublicSigningKey]
 
 
-class KeysResults(schema.Strict):
-    endpoint: Literal["/keys"] = schema.Field(alias="endpoint")
-    data: Sequence[sql.PublicSigningKey]
-    count: int
+class KeysDeleteArgs(schema.Strict):
+    fingerprint: str
 
 
-class KeysCommitteeResults(schema.Strict):
-    endpoint: Literal["/keys/committee"] = schema.Field(alias="endpoint")
-    keys: Sequence[sql.PublicSigningKey]
+class KeysDeleteResults(schema.Strict):
+    endpoint: Literal["/keys/delete"] = schema.Field(alias="endpoint")
+    success: str
 
 
 class KeysGetResults(schema.Strict):
@@ -317,6 +326,7 @@ Results = Annotated[
     | JwtResults
     | KeysResults
     | KeysAddResults
+    | KeysDeleteResults
     | KeysGetResults
     | KeysCommitteeResults
     | KeysUserResults
@@ -367,6 +377,7 @@ validate_jwt = validator(JwtResults)
 validate_keys = validator(KeysResults)
 validate_keys_add = validator(KeysAddResults)
 validate_keys_committee = validator(KeysCommitteeResults)
+validate_keys_delete = validator(KeysDeleteResults)
 validate_keys_get = validator(KeysGetResults)
 validate_keys_user = validator(KeysUserResults)
 validate_list = validator(ListResults)
diff --git a/tests/cli_keys.t b/tests/cli_keys.t
index c424e54..636e326 100644
--- a/tests/cli_keys.t
+++ b/tests/cli_keys.t
@@ -24,3 +24,9 @@ $ atr dev key
 
 $ atr keys add tooling-public-test.asc
 E35604DD9E2892E5465B3D8A203F105A7B33A64F
+
+$ atr keys get E35604DD9E2892E5465B3D8A203F105A7B33A64F
+<.skip.>e35604dd9e2892e5465b3d8a203f105a7b33a64f<.skip.><!user!><.skip.>
+
+$ atr keys delete E35604DD9E2892E5465B3D8A203F105A7B33A64F
+Key deleted
diff --git a/uv.lock b/uv.lock
index 86a01e3..ff819b7 100644
--- a/uv.lock
+++ b/uv.lock
@@ -2,7 +2,7 @@ version = 1
 requires-python = ">=3.13"
 
 [options]
-exclude-newer = "2025-07-16T16:16:00Z"
+exclude-newer = "2025-07-16T17:34:00Z"
 
 [[package]]
 name = "aiohappyeyeballs"
@@ -83,7 +83,7 @@ wheels = [
 
 [[package]]
 name = "apache-trusted-releases"
-version = "0.20250716.1616"
+version = "0.20250716.1734"
 source = { editable = "." }
 dependencies = [
     { name = "aiohttp" },


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to