From 16aacabafb8b9c8d197852fa5247d0f70ea7efb3 Mon Sep 17 00:00:00 2001 From: ImMin5 Date: Tue, 2 Jul 2024 18:39:05 +0900 Subject: [PATCH] feat: add additional info data Signed-off-by: ImMin5 --- src/cloudforet/cost_analysis/manager/cost_manager.py | 6 ++++++ src/cloudforet/cost_analysis/manager/data_source_manager.py | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/src/cloudforet/cost_analysis/manager/cost_manager.py b/src/cloudforet/cost_analysis/manager/cost_manager.py index d67604d..e79db04 100644 --- a/src/cloudforet/cost_analysis/manager/cost_manager.py +++ b/src/cloudforet/cost_analysis/manager/cost_manager.py @@ -207,6 +207,9 @@ def _get_additional_info(self, result: dict, options: dict, tenant_id: str = Non if result.get("pricingmodel") != "" and result.get("pricingmodel"): additional_info["Pricing Model"] = result["pricingmodel"] + if result.get("reservationname") != "" and result.get("reservationname"): + additional_info["Reservation Name"] = result["reservationname"] + if result.get("benefitname") != "" and result.get("benefitname"): benefit_name = result["benefitname"] additional_info["Benefit Name"] = benefit_name @@ -244,6 +247,9 @@ def _get_additional_info(self, result: dict, options: dict, tenant_id: str = Non ): additional_info["Enrollment Account Name"] = result["enrollmentaccountname"] + if result.get("chargetype") != "" and result.get("chargetype"): + additional_info["Charge Type"] = result["chargetype"] + collect_resource_id = options.get("collect_resource_id", False) if ( collect_resource_id diff --git a/src/cloudforet/cost_analysis/manager/data_source_manager.py b/src/cloudforet/cost_analysis/manager/data_source_manager.py index 49bb000..6677a9b 100644 --- a/src/cloudforet/cost_analysis/manager/data_source_manager.py +++ b/src/cloudforet/cost_analysis/manager/data_source_manager.py @@ -26,6 +26,10 @@ def init_response(options): "name": "Amortized Cost", "unit": options.get("currency", "KRW"), } + plugin_metadata.data_info["PayAsYouGo"] = { + "name": "PayAsYouGo", + "unit": options.get("currency", "KRW"), + } else: plugin_metadata.cost_info = { "name": "Actual Cost",