Skip to content

Commit 459bf06

Browse files
fix: delete state field & fix schedule logic from DataSource
1 parent 2141906 commit 459bf06

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

src/spaceone/cost_analysis/info/data_source_info.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,28 @@ def PluginInfo(vo):
3737
return None
3838

3939

40+
def ScheduleInfo(vo):
41+
if vo:
42+
info = {
43+
"state": vo.state,
44+
"hour": vo.hour,
45+
}
46+
47+
return data_source_pb2.Schedule(**info)
48+
else:
49+
return None
50+
51+
4052
def DataSourceInfo(data_source_vo: DataSource, minimal=False):
4153
info = {
4254
"data_source_id": data_source_vo.data_source_id,
4355
"workspace_id": data_source_vo.workspace_id,
4456
"name": data_source_vo.name,
45-
"state": data_source_vo.state,
4657
"data_source_type": data_source_vo.data_source_type,
4758
"secret_type": data_source_vo.secret_type,
4859
"provider": data_source_vo.provider,
4960
"resource_group": data_source_vo.resource_group,
61+
"schedule": ScheduleInfo(data_source_vo.schedule),
5062
}
5163

5264
if not minimal:

src/spaceone/cost_analysis/model/data_source/request.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Plugin(BaseModel):
2626

2727

2828
class Schedule(BaseModel):
29-
state: State
29+
state: str
3030
hour: Union[int, None] = None
3131

3232

src/spaceone/cost_analysis/model/data_source_model.py

+2
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ class DataSource(MongoModel):
7777
"plugin_info",
7878
"secret_filter",
7979
"template",
80+
"schedule",
8081
"tags",
8182
"updated_at",
8283
"last_synchronized_at",
@@ -93,6 +94,7 @@ class DataSource(MongoModel):
9394
"data_source_type",
9495
"secret_type",
9596
"provider",
97+
"schedule",
9698
],
9799
"ordering": ["name"],
98100
"indexes": [

src/spaceone/cost_analysis/service/data_source_service.py

-2
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,6 @@ def get(self, params: DataSourceGetRequest) -> Union[DataSourceResponse, dict]:
585585
[
586586
"data_source_id",
587587
"name",
588-
"state",
589588
"data_source_type",
590589
"provider",
591590
"workspace_id",
@@ -605,7 +604,6 @@ def list(
605604
'query': 'dict (spaceone.api.core.v1.Query)'
606605
'data_source_id': 'str',
607606
'name': 'str',
608-
'state': 'str',
609607
'data_source_type': 'str',
610608
'provider': 'str',
611609
'connected_workspace_id': str,

0 commit comments

Comments
 (0)