perceptic-core-client 0.13.0__py3-none-any.whl → 0.15.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of perceptic-core-client might be problematic. Click here for more details.
- perceptic_core_client/__init__.py +15 -0
- perceptic_core_client/api/__init__.py +1 -0
- perceptic_core_client/api/indexing_schedule_resource_api.py +2243 -0
- perceptic_core_client/models/__init__.py +14 -0
- perceptic_core_client/models/create_indexing_schedule_request.py +122 -0
- perceptic_core_client/models/create_indexing_schedule_response.py +93 -0
- perceptic_core_client/models/cron_trigger.py +106 -0
- perceptic_core_client/models/execution_trigger_reason.py +37 -0
- perceptic_core_client/models/get_indexing_schedule_response.py +91 -0
- perceptic_core_client/models/indexing_schedule_dto.py +118 -0
- perceptic_core_client/models/interval_trigger.py +92 -0
- perceptic_core_client/models/list_indexing_schedules_response.py +104 -0
- perceptic_core_client/models/list_schedule_executions_response.py +104 -0
- perceptic_core_client/models/on_upload_trigger.py +87 -0
- perceptic_core_client/models/schedule_execution_dto.py +104 -0
- perceptic_core_client/models/schedule_trigger.py +189 -0
- perceptic_core_client/models/update_indexing_schedule_request.py +127 -0
- perceptic_core_client/models/update_indexing_schedule_response.py +91 -0
- perceptic_core_client/test/test_create_indexing_schedule_request.py +66 -0
- perceptic_core_client/test/test_create_indexing_schedule_response.py +68 -0
- perceptic_core_client/test/test_cron_trigger.py +55 -0
- perceptic_core_client/test/test_execution_trigger_reason.py +33 -0
- perceptic_core_client/test/test_get_indexing_schedule_response.py +67 -0
- perceptic_core_client/test/test_indexing_schedule_dto.py +66 -0
- perceptic_core_client/test/test_indexing_schedule_resource_api.py +87 -0
- perceptic_core_client/test/test_interval_trigger.py +54 -0
- perceptic_core_client/test/test_list_indexing_schedules_response.py +71 -0
- perceptic_core_client/test/test_list_schedule_executions_response.py +61 -0
- perceptic_core_client/test/test_on_upload_trigger.py +51 -0
- perceptic_core_client/test/test_schedule_execution_dto.py +56 -0
- perceptic_core_client/test/test_schedule_trigger.py +58 -0
- perceptic_core_client/test/test_update_indexing_schedule_request.py +58 -0
- perceptic_core_client/test/test_update_indexing_schedule_response.py +67 -0
- {perceptic_core_client-0.13.0.dist-info → perceptic_core_client-0.15.0.dist-info}/METADATA +1 -1
- {perceptic_core_client-0.13.0.dist-info → perceptic_core_client-0.15.0.dist-info}/RECORD +37 -7
- {perceptic_core_client-0.13.0.dist-info → perceptic_core_client-0.15.0.dist-info}/WHEEL +0 -0
- {perceptic_core_client-0.13.0.dist-info → perceptic_core_client-0.15.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
perceptic-core-server API
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.0.1-SNAPSHOT
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from datetime import datetime
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class IntervalTrigger(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
IntervalTrigger
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
interval: StrictStr
|
|
31
|
+
start_time: Optional[datetime] = Field(default=None, alias="startTime")
|
|
32
|
+
type: Optional[StrictStr] = None
|
|
33
|
+
__properties: ClassVar[List[str]] = ["interval", "startTime", "type"]
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
populate_by_name=True,
|
|
37
|
+
validate_assignment=True,
|
|
38
|
+
protected_namespaces=(),
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def to_str(self) -> str:
|
|
43
|
+
"""Returns the string representation of the model using alias"""
|
|
44
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
45
|
+
|
|
46
|
+
def to_json(self) -> str:
|
|
47
|
+
"""Returns the JSON representation of the model using alias"""
|
|
48
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
49
|
+
return json.dumps(self.to_dict())
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
53
|
+
"""Create an instance of IntervalTrigger from a JSON string"""
|
|
54
|
+
return cls.from_dict(json.loads(json_str))
|
|
55
|
+
|
|
56
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
57
|
+
"""Return the dictionary representation of the model using alias.
|
|
58
|
+
|
|
59
|
+
This has the following differences from calling pydantic's
|
|
60
|
+
`self.model_dump(by_alias=True)`:
|
|
61
|
+
|
|
62
|
+
* `None` is only added to the output dict for nullable fields that
|
|
63
|
+
were set at model initialization. Other fields with value `None`
|
|
64
|
+
are ignored.
|
|
65
|
+
"""
|
|
66
|
+
excluded_fields: Set[str] = set([
|
|
67
|
+
])
|
|
68
|
+
|
|
69
|
+
_dict = self.model_dump(
|
|
70
|
+
by_alias=True,
|
|
71
|
+
exclude=excluded_fields,
|
|
72
|
+
exclude_none=True,
|
|
73
|
+
)
|
|
74
|
+
return _dict
|
|
75
|
+
|
|
76
|
+
@classmethod
|
|
77
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
78
|
+
"""Create an instance of IntervalTrigger from a dict"""
|
|
79
|
+
if obj is None:
|
|
80
|
+
return None
|
|
81
|
+
|
|
82
|
+
if not isinstance(obj, dict):
|
|
83
|
+
return cls.model_validate(obj)
|
|
84
|
+
|
|
85
|
+
_obj = cls.model_validate({
|
|
86
|
+
"interval": obj.get("interval"),
|
|
87
|
+
"startTime": obj.get("startTime"),
|
|
88
|
+
"type": obj.get("type")
|
|
89
|
+
})
|
|
90
|
+
return _obj
|
|
91
|
+
|
|
92
|
+
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
perceptic-core-server API
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.0.1-SNAPSHOT
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictInt
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from perceptic_core_client.models.indexing_schedule_dto import IndexingScheduleDto
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class ListIndexingSchedulesResponse(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
ListIndexingSchedulesResponse
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
schedules: Optional[List[IndexingScheduleDto]] = None
|
|
31
|
+
total_count: Optional[StrictInt] = Field(default=None, alias="totalCount")
|
|
32
|
+
next_offset: Optional[StrictInt] = Field(default=None, alias="nextOffset")
|
|
33
|
+
__properties: ClassVar[List[str]] = ["schedules", "totalCount", "nextOffset"]
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
populate_by_name=True,
|
|
37
|
+
validate_assignment=True,
|
|
38
|
+
protected_namespaces=(),
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def to_str(self) -> str:
|
|
43
|
+
"""Returns the string representation of the model using alias"""
|
|
44
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
45
|
+
|
|
46
|
+
def to_json(self) -> str:
|
|
47
|
+
"""Returns the JSON representation of the model using alias"""
|
|
48
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
49
|
+
return json.dumps(self.to_dict())
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
53
|
+
"""Create an instance of ListIndexingSchedulesResponse from a JSON string"""
|
|
54
|
+
return cls.from_dict(json.loads(json_str))
|
|
55
|
+
|
|
56
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
57
|
+
"""Return the dictionary representation of the model using alias.
|
|
58
|
+
|
|
59
|
+
This has the following differences from calling pydantic's
|
|
60
|
+
`self.model_dump(by_alias=True)`:
|
|
61
|
+
|
|
62
|
+
* `None` is only added to the output dict for nullable fields that
|
|
63
|
+
were set at model initialization. Other fields with value `None`
|
|
64
|
+
are ignored.
|
|
65
|
+
"""
|
|
66
|
+
excluded_fields: Set[str] = set([
|
|
67
|
+
])
|
|
68
|
+
|
|
69
|
+
_dict = self.model_dump(
|
|
70
|
+
by_alias=True,
|
|
71
|
+
exclude=excluded_fields,
|
|
72
|
+
exclude_none=True,
|
|
73
|
+
)
|
|
74
|
+
# override the default output from pydantic by calling `to_dict()` of each item in schedules (list)
|
|
75
|
+
_items = []
|
|
76
|
+
if self.schedules:
|
|
77
|
+
for _item_schedules in self.schedules:
|
|
78
|
+
if _item_schedules:
|
|
79
|
+
_items.append(_item_schedules.to_dict())
|
|
80
|
+
_dict['schedules'] = _items
|
|
81
|
+
# set to None if next_offset (nullable) is None
|
|
82
|
+
# and model_fields_set contains the field
|
|
83
|
+
if self.next_offset is None and "next_offset" in self.model_fields_set:
|
|
84
|
+
_dict['nextOffset'] = None
|
|
85
|
+
|
|
86
|
+
return _dict
|
|
87
|
+
|
|
88
|
+
@classmethod
|
|
89
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
90
|
+
"""Create an instance of ListIndexingSchedulesResponse from a dict"""
|
|
91
|
+
if obj is None:
|
|
92
|
+
return None
|
|
93
|
+
|
|
94
|
+
if not isinstance(obj, dict):
|
|
95
|
+
return cls.model_validate(obj)
|
|
96
|
+
|
|
97
|
+
_obj = cls.model_validate({
|
|
98
|
+
"schedules": [IndexingScheduleDto.from_dict(_item) for _item in obj["schedules"]] if obj.get("schedules") is not None else None,
|
|
99
|
+
"totalCount": obj.get("totalCount"),
|
|
100
|
+
"nextOffset": obj.get("nextOffset")
|
|
101
|
+
})
|
|
102
|
+
return _obj
|
|
103
|
+
|
|
104
|
+
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
perceptic-core-server API
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.0.1-SNAPSHOT
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictInt
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from perceptic_core_client.models.schedule_execution_dto import ScheduleExecutionDto
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class ListScheduleExecutionsResponse(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
ListScheduleExecutionsResponse
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
executions: Optional[List[ScheduleExecutionDto]] = None
|
|
31
|
+
total_count: Optional[StrictInt] = Field(default=None, alias="totalCount")
|
|
32
|
+
next_offset: Optional[StrictInt] = Field(default=None, alias="nextOffset")
|
|
33
|
+
__properties: ClassVar[List[str]] = ["executions", "totalCount", "nextOffset"]
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
populate_by_name=True,
|
|
37
|
+
validate_assignment=True,
|
|
38
|
+
protected_namespaces=(),
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def to_str(self) -> str:
|
|
43
|
+
"""Returns the string representation of the model using alias"""
|
|
44
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
45
|
+
|
|
46
|
+
def to_json(self) -> str:
|
|
47
|
+
"""Returns the JSON representation of the model using alias"""
|
|
48
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
49
|
+
return json.dumps(self.to_dict())
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
53
|
+
"""Create an instance of ListScheduleExecutionsResponse from a JSON string"""
|
|
54
|
+
return cls.from_dict(json.loads(json_str))
|
|
55
|
+
|
|
56
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
57
|
+
"""Return the dictionary representation of the model using alias.
|
|
58
|
+
|
|
59
|
+
This has the following differences from calling pydantic's
|
|
60
|
+
`self.model_dump(by_alias=True)`:
|
|
61
|
+
|
|
62
|
+
* `None` is only added to the output dict for nullable fields that
|
|
63
|
+
were set at model initialization. Other fields with value `None`
|
|
64
|
+
are ignored.
|
|
65
|
+
"""
|
|
66
|
+
excluded_fields: Set[str] = set([
|
|
67
|
+
])
|
|
68
|
+
|
|
69
|
+
_dict = self.model_dump(
|
|
70
|
+
by_alias=True,
|
|
71
|
+
exclude=excluded_fields,
|
|
72
|
+
exclude_none=True,
|
|
73
|
+
)
|
|
74
|
+
# override the default output from pydantic by calling `to_dict()` of each item in executions (list)
|
|
75
|
+
_items = []
|
|
76
|
+
if self.executions:
|
|
77
|
+
for _item_executions in self.executions:
|
|
78
|
+
if _item_executions:
|
|
79
|
+
_items.append(_item_executions.to_dict())
|
|
80
|
+
_dict['executions'] = _items
|
|
81
|
+
# set to None if next_offset (nullable) is None
|
|
82
|
+
# and model_fields_set contains the field
|
|
83
|
+
if self.next_offset is None and "next_offset" in self.model_fields_set:
|
|
84
|
+
_dict['nextOffset'] = None
|
|
85
|
+
|
|
86
|
+
return _dict
|
|
87
|
+
|
|
88
|
+
@classmethod
|
|
89
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
90
|
+
"""Create an instance of ListScheduleExecutionsResponse from a dict"""
|
|
91
|
+
if obj is None:
|
|
92
|
+
return None
|
|
93
|
+
|
|
94
|
+
if not isinstance(obj, dict):
|
|
95
|
+
return cls.model_validate(obj)
|
|
96
|
+
|
|
97
|
+
_obj = cls.model_validate({
|
|
98
|
+
"executions": [ScheduleExecutionDto.from_dict(_item) for _item in obj["executions"]] if obj.get("executions") is not None else None,
|
|
99
|
+
"totalCount": obj.get("totalCount"),
|
|
100
|
+
"nextOffset": obj.get("nextOffset")
|
|
101
|
+
})
|
|
102
|
+
return _obj
|
|
103
|
+
|
|
104
|
+
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
perceptic-core-server API
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.0.1-SNAPSHOT
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class OnUploadTrigger(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
OnUploadTrigger
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
type: Optional[StrictStr] = None
|
|
30
|
+
__properties: ClassVar[List[str]] = ["type"]
|
|
31
|
+
|
|
32
|
+
model_config = ConfigDict(
|
|
33
|
+
populate_by_name=True,
|
|
34
|
+
validate_assignment=True,
|
|
35
|
+
protected_namespaces=(),
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def to_str(self) -> str:
|
|
40
|
+
"""Returns the string representation of the model using alias"""
|
|
41
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
42
|
+
|
|
43
|
+
def to_json(self) -> str:
|
|
44
|
+
"""Returns the JSON representation of the model using alias"""
|
|
45
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
46
|
+
return json.dumps(self.to_dict())
|
|
47
|
+
|
|
48
|
+
@classmethod
|
|
49
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
50
|
+
"""Create an instance of OnUploadTrigger from a JSON string"""
|
|
51
|
+
return cls.from_dict(json.loads(json_str))
|
|
52
|
+
|
|
53
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
54
|
+
"""Return the dictionary representation of the model using alias.
|
|
55
|
+
|
|
56
|
+
This has the following differences from calling pydantic's
|
|
57
|
+
`self.model_dump(by_alias=True)`:
|
|
58
|
+
|
|
59
|
+
* `None` is only added to the output dict for nullable fields that
|
|
60
|
+
were set at model initialization. Other fields with value `None`
|
|
61
|
+
are ignored.
|
|
62
|
+
"""
|
|
63
|
+
excluded_fields: Set[str] = set([
|
|
64
|
+
])
|
|
65
|
+
|
|
66
|
+
_dict = self.model_dump(
|
|
67
|
+
by_alias=True,
|
|
68
|
+
exclude=excluded_fields,
|
|
69
|
+
exclude_none=True,
|
|
70
|
+
)
|
|
71
|
+
return _dict
|
|
72
|
+
|
|
73
|
+
@classmethod
|
|
74
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
75
|
+
"""Create an instance of OnUploadTrigger from a dict"""
|
|
76
|
+
if obj is None:
|
|
77
|
+
return None
|
|
78
|
+
|
|
79
|
+
if not isinstance(obj, dict):
|
|
80
|
+
return cls.model_validate(obj)
|
|
81
|
+
|
|
82
|
+
_obj = cls.model_validate({
|
|
83
|
+
"type": obj.get("type")
|
|
84
|
+
})
|
|
85
|
+
return _obj
|
|
86
|
+
|
|
87
|
+
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
perceptic-core-server API
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.0.1-SNAPSHOT
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from datetime import datetime
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from perceptic_core_client.models.execution_trigger_reason import ExecutionTriggerReason
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class ScheduleExecutionDto(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
ScheduleExecutionDto
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
execution_rid: Optional[StrictStr] = Field(default=None, alias="executionRid")
|
|
32
|
+
schedule_rid: Optional[StrictStr] = Field(default=None, alias="scheduleRid")
|
|
33
|
+
task_rid: Optional[StrictStr] = Field(default=None, alias="taskRid")
|
|
34
|
+
triggered_at: Optional[datetime] = Field(default=None, alias="triggeredAt")
|
|
35
|
+
reason: Optional[ExecutionTriggerReason] = None
|
|
36
|
+
trigger_details: Optional[StrictStr] = Field(default=None, alias="triggerDetails")
|
|
37
|
+
__properties: ClassVar[List[str]] = ["executionRid", "scheduleRid", "taskRid", "triggeredAt", "reason", "triggerDetails"]
|
|
38
|
+
|
|
39
|
+
model_config = ConfigDict(
|
|
40
|
+
populate_by_name=True,
|
|
41
|
+
validate_assignment=True,
|
|
42
|
+
protected_namespaces=(),
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def to_str(self) -> str:
|
|
47
|
+
"""Returns the string representation of the model using alias"""
|
|
48
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
49
|
+
|
|
50
|
+
def to_json(self) -> str:
|
|
51
|
+
"""Returns the JSON representation of the model using alias"""
|
|
52
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
53
|
+
return json.dumps(self.to_dict())
|
|
54
|
+
|
|
55
|
+
@classmethod
|
|
56
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
57
|
+
"""Create an instance of ScheduleExecutionDto from a JSON string"""
|
|
58
|
+
return cls.from_dict(json.loads(json_str))
|
|
59
|
+
|
|
60
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
61
|
+
"""Return the dictionary representation of the model using alias.
|
|
62
|
+
|
|
63
|
+
This has the following differences from calling pydantic's
|
|
64
|
+
`self.model_dump(by_alias=True)`:
|
|
65
|
+
|
|
66
|
+
* `None` is only added to the output dict for nullable fields that
|
|
67
|
+
were set at model initialization. Other fields with value `None`
|
|
68
|
+
are ignored.
|
|
69
|
+
"""
|
|
70
|
+
excluded_fields: Set[str] = set([
|
|
71
|
+
])
|
|
72
|
+
|
|
73
|
+
_dict = self.model_dump(
|
|
74
|
+
by_alias=True,
|
|
75
|
+
exclude=excluded_fields,
|
|
76
|
+
exclude_none=True,
|
|
77
|
+
)
|
|
78
|
+
# set to None if trigger_details (nullable) is None
|
|
79
|
+
# and model_fields_set contains the field
|
|
80
|
+
if self.trigger_details is None and "trigger_details" in self.model_fields_set:
|
|
81
|
+
_dict['triggerDetails'] = None
|
|
82
|
+
|
|
83
|
+
return _dict
|
|
84
|
+
|
|
85
|
+
@classmethod
|
|
86
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
87
|
+
"""Create an instance of ScheduleExecutionDto from a dict"""
|
|
88
|
+
if obj is None:
|
|
89
|
+
return None
|
|
90
|
+
|
|
91
|
+
if not isinstance(obj, dict):
|
|
92
|
+
return cls.model_validate(obj)
|
|
93
|
+
|
|
94
|
+
_obj = cls.model_validate({
|
|
95
|
+
"executionRid": obj.get("executionRid"),
|
|
96
|
+
"scheduleRid": obj.get("scheduleRid"),
|
|
97
|
+
"taskRid": obj.get("taskRid"),
|
|
98
|
+
"triggeredAt": obj.get("triggeredAt"),
|
|
99
|
+
"reason": obj.get("reason"),
|
|
100
|
+
"triggerDetails": obj.get("triggerDetails")
|
|
101
|
+
})
|
|
102
|
+
return _obj
|
|
103
|
+
|
|
104
|
+
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
perceptic-core-server API
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.0.1-SNAPSHOT
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
|
19
|
+
from typing import Any, List, Optional
|
|
20
|
+
from perceptic_core_client.models.cron_trigger import CronTrigger
|
|
21
|
+
from perceptic_core_client.models.interval_trigger import IntervalTrigger
|
|
22
|
+
from perceptic_core_client.models.on_upload_trigger import OnUploadTrigger
|
|
23
|
+
from pydantic import StrictStr, Field
|
|
24
|
+
from typing import Union, List, Set, Optional, Dict
|
|
25
|
+
from typing_extensions import Literal, Self
|
|
26
|
+
|
|
27
|
+
SCHEDULETRIGGER_ONE_OF_SCHEMAS = ["CronTrigger", "IntervalTrigger", "OnUploadTrigger"]
|
|
28
|
+
|
|
29
|
+
class ScheduleTrigger(BaseModel):
|
|
30
|
+
"""
|
|
31
|
+
ScheduleTrigger
|
|
32
|
+
"""
|
|
33
|
+
# data type: OnUploadTrigger
|
|
34
|
+
oneof_schema_1_validator: Optional[OnUploadTrigger] = None
|
|
35
|
+
# data type: CronTrigger
|
|
36
|
+
oneof_schema_2_validator: Optional[CronTrigger] = None
|
|
37
|
+
# data type: IntervalTrigger
|
|
38
|
+
oneof_schema_3_validator: Optional[IntervalTrigger] = None
|
|
39
|
+
actual_instance: Optional[Union[CronTrigger, IntervalTrigger, OnUploadTrigger]] = None
|
|
40
|
+
one_of_schemas: Set[str] = { "CronTrigger", "IntervalTrigger", "OnUploadTrigger" }
|
|
41
|
+
|
|
42
|
+
model_config = ConfigDict(
|
|
43
|
+
validate_assignment=True,
|
|
44
|
+
protected_namespaces=(),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
discriminator_value_class_map: Dict[str, str] = {
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
52
|
+
if args:
|
|
53
|
+
if len(args) > 1:
|
|
54
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
55
|
+
if kwargs:
|
|
56
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
57
|
+
super().__init__(actual_instance=args[0])
|
|
58
|
+
else:
|
|
59
|
+
super().__init__(**kwargs)
|
|
60
|
+
|
|
61
|
+
@field_validator('actual_instance')
|
|
62
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
63
|
+
instance = ScheduleTrigger.model_construct()
|
|
64
|
+
error_messages = []
|
|
65
|
+
match = 0
|
|
66
|
+
# validate data type: OnUploadTrigger
|
|
67
|
+
if not isinstance(v, OnUploadTrigger):
|
|
68
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `OnUploadTrigger`")
|
|
69
|
+
else:
|
|
70
|
+
match += 1
|
|
71
|
+
# validate data type: CronTrigger
|
|
72
|
+
if not isinstance(v, CronTrigger):
|
|
73
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `CronTrigger`")
|
|
74
|
+
else:
|
|
75
|
+
match += 1
|
|
76
|
+
# validate data type: IntervalTrigger
|
|
77
|
+
if not isinstance(v, IntervalTrigger):
|
|
78
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `IntervalTrigger`")
|
|
79
|
+
else:
|
|
80
|
+
match += 1
|
|
81
|
+
if match > 1:
|
|
82
|
+
# more than 1 match
|
|
83
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in ScheduleTrigger with oneOf schemas: CronTrigger, IntervalTrigger, OnUploadTrigger. Details: " + ", ".join(error_messages))
|
|
84
|
+
elif match == 0:
|
|
85
|
+
# no match
|
|
86
|
+
raise ValueError("No match found when setting `actual_instance` in ScheduleTrigger with oneOf schemas: CronTrigger, IntervalTrigger, OnUploadTrigger. Details: " + ", ".join(error_messages))
|
|
87
|
+
else:
|
|
88
|
+
return v
|
|
89
|
+
|
|
90
|
+
@classmethod
|
|
91
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
92
|
+
return cls.from_json(json.dumps(obj))
|
|
93
|
+
|
|
94
|
+
@classmethod
|
|
95
|
+
def from_json(cls, json_str: str) -> Self:
|
|
96
|
+
"""Returns the object represented by the json string"""
|
|
97
|
+
instance = cls.model_construct()
|
|
98
|
+
error_messages = []
|
|
99
|
+
match = 0
|
|
100
|
+
|
|
101
|
+
# use oneOf discriminator to lookup the data type
|
|
102
|
+
_data_type = json.loads(json_str).get("type")
|
|
103
|
+
if not _data_type:
|
|
104
|
+
raise ValueError("Failed to lookup data type from the field `type` in the input.")
|
|
105
|
+
|
|
106
|
+
# check if data type is `CronTrigger`
|
|
107
|
+
if _data_type == "cron":
|
|
108
|
+
instance.actual_instance = CronTrigger.from_json(json_str)
|
|
109
|
+
return instance
|
|
110
|
+
|
|
111
|
+
# check if data type is `IntervalTrigger`
|
|
112
|
+
if _data_type == "interval":
|
|
113
|
+
instance.actual_instance = IntervalTrigger.from_json(json_str)
|
|
114
|
+
return instance
|
|
115
|
+
|
|
116
|
+
# check if data type is `OnUploadTrigger`
|
|
117
|
+
if _data_type == "onUpload":
|
|
118
|
+
instance.actual_instance = OnUploadTrigger.from_json(json_str)
|
|
119
|
+
return instance
|
|
120
|
+
|
|
121
|
+
# check if data type is `CronTrigger`
|
|
122
|
+
if _data_type == "CronTrigger":
|
|
123
|
+
instance.actual_instance = CronTrigger.from_json(json_str)
|
|
124
|
+
return instance
|
|
125
|
+
|
|
126
|
+
# check if data type is `IntervalTrigger`
|
|
127
|
+
if _data_type == "IntervalTrigger":
|
|
128
|
+
instance.actual_instance = IntervalTrigger.from_json(json_str)
|
|
129
|
+
return instance
|
|
130
|
+
|
|
131
|
+
# check if data type is `OnUploadTrigger`
|
|
132
|
+
if _data_type == "OnUploadTrigger":
|
|
133
|
+
instance.actual_instance = OnUploadTrigger.from_json(json_str)
|
|
134
|
+
return instance
|
|
135
|
+
|
|
136
|
+
# deserialize data into OnUploadTrigger
|
|
137
|
+
try:
|
|
138
|
+
instance.actual_instance = OnUploadTrigger.from_json(json_str)
|
|
139
|
+
match += 1
|
|
140
|
+
except (ValidationError, ValueError) as e:
|
|
141
|
+
error_messages.append(str(e))
|
|
142
|
+
# deserialize data into CronTrigger
|
|
143
|
+
try:
|
|
144
|
+
instance.actual_instance = CronTrigger.from_json(json_str)
|
|
145
|
+
match += 1
|
|
146
|
+
except (ValidationError, ValueError) as e:
|
|
147
|
+
error_messages.append(str(e))
|
|
148
|
+
# deserialize data into IntervalTrigger
|
|
149
|
+
try:
|
|
150
|
+
instance.actual_instance = IntervalTrigger.from_json(json_str)
|
|
151
|
+
match += 1
|
|
152
|
+
except (ValidationError, ValueError) as e:
|
|
153
|
+
error_messages.append(str(e))
|
|
154
|
+
|
|
155
|
+
if match > 1:
|
|
156
|
+
# more than 1 match
|
|
157
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into ScheduleTrigger with oneOf schemas: CronTrigger, IntervalTrigger, OnUploadTrigger. Details: " + ", ".join(error_messages))
|
|
158
|
+
elif match == 0:
|
|
159
|
+
# no match
|
|
160
|
+
raise ValueError("No match found when deserializing the JSON string into ScheduleTrigger with oneOf schemas: CronTrigger, IntervalTrigger, OnUploadTrigger. Details: " + ", ".join(error_messages))
|
|
161
|
+
else:
|
|
162
|
+
return instance
|
|
163
|
+
|
|
164
|
+
def to_json(self) -> str:
|
|
165
|
+
"""Returns the JSON representation of the actual instance"""
|
|
166
|
+
if self.actual_instance is None:
|
|
167
|
+
return "null"
|
|
168
|
+
|
|
169
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
170
|
+
return self.actual_instance.to_json()
|
|
171
|
+
else:
|
|
172
|
+
return json.dumps(self.actual_instance)
|
|
173
|
+
|
|
174
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], CronTrigger, IntervalTrigger, OnUploadTrigger]]:
|
|
175
|
+
"""Returns the dict representation of the actual instance"""
|
|
176
|
+
if self.actual_instance is None:
|
|
177
|
+
return None
|
|
178
|
+
|
|
179
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
180
|
+
return self.actual_instance.to_dict()
|
|
181
|
+
else:
|
|
182
|
+
# primitive type
|
|
183
|
+
return self.actual_instance
|
|
184
|
+
|
|
185
|
+
def to_str(self) -> str:
|
|
186
|
+
"""Returns the string representation of the actual instance"""
|
|
187
|
+
return pprint.pformat(self.model_dump())
|
|
188
|
+
|
|
189
|
+
|