本文整理汇总了Python中pysphere.VIServer.get_api_type方法的典型用法代码示例。如果您正苦于以下问题:Python VIServer.get_api_type方法的具体用法?Python VIServer.get_api_type怎么用?Python VIServer.get_api_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pysphere.VIServer
的用法示例。
在下文中一共展示了VIServer.get_api_type方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: vConnect
# 需要导入模块: from pysphere import VIServer [as 别名]
# 或者: from pysphere.VIServer import get_api_type [as 别名]
def vConnect(VIHost, VIUser, VIPassword):
"""Verbindungs Funktion zum Server
Baut eine Verbindung mit VCS Server auf und speichert die Verbindungsinformationen in der VISerever variable des Typs "VIServer".
"""
logger.info("Connecting to vSphere: " + VIHost)
VirtualServerInstance = VIServer()
VirtualServerInstance.connect(VIHost, VIUser, VIPassword)
if VirtualServerInstance:
logger.info("Connected to vSphere: " + VIHost)
logger.info(VirtualServerInstance.get_api_type() + " API " + VirtualServerInstance.get_api_version())
return VirtualServerInstance
else:
logger.error("Connection to the vSphere failed.")
sys.exit(2)
示例2: main
# 需要导入模块: from pysphere import VIServer [as 别名]
# 或者: from pysphere.VIServer import get_api_type [as 别名]
def main():
if len(sys.argv) <> 3:
print ("Usage:")
print (sys.argv[0], "<username> <password")
username = sys.argv[1]
password = sys.argv[2]
vcenter = "ecnshmw1001.sh.cn.ao.ericsson.se"
server = VIServer()
server.connect( vcenter, username, password )
print ("Login .....")
type = server.get_api_type()
version = server.get_api_version()
print ("You are now connecting with {0} with API version {1}".format(type, version))
select(server)
server.disconnect()