33import logging
44import time
55from datetime import datetime , timezone
6- from typing import Union , Generator , Any
6+ from typing import Any , Generator , Union
77
88import pandas as pd
99from spaceone .core .error import *
@@ -193,7 +193,16 @@ def _make_data_info(
193193 if billing_tenant_id :
194194 additional_info ["Billing Tenant Id" ] = billing_tenant_id
195195
196- cost : float = self ._get_cost_from_result_with_options (result , options )
196+ aggregate_data = self ._get_aggregate_data (result , options )
197+
198+ if options .get ("custom_cost_adjustment_percent" ):
199+ cost_adjustment_factor = (
200+ 1 + options .get ("custom_cost_adjustment_percent" ) / 100
201+ )
202+ cost = aggregate_data ["Actual Cost" ] * cost_adjustment_factor
203+ else :
204+ cost : float = self ._get_cost_from_result_with_options (result , options )
205+
197206 usage_quantity : float = self ._convert_str_to_float_format (
198207 result .get ("quantity" , 0.0 )
199208 )
@@ -203,8 +212,6 @@ def _make_data_info(
203212 product : str = self ._get_product_from_result (result )
204213 tags : dict = self ._convert_tags_str_to_dict (result .get ("tags" ))
205214
206- aggregate_data = self ._get_aggregate_data (result , options )
207-
208215 # Set Network Traffic Cost at Additional Info
209216 additional_info : dict = self ._set_network_traffic_cost (
210217 additional_info , result , usage_type
@@ -473,7 +480,13 @@ def _make_benefit_cost_info(
473480 # TODO: Add logic to show Actual Cost RI/SP as retail
474481 pass
475482 else :
476- cost = actual_cost
483+ if options .get ("custom_cost_adjustment_percent" ):
484+ cost_adjustment_factor = (
485+ 1 + options .get ("custom_cost_adjustment_percent" ) / 100
486+ )
487+ cost = actual_cost * cost_adjustment_factor
488+ else :
489+ cost = actual_cost
477490
478491 data = {
479492 "cost" : cost ,
0 commit comments