diff --git a/src/cloudforet/cost_analysis/manager/data_source_manager.py b/src/cloudforet/cost_analysis/manager/data_source_manager.py index e19eab9..49bb000 100644 --- a/src/cloudforet/cost_analysis/manager/data_source_manager.py +++ b/src/cloudforet/cost_analysis/manager/data_source_manager.py @@ -17,11 +17,24 @@ def init_response(options): plugin_metadata.currency = currency if options.get("pay_as_you_go"): - plugin_metadata.alias.update({"cost": "PayAsYouGo"}) + plugin_metadata.cost_info = { + "name": "PayAsYouGo", + "unit": options.get("currency", "KRW"), + } elif options.get("cost_metric") == "AmortizedCost": - plugin_metadata.alias.update({"cost": "Amortized Cost"}) + plugin_metadata.cost_info = { + "name": "Amortized Cost", + "unit": options.get("currency", "KRW"), + } else: - plugin_metadata.alias.update({"cost": "Actual Cost"}) + plugin_metadata.cost_info = { + "name": "Actual Cost", + "unit": options.get("currency", "KRW"), + } + plugin_metadata.data_info["PayAsYouGo"] = { + "name": "PayAsYouGo", + "unit": options.get("currency", "KRW"), + } if options.get("use_account_routing"): plugin_metadata.use_account_routing = True diff --git a/src/cloudforet/cost_analysis/model/data_source_model.py b/src/cloudforet/cost_analysis/model/data_source_model.py index 4248162..9229d5b 100644 --- a/src/cloudforet/cost_analysis/model/data_source_model.py +++ b/src/cloudforet/cost_analysis/model/data_source_model.py @@ -54,6 +54,11 @@ class DataSourceRule(Model): tags = DictType(StringType, default={}) +class MetadataDataInfo(Model): + name = StringType(required=True) + unit = StringType(required=True) + + class PluginMetadata(Model): data_source_rules = ListType( ModelType(DataSourceRule), default=_DEFAULT_DATA_SOURCE_RULES @@ -64,3 +69,5 @@ class PluginMetadata(Model): alias = DictType(StringType, default={}) account_match_key = StringType(default=None) exclude_license_cost = BooleanType(default=False) + cost_info = DictType(StringType, default={}) + data_info = DictType(ModelType(MetadataDataInfo), default={})