api: Address issues with keypairs APIs

Change-Id: I84ea28fc3ee255dea207e373c7064e3231e777f7
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane
2025-06-10 10:52:55 +01:00
parent 64f70797d6
commit 33cf8fef38
3 changed files with 11 additions and 14 deletions
+2
View File
@@ -197,6 +197,8 @@ class KeypairController(wsgi.Controller):
if api_version_request.is_supported(req, '2.35'):
links = True
# TODO(stephenfin): Remove deleted, deleted_at, and updated_at from
# response in future microversion.
return self._index(
req, key_type=key_type, user_id=user_id, links=links
)
+8 -13
View File
@@ -165,23 +165,18 @@ show_response = {
'type': 'object',
'properties': {
'created_at': {'type': 'string', 'format': 'date-time'},
'deleted': {'type': 'boolean'},
'deleted_at': {
'oneOf': [
{'type': 'string', 'format': 'date-time'},
{'type': 'null'},
],
},
# NOTE(stephenfin): While we expose these soft delete fields,
# we don't provide a mechanism to show actual soft deleted
# entries. As such, they're never populated.
'deleted': {'type': 'boolean', 'const': False},
'deleted_at': {'type': 'null'},
'fingerprint': {'type': 'string'},
'id': {'type': 'integer'},
'name': parameter_types.keypair_name_special_chars,
'public_key': {'type': 'string'},
'updated_at': {
'oneOf': [
{'type': 'string', 'format': 'date-time'},
{'type': 'null'},
],
},
# NOTE(stephenfin): There is no way to update an existing
# keypair, so this is never populated.
'updated_at': {'type': 'null'},
'user_id': parameter_types.user_id,
},
'required': [
+1 -1
View File
@@ -33,7 +33,7 @@ FAKE_KEYPAIR = objects.KeyPair(
private_key='ssh-rsa foo',
public_key='ssh-rsa foo',
type='ssh',
updated_at=datetime.datetime(2024, 10, 29, 13, 42, 2),
updated_at=None,
user_id=uuids.user_alt_id,
)