Skip to content

Commit 684c00b

Browse files
authored
Merge pull request #73 from ImMin5/master
Modify metadata field type 'additional_info' , list -> dict
2 parents e5d234b + 854ede4 commit 684c00b

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

src/cloudforet/cost_analysis/manager/data_source_manager.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ class DataSourceManager(BaseManager):
1414
def init_response(options):
1515
plugin_metadata = PluginMetadata()
1616

17-
plugin_metadata.additional_info = [
18-
"Unit Price",
19-
"Resource Id",
20-
"Subscription Id",
21-
"Charge Type",
22-
]
17+
plugin_metadata.additional_info = {
18+
"Subscription Name": {"name": "Subscription Name", "visible": True},
19+
"Unit Price": {"name": "Unit Price", "visible": False},
20+
"Resource Id": {"name": "Resource Id", "visible": False},
21+
"Subscription Id": {"name": "Subscription Id", "visible": False},
22+
"Charge Type": {"name": "Charge Type", "visible": False},
23+
}
2324

2425
if currency := options.get("currency"):
2526
plugin_metadata.currency = currency

src/cloudforet/cost_analysis/model/data_source_model.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ class MetadataDataInfo(Model):
5959
unit = StringType(required=True)
6060

6161

62+
class MetadataAdditionalInfo(Model):
63+
name = StringType(required=True)
64+
visible = BooleanType(default=False)
65+
66+
6267
class PluginMetadata(Model):
6368
data_source_rules = ListType(
6469
ModelType(DataSourceRule), default=_DEFAULT_DATA_SOURCE_RULES
@@ -71,4 +76,4 @@ class PluginMetadata(Model):
7176
exclude_license_cost = BooleanType(default=False)
7277
cost_info = DictType(StringType, default={})
7378
data_info = DictType(ModelType(MetadataDataInfo), default={})
74-
additional_info = ListType(StringType, default=[])
79+
additional_info = DictType(ModelType(MetadataAdditionalInfo), default={})

0 commit comments

Comments
 (0)