mirror of
https://github.com/openkmip/pykmip
synced 2025-12-29 14:43:44 +00:00
Add ModifyAttribute support to the client
This change adds ModifyAttribute support to the ProxyKmipClient, leveraging the new generic request capability in the underlying KMIPProxy client. New unit tests have been added to cover the new client additions. Partially implements #547
This commit is contained in:
committed by
Peter Hamilton
parent
2d283e128c
commit
53308c346b
@@ -340,8 +340,8 @@ class KMIPProxy(object):
|
||||
"The request payload must be a RequestPayload object."
|
||||
)
|
||||
|
||||
# TODO (peterhamilton) For now limit this to the new DeleteAttribute
|
||||
# and SetAttribute operations. Migrate over existing operations to use
|
||||
# TODO (peterhamilton) For now limit this to the new Delete/Set/Modify
|
||||
# Attribute operations. Migrate over existing operations to use
|
||||
# this method instead.
|
||||
if operation == enums.Operation.DELETE_ATTRIBUTE:
|
||||
if not isinstance(payload, payloads.DeleteAttributeRequestPayload):
|
||||
@@ -355,6 +355,12 @@ class KMIPProxy(object):
|
||||
"The request payload for the SetAttribute operation must "
|
||||
"be a SetAttributeRequestPayload object."
|
||||
)
|
||||
elif operation == enums.Operation.MODIFY_ATTRIBUTE:
|
||||
if not isinstance(payload, payloads.ModifyAttributeRequestPayload):
|
||||
raise TypeError(
|
||||
"The request payload for the ModifyAttribute operation "
|
||||
"must be a ModifyAttributeRequestPayload object."
|
||||
)
|
||||
|
||||
batch_item = messages.RequestBatchItem(
|
||||
operation=operation,
|
||||
@@ -403,6 +409,15 @@ class KMIPProxy(object):
|
||||
"Invalid response payload received for the SetAttribute "
|
||||
"operation."
|
||||
)
|
||||
elif batch_item.operation.value == enums.Operation.MODIFY_ATTRIBUTE:
|
||||
if not isinstance(
|
||||
batch_item.response_payload,
|
||||
payloads.ModifyAttributeRequestPayload
|
||||
):
|
||||
raise exceptions.InvalidMessage(
|
||||
"Invalid response payload received for the "
|
||||
"ModifyAttribute operation."
|
||||
)
|
||||
|
||||
return batch_item.response_payload
|
||||
|
||||
|
||||
Reference in New Issue
Block a user