• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python utils.filters_from_querystring函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中moto.ec2.utils.filters_from_querystring函数的典型用法代码示例。如果您正苦于以下问题:Python filters_from_querystring函数的具体用法?Python filters_from_querystring怎么用?Python filters_from_querystring使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: describe_network_interfaces

 def describe_network_interfaces(self):
     eni_ids = sequence_from_querystring(
         'NetworkInterfaceId', self.querystring)
     filters = filters_from_querystring(self.querystring)
     enis = self.ec2_backend.get_all_network_interfaces(eni_ids, filters)
     template = self.response_template(DESCRIBE_NETWORK_INTERFACES_RESPONSE)
     return template.render(enis=enis)
开发者ID:2rs2ts,项目名称:moto,代码行数:7,代码来源:elastic_network_interfaces.py


示例2: describe_dhcp_options

 def describe_dhcp_options(self):
     dhcp_opt_ids = dhcp_opt_ids_from_querystring(self.querystring)
     if filters_from_querystring(self.querystring):
         raise NotImplementedError("Filtering not supported in describe_dhcp_options.")
     dhcp_opts = self.ec2_backend.get_all_dhcp_options(dhcp_opt_ids, None)
     template = self.response_template(DESCRIBE_DHCP_OPTIONS_RESPONSE)
     return template.render(dhcp_options=dhcp_opts)
开发者ID:EarthmanT,项目名称:moto,代码行数:7,代码来源:dhcp_options.py


示例3: describe_images

 def describe_images(self):
     ami_ids = image_ids_from_querystring(self.querystring)
     filters = filters_from_querystring(self.querystring)
     images = self.ec2_backend.describe_images(
         ami_ids=ami_ids, filters=filters)
     template = self.response_template(DESCRIBE_IMAGES_RESPONSE)
     return template.render(images=images)
开发者ID:2rs2ts,项目名称:moto,代码行数:7,代码来源:amis.py


示例4: describe_route_tables

 def describe_route_tables(self):
     route_table_ids = route_table_ids_from_querystring(self.querystring)
     filters = filters_from_querystring(self.querystring)
     route_tables = self.ec2_backend.get_all_route_tables(
         route_table_ids, filters)
     template = self.response_template(DESCRIBE_ROUTE_TABLES_RESPONSE)
     return template.render(route_tables=route_tables)
开发者ID:2rs2ts,项目名称:moto,代码行数:7,代码来源:route_tables.py


示例5: describe_vpn_connections

 def describe_vpn_connections(self):
     vpn_connection_ids = sequence_from_querystring('VpnConnectionId', self.querystring)
     filters = filters_from_querystring(self.querystring)
     vpn_connections = self.ec2_backend.get_all_vpn_connections(
         vpn_connection_ids=vpn_connection_ids, filters=filters)
     template = self.response_template(DESCRIBE_VPN_CONNECTION_RESPONSE)
     return template.render(vpn_connections=vpn_connections)
开发者ID:DarthLorenzo,项目名称:moto,代码行数:7,代码来源:vpn_connections.py


示例6: describe_dhcp_options

 def describe_dhcp_options(self):
     dhcp_opt_ids = self._get_multi_param("DhcpOptionsId")
     filters = filters_from_querystring(self.querystring)
     dhcp_opts = self.ec2_backend.get_all_dhcp_options(
         dhcp_opt_ids, filters)
     template = self.response_template(DESCRIBE_DHCP_OPTIONS_RESPONSE)
     return template.render(dhcp_options=dhcp_opts)
开发者ID:Affirm,项目名称:moto,代码行数:7,代码来源:dhcp_options.py


示例7: describe_vpcs

 def describe_vpcs(self):
     vpc_ids = self._get_multi_param('VpcId')
     filters = filters_from_querystring(self.querystring)
     vpcs = self.ec2_backend.get_all_vpcs(vpc_ids=vpc_ids, filters=filters)
     doc_date = '2013-10-15' if 'Boto/' in self.headers.get('user-agent', '') else '2016-11-15'
     template = self.response_template(DESCRIBE_VPCS_RESPONSE)
     return template.render(vpcs=vpcs, doc_date=doc_date)
开发者ID:botify-labs,项目名称:moto,代码行数:7,代码来源:vpcs.py


示例8: describe_network_acls

 def describe_network_acls(self):
     network_acl_ids = network_acl_ids_from_querystring(self.querystring)
     filters = filters_from_querystring(self.querystring)
     network_acls = self.ec2_backend.get_all_network_acls(
         network_acl_ids, filters)
     template = self.response_template(DESCRIBE_NETWORK_ACL_RESPONSE)
     return template.render(network_acls=network_acls)
开发者ID:2rs2ts,项目名称:moto,代码行数:7,代码来源:network_acls.py


示例9: describe_tags

 def describe_tags(self):
     filters = filters_from_querystring(querystring_dict=self.querystring)
     tags = self.ec2_backend.describe_tags(filters=filters)
     for tag in tags:
         tag['value'] = escape(tag['value'])
     template = self.response_template(DESCRIBE_RESPONSE)
     return template.render(tags=tags)
开发者ID:EvaSDK,项目名称:moto,代码行数:7,代码来源:tags.py


示例10: describe_addresses

 def describe_addresses(self):
     allocation_ids = self._get_multi_param('AllocationId')
     public_ips = self._get_multi_param('PublicIp')
     filters = filters_from_querystring(self.querystring)
     addresses = self.ec2_backend.describe_addresses(
         allocation_ids, public_ips, filters)
     template = self.response_template(DESCRIBE_ADDRESS_RESPONSE)
     return template.render(addresses=addresses)
开发者ID:botify-labs,项目名称:moto,代码行数:8,代码来源:elastic_ip_addresses.py


示例11: describe_images

 def describe_images(self):
     ami_ids = self._get_multi_param('ImageId')
     filters = filters_from_querystring(self.querystring)
     exec_users = self._get_multi_param('ExecutableBy')
     images = self.ec2_backend.describe_images(
         ami_ids=ami_ids, filters=filters, exec_users=exec_users)
     template = self.response_template(DESCRIBE_IMAGES_RESPONSE)
     return template.render(images=images)
开发者ID:whummer,项目名称:moto,代码行数:8,代码来源:amis.py


示例12: describe_volumes

 def describe_volumes(self):
     filters = filters_from_querystring(self.querystring)
     # querystring for multiple volumeids results in VolumeId.1, VolumeId.2 etc
     volume_ids = ','.join([','.join(v[1]) for v in self.querystring.items() if 'VolumeId' in v[0]])
     volumes = self.ec2_backend.describe_volumes(filters=filters)
     # Describe volumes to handle filter on volume_ids
     volumes = [v for v in volumes if v.id in volume_ids] if volume_ids else volumes
     template = self.response_template(DESCRIBE_VOLUMES_RESPONSE)
     return template.render(volumes=volumes)
开发者ID:balintzs,项目名称:moto,代码行数:9,代码来源:elastic_block_store.py


示例13: describe_key_pairs

    def describe_key_pairs(self):
        names = keypair_names_from_querystring(self.querystring)
        filters = filters_from_querystring(self.querystring)
        if len(filters) > 0:
            raise NotImplementedError('Using filters in KeyPairs.describe_key_pairs is not yet implemented')

        keypairs = self.ec2_backend.describe_key_pairs(names)
        template = self.response_template(DESCRIBE_KEY_PAIRS_RESPONSE)
        return template.render(keypairs=keypairs)
开发者ID:ZhenxingWu,项目名称:moto,代码行数:9,代码来源:key_pairs.py


示例14: describe_snapshots

 def describe_snapshots(self):
     filters = filters_from_querystring(self.querystring)
     # querystring for multiple snapshotids results in SnapshotId.1, SnapshotId.2 etc
     snapshot_ids = ','.join([','.join(s[1]) for s in self.querystring.items() if 'SnapshotId' in s[0]])
     snapshots = self.ec2_backend.describe_snapshots(filters=filters)
     # Describe snapshots to handle filter on snapshot_ids
     snapshots = [s for s in snapshots if s.id in snapshot_ids] if snapshot_ids else snapshots
     template = self.response_template(DESCRIBE_SNAPSHOTS_RESPONSE)
     return template.render(snapshots=snapshots)
开发者ID:balintzs,项目名称:moto,代码行数:9,代码来源:elastic_block_store.py


示例15: describe_security_groups

    def describe_security_groups(self):
        groupnames = self._get_multi_param("GroupName")
        group_ids = self._get_multi_param("GroupId")
        filters = filters_from_querystring(self.querystring)

        groups = self.ec2_backend.describe_security_groups(group_ids=group_ids, groupnames=groupnames, filters=filters)

        template = self.response_template(DESCRIBE_SECURITY_GROUPS_RESPONSE)
        return template.render(groups=groups)
开发者ID:rocky4570,项目名称:moto,代码行数:9,代码来源:security_groups.py


示例16: describe_instances

    def describe_instances(self):
        filter_dict = filters_from_querystring(self.querystring)
        instance_ids = instance_ids_from_querystring(self.querystring)
        if instance_ids:
            reservations = self.ec2_backend.get_reservations_by_instance_ids(instance_ids, filters=filter_dict)
        else:
            reservations = self.ec2_backend.all_reservations(make_copy=True, filters=filter_dict)

        template = self.response_template(EC2_DESCRIBE_INSTANCES)
        return template.render(reservations=reservations)
开发者ID:rouge8,项目名称:moto,代码行数:10,代码来源:instances.py


示例17: describe_internet_gateways

    def describe_internet_gateways(self):
        filter_dict = filters_from_querystring(self.querystring)
        if "InternetGatewayId.1" in self.querystring:
            igw_ids = sequence_from_querystring(
                "InternetGatewayId", self.querystring)
            igws = self.ec2_backend.describe_internet_gateways(igw_ids, filters=filter_dict)
        else:
            igws = self.ec2_backend.describe_internet_gateways(filters=filter_dict)

        template = Template(DESCRIBE_INTERNET_GATEWAYS_RESPONSE)
        return template.render(internet_gateways=igws)
开发者ID:pvbouwel,项目名称:moto,代码行数:11,代码来源:internet_gateways.py


示例18: describe_network_interfaces

 def describe_network_interfaces(self):
     # Partially implemented. Supports only network-interface-id and group-id filters
     filters = filters_from_querystring(self.querystring)
     eni_ids = self._get_multi_param("NetworkInterfaceId.")
     if "network-interface-id" not in filters and eni_ids:
         # Network interfaces can be filtered by passing the 'network-interface-id'
         # filter or by passing the NetworkInterfaceId parameter
         filters["network-interface-id"] = eni_ids
     enis = self.ec2_backend.describe_network_interfaces(filters)
     template = self.response_template(DESCRIBE_NETWORK_INTERFACES_RESPONSE)
     return template.render(enis=enis)
开发者ID:ZhenxingWu,项目名称:moto,代码行数:11,代码来源:elastic_network_interfaces.py


示例19: describe_security_groups

    def describe_security_groups(self):
        groupnames = process_groupnames_from_querystring(self.querystring)
        group_ids = process_group_ids_from_querystring(self.querystring)
        filters = filters_from_querystring(self.querystring)

        groups = ec2_backend.describe_security_groups(
            group_ids=group_ids,
            groupnames=groupnames,
            filters=filters
        )

        template = Template(DESCRIBE_SECURITY_GROUPS_RESPONSE)
        return template.render(groups=groups)
开发者ID:invenia,项目名称:moto,代码行数:13,代码来源:security_groups.py


示例20: describe_key_pairs

    def describe_key_pairs(self):
        names = keypair_names_from_querystring(self.querystring)
        filters = filters_from_querystring(self.querystring)
        if len(filters) > 0:
            raise NotImplementedError('Using filters in KeyPairs.describe_key_pairs is not yet implemented')

        try:
            keypairs = ec2_backend.describe_key_pairs(names)
        except InvalidIdError as exc:
            template = Template(CREATE_KEY_PAIR_NOT_FOUND)
            return template.render(keypair_id=exc.id), dict(status=400)
        else:
            template = Template(DESCRIBE_KEY_PAIRS_RESPONSE)
            return template.render(keypairs=keypairs)
开发者ID:Anislav,项目名称:moto,代码行数:14,代码来源:key_pairs.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.instance_ids_from_querystring函数代码示例发布时间:2022-05-27
下一篇:
Python utils.unix_time_millis函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap