当前位置: 首页>>代码示例>>Python>>正文


Python KMIPProxy.discover_versions方法代码示例

本文整理汇总了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:
开发者ID:JHUAPL,项目名称:PyKMIP,代码行数:33,代码来源:discover_versions.py

示例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:
开发者ID:spencerjackson,项目名称:PyKMIP,代码行数:32,代码来源:discover_versions.py


注:本文中的kmip.services.kmip_client.KMIPProxy.discover_versions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。