Exemplo n.º 1
0
    def _create_s3_sections(names, tags):
        # on_time is somehow not feeded from here to S3Limits, so use monkey patch...
        monkeypatch.setattr(
            agent_aws, "NOW",
            dt.strptime("2020-09-28 15:30 UTC", "%Y-%m-%d %H:%M %Z"))

        region = "region"
        config = AWSConfig("hostname", [], (None, None))
        config.add_single_service_config("s3_names", names)
        config.add_service_tags("s3_tags", tags)

        fake_s3_client = FakeS3Client()
        fake_cloudwatch_client = FakeCloudwatchClient()

        s3_limits_distributor = ResultDistributor()
        s3_summary_distributor = ResultDistributor()

        s3_limits = S3Limits(fake_s3_client, region, config,
                             s3_limits_distributor)
        s3_summary = S3Summary(fake_s3_client, region, config,
                               s3_summary_distributor)
        s3 = S3(fake_cloudwatch_client, region, config)
        s3_requests = S3Requests(fake_cloudwatch_client, region, config)

        s3_limits_distributor.add(s3_summary)
        s3_summary_distributor.add(s3)
        s3_summary_distributor.add(s3_requests)
        return s3_limits, s3_summary, s3, s3_requests
Exemplo n.º 2
0
    def _create_s3_sections(names, tags):
        region = 'region'
        config = AWSConfig('hostname', (None, None))
        config.add_single_service_config('s3_names', names)
        config.add_service_tags('s3_tags', tags)

        fake_s3_client = FakeS3Client()
        fake_cloudwatch_client = FakeCloudwatchClient()

        s3_limits_distributor = ResultDistributor()
        s3_summary_distributor = ResultDistributor()

        s3_limits = S3Limits(fake_s3_client, region, config, s3_limits_distributor)
        s3_summary = S3Summary(fake_s3_client, region, config, s3_summary_distributor)
        s3 = S3(fake_cloudwatch_client, region, config)
        s3_requests = S3Requests(fake_cloudwatch_client, region, config)

        s3_limits_distributor.add(s3_summary)
        s3_summary_distributor.add(s3)
        s3_summary_distributor.add(s3_requests)
        return s3_limits, s3_summary, s3, s3_requests