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


Python Gateway.get_firewall_rules方法代码示例

本文整理汇总了Python中pyvcloud.vcd.gateway.Gateway.get_firewall_rules方法的典型用法代码示例。如果您正苦于以下问题:Python Gateway.get_firewall_rules方法的具体用法?Python Gateway.get_firewall_rules怎么用?Python Gateway.get_firewall_rules使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyvcloud.vcd.gateway.Gateway的用法示例。


在下文中一共展示了Gateway.get_firewall_rules方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_0000_setup

# 需要导入模块: from pyvcloud.vcd.gateway import Gateway [as 别名]
# 或者: from pyvcloud.vcd.gateway.Gateway import get_firewall_rules [as 别名]
    def test_0000_setup(self):

        self._config = Environment.get_config()
        TestFirewallRule._logger = Environment.get_default_logger()
        TestFirewallRule._client = Environment.get_sys_admin_client()
        TestFirewallRule._runner = CliRunner()
        default_org = self._config['vcd']['default_org_name']
        TestFirewallRule._ext_nw = self._config['external_network']['name']
        self._login()
        TestFirewallRule._runner.invoke(org, ['use', default_org])
        result = TestFirewallRule._runner.invoke(
            gateway,
            args=[
                'services', 'firewall', 'create', TestFirewallRule.__name,
                '--name', TestFirewallRule.__firewall_rule_name, '--action',
                'accept', '--type', 'User', '--enabled', '--logging-enabled'
            ])
        self.assertEqual(0, result.exit_code)
        gateway_res = Environment.get_test_gateway(TestFirewallRule._client)
        gateway_obj = Gateway(
            TestFirewallRule._client, href=gateway_res.get('href'))
        firewall_rules = gateway_obj.get_firewall_rules()
        for rule in firewall_rules.firewallRules.firewallRule:
            if rule.name == TestFirewallRule.__firewall_rule_name:
                TestFirewallRule._rule_id = rule.id
                break
开发者ID:vmware,项目名称:vca-cli,代码行数:28,代码来源:firewall_rule_tests.py

示例2: test_0095_add_firewall_rule

# 需要导入模块: from pyvcloud.vcd.gateway import Gateway [as 别名]
# 或者: from pyvcloud.vcd.gateway.Gateway import get_firewall_rules [as 别名]
    def test_0095_add_firewall_rule(self):
        """Add Firewall Rule's in the gateway."""

        gateway_obj = Gateway(TestGateway._client, self._name,
                              TestGateway._gateway.get('href'))
        gateway_obj.add_firewall_rule(TestGateway._firewall_rule_name)
        firewall_rule = gateway_obj.get_firewall_rules()
        # Verify
        matchFound = False
        for firewallRule in firewall_rule.firewallRules.firewallRule:
            if firewallRule['name'] == TestGateway._firewall_rule_name:
                matchFound = True
                break
        self.assertTrue(matchFound)
开发者ID:vmware,项目名称:pyvcloud,代码行数:16,代码来源:gateway_tests.py

示例3: update_firewall_rule_sequence

# 需要导入模块: from pyvcloud.vcd.gateway import Gateway [as 别名]
# 或者: from pyvcloud.vcd.gateway.Gateway import get_firewall_rules [as 别名]
    def update_firewall_rule_sequence(self, index):
        """Change firewall rule's sequence of gateway.

        :param int index: new sequence index of firewall rule.
        """
        index = int(index)
        gateway_res = Gateway(self.client, resource=self.parent)
        firewall_rule = gateway_res.get_firewall_rules()
        resource = self._get_resource()
        for rule in firewall_rule.firewallRules.firewallRule:
            if rule.id == resource.id:
                firewall_rule.firewallRules.remove(rule)
                firewall_rule.firewallRules.insert(index, rule)
                break
        return self.client.put_resource(self._build_firewall_rules_href(),
                                        firewall_rule,
                                        EntityType.DEFAULT_CONTENT_TYPE.value)
开发者ID:vmware,项目名称:pyvcloud,代码行数:19,代码来源:firewall_rule.py


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