Skip to content

Commit

Permalink
feat: add workspace_id at CostQuerySetInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
ImMin5 committed Jan 3, 2024
1 parent 8884ceb commit 9a07411
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions src/spaceone/cost_analysis/info/cost_query_set_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,36 @@
from spaceone.core import utils
from spaceone.cost_analysis.model.cost_query_set_model import CostQuerySet

__all__ = ['CostQuerySetInfo', 'CostQuerySetsInfo']
__all__ = ["CostQuerySetInfo", "CostQuerySetsInfo"]


def CostQuerySetInfo(cost_query_set_vo: CostQuerySet, minimal=False):
info = {
'cost_query_set_id': cost_query_set_vo.cost_query_set_id,
'name': cost_query_set_vo.name,
'user_id': cost_query_set_vo.user_id,
"cost_query_set_id": cost_query_set_vo.cost_query_set_id,
"name": cost_query_set_vo.name,
"user_id": cost_query_set_vo.user_id,
"workspace_id": cost_query_set_vo.workspace_id,
}

if not minimal:
info.update({
'options': change_struct_type(cost_query_set_vo.options),
'tags': change_struct_type(cost_query_set_vo.tags),
'data_source_id': cost_query_set_vo.data_source_id,
'domain_id': cost_query_set_vo.domain_id,
'created_at': utils.datetime_to_iso8601(cost_query_set_vo.created_at),
'updated_at': utils.datetime_to_iso8601(cost_query_set_vo.updated_at),
})
info.update(
{
"options": change_struct_type(cost_query_set_vo.options),
"tags": change_struct_type(cost_query_set_vo.tags),
"data_source_id": cost_query_set_vo.data_source_id,
"domain_id": cost_query_set_vo.domain_id,
"created_at": utils.datetime_to_iso8601(cost_query_set_vo.created_at),
"updated_at": utils.datetime_to_iso8601(cost_query_set_vo.updated_at),
}
)

return cost_query_set_pb2.CostQuerySetInfo(**info)


def CostQuerySetsInfo(cost_query_set_vos, total_count, **kwargs):
return cost_query_set_pb2.CostQuerySetsInfo(results=list(
map(functools.partial(CostQuerySetInfo, **kwargs), cost_query_set_vos)), total_count=total_count)
return cost_query_set_pb2.CostQuerySetsInfo(
results=list(
map(functools.partial(CostQuerySetInfo, **kwargs), cost_query_set_vos)
),
total_count=total_count,
)

0 comments on commit 9a07411

Please sign in to comment.