Skip to content

Commit 05412cc

Browse files
authored
[COST-5449] - Switch code to point at new EC2 table (#5318)
1 parent 440a5df commit 05412cc

File tree

7 files changed

+13
-13
lines changed

7 files changed

+13
-13
lines changed

koku/api/report/aws/provider_map.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from reporting.provider.aws.models import AWSComputeSummaryByAccountP
2121
from reporting.provider.aws.models import AWSComputeSummaryP
2222
from reporting.provider.aws.models import AWSCostEntryLineItemDailySummary
23-
from reporting.provider.aws.models import AWSCostEntryLineItemSummaryByEC2Compute
23+
from reporting.provider.aws.models import AWSCostEntryLineItemSummaryByEC2ComputeP
2424
from reporting.provider.aws.models import AWSCostSummaryByAccountP
2525
from reporting.provider.aws.models import AWSCostSummaryByRegionP
2626
from reporting.provider.aws.models import AWSCostSummaryByServiceP
@@ -378,7 +378,7 @@ def __init__(self, provider, report_type, schema_name, cost_type, markup_cost="m
378378
"usage_units_fallback": "Hrs",
379379
"sum_columns": ["usage", "cost_total", "infra_total", "sup_total"],
380380
"default_ordering": {"resource_id": "desc"},
381-
"tables": {"query": AWSCostEntryLineItemSummaryByEC2Compute},
381+
"tables": {"query": AWSCostEntryLineItemSummaryByEC2ComputeP},
382382
"default_time_period": {
383383
"time_scope_value": "-1",
384384
"time_scope_units": "month",
@@ -562,7 +562,7 @@ def __init__(self, provider, report_type, schema_name, cost_type, markup_cost="m
562562
("org_unit_id",): AWSComputeSummaryByAccountP,
563563
},
564564
"ec2_compute": {
565-
"default": AWSCostEntryLineItemSummaryByEC2Compute,
565+
"default": AWSCostEntryLineItemSummaryByEC2ComputeP,
566566
},
567567
"storage": {
568568
"default": AWSStorageSummaryP,

koku/api/report/test/util/baker_recipes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def decimal_yielder():
4343
)
4444

4545
aws_ec2_compute_summary = Recipe(
46-
"AWSCostEntryLineItemSummaryByEC2Compute",
46+
"AWSCostEntryLineItemSummaryByEC2ComputeP",
4747
resource_id=cycle(f"i-000000{i}" for i in range(AWS_CONSTANTS.length - 1)),
4848
instance_type=cycle(AWS_CONSTANTS["instance_types"]),
4949
operating_system=cycle(AWS_CONSTANTS["operating_systems"]),

koku/api/resource_types/aws_ec2_compute_instances/view.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
from api.common.pagination import ResourceTypeViewPaginator
1818
from api.common.permissions.aws_access import AwsAccessPermission
1919
from api.resource_types.serializers import ResourceTypeSerializer
20-
from reporting.provider.aws.models import AWSCostEntryLineItemSummaryByEC2Compute
20+
from reporting.provider.aws.models import AWSCostEntryLineItemSummaryByEC2ComputeP
2121

2222

2323
class AWSEC2ComputeInstanceView(generics.ListAPIView):
2424
"""API GET list view for AWS EC2 compute instances."""
2525

2626
queryset = (
27-
AWSCostEntryLineItemSummaryByEC2Compute.objects.annotate(
27+
AWSCostEntryLineItemSummaryByEC2ComputeP.objects.annotate(
2828
value=F("resource_id"), ec2_instance_name=Coalesce(F("instance_name"), "resource_id")
2929
)
3030
.values("value", "ec2_instance_name")

koku/api/resource_types/aws_ec2_compute_os/view.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616
from api.common.pagination import ResourceTypeViewPaginator
1717
from api.common.permissions.aws_access import AwsAccessPermission
1818
from api.resource_types.serializers import ResourceTypeSerializer
19-
from reporting.provider.aws.models import AWSCostEntryLineItemSummaryByEC2Compute
19+
from reporting.provider.aws.models import AWSCostEntryLineItemSummaryByEC2ComputeP
2020

2121

2222
class AWSEC2ComputeOperatingSystemView(generics.ListAPIView):
2323
"""API GET list view for AWS EC2 compute operating systems."""
2424

2525
queryset = (
26-
AWSCostEntryLineItemSummaryByEC2Compute.objects.annotate(value=F("operating_system"))
26+
AWSCostEntryLineItemSummaryByEC2ComputeP.objects.annotate(value=F("operating_system"))
2727
.values("value")
2828
.distinct()
2929
.filter(operating_system__isnull=False)

koku/masu/database/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
AWS_CUR_TABLE_MAP = {
88
"bill": "reporting_awscostentrybill",
99
"line_item_daily_summary": "reporting_awscostentrylineitem_daily_summary",
10-
"ec2_compute_summary": "reporting_awscostentrylineitem_summary_by_ec2_compute",
10+
"ec2_compute_summary": "reporting_awscostentrylineitem_summary_by_ec2_compute_p",
1111
"tags_summary": "reporting_awstags_summary",
1212
"category_summary": "reporting_awscategory_summary",
1313
"ocp_on_aws_daily_summary": "reporting_ocpawscostlineitem_daily_summary_p",

koku/masu/database/trino_sql/reporting_awscostentrylineitem_summary_by_ec2_compute.sql koku/masu/database/trino_sql/reporting_awscostentrylineitem_summary_by_ec2_compute_p.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
INSERT INTO postgres.{{schema | sqlsafe}}.reporting_awscostentrylineitem_summary_by_ec2_compute (
1+
INSERT INTO postgres.{{schema | sqlsafe}}.reporting_awscostentrylineitem_summary_by_ec2_compute_p (
22
uuid,
33
usage_start,
44
usage_end,

koku/masu/test/database/test_aws_report_db_accessor.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
from reporting.provider.all.models import TagMapping
3636
from reporting.provider.aws.models import AWSCostEntryBill
3737
from reporting.provider.aws.models import AWSCostEntryLineItemDailySummary
38-
from reporting.provider.aws.models import AWSCostEntryLineItemSummaryByEC2Compute
38+
from reporting.provider.aws.models import AWSCostEntryLineItemSummaryByEC2ComputeP
3939
from reporting.provider.aws.models import TRINO_MANAGED_OCP_AWS_DAILY_TABLE
4040
from reporting.provider.aws.models import TRINO_OCP_ON_AWS_DAILY_TABLE
4141

@@ -416,7 +416,7 @@ def test_update_line_item_daily_summary_with_tag_mapping(self, mock_unleash):
416416
mock_unleash.return_value = True
417417
populated_keys = []
418418

419-
table_classes = [AWSCostEntryLineItemDailySummary, AWSCostEntryLineItemSummaryByEC2Compute]
419+
table_classes = [AWSCostEntryLineItemDailySummary, AWSCostEntryLineItemSummaryByEC2ComputeP]
420420

421421
for table_class in table_classes:
422422
with self.subTest(table_class=table_class):
@@ -503,7 +503,7 @@ def test_populate_ocp_on_aws_tag_information(self, mock_unleash):
503503
@patch("masu.database.aws_report_db_accessor.AWSReportDBAccessor._execute_trino_raw_sql_query")
504504
def test_populate_ec2_compute_summary_table_trino(self, mock_trino):
505505
"""
506-
Test that we construst our SQL and query using Trino to populate AWSCostEntryLineItemSummaryByEC2Compute.
506+
Test that we construst our SQL and query using Trino to populate AWSCostEntryLineItemSummaryByEC2ComputeP.
507507
"""
508508
start_date = self.dh.this_month_start.date()
509509

0 commit comments

Comments
 (0)