Skip to content

Commit

Permalink
Merge pull request #163 from ImMin5/feature-cost-report
Browse files Browse the repository at this point in the history
Fix check workspace error at identity manager
  • Loading branch information
ImMin5 authored Jan 26, 2024
2 parents 7cce022 + 3d56d22 commit 8c0d7ed
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
3 changes: 1 addition & 2 deletions src/spaceone/cost_analysis/manager/identity_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@ def get_domain_name(self, domain_id: str) -> str:
def check_workspace(self, workspace_id: str, domain_id: str) -> None:
system_token = config.get_global("TOKEN")

domain_info = self.identity_conn.dispatch(
self.identity_conn.dispatch(
"Workspace.check",
{"workspace_id": workspace_id, "domain_id": domain_id},
token=system_token,
)
return domain_info["name"]

@cache.cacheable(
key="cost-analysis:workspace-name:{domain_id}:{workspace_id}:name", expire=300
Expand Down
3 changes: 1 addition & 2 deletions src/spaceone/cost_analysis/model/cost_report_data/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ class CostReportDataSearchQueryRequest(BaseModel):
class CostReportDataAnalyzeQueryRequest(BaseModel):
query: Union[dict, None] = None
cost_report_data_id: Union[str, None] = None
report_year: Union[str, None] = None
report_month: Union[str, None] = None
is_confirmed: Union[bool, None] = None
product: Union[str, None] = None
provider: Union[str, None] = None
data_source_id: Union[str, None] = None
Expand Down
12 changes: 6 additions & 6 deletions src/spaceone/cost_analysis/service/cost_report_serivce.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def get(self, params: CostReportGetRequest) -> Union[CostReportResponse, dict]:
)
@append_query_filter(
[
"state",
"status",
"cost_report_id",
"workspace_id",
"domain_id",
Expand All @@ -126,7 +126,8 @@ def get(self, params: CostReportGetRequest) -> Union[CostReportResponse, dict]:
[
"report_number",
"workspace_name",
"report_year" "report_month",
"report_year",
"report_month",
]
)
@convert_model
Expand All @@ -137,9 +138,8 @@ def list(

query = params.query or {}

# todo: temporary code
# if params.status is None:
# query["filter"].append({"k": "status", "v": "SUCCESS", "o": "eq"})
if params.status is None:
query["filter"].append({"k": "status", "v": "SUCCESS", "o": "eq"})

cost_report_vos, total_count = self.cost_report_mgr.list_cost_reports(query)

Expand Down Expand Up @@ -170,7 +170,7 @@ def stat(self, params: CostReportDataStatQueryRequest) -> dict:
"""Stat cost reports"""

query = params.query or {}
return self.cost_report_mgr.stat_cost_reports(params.query)
return self.cost_report_mgr.stat_cost_reports(query)

def create_cost_report(self, cost_report_config_vo: CostReportConfig):
domain_id = cost_report_config_vo.domain_id
Expand Down

0 comments on commit 8c0d7ed

Please sign in to comment.