本文整理汇总了Python中pyvcloud.vcd.vdc.VDC.get_gateway方法的典型用法代码示例。如果您正苦于以下问题:Python VDC.get_gateway方法的具体用法?Python VDC.get_gateway怎么用?Python VDC.get_gateway使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyvcloud.vcd.vdc.VDC
的用法示例。
在下文中一共展示了VDC.get_gateway方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __create_advanced_gateway
# 需要导入模块: from pyvcloud.vcd.vdc import VDC [as 别名]
# 或者: from pyvcloud.vcd.vdc.VDC import get_gateway [as 别名]
def __create_advanced_gateway(self):
"""Creates a gateway."""
ext_config = TestIpSecVpn._config['external_network']
vdc_reource = TestIpSecVpn._vdc_resource
api_version = TestIpSecVpn._config['vcd']['api_version']
vdc = VDC(TestIpSecVpn._client, resource=vdc_reource)
gateway = vdc.get_gateway(TestIpSecVpn._gateway_name)
if self.__does_exist_gateway(TestIpSecVpn._gateway_name):
return
if float(api_version) <= float(
ApiVersion.VERSION_30.value):
gateway = vdc.create_gateway_api_version_30(
TestIpSecVpn._gateway_name, [ext_config['name']])
elif float(api_version) == float(ApiVersion.VERSION_31.value):
gateway = vdc.create_gateway_api_version_31(
TestIpSecVpn._gateway_name,
[ext_config['name']],
should_create_as_advanced=True)
elif float(api_version) >= float(ApiVersion.VERSION_32.value):
gateway = vdc.create_gateway_api_version_32(
TestIpSecVpn._gateway_name, [ext_config['name']],
should_create_as_advanced=True)
TestIpSecVpn._client.get_task_monitor(). \
wait_for_success(task=gateway.Tasks.Task[0])
TestIpSecVpn._gateway_href = gateway.get('href')
TestIpSecVpn._gateway_obj = Gateway(TestIpSecVpn._client,
href=TestIpSecVpn._gateway_href)
TestIpSecVpn._gateway_resource = TestIpSecVpn. \
_gateway_obj.get_resource()
示例2: __does_exist_gateway
# 需要导入模块: from pyvcloud.vcd.vdc import VDC [as 别名]
# 或者: from pyvcloud.vcd.vdc.VDC import get_gateway [as 别名]
def __does_exist_gateway(self, gateway_name):
vdc = VDC(TestIpSecVpn._client, resource=TestIpSecVpn._vdc_resource)
gateway = vdc.get_gateway(TestIpSecVpn._gateway_name)
if gateway:
TestIpSecVpn._gateway_resource = gateway
TestIpSecVpn._gateway_href = gateway.get('href')
TestIpSecVpn._gateway_obj = Gateway(
TestIpSecVpn._client, href=TestIpSecVpn._gateway_href)
return True
else:
return False