本文整理汇总了Python中kmip.services.kmip_client.KMIPProxy.locate方法的典型用法代码示例。如果您正苦于以下问题:Python KMIPProxy.locate方法的具体用法?Python KMIPProxy.locate怎么用?Python KMIPProxy.locate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kmip.services.kmip_client.KMIPProxy
的用法示例。
在下文中一共展示了KMIPProxy.locate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: KMIPProxy
# 需要导入模块: from kmip.services.kmip_client import KMIPProxy [as 别名]
# 或者: from kmip.services.kmip_client.KMIPProxy import locate [as 别名]
credential_value)
# Build the client and connect to the server
client = KMIPProxy(config=config)
client.open()
# Build name attribute
# TODO (peter-hamilton) Push this into the AttributeFactory
attribute_name = Attribute.AttributeName('Name')
name_value = Name.NameValue(name)
name_type = Name.NameType(NameType.UNINTERPRETED_TEXT_STRING)
value = Name.create(name_value=name_value, name_type=name_type)
name_obj = Attribute(attribute_name=attribute_name, attribute_value=value)
attributes = [name_obj]
# Locate UUID of specified SYMMETRIC_KEY object
result = client.locate(attributes=attributes,
credential=credential)
client.close()
# Display operation results
logger.info('locate() result status: {0}'.format(
result.result_status.enum))
if result.result_status.enum == ResultStatus.SUCCESS:
logger.info('located UUIDs:')
for uuid in result.uuids:
logger.info('{0}'.format(uuid))
else:
logger.info('get() result reason: {0}'.format(
result.result_reason.enum))
logger.info('get() result message: {0}'.format(
result.result_message.value))