Skip to content

Commit d31abbc

Browse files
authored
Merge pull request #47 from stat-kwon/master
Change init metadata for other csp
2 parents fb35460 + 8ed0cf6 commit d31abbc

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/cloudforet/cost_analysis/manager/data_source_manager.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,19 @@ class DataSourceManager(BaseManager):
1616
def init_response(options):
1717
plugin_metadata = PluginMetadata()
1818
plugin_metadata.validate()
19+
currency = options.get("currency", "USD")
1920

2021
if "bucket_name" in options:
22+
provider = options.get("provider", "google_cloud")
23+
source = "additional_info.Project ID"
24+
target = "data.project_id"
25+
if provider == "aws":
26+
source = "additional_info.Account ID"
27+
target = "data.account_id"
28+
elif provider == "azure":
29+
source = "additional_info.Subscription Id"
30+
target = "data.subscription_id"
31+
2132
return {
2233
"metadata": {
2334
"data_source_rules": [
@@ -26,14 +37,14 @@ def init_response(options):
2637
"conditions_policy": "ALWAYS",
2738
"actions": {
2839
"match_service_account": {
29-
"source": "additional_info.Project ID",
30-
"target": "data.project_id",
40+
"source": source,
41+
"target": target,
3142
}
3243
},
3344
"options": {"stop_processing": True},
3445
}
3546
],
36-
"currency": "KRW",
47+
"currency": currency,
3748
}
3849
}
3950

0 commit comments

Comments
 (0)