Skip to content

Commit

Permalink
fix: delete state field & fix schedule logic from DataSource
Browse files Browse the repository at this point in the history
  • Loading branch information
jinyoungmoonDEV committed Feb 10, 2025
1 parent 2141906 commit 459bf06
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
14 changes: 13 additions & 1 deletion src/spaceone/cost_analysis/info/data_source_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,28 @@ def PluginInfo(vo):
return None


def ScheduleInfo(vo):
if vo:
info = {
"state": vo.state,
"hour": vo.hour,
}

return data_source_pb2.Schedule(**info)
else:
return None


def DataSourceInfo(data_source_vo: DataSource, minimal=False):
info = {
"data_source_id": data_source_vo.data_source_id,
"workspace_id": data_source_vo.workspace_id,
"name": data_source_vo.name,
"state": data_source_vo.state,
"data_source_type": data_source_vo.data_source_type,
"secret_type": data_source_vo.secret_type,
"provider": data_source_vo.provider,
"resource_group": data_source_vo.resource_group,
"schedule": ScheduleInfo(data_source_vo.schedule),
}

if not minimal:
Expand Down
2 changes: 1 addition & 1 deletion src/spaceone/cost_analysis/model/data_source/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Plugin(BaseModel):


class Schedule(BaseModel):
state: State
state: str
hour: Union[int, None] = None


Expand Down
2 changes: 2 additions & 0 deletions src/spaceone/cost_analysis/model/data_source_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class DataSource(MongoModel):
"plugin_info",
"secret_filter",
"template",
"schedule",
"tags",
"updated_at",
"last_synchronized_at",
Expand All @@ -93,6 +94,7 @@ class DataSource(MongoModel):
"data_source_type",
"secret_type",
"provider",
"schedule",
],
"ordering": ["name"],
"indexes": [
Expand Down
2 changes: 0 additions & 2 deletions src/spaceone/cost_analysis/service/data_source_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,6 @@ def get(self, params: DataSourceGetRequest) -> Union[DataSourceResponse, dict]:
[
"data_source_id",
"name",
"state",
"data_source_type",
"provider",
"workspace_id",
Expand All @@ -605,7 +604,6 @@ def list(
'query': 'dict (spaceone.api.core.v1.Query)'
'data_source_id': 'str',
'name': 'str',
'state': 'str',
'data_source_type': 'str',
'provider': 'str',
'connected_workspace_id': str,
Expand Down

0 comments on commit 459bf06

Please sign in to comment.