本文整理汇总了Python中kmip.services.kmip_client.KMIPProxy.discover_versions方法的典型用法代码示例。如果您正苦于以下问题:Python KMIPProxy.discover_versions方法的具体用法?Python KMIPProxy.discover_versions怎么用?Python KMIPProxy.discover_versions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kmip.services.kmip_client.KMIPProxy
的用法示例。
在下文中一共展示了KMIPProxy.discover_versions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: list
# 需要导入模块: from kmip.services.kmip_client import KMIPProxy [as 别名]
# 或者: from kmip.services.kmip_client.KMIPProxy import discover_versions [as 别名]
username = opts.username
password = opts.password
config = opts.config
protocol_versions = list()
if opts.protocol_versions is not None:
for version in re.split(',| ', opts.protocol_versions):
mm = re.split('\.', version)
protocol_versions.append(ProtocolVersion.create(int(mm[0]),
int(mm[1])))
# Build the client and connect to the server
client = KMIPProxy(config=config)
client.open()
result = client.discover_versions(protocol_versions=protocol_versions)
client.close()
# Display operation results
logger.info('discover_versions() result status: {0}'.format(
result.result_status.value))
if result.result_status.value == ResultStatus.SUCCESS:
protocol_versions = result.protocol_versions
if isinstance(protocol_versions, list):
logger.info('number of protocol versions returned: {0}'.format(
len(protocol_versions)))
for protocol_version in protocol_versions:
logger.info('protocol version supported: {0}'.format(
protocol_version))
else:
示例2: KMIPProxy
# 需要导入模块: from kmip.services.kmip_client import KMIPProxy [as 别名]
# 或者: from kmip.services.kmip_client.KMIPProxy import discover_versions [as 别名]
username = opts.username
password = opts.password
config = opts.config
# Build and setup logging
f_log = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir,
'logconfig.ini')
logging.config.fileConfig(f_log)
logger = logging.getLogger(__name__)
# Build the client and connect to the server
client = KMIPProxy(config=config)
client.open()
result = client.discover_versions()
client.close()
# Display operation results
logger.info('discover_versions() result status: {0}'.format(
result.result_status.value))
if result.result_status.value == ResultStatus.SUCCESS:
protocol_versions = result.protocol_versions
if isinstance(protocol_versions, list):
logger.info('number of protocol versions returned: {0}'.format(
len(protocol_versions)))
for protocol_version in protocol_versions:
logger.info('protocol version supported: {0}'.format(
protocol_version))
else: