Ejemplo n.º 1
0
    def _create_ebs_sections(names, tags):
        region = 'region'
        config = AWSConfig('hostname', [], (None, None))
        config.add_single_service_config('ebs_names', names)
        config.add_service_tags('ebs_tags', tags)
        config.add_single_service_config('ec2_names', None)
        config.add_service_tags('ec2_tags', (None, None))

        fake_ec2_client = FakeEC2Client()
        fake_cloudwatch_client = FakeCloudwatchClient()

        ec2_summary_distributor = ResultDistributor()
        ebs_limits_distributor = ResultDistributor()
        ebs_summary_distributor = ResultDistributor()

        ec2_summary = EC2Summary(fake_ec2_client, region, config,
                                 ec2_summary_distributor)
        ebs_limits = EBSLimits(fake_ec2_client, region, config,
                               ebs_limits_distributor)
        ebs_summary = EBSSummary(fake_ec2_client, region, config,
                                 ebs_summary_distributor)
        ebs = EBS(fake_cloudwatch_client, region, config)

        ec2_summary_distributor.add(ebs_summary)
        ebs_limits_distributor.add(ebs_summary)
        ebs_summary_distributor.add(ebs)
        return ec2_summary, ebs_limits, ebs_summary, ebs
Ejemplo n.º 2
0
    def _create_ec2_sections(names, tags, *, skip_entities=None):
        region = "region"
        config = AWSConfig("hostname", [], (None, None))
        config.add_single_service_config("ec2_names", names)
        config.add_service_tags("ec2_tags", tags)
        fake_ec2_client = FakeEC2Client(skip_entities)
        fake_cloudwatch_client = FakeCloudwatchClient()
        fake_service_quotas_client = FakeServiceQuotasClient()

        ec2_limits_distributor = ResultDistributor()
        ec2_summary_distributor = ResultDistributor()

        ec2_limits = EC2Limits(
            fake_ec2_client, region, config, ec2_limits_distributor, fake_service_quotas_client
        )
        ec2_summary = EC2Summary(fake_ec2_client, region, config, ec2_summary_distributor)
        ec2_labels = EC2Labels(fake_ec2_client, region, config)
        ec2_security_groups = EC2SecurityGroups(fake_ec2_client, region, config)
        ec2 = EC2(fake_cloudwatch_client, region, config)

        ec2_limits_distributor.add(ec2_summary)
        ec2_summary_distributor.add(ec2_labels)
        ec2_summary_distributor.add(ec2_security_groups)
        ec2_summary_distributor.add(ec2)
        return ec2_limits, ec2_summary, ec2_labels, ec2_security_groups, ec2
Ejemplo n.º 3
0
    def _create_ec2_sections(names, tags):
        region = 'region'
        config = AWSConfig('hostname', [], (None, None))
        config.add_single_service_config('ec2_names', names)
        config.add_service_tags('ec2_tags', tags)

        fake_ec2_client = FakeEC2Client()
        fake_cloudwatch_client = FakeCloudwatchClient()

        ec2_limits_distributor = ResultDistributor()
        ec2_summary_distributor = ResultDistributor()

        ec2_limits = EC2Limits(fake_ec2_client, region, config,
                               ec2_limits_distributor)
        ec2_summary = EC2Summary(fake_ec2_client, region, config,
                                 ec2_summary_distributor)
        ec2_labels = EC2Labels(fake_ec2_client, region, config)
        ec2_security_groups = EC2SecurityGroups(fake_ec2_client, region,
                                                config)
        ec2 = EC2(fake_cloudwatch_client, region, config)

        ec2_limits_distributor.add(ec2_summary)
        ec2_summary_distributor.add(ec2_labels)
        ec2_summary_distributor.add(ec2_security_groups)
        ec2_summary_distributor.add(ec2)
        return ec2_limits, ec2_summary, ec2_labels, ec2_security_groups, ec2