2
0
mirror of https://github.com/openkmip/pykmip synced 2025-12-10 05:13:15 +00:00

Add ObjectType filtering support for the Locate operation

This change updates Locate operation support in the PyKMIP server,
allowing users to filter objects based on the object's Object Type.
Unit tests and integration tests have been added to test and verify
the correctness of this feature.

Additionally, the Locate demo scripts have also been updated to
support Object Type filtering. Simply use the "--object-type" flag
to specify an Object Type enumeration for the Locate script to
filter on.
This commit is contained in:
Peter Hamilton
2019-07-30 15:54:52 -04:00
committed by Peter Hamilton
parent e5de55c0a8
commit d74b394261
7 changed files with 195 additions and 1 deletions

View File

@@ -35,6 +35,7 @@ if __name__ == '__main__':
name = opts.name
initial_dates = opts.initial_dates
state = opts.state
object_type = opts.object_type
attribute_factory = AttributeFactory()
@@ -84,6 +85,20 @@ if __name__ == '__main__':
else:
logger.error("Invalid state provided: {}".format(opts.state))
sys.exit(-3)
if object_type:
object_type = getattr(enums.ObjectType, object_type, None)
if object_type:
attributes.append(
attribute_factory.create_attribute(
enums.AttributeType.OBJECT_TYPE,
object_type
)
)
else:
logger.error(
"Invalid object type provided: {}".format(opts.object_type)
)
sys.exit(-4)
# Build the client and connect to the server
with client.ProxyKmipClient(