本文整理汇总了Python中pyvcloud.vcd.vdc.VDC.list_resources方法的典型用法代码示例。如果您正苦于以下问题:Python VDC.list_resources方法的具体用法?Python VDC.list_resources怎么用?Python VDC.list_resources使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyvcloud.vcd.vdc.VDC
的用法示例。
在下文中一共展示了VDC.list_resources方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: print
# 需要导入模块: from pyvcloud.vcd.vdc import VDC [as 别名]
# 或者: from pyvcloud.vcd.vdc.VDC import list_resources [as 别名]
user = sys.argv[3]
password = sys.argv[4]
# Disable warnings from self-signed certificates.
requests.packages.urllib3.disable_warnings()
# Login. SSL certificate verification is turned off to allow self-signed
# certificates. You should only do this in trusted environments.
print("Logging in: host={0}, org={1}, user={2}".format(host, org, user))
client = Client(host, verify_ssl_certs=False)
client.set_highest_supported_version()
client.set_credentials(BasicLoginCredentials(user, org, password))
print("Fetching Org...")
org = Org(client, resource=client.get_org())
print("Fetching VDCs...")
for vdc_info in org.list_vdcs():
name = vdc_info['name']
href = vdc_info['href']
print("VDC name: {0}\n href: {1}".format(
vdc_info['name'], vdc_info['href']))
vdc = VDC(client, resource=org.get_vdc(vdc_info['name']))
print("{0}{1}".format("Name".ljust(40), "Type"))
print("{0}{1}".format("----".ljust(40), "----"))
for resource in vdc.list_resources():
print('%s%s' % (resource['name'].ljust(40), resource['type']))
# Log out.
print("Logging out")
client.logout()