Skip to content

Commit

Permalink
feat: modify get region code method
Browse files Browse the repository at this point in the history
Signed-off-by: ImMin5 <[email protected]>
  • Loading branch information
ImMin5 committed Oct 19, 2023
1 parent 2685273 commit 302d9dc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/cloudforet/cost_analysis/manager/cost_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def _make_data_info(self, result, billed_date, options, tenant_id=None):
usage_quantity = self._convert_str_to_float_format(result.get('quantity', 0))
usage_type = result.get('metername', '')
usage_unit = result.get('unitofmeasure', '')
region_code = result.get('resourcelocation', '')
region_code = self._get_region_code(result.get('resourcelocation', ''))
product = result.get('metercategory', '')
tags = self._convert_tags_str_to_dict(result.get('tags', {}))

Expand Down Expand Up @@ -153,6 +153,10 @@ def _get_additional_info(self, result, options, tenant_id=None):

return additional_info

@staticmethod
def _get_region_code(resource_location):
return resource_location.lower() if resource_location else resource_location

@staticmethod
def _make_parameters(start, end, options):
parameters = {
Expand Down Expand Up @@ -190,7 +194,7 @@ def _make_scope(secret_data, task_options, collect_scope, customer_tenant_id=Non
return scope

@staticmethod
def _convert_tags_str_to_dict(tags_str: str):
def _convert_tags_str_to_dict(tags_str):
try:
if tags_str is None:
return {}
Expand Down

0 comments on commit 302d9dc

Please sign in to comment.