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

Python skew.scan函数代码示例

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

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



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

示例1: test_iam_users

 def test_iam_users(self):
     arn = scan('arn:aws:iam:*:234567890123:user/*')
     l = list(arn)
     self.assertEqual(len(l), 3)
     arn = scan('arn:aws:iam:*:234567890123:user/foo')
     l = list(arn)
     self.assertEqual(len(l), 1)
开发者ID:FremanZhang,项目名称:skew,代码行数:7,代码来源:test_arn.py


示例2: test_ec2

 def test_ec2(self):
     placebo_cfg = {
         'placebo': placebo,
         'placebo_dir': self._get_response_path('instances_1'),
         'placebo_mode': 'playback'}
     arn = scan('arn:aws:ec2:us-west-2:123456789012:instance/*',
                **placebo_cfg)
     # Fetch all Instance resources
     l = list(arn)
     self.assertEqual(len(l), 2)
     # Fetch a single resource
     placebo_cfg = {
         'placebo': placebo,
         'placebo_dir': self._get_response_path('instances_2'),
         'placebo_mode': 'playback'}
     arn = scan('arn:aws:ec2:us-west-2:123456789012:instance/i-db530902',
                **placebo_cfg)
     l = list(arn)
     self.assertEqual(len(l), 1)
     # check filters
     arn = scan('arn:aws:ec2:us-west-2:123456789012:instance/i-db530902|InstanceType',
                **placebo_cfg)
     l = list(arn)
     self.assertEqual(len(l), 1)
     r = l[0]
     self.assertEqual(r.filtered_data, 't2.small')
开发者ID:Gifflen,项目名称:skew,代码行数:26,代码来源:test_arn.py


示例3: test_elb_loadbalancer

 def test_elb_loadbalancer(self):
     arn = scan('arn:aws:elb:us-west-2:123456789012:loadbalancer/*')
     l = list(arn)
     self.assertEqual(len(l), 1)
     arn = scan('arn:aws:elb:us-west-2:234567890123:loadbalancer/*')
     l = list(arn)
     self.assertEqual(len(l), 5)
开发者ID:FremanZhang,项目名称:skew,代码行数:7,代码来源:test_arn.py


示例4: test_ec2_instance

 def test_ec2_instance(self):
     # Set up the HTTP mocking
     host = 'https://ec2.us-east-1.amazonaws.com/'
     body1 = get_response_body('ec2_instance.xml')
     body2 = get_response_body('instance_not_found.xml')
     body3 = get_response_body('one_instance.xml')
     httpretty.register_uri(httpretty.POST, host,
                            responses=[
                                httpretty.Response(body=body1, status=200),
                                httpretty.Response(body=body2, status=400),
                                httpretty.Response(body=body3, status=200),
                            ])
     host = 'https://monitoring.us-east-1.amazonaws.com/'
     body1 = get_response_body('instance_metric_names.xml')
     body2 = get_response_body('get_metric_data.xml')
     httpretty.register_uri(httpretty.POST, host,
                            responses=[
                                httpretty.Response(body=body1, status=200),
                                httpretty.Response(body=body2, status=200),
                            ])
     # Run the test
     arn = scan('arn:aws:ec2:us-east-1:123456789012:instance/*')
     # Fetch all Instance resources
     instances = list(arn)
     self.assertEqual(len(instances), 2)
     # Fetch non-existant resource
     arn = scan('arn:aws:ec2:us-east-1:123456789012:instance/i-decafbad')
     instances = list(arn)
     self.assertEqual(len(instances), 0)
     # Fetch a single instance
     arn = scan('arn:aws:ec2:us-east-1:123456789012:instance/i-123456789')
     instances = list(arn)
     self.assertEqual(len(instances), 1)
     instance = instances[0]
     # Find available metrics
     self.assertEqual(len(instance.metric_names), 10)
     self.assertEqual(instance.metric_names,
                      ['DiskReadOps',
                       'NetworkOut',
                       'DiskWriteOps',
                       'DiskReadBytes',
                       'CPUUtilization',
                       'StatusCheckFailed',
                       'StatusCheckFailed_System',
                       'StatusCheckFailed_Instance',
                       'NetworkIn',
                       'DiskWriteBytes'])
     # Fetch metric data
     metric_data = instance.get_metric_data('CPUUtilization')
     self.assertEqual(len(metric_data.data), 12)
     self.assertEqual(metric_data.data[-1]['Average'], 0.0)
     self.assertEqual(instance.name, 'foo.bar.com')
     # Fetch tags
     self.assertEqual(list(instance.tags.keys()), ['Name'])
     self.assertEqual(list(instance.tags.values()), ['foo'])
开发者ID:samstav,项目名称:skew,代码行数:55,代码来源:test_arn.py


示例5: test_cloudformation_stacks

 def test_cloudformation_stacks(self):
     arn = scan('arn:aws:cloudformation:us-west-2:123456789012:stack/*')
     l = list(arn)
     self.assertEqual(len(l), 10)
     stack_resource = l[0]
     resources = list(stack_resource)
     self.assertEqual(len(resources), 6)
开发者ID:FremanZhang,项目名称:skew,代码行数:7,代码来源:test_arn.py


示例6: test_route53_hostedzone

 def test_route53_hostedzone(self):
     arn = scan('arn:aws:route53::123456789012:hostedzone/*')
     l = list(arn)
     self.assertEqual(len(l), 2)
     zone_resource = l[0]
     self.assertEqual(zone_resource.arn,
                      'arn:aws:route53:::hostedzone/FFFF865FFFF3')
开发者ID:FremanZhang,项目名称:skew,代码行数:7,代码来源:test_arn.py


示例7: test_iam_groups

 def test_iam_groups(self):
     arn = scan('arn:aws:iam::123456789012:group/*')
     l = list(arn)
     self.assertEqual(len(l), 2)
     group_resource = l[0]
     self.assertEqual(group_resource.arn,
                      'arn:aws:iam::123456789012:group/Administrators')
开发者ID:FremanZhang,项目名称:skew,代码行数:7,代码来源:test_arn.py


示例8: test_s3_buckets

 def test_s3_buckets(self):
     arn = scan('arn:aws:s3:us-east-1:234567890123:bucket/*')
     l = list(arn)
     self.assertEqual(len(l), 4)
     bucket_resource = l[1]
     keys = list(bucket_resource)
     self.assertEqual(len(keys), 4)
开发者ID:FremanZhang,项目名称:skew,代码行数:7,代码来源:test_arn.py


示例9: test_sqs_queues

 def test_sqs_queues(self):
     # Set up the HTTP mocking
     host = 'https://queue.amazonaws.com/'
     body1 = get_response_body('sqs_queues.xml')
     httpretty.register_uri(httpretty.POST, host,
                            responses=[
                                httpretty.Response(
                                    body=body1, status=200)
                            ])
     # Run the test
     arn = scan('arn:aws:sqs:us-east-1:123456789012:queue/*')
     # Fetch all queue resources
     queues = list(arn)
     self.assertEqual(len(queues), 4)
     q = queues[0]
     self.assertEqual(q.id, 'foo')
     self.assertEqual(
         q.name, 'https://queue.amazonaws.com/123456789012/foo')
     q = queues[1]
     self.assertEqual(
         q.name, 'https://queue.amazonaws.com/123456789012/bar')
     self.assertEqual(q.id, 'bar')
     q = queues[2]
     self.assertEqual(
         q.name, 'https://queue.amazonaws.com/123456789012/fie')
     self.assertEqual(q.id, 'fie')
     q = queues[3]
     self.assertEqual(
         q.name, 'https://queue.amazonaws.com/123456789012/baz')
     self.assertEqual(q.id, 'baz')
开发者ID:samstav,项目名称:skew,代码行数:30,代码来源:test_arn.py


示例10: test_dynamodb_filtering

 def test_dynamodb_filtering(self):
     # Set up the HTTP mocking
     content_type = 'application/x-amz-json-1.0'
     host = 'https://dynamodb.us-east-1.amazonaws.com/'
     body1 = get_response_body('dynamodb_tables.json')
     body2 = get_response_body('table_one.json')
     body3 = get_response_body('table_two.json')
     httpretty.register_uri(httpretty.POST, host,
                            responses=[
                                httpretty.Response(
                                    body=body1, status=200,
                                    content_type=content_type),
                                httpretty.Response(
                                    body=body2, status=200,
                                    content_type=content_type),
                                httpretty.Response(
                                    body=body3, status=200,
                                    content_type=content_type),
                            ])
     # Run the test
     arn = scan('arn:aws:dynamodb:us-east-1:123456789012:table/foo')
     # Fetch all Table resources
     tables = list(arn)
     self.assertEqual(len(tables), 1)
     t = tables[0]
     self.assertEqual(t.name, 'foo')
     self.assertEqual(t.date, 1368642592.791)
开发者ID:ptone,项目名称:skew,代码行数:27,代码来源:test_arn.py


示例11: test_ec2_network_acls

 def test_ec2_network_acls(self):
     placebo_cfg = {
         'placebo': placebo,
         'placebo_dir': self._get_response_path('networkacls'),
         'placebo_mode': 'playback'}
     arn = scan('arn:aws:ec2:us-west-2:123456789012:network-acl/*',
                **placebo_cfg)
     l = list(arn)
     self.assertEqual(len(l), 8)
开发者ID:Gifflen,项目名称:skew,代码行数:9,代码来源:test_arn.py


示例12: test_iam_users

 def test_iam_users(self):
     placebo_cfg = {
         'placebo': placebo,
         'placebo_dir': self._get_response_path('users'),
         'placebo_mode': 'playback'}
     arn = scan('arn:aws:iam:*:234567890123:user/*',
                **placebo_cfg)
     l = list(arn)
     self.assertEqual(len(l), 4)
开发者ID:Gifflen,项目名称:skew,代码行数:9,代码来源:test_arn.py


示例13: test_s3_buckets

 def test_s3_buckets(self):
     placebo_cfg = {
         'placebo': placebo,
         'placebo_dir': self._get_response_path('buckets'),
         'placebo_mode': 'playback'}
     arn = scan('arn:aws:s3:us-east-1:234567890123:bucket/*',
                **placebo_cfg)
     l = list(arn)
     self.assertEqual(len(l), 5)
开发者ID:Gifflen,项目名称:skew,代码行数:9,代码来源:test_arn.py


示例14: test_rds_security_group

 def test_rds_security_group(self):
     # Set up the HTTP mocking
     host = 'https://rds.amazonaws.com/'
     body1 = get_response_body('rds_secgrp.xml')
     httpretty.register_uri(httpretty.POST, host,
                            responses=[
                                httpretty.Response(body=body1, status=200),
                                httpretty.Response(body=body1, status=200),
                            ])
     # Run the test
     arn = scan('arn:aws:rds:us-east-1:123456789012:secgrp/*')
     # Fetch all resources
     secgrps = list(arn)
     self.assertEqual(len(secgrps), 1)
     # Fetch a single resource
     arn = scan('arn:aws:rds:us-east-1:123456789012:secgrp/foo')
     secgrps = list(arn)
     self.assertEqual(len(secgrps), 1)
开发者ID:ptone,项目名称:skew,代码行数:18,代码来源:test_arn.py


示例15: test_ec2_routetable

 def test_ec2_routetable(self):
     placebo_cfg = {
         'placebo': placebo,
         'placebo_dir': self._get_response_path('routetables'),
         'placebo_mode': 'playback'}
     arn = scan('arn:aws:ec2:us-west-2:123456789012:route-table/*',
                **placebo_cfg)
     l = list(arn)
     self.assertEqual(len(l), 5)
开发者ID:Gifflen,项目名称:skew,代码行数:9,代码来源:test_arn.py


示例16: test_elb_loadbalancer

 def test_elb_loadbalancer(self):
     placebo_cfg = {
         'placebo': placebo,
         'placebo_dir': self._get_response_path('elbs'),
         'placebo_mode': 'playback'}
     arn = scan('arn:aws:elb:us-west-2:123456789012:loadbalancer/*',
                **placebo_cfg)
     l = list(arn)
     self.assertEqual(len(l), 6)
开发者ID:Gifflen,项目名称:skew,代码行数:9,代码来源:test_arn.py


示例17: test_ec2_securitygroup

 def test_ec2_securitygroup(self):
     placebo_cfg = {
         'placebo': placebo,
         'placebo_dir': self._get_response_path('secgrp'),
         'placebo_mode': 'playback'}
     arn = scan('arn:aws:ec2:us-west-2:123456789012:security-group/*',
                **placebo_cfg)
     l = list(arn)
     self.assertEqual(len(l), 3)
开发者ID:Gifflen,项目名称:skew,代码行数:9,代码来源:test_arn.py


示例18: test_ec2_instance

 def test_ec2_instance(self):
     arn = scan('arn:aws:ec2:us-west-2:123456789012:instance/*')
     # Fetch all Instance resources
     l = list(arn)
     self.assertEqual(len(l), 2)
     # Fetch non-existant resource
     arn = scan('arn:aws:ec2:us-west-2:123456789012:instance/i-decafbad')
     l = list(arn)
     self.assertEqual(len(l), 0)
     # Fetch a single resource
     arn = scan('arn:aws:ec2:us-west-2:123456789012:instance/i-30f39af5')
     l = list(arn)
     self.assertEqual(len(l), 1)
     # check filters
     arn = scan('arn:aws:ec2:us-west-2:123456789012:instance/i-30f39af5|InstanceType')
     l = list(arn)
     self.assertEqual(len(l), 1)
     r = l[0]
     self.assertEqual(r.filtered_data, 't2.small')
开发者ID:FremanZhang,项目名称:skew,代码行数:19,代码来源:test_arn.py


示例19: test_ec2_volumes

 def test_ec2_volumes(self):
     placebo_cfg = {
         'placebo': placebo,
         'placebo_dir': self._get_response_path('volumes'),
         'placebo_mode': 'playback'}
     arn = scan('arn:aws:ec2:us-west-2:123456789012:volume/*',
                **placebo_cfg)
     l = list(arn)
     self.assertEqual(len(l), 4)
     r = l[0]
     self.assertEqual(r.data['VolumeId'], "vol-b85e475f")
开发者ID:Gifflen,项目名称:skew,代码行数:11,代码来源:test_arn.py


示例20: test_cloudformation_stacks

 def test_cloudformation_stacks(self):
     placebo_cfg = {
         'placebo': placebo,
         'placebo_dir': self._get_response_path('stacks'),
         'placebo_mode': 'playback'}
     arn = scan('arn:aws:cloudformation:us-west-2:123456789012:stack/*',
                **placebo_cfg)
     l = list(arn)
     self.assertEqual(len(l), 1)
     stack_resource = l[0]
     resources = list(stack_resource)
     self.assertEqual(len(resources), 4)
开发者ID:Gifflen,项目名称:skew,代码行数:12,代码来源:test_arn.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python skfuzzy.defuzz函数代码示例发布时间:2022-05-27
下一篇:
Python settings.getReadRepository函数代码示例发布时间: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