Skip to content

Commit

Permalink
Merge pull request #47 from stat-kwon/master
Browse files Browse the repository at this point in the history
Change init metadata for other csp
  • Loading branch information
stat-kwon authored Sep 2, 2024
2 parents fb35460 + 8ed0cf6 commit d31abbc
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/cloudforet/cost_analysis/manager/data_source_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,19 @@ class DataSourceManager(BaseManager):
def init_response(options):
plugin_metadata = PluginMetadata()
plugin_metadata.validate()
currency = options.get("currency", "USD")

if "bucket_name" in options:
provider = options.get("provider", "google_cloud")
source = "additional_info.Project ID"
target = "data.project_id"
if provider == "aws":
source = "additional_info.Account ID"
target = "data.account_id"
elif provider == "azure":
source = "additional_info.Subscription Id"
target = "data.subscription_id"

return {
"metadata": {
"data_source_rules": [
Expand All @@ -26,14 +37,14 @@ def init_response(options):
"conditions_policy": "ALWAYS",
"actions": {
"match_service_account": {
"source": "additional_info.Project ID",
"target": "data.project_id",
"source": source,
"target": target,
}
},
"options": {"stop_processing": True},
}
],
"currency": "KRW",
"currency": currency,
}
}

Expand Down

0 comments on commit d31abbc

Please sign in to comment.