Skip to content

Commit

Permalink
feat: add class variable at region manager for using ResourceManager
Browse files Browse the repository at this point in the history
Signed-off-by: ImMin5 <[email protected]>
  • Loading branch information
ImMin5 committed Dec 11, 2024
1 parent 9f74a66 commit c1dbe92
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ def _convert_resource_in_resource_data(resource_data: dict) -> dict:
if _resource := resource_data.get("resource"):
resource_type = resource_data.get("resource_type")
if resource_type == "inventory.Region":
pass
_resource["region_id"] = (
f"{_resource['provider']}-{_resource['region_code']}"
)

elif resource_type == "inventory.Metric":
metric_resource_type = _resource.get("resource_type")
_resource["resource_type"] = metric_resource_type.replace(
Expand Down
1 change: 0 additions & 1 deletion src/spaceone/inventory_v2/manager/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from spaceone.inventory_v2.manager.asset_manager import AssetManager
from spaceone.inventory_v2.manager.asset_type_manager import AssetTypeManager
from spaceone.inventory_v2.lib.resource_manager import ResourceManager
from spaceone.inventory_v2.manager.region_manager import RegionManager
from spaceone.inventory_v2.manager.collecting_manager import CollectingManager
from spaceone.inventory_v2.manager.namespace_group_manager import NamespaceGroupManager
Expand Down
3 changes: 3 additions & 0 deletions src/spaceone/inventory_v2/manager/region_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@


class RegionManager(BaseManager, ResourceManager):
resource_keys = ["region_id"]
query_method = "list_regions"

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.region_model = Region()
Expand Down
3 changes: 0 additions & 3 deletions src/spaceone/inventory_v2/service/asset_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,6 @@ def list(self, params: AssetSearchQueryRequest) -> Union[AssetsResponse, dict]:
)

assets_info = [asset_vo.to_dict() for asset_vo in asset_vos]

for asset_info in assets_info:
print(asset_info)
return AssetsResponse(results=assets_info, total_count=total_count)

@transaction(
Expand Down

0 comments on commit c1dbe92

Please sign in to comment.