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


Python CloudProvider.delete_secgroup_rule方法代码示例

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


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

示例1: delete_rule

# 需要导入模块: from cloudmesh_client.cloud.iaas.CloudProvider import CloudProvider [as 别名]
# 或者: from cloudmesh_client.cloud.iaas.CloudProvider.CloudProvider import delete_secgroup_rule [as 别名]
    def delete_rule(cls, cloud, secgroup, from_port, to_port, protocol, cidr):
        try:
            args = {
                "group": secgroup["uuid"],
                "fromPort": from_port,
                "toPort": to_port,
                "protocol": protocol,
                "cidr": cidr
            }

            rule = cls.cm.find(kind="secgrouprule",
                               output="object",
                               scope="first",
                               **args)

            if rule is not None:
                # get the nova client for cloud
                cloud_provider = CloudProvider(cloud).provider
                # delete the rule from the cloud
                cloud_provider.delete_secgroup_rule(rule.uuid)
                # delete the local db record
                cls.cm.delete(rule)
                return "Rule [{fromPort} | {toPort} | {protocol} | {cidr}] deleted" \
                    .format(**args)
            else:
                return None

        except Exception as ex:
            Console.error("delete rule")

        return
开发者ID:cloudmesh,项目名称:client,代码行数:33,代码来源:secgroup.py

示例2: delete_rule

# 需要导入模块: from cloudmesh_client.cloud.iaas.CloudProvider import CloudProvider [as 别名]
# 或者: from cloudmesh_client.cloud.iaas.CloudProvider.CloudProvider import delete_secgroup_rule [as 别名]
    def delete_rule(cls, cloud, secgroup, from_port, to_port, protocol, cidr):
        try:
            args = {
                "groupid": secgroup.uuid,
                "fromPort": from_port,
                "toPort": to_port,
                "protocol": protocol,
                "cidr": cidr
            }

            rule = cls.cm_db.find("secgrouprule", output="object",
                                  **args).first()

            if rule is not None:
                # get the nova client for cloud
                cloud_provider = CloudProvider(cloud).provider
                # delete the rule from the cloud
                cloud_provider.delete_secgroup_rule(rule.uuid)
                # delete the local db record
                cls.cm_db.delete(rule)
                return "Rule [{} | {} | {} | {}] deleted" \
                    .format(from_port, to_port, protocol, cidr)
            else:
                return None

        except Exception as ex:
            Console.error(ex.message, ex)

        return
开发者ID:alistairking,项目名称:client,代码行数:31,代码来源:secgroup.py

示例3: delete_all_rules_cloud

# 需要导入模块: from cloudmesh_client.cloud.iaas.CloudProvider import CloudProvider [as 别名]
# 或者: from cloudmesh_client.cloud.iaas.CloudProvider.CloudProvider import delete_secgroup_rule [as 别名]
 def delete_all_rules_cloud(cls, cloud, groupname):
     rules = cls.list_rules_cloud(cloud, groupname)
     provider = CloudProvider(cloud).provider
     if rules:
         for rule in rules:
             ruleid = rule['id']
             provider.delete_secgroup_rule(ruleid)
     return
开发者ID:pombredanne,项目名称:client-6,代码行数:10,代码来源:secgroup.py

示例4: delete_all_rules_cloud

# 需要导入模块: from cloudmesh_client.cloud.iaas.CloudProvider import CloudProvider [as 别名]
# 或者: from cloudmesh_client.cloud.iaas.CloudProvider.CloudProvider import delete_secgroup_rule [as 别名]
 def delete_all_rules_cloud(cls, cloud, groupname):
     rules = cls.list_rules_cloud(cloud, groupname)
     provider = CloudProvider(cloud).provider
     if rules:
         for rule in rules:
             ruleid = rule['id']
             # only refresh those defined with a protocol
             # This leaves the default rule defined by
             # allowing the same secgroup untouched
             if rule['ip_protocol']:
                 provider.delete_secgroup_rule(ruleid)
     return
开发者ID:cloudmesh,项目名称:client,代码行数:14,代码来源:secgroup.py

示例5: delete_rule_cloud

# 需要导入模块: from cloudmesh_client.cloud.iaas.CloudProvider import CloudProvider [as 别名]
# 或者: from cloudmesh_client.cloud.iaas.CloudProvider.CloudProvider import delete_secgroup_rule [as 别名]
 def delete_rule_cloud(cls, cloud, groupname, rulename):
     ret = None
     provider = CloudProvider(cloud).provider
     ruleid = cls.get_rule_cloud(cloud, groupname, rulename)
     if ruleid:
         ret = provider.delete_secgroup_rule(ruleid)
     #else:
     #    Console.error("Rule does not exist - Rule:{}, Group:{}"\
     #                  .format(rulename, groupname), traceflag=False)
     return ret
开发者ID:cloudmesh,项目名称:client,代码行数:12,代码来源:secgroup.py


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