Files.com 1.6.331__py3-none-any.whl → 1.6.332__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.
README.md CHANGED
@@ -644,6 +644,8 @@ files_sdk.error.FolderAdminPermissionRequiredError -> files_sdk.error.NotAuthori
644
644
  |`DestinationParentConflictError`| `ProcessingFailureError` |
645
645
  |`DestinationParentDoesNotExistError`| `ProcessingFailureError` |
646
646
  |`ExceededRuntimeLimitError`| `ProcessingFailureError` |
647
+ |`ExpectationAlreadyHasOpenWindowError`| `ProcessingFailureError` |
648
+ |`ExpectationNotManualTriggerError`| `ProcessingFailureError` |
647
649
  |`ExpiredPrivateKeyError`| `ProcessingFailureError` |
648
650
  |`ExpiredPublicKeyError`| `ProcessingFailureError` |
649
651
  |`ExportFailureError`| `ProcessingFailureError` |
_VERSION CHANGED
@@ -1 +1 @@
1
- 1.6.331
1
+ 1.6.332
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: files_com
3
- Version: 1.6.331
3
+ Version: 1.6.332
4
4
  Summary: Python bindings for the Files.com API
5
5
  License: MIT
6
6
  Requires-Python: >=3.5
@@ -656,6 +656,8 @@ files_sdk.error.FolderAdminPermissionRequiredError -> files_sdk.error.NotAuthori
656
656
  |`DestinationParentConflictError`| `ProcessingFailureError` |
657
657
  |`DestinationParentDoesNotExistError`| `ProcessingFailureError` |
658
658
  |`ExceededRuntimeLimitError`| `ProcessingFailureError` |
659
+ |`ExpectationAlreadyHasOpenWindowError`| `ProcessingFailureError` |
660
+ |`ExpectationNotManualTriggerError`| `ProcessingFailureError` |
659
661
  |`ExpiredPrivateKeyError`| `ProcessingFailureError` |
660
662
  |`ExpiredPublicKeyError`| `ProcessingFailureError` |
661
663
  |`ExportFailureError`| `ProcessingFailureError` |
@@ -1,14 +1,14 @@
1
- README.md,sha256=SvOBQpHSPtwML5vWdswnePFUKgTpoid3y5i0GKM1OUs,32849
2
- _VERSION,sha256=UXV49NSxE3wYEJEu7bWq-yvGfSk-zJbVzyHB8IdsUzE,8
3
- files_com-1.6.331.dist-info/licenses/LICENSE,sha256=ziANl9OTD-5-iE8XYIZNm6IYBDxOCHwQ-mdhci7lNew,1102
4
- files_sdk/__init__.py,sha256=1O0gEbHQMNubSoqDtwbB1HpFc5K8uSDxEX6B22rn5Lw,14503
1
+ README.md,sha256=JOQU7EuTx0kZ0hPbb4lVzpWoMn0CFyJ_OZks24oNRfA,32983
2
+ _VERSION,sha256=ObCwRaKBWHBsti_t_sBrDoAMgNbhSEyARPAhqJTxHN4,8
3
+ files_com-1.6.332.dist-info/licenses/LICENSE,sha256=ziANl9OTD-5-iE8XYIZNm6IYBDxOCHwQ-mdhci7lNew,1102
4
+ files_sdk/__init__.py,sha256=UChUMvnWAObPY2C6c9ZZFK4flYMZbfDpKmvMuuPf6Bc,14893
5
5
  files_sdk/api.py,sha256=HOLk50HLQCbnHwnAr9OElQEWvdA_BABBSEvvFSt1S4A,1846
6
6
  files_sdk/api_client.py,sha256=mKHqpVmsqKb8oVrlybks-5WUB9RXtuNglv9fD4q2BT8,11700
7
- files_sdk/error.py,sha256=EKXwd9Rx4_Q6Y_LioHScPAtCYNssXnzTXm2m7LqF5_I,69044
7
+ files_sdk/error.py,sha256=WrLf-6R0D-A2_P_VEs3XRY3q9hZBWidBh6cZQCupnoI,69744
8
8
  files_sdk/list_obj.py,sha256=MWgmESLAmfh1uaSw76PWxmnf9f6_08TLUHe8_mCYKL4,1157
9
9
  files_sdk/path_util.py,sha256=7x8X3JLoMkcqNefCaBeHYXD8MGvPby4AOy-xnBX_LNk,1694
10
10
  files_sdk/util.py,sha256=6aA4N0Wq_ykINW7eMrs2ntFAL2hRLM6IvJf6n_yP34c,962
11
- files_sdk/models/__init__.py,sha256=DXOg-nR4J5QQrCIW_p4IJoQDegrEVFn8Fmyz9wQk7vg,6642
11
+ files_sdk/models/__init__.py,sha256=CTJtvZd5nFjUfDrqZ94V0dIJVmm0Rq5skYTjRORf7wE,6839
12
12
  files_sdk/models/account_line_item.py,sha256=XxYF8IoqQk_J8Gt7eoJMoo7xI9iHADl5Y2E3pxWml4A,2838
13
13
  files_sdk/models/action.py,sha256=RxBraK9vQliGv2artY8lmEzQtFQBHDW_vHpHFfaogJo,2082
14
14
  files_sdk/models/action_log.py,sha256=wTu8kTUCKs_-NO7E32Ua8AOaZAQkmEhQ-gIuQBMYzVQ,34229
@@ -43,6 +43,9 @@ files_sdk/models/email_incoming_message.py,sha256=nMwugkXAIiOB_B42SW66bi7IO4mMbm
43
43
  files_sdk/models/email_log.py,sha256=r8VF7_Cxeymp9bOqRkKeEQl2NtitpIEpGtxcSssVFLg,4898
44
44
  files_sdk/models/errors.py,sha256=UoIYHG1iG5HJRQDTM076R5699iIU5eWbRvLOHcTsdMU,1165
45
45
  files_sdk/models/exavault_api_request_log.py,sha256=SE-XH12SsRSFBEkrSbZmz5i9i_bdp6L6vRxYfs70kF4,8138
46
+ files_sdk/models/expectation.py,sha256=lsXX9stsHkYja-Bk_LdoZZzMwjrey6tcb8SaHiydsTg,26683
47
+ files_sdk/models/expectation_evaluation.py,sha256=Svlaj6r1oEa9tKuU4Zy8RSoY65wNK44TBdCKcLxVZ0M,5236
48
+ files_sdk/models/expectation_incident.py,sha256=4N6hzwA5amZ6GneNjCsb_4kCo0faS4hMCyfiVfMEMBk,10133
46
49
  files_sdk/models/external_event.py,sha256=V2F51G4siEexbMPULjNAf8wOaEOZCq3yIwdOu-vX-CU,7642
47
50
  files_sdk/models/file.py,sha256=MggNuNxwn6pmFaTL935q2SO4uo634r790zOKKSPoqnI,41659
48
51
  files_sdk/models/file_action.py,sha256=kHzWb8x5mbB6WKfK-kz1W477zs4-qDPpGECP1FMRgyY,1279
@@ -125,7 +128,7 @@ files_sdk/models/web_dav_action_log.py,sha256=6juNDfHirJ-aTwpi59XSZLfGVg2tDBbaWN
125
128
  files_sdk/models/webhook_test.py,sha256=DQfko2EeEtawm2EKGPseM-jq-dkcrcUnF4R2QJM2kE4,5066
126
129
  files_sdk/models/workspace.py,sha256=qDOGzpo7AXQ5x4Uv7Nyw0RRRwC2vw0Q-N9LMUWK-z04,7696
127
130
  files_sdk/models/zip_list_entry.py,sha256=Jq1tr0POvFl_yZ2aTEPVxskazvaM8oIEWoi-6RSRBaw,1305
128
- files_com-1.6.331.dist-info/METADATA,sha256=ekqq0iSH4N-UMXEZfRt3r3uND28m74J-opkbVfDA-ko,33142
129
- files_com-1.6.331.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
130
- files_com-1.6.331.dist-info/top_level.txt,sha256=p_2P-gluT_8boeXQNixTP3x-tFd1-la2NedKOiln21I,10
131
- files_com-1.6.331.dist-info/RECORD,,
131
+ files_com-1.6.332.dist-info/METADATA,sha256=A392HXFqfNqxVyXgfggd8T1W00CTTPe3kkCBApqZdNA,33276
132
+ files_com-1.6.332.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
133
+ files_com-1.6.332.dist-info/top_level.txt,sha256=p_2P-gluT_8boeXQNixTP3x-tFd1-la2NedKOiln21I,10
134
+ files_com-1.6.332.dist-info/RECORD,,
files_sdk/__init__.py CHANGED
@@ -33,6 +33,9 @@ import files_sdk.models.email_incoming_message as email_incoming_message
33
33
  import files_sdk.models.email_log as email_log
34
34
  import files_sdk.models.errors as errors
35
35
  import files_sdk.models.exavault_api_request_log as exavault_api_request_log
36
+ import files_sdk.models.expectation as expectation
37
+ import files_sdk.models.expectation_evaluation as expectation_evaluation
38
+ import files_sdk.models.expectation_incident as expectation_incident
36
39
  import files_sdk.models.external_event as external_event
37
40
  import files_sdk.models.file as file
38
41
  import files_sdk.models.file_action as file_action
@@ -158,6 +161,9 @@ from files_sdk.models.email_incoming_message import EmailIncomingMessage
158
161
  from files_sdk.models.email_log import EmailLog
159
162
  from files_sdk.models.errors import Errors
160
163
  from files_sdk.models.exavault_api_request_log import ExavaultApiRequestLog
164
+ from files_sdk.models.expectation import Expectation
165
+ from files_sdk.models.expectation_evaluation import ExpectationEvaluation
166
+ from files_sdk.models.expectation_incident import ExpectationIncident
161
167
  from files_sdk.models.external_event import ExternalEvent
162
168
  from files_sdk.models.file import File
163
169
  from files_sdk.models.file_action import FileAction
@@ -253,7 +259,7 @@ session_id = None
253
259
  source_ip = None
254
260
  base_url = "https://app.files.com"
255
261
  base_path = "api/rest/v1"
256
- version = "1.6.331"
262
+ version = "1.6.332"
257
263
 
258
264
  __version__ = version
259
265
 
files_sdk/error.py CHANGED
@@ -2167,6 +2167,36 @@ class ExceededRuntimeLimitError(ProcessingFailureError):
2167
2167
  )
2168
2168
 
2169
2169
 
2170
+ class ExpectationAlreadyHasOpenWindowError(ProcessingFailureError):
2171
+ def __init__(
2172
+ self,
2173
+ message=None,
2174
+ http_body=None,
2175
+ http_status=None,
2176
+ json_body=None,
2177
+ headers=None,
2178
+ code=None,
2179
+ ):
2180
+ super().__init__(
2181
+ message, http_body, http_status, json_body, headers, code
2182
+ )
2183
+
2184
+
2185
+ class ExpectationNotManualTriggerError(ProcessingFailureError):
2186
+ def __init__(
2187
+ self,
2188
+ message=None,
2189
+ http_body=None,
2190
+ http_status=None,
2191
+ json_body=None,
2192
+ headers=None,
2193
+ code=None,
2194
+ ):
2195
+ super().__init__(
2196
+ message, http_body, http_status, json_body, headers, code
2197
+ )
2198
+
2199
+
2170
2200
  class ExpiredPrivateKeyError(ProcessingFailureError):
2171
2201
  def __init__(
2172
2202
  self,
@@ -40,6 +40,9 @@ from files_sdk.models.email_incoming_message import EmailIncomingMessage
40
40
  from files_sdk.models.email_log import EmailLog
41
41
  from files_sdk.models.errors import Errors
42
42
  from files_sdk.models.exavault_api_request_log import ExavaultApiRequestLog
43
+ from files_sdk.models.expectation import Expectation
44
+ from files_sdk.models.expectation_evaluation import ExpectationEvaluation
45
+ from files_sdk.models.expectation_incident import ExpectationIncident
43
46
  from files_sdk.models.external_event import ExternalEvent
44
47
  from files_sdk.models.file import File
45
48
  from files_sdk.models.file_action import FileAction
@@ -0,0 +1,566 @@
1
+ import builtins # noqa: F401
2
+ from files_sdk.models.expectation_evaluation import ExpectationEvaluation
3
+ from files_sdk.api import Api # noqa: F401
4
+ from files_sdk.list_obj import ListObj
5
+ from files_sdk.error import ( # noqa: F401
6
+ InvalidParameterError,
7
+ MissingParameterError,
8
+ NotImplementedError,
9
+ )
10
+
11
+
12
+ class Expectation:
13
+ default_attributes = {
14
+ "id": None, # int64 - Expectation ID
15
+ "workspace_id": None, # int64 - Workspace ID. `0` means the default workspace.
16
+ "name": None, # string - Expectation name.
17
+ "description": None, # string - Expectation description.
18
+ "path": None, # string - Path scope for the expectation. Supports workspace-relative presentation. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
19
+ "source": None, # string - Source glob used to select candidate files.
20
+ "exclude_pattern": None, # string - Optional source exclusion glob.
21
+ "disabled": None, # boolean - If true, the expectation is disabled.
22
+ "expectations_version": None, # int64 - Criteria schema version for this expectation.
23
+ "trigger": None, # string - How this expectation opens windows.
24
+ "interval": None, # string - If trigger is `daily`, this specifies how often to run the expectation.
25
+ "recurring_day": None, # int64 - If trigger is `daily`, this selects the day number inside the chosen interval.
26
+ "schedule_days_of_week": None, # array(int64) - If trigger is `custom_schedule`, the 0-based weekdays used by the schedule.
27
+ "schedule_times_of_day": None, # array(string) - Times of day in HH:MM format for schedule-driven expectations.
28
+ "schedule_time_zone": None, # string - Time zone used by the expectation schedule.
29
+ "holiday_region": None, # string - Optional holiday region used by schedule-driven expectations.
30
+ "lookback_interval": None, # int64 - How many seconds before the due boundary the window starts.
31
+ "late_acceptance_interval": None, # int64 - How many seconds a schedule-driven window may remain eligible to close as late.
32
+ "inactivity_interval": None, # int64 - How many quiet seconds are required before final closure.
33
+ "max_open_interval": None, # int64 - Hard-stop duration in seconds for unscheduled expectations.
34
+ "criteria": None, # object - Structured criteria v1 definition for the expectation.
35
+ "last_evaluated_at": None, # date-time - Last time this expectation was evaluated.
36
+ "last_success_at": None, # date-time - Last time this expectation closed successfully.
37
+ "last_failure_at": None, # date-time - Last time this expectation closed with a failure result.
38
+ "last_result": None, # string - Most recent terminal result for this expectation.
39
+ "created_at": None, # date-time - Creation time.
40
+ "updated_at": None, # date-time - Last update time.
41
+ }
42
+
43
+ def __init__(self, attributes=None, options=None):
44
+ if not isinstance(attributes, dict):
45
+ attributes = {}
46
+ if not isinstance(options, dict):
47
+ options = {}
48
+ self.set_attributes(attributes)
49
+ self.options = options
50
+
51
+ def set_attributes(self, attributes):
52
+ for attribute, default_value in Expectation.default_attributes.items():
53
+ value = attributes.get(attribute, default_value)
54
+ setattr(self, attribute, value)
55
+
56
+ def get_attributes(self):
57
+ attrs = {
58
+ k: getattr(self, k, None)
59
+ for k in Expectation.default_attributes
60
+ if getattr(self, k, None) is not None
61
+ }
62
+ return attrs
63
+
64
+ # Manually open an Expectation window
65
+ def trigger(self, params=None):
66
+ if not isinstance(params, dict):
67
+ params = {}
68
+
69
+ if hasattr(self, "id") and self.id:
70
+ params["id"] = self.id
71
+ else:
72
+ raise MissingParameterError("Current object doesn't have a id")
73
+ if "id" not in params:
74
+ raise MissingParameterError("Parameter missing: id")
75
+ if "id" in params and not isinstance(params["id"], int):
76
+ raise InvalidParameterError("Bad parameter: id must be an int")
77
+ response, _options = Api.send_request(
78
+ "POST",
79
+ "/expectations/{id}/trigger".format(id=params["id"]),
80
+ params,
81
+ self.options,
82
+ )
83
+ return response.data
84
+
85
+ # Parameters:
86
+ # name - string - Expectation name.
87
+ # description - string - Expectation description.
88
+ # path - string - Path scope for the expectation. Supports workspace-relative presentation.
89
+ # source - string - Source glob used to select candidate files.
90
+ # exclude_pattern - string - Optional source exclusion glob.
91
+ # disabled - boolean - If true, the expectation is disabled.
92
+ # trigger - string - How this expectation opens windows.
93
+ # interval - string - If trigger is `daily`, this specifies how often to run the expectation.
94
+ # recurring_day - int64 - If trigger is `daily`, this selects the day number inside the chosen interval.
95
+ # schedule_days_of_week - array(int64) - If trigger is `custom_schedule`, the 0-based weekdays used by the schedule.
96
+ # schedule_times_of_day - array(string) - Times of day in HH:MM format for schedule-driven expectations.
97
+ # schedule_time_zone - string - Time zone used by the expectation schedule.
98
+ # holiday_region - string - Optional holiday region used by schedule-driven expectations.
99
+ # lookback_interval - int64 - How many seconds before the due boundary the window starts.
100
+ # late_acceptance_interval - int64 - How many seconds a schedule-driven window may remain eligible to close as late.
101
+ # inactivity_interval - int64 - How many quiet seconds are required before final closure.
102
+ # max_open_interval - int64 - Hard-stop duration in seconds for unscheduled expectations.
103
+ # criteria - object - Structured criteria v1 definition for the expectation.
104
+ # workspace_id - int64 - Workspace ID. `0` means the default workspace.
105
+ def update(self, params=None):
106
+ if not isinstance(params, dict):
107
+ params = {}
108
+
109
+ if hasattr(self, "id") and self.id:
110
+ params["id"] = self.id
111
+ else:
112
+ raise MissingParameterError("Current object doesn't have a id")
113
+ if "id" not in params:
114
+ raise MissingParameterError("Parameter missing: id")
115
+ if "id" in params and not isinstance(params["id"], int):
116
+ raise InvalidParameterError("Bad parameter: id must be an int")
117
+ if "name" in params and not isinstance(params["name"], str):
118
+ raise InvalidParameterError("Bad parameter: name must be an str")
119
+ if "description" in params and not isinstance(
120
+ params["description"], str
121
+ ):
122
+ raise InvalidParameterError(
123
+ "Bad parameter: description must be an str"
124
+ )
125
+ if "path" in params and not isinstance(params["path"], str):
126
+ raise InvalidParameterError("Bad parameter: path must be an str")
127
+ if "source" in params and not isinstance(params["source"], str):
128
+ raise InvalidParameterError("Bad parameter: source must be an str")
129
+ if "exclude_pattern" in params and not isinstance(
130
+ params["exclude_pattern"], str
131
+ ):
132
+ raise InvalidParameterError(
133
+ "Bad parameter: exclude_pattern must be an str"
134
+ )
135
+ if "trigger" in params and not isinstance(params["trigger"], str):
136
+ raise InvalidParameterError(
137
+ "Bad parameter: trigger must be an str"
138
+ )
139
+ if "interval" in params and not isinstance(params["interval"], str):
140
+ raise InvalidParameterError(
141
+ "Bad parameter: interval must be an str"
142
+ )
143
+ if "recurring_day" in params and not isinstance(
144
+ params["recurring_day"], int
145
+ ):
146
+ raise InvalidParameterError(
147
+ "Bad parameter: recurring_day must be an int"
148
+ )
149
+ if "schedule_days_of_week" in params and not isinstance(
150
+ params["schedule_days_of_week"], builtins.list
151
+ ):
152
+ raise InvalidParameterError(
153
+ "Bad parameter: schedule_days_of_week must be an list"
154
+ )
155
+ if "schedule_times_of_day" in params and not isinstance(
156
+ params["schedule_times_of_day"], builtins.list
157
+ ):
158
+ raise InvalidParameterError(
159
+ "Bad parameter: schedule_times_of_day must be an list"
160
+ )
161
+ if "schedule_time_zone" in params and not isinstance(
162
+ params["schedule_time_zone"], str
163
+ ):
164
+ raise InvalidParameterError(
165
+ "Bad parameter: schedule_time_zone must be an str"
166
+ )
167
+ if "holiday_region" in params and not isinstance(
168
+ params["holiday_region"], str
169
+ ):
170
+ raise InvalidParameterError(
171
+ "Bad parameter: holiday_region must be an str"
172
+ )
173
+ if "lookback_interval" in params and not isinstance(
174
+ params["lookback_interval"], int
175
+ ):
176
+ raise InvalidParameterError(
177
+ "Bad parameter: lookback_interval must be an int"
178
+ )
179
+ if "late_acceptance_interval" in params and not isinstance(
180
+ params["late_acceptance_interval"], int
181
+ ):
182
+ raise InvalidParameterError(
183
+ "Bad parameter: late_acceptance_interval must be an int"
184
+ )
185
+ if "inactivity_interval" in params and not isinstance(
186
+ params["inactivity_interval"], int
187
+ ):
188
+ raise InvalidParameterError(
189
+ "Bad parameter: inactivity_interval must be an int"
190
+ )
191
+ if "max_open_interval" in params and not isinstance(
192
+ params["max_open_interval"], int
193
+ ):
194
+ raise InvalidParameterError(
195
+ "Bad parameter: max_open_interval must be an int"
196
+ )
197
+ if "workspace_id" in params and not isinstance(
198
+ params["workspace_id"], int
199
+ ):
200
+ raise InvalidParameterError(
201
+ "Bad parameter: workspace_id must be an int"
202
+ )
203
+ response, _options = Api.send_request(
204
+ "PATCH",
205
+ "/expectations/{id}".format(id=params["id"]),
206
+ params,
207
+ self.options,
208
+ )
209
+ return response.data
210
+
211
+ def delete(self, params=None):
212
+ if not isinstance(params, dict):
213
+ params = {}
214
+
215
+ if hasattr(self, "id") and self.id:
216
+ params["id"] = self.id
217
+ else:
218
+ raise MissingParameterError("Current object doesn't have a id")
219
+ if "id" not in params:
220
+ raise MissingParameterError("Parameter missing: id")
221
+ if "id" in params and not isinstance(params["id"], int):
222
+ raise InvalidParameterError("Bad parameter: id must be an int")
223
+ Api.send_request(
224
+ "DELETE",
225
+ "/expectations/{id}".format(id=params["id"]),
226
+ params,
227
+ self.options,
228
+ )
229
+
230
+ def destroy(self, params=None):
231
+ self.delete(params)
232
+
233
+ def save(self):
234
+ if hasattr(self, "id") and self.id:
235
+ new_obj = self.update(self.get_attributes())
236
+ self.set_attributes(new_obj.get_attributes())
237
+ return True
238
+ else:
239
+ new_obj = create(self.get_attributes(), self.options)
240
+ self.set_attributes(new_obj.get_attributes())
241
+ return True
242
+
243
+
244
+ # Parameters:
245
+ # cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
246
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
247
+ # sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `workspace_id`, `name` or `disabled`.
248
+ # filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `disabled` and `workspace_id`. Valid field combinations are `[ workspace_id, disabled ]`.
249
+ def list(params=None, options=None):
250
+ if not isinstance(params, dict):
251
+ params = {}
252
+ if not isinstance(options, dict):
253
+ options = {}
254
+ if "cursor" in params and not isinstance(params["cursor"], str):
255
+ raise InvalidParameterError("Bad parameter: cursor must be an str")
256
+ if "per_page" in params and not isinstance(params["per_page"], int):
257
+ raise InvalidParameterError("Bad parameter: per_page must be an int")
258
+ if "sort_by" in params and not isinstance(params["sort_by"], dict):
259
+ raise InvalidParameterError("Bad parameter: sort_by must be an dict")
260
+ if "filter" in params and not isinstance(params["filter"], dict):
261
+ raise InvalidParameterError("Bad parameter: filter must be an dict")
262
+ return ListObj(Expectation, "GET", "/expectations", params, options)
263
+
264
+
265
+ def all(params=None, options=None):
266
+ list(params, options)
267
+
268
+
269
+ # Parameters:
270
+ # id (required) - int64 - Expectation ID.
271
+ def find(id, params=None, options=None):
272
+ if not isinstance(params, dict):
273
+ params = {}
274
+ if not isinstance(options, dict):
275
+ options = {}
276
+ params["id"] = id
277
+ if "id" in params and not isinstance(params["id"], int):
278
+ raise InvalidParameterError("Bad parameter: id must be an int")
279
+ if "id" not in params:
280
+ raise MissingParameterError("Parameter missing: id")
281
+ response, options = Api.send_request(
282
+ "GET", "/expectations/{id}".format(id=params["id"]), params, options
283
+ )
284
+ return Expectation(response.data, options)
285
+
286
+
287
+ def get(id, params=None, options=None):
288
+ find(id, params, options)
289
+
290
+
291
+ # Parameters:
292
+ # name - string - Expectation name.
293
+ # description - string - Expectation description.
294
+ # path - string - Path scope for the expectation. Supports workspace-relative presentation.
295
+ # source - string - Source glob used to select candidate files.
296
+ # exclude_pattern - string - Optional source exclusion glob.
297
+ # disabled - boolean - If true, the expectation is disabled.
298
+ # trigger - string - How this expectation opens windows.
299
+ # interval - string - If trigger is `daily`, this specifies how often to run the expectation.
300
+ # recurring_day - int64 - If trigger is `daily`, this selects the day number inside the chosen interval.
301
+ # schedule_days_of_week - array(int64) - If trigger is `custom_schedule`, the 0-based weekdays used by the schedule.
302
+ # schedule_times_of_day - array(string) - Times of day in HH:MM format for schedule-driven expectations.
303
+ # schedule_time_zone - string - Time zone used by the expectation schedule.
304
+ # holiday_region - string - Optional holiday region used by schedule-driven expectations.
305
+ # lookback_interval - int64 - How many seconds before the due boundary the window starts.
306
+ # late_acceptance_interval - int64 - How many seconds a schedule-driven window may remain eligible to close as late.
307
+ # inactivity_interval - int64 - How many quiet seconds are required before final closure.
308
+ # max_open_interval - int64 - Hard-stop duration in seconds for unscheduled expectations.
309
+ # criteria - object - Structured criteria v1 definition for the expectation.
310
+ # workspace_id - int64 - Workspace ID. `0` means the default workspace.
311
+ def create(params=None, options=None):
312
+ if not isinstance(params, dict):
313
+ params = {}
314
+ if not isinstance(options, dict):
315
+ options = {}
316
+ if "name" in params and not isinstance(params["name"], str):
317
+ raise InvalidParameterError("Bad parameter: name must be an str")
318
+ if "description" in params and not isinstance(params["description"], str):
319
+ raise InvalidParameterError(
320
+ "Bad parameter: description must be an str"
321
+ )
322
+ if "path" in params and not isinstance(params["path"], str):
323
+ raise InvalidParameterError("Bad parameter: path must be an str")
324
+ if "source" in params and not isinstance(params["source"], str):
325
+ raise InvalidParameterError("Bad parameter: source must be an str")
326
+ if "exclude_pattern" in params and not isinstance(
327
+ params["exclude_pattern"], str
328
+ ):
329
+ raise InvalidParameterError(
330
+ "Bad parameter: exclude_pattern must be an str"
331
+ )
332
+ if "disabled" in params and not isinstance(params["disabled"], bool):
333
+ raise InvalidParameterError("Bad parameter: disabled must be an bool")
334
+ if "trigger" in params and not isinstance(params["trigger"], str):
335
+ raise InvalidParameterError("Bad parameter: trigger must be an str")
336
+ if "interval" in params and not isinstance(params["interval"], str):
337
+ raise InvalidParameterError("Bad parameter: interval must be an str")
338
+ if "recurring_day" in params and not isinstance(
339
+ params["recurring_day"], int
340
+ ):
341
+ raise InvalidParameterError(
342
+ "Bad parameter: recurring_day must be an int"
343
+ )
344
+ if "schedule_days_of_week" in params and not isinstance(
345
+ params["schedule_days_of_week"], builtins.list
346
+ ):
347
+ raise InvalidParameterError(
348
+ "Bad parameter: schedule_days_of_week must be an list"
349
+ )
350
+ if "schedule_times_of_day" in params and not isinstance(
351
+ params["schedule_times_of_day"], builtins.list
352
+ ):
353
+ raise InvalidParameterError(
354
+ "Bad parameter: schedule_times_of_day must be an list"
355
+ )
356
+ if "schedule_time_zone" in params and not isinstance(
357
+ params["schedule_time_zone"], str
358
+ ):
359
+ raise InvalidParameterError(
360
+ "Bad parameter: schedule_time_zone must be an str"
361
+ )
362
+ if "holiday_region" in params and not isinstance(
363
+ params["holiday_region"], str
364
+ ):
365
+ raise InvalidParameterError(
366
+ "Bad parameter: holiday_region must be an str"
367
+ )
368
+ if "lookback_interval" in params and not isinstance(
369
+ params["lookback_interval"], int
370
+ ):
371
+ raise InvalidParameterError(
372
+ "Bad parameter: lookback_interval must be an int"
373
+ )
374
+ if "late_acceptance_interval" in params and not isinstance(
375
+ params["late_acceptance_interval"], int
376
+ ):
377
+ raise InvalidParameterError(
378
+ "Bad parameter: late_acceptance_interval must be an int"
379
+ )
380
+ if "inactivity_interval" in params and not isinstance(
381
+ params["inactivity_interval"], int
382
+ ):
383
+ raise InvalidParameterError(
384
+ "Bad parameter: inactivity_interval must be an int"
385
+ )
386
+ if "max_open_interval" in params and not isinstance(
387
+ params["max_open_interval"], int
388
+ ):
389
+ raise InvalidParameterError(
390
+ "Bad parameter: max_open_interval must be an int"
391
+ )
392
+ if "criteria" in params and not isinstance(params["criteria"], dict):
393
+ raise InvalidParameterError("Bad parameter: criteria must be an dict")
394
+ if "workspace_id" in params and not isinstance(
395
+ params["workspace_id"], int
396
+ ):
397
+ raise InvalidParameterError(
398
+ "Bad parameter: workspace_id must be an int"
399
+ )
400
+ response, options = Api.send_request(
401
+ "POST", "/expectations", params, options
402
+ )
403
+ return Expectation(response.data, options)
404
+
405
+
406
+ # Manually open an Expectation window
407
+ def trigger(id, params=None, options=None):
408
+ if not isinstance(params, dict):
409
+ params = {}
410
+ if not isinstance(options, dict):
411
+ options = {}
412
+ params["id"] = id
413
+ if "id" in params and not isinstance(params["id"], int):
414
+ raise InvalidParameterError("Bad parameter: id must be an int")
415
+ if "id" not in params:
416
+ raise MissingParameterError("Parameter missing: id")
417
+ response, options = Api.send_request(
418
+ "POST",
419
+ "/expectations/{id}/trigger".format(id=params["id"]),
420
+ params,
421
+ options,
422
+ )
423
+ return ExpectationEvaluation(response.data, options)
424
+
425
+
426
+ # Parameters:
427
+ # name - string - Expectation name.
428
+ # description - string - Expectation description.
429
+ # path - string - Path scope for the expectation. Supports workspace-relative presentation.
430
+ # source - string - Source glob used to select candidate files.
431
+ # exclude_pattern - string - Optional source exclusion glob.
432
+ # disabled - boolean - If true, the expectation is disabled.
433
+ # trigger - string - How this expectation opens windows.
434
+ # interval - string - If trigger is `daily`, this specifies how often to run the expectation.
435
+ # recurring_day - int64 - If trigger is `daily`, this selects the day number inside the chosen interval.
436
+ # schedule_days_of_week - array(int64) - If trigger is `custom_schedule`, the 0-based weekdays used by the schedule.
437
+ # schedule_times_of_day - array(string) - Times of day in HH:MM format for schedule-driven expectations.
438
+ # schedule_time_zone - string - Time zone used by the expectation schedule.
439
+ # holiday_region - string - Optional holiday region used by schedule-driven expectations.
440
+ # lookback_interval - int64 - How many seconds before the due boundary the window starts.
441
+ # late_acceptance_interval - int64 - How many seconds a schedule-driven window may remain eligible to close as late.
442
+ # inactivity_interval - int64 - How many quiet seconds are required before final closure.
443
+ # max_open_interval - int64 - Hard-stop duration in seconds for unscheduled expectations.
444
+ # criteria - object - Structured criteria v1 definition for the expectation.
445
+ # workspace_id - int64 - Workspace ID. `0` means the default workspace.
446
+ def update(id, params=None, options=None):
447
+ if not isinstance(params, dict):
448
+ params = {}
449
+ if not isinstance(options, dict):
450
+ options = {}
451
+ params["id"] = id
452
+ if "id" in params and not isinstance(params["id"], int):
453
+ raise InvalidParameterError("Bad parameter: id must be an int")
454
+ if "name" in params and not isinstance(params["name"], str):
455
+ raise InvalidParameterError("Bad parameter: name must be an str")
456
+ if "description" in params and not isinstance(params["description"], str):
457
+ raise InvalidParameterError(
458
+ "Bad parameter: description must be an str"
459
+ )
460
+ if "path" in params and not isinstance(params["path"], str):
461
+ raise InvalidParameterError("Bad parameter: path must be an str")
462
+ if "source" in params and not isinstance(params["source"], str):
463
+ raise InvalidParameterError("Bad parameter: source must be an str")
464
+ if "exclude_pattern" in params and not isinstance(
465
+ params["exclude_pattern"], str
466
+ ):
467
+ raise InvalidParameterError(
468
+ "Bad parameter: exclude_pattern must be an str"
469
+ )
470
+ if "disabled" in params and not isinstance(params["disabled"], bool):
471
+ raise InvalidParameterError("Bad parameter: disabled must be an bool")
472
+ if "trigger" in params and not isinstance(params["trigger"], str):
473
+ raise InvalidParameterError("Bad parameter: trigger must be an str")
474
+ if "interval" in params and not isinstance(params["interval"], str):
475
+ raise InvalidParameterError("Bad parameter: interval must be an str")
476
+ if "recurring_day" in params and not isinstance(
477
+ params["recurring_day"], int
478
+ ):
479
+ raise InvalidParameterError(
480
+ "Bad parameter: recurring_day must be an int"
481
+ )
482
+ if "schedule_days_of_week" in params and not isinstance(
483
+ params["schedule_days_of_week"], builtins.list
484
+ ):
485
+ raise InvalidParameterError(
486
+ "Bad parameter: schedule_days_of_week must be an list"
487
+ )
488
+ if "schedule_times_of_day" in params and not isinstance(
489
+ params["schedule_times_of_day"], builtins.list
490
+ ):
491
+ raise InvalidParameterError(
492
+ "Bad parameter: schedule_times_of_day must be an list"
493
+ )
494
+ if "schedule_time_zone" in params and not isinstance(
495
+ params["schedule_time_zone"], str
496
+ ):
497
+ raise InvalidParameterError(
498
+ "Bad parameter: schedule_time_zone must be an str"
499
+ )
500
+ if "holiday_region" in params and not isinstance(
501
+ params["holiday_region"], str
502
+ ):
503
+ raise InvalidParameterError(
504
+ "Bad parameter: holiday_region must be an str"
505
+ )
506
+ if "lookback_interval" in params and not isinstance(
507
+ params["lookback_interval"], int
508
+ ):
509
+ raise InvalidParameterError(
510
+ "Bad parameter: lookback_interval must be an int"
511
+ )
512
+ if "late_acceptance_interval" in params and not isinstance(
513
+ params["late_acceptance_interval"], int
514
+ ):
515
+ raise InvalidParameterError(
516
+ "Bad parameter: late_acceptance_interval must be an int"
517
+ )
518
+ if "inactivity_interval" in params and not isinstance(
519
+ params["inactivity_interval"], int
520
+ ):
521
+ raise InvalidParameterError(
522
+ "Bad parameter: inactivity_interval must be an int"
523
+ )
524
+ if "max_open_interval" in params and not isinstance(
525
+ params["max_open_interval"], int
526
+ ):
527
+ raise InvalidParameterError(
528
+ "Bad parameter: max_open_interval must be an int"
529
+ )
530
+ if "criteria" in params and not isinstance(params["criteria"], dict):
531
+ raise InvalidParameterError("Bad parameter: criteria must be an dict")
532
+ if "workspace_id" in params and not isinstance(
533
+ params["workspace_id"], int
534
+ ):
535
+ raise InvalidParameterError(
536
+ "Bad parameter: workspace_id must be an int"
537
+ )
538
+ if "id" not in params:
539
+ raise MissingParameterError("Parameter missing: id")
540
+ response, options = Api.send_request(
541
+ "PATCH", "/expectations/{id}".format(id=params["id"]), params, options
542
+ )
543
+ return Expectation(response.data, options)
544
+
545
+
546
+ def delete(id, params=None, options=None):
547
+ if not isinstance(params, dict):
548
+ params = {}
549
+ if not isinstance(options, dict):
550
+ options = {}
551
+ params["id"] = id
552
+ if "id" in params and not isinstance(params["id"], int):
553
+ raise InvalidParameterError("Bad parameter: id must be an int")
554
+ if "id" not in params:
555
+ raise MissingParameterError("Parameter missing: id")
556
+ Api.send_request(
557
+ "DELETE", "/expectations/{id}".format(id=params["id"]), params, options
558
+ )
559
+
560
+
561
+ def destroy(id, params=None, options=None):
562
+ delete(id, params, options)
563
+
564
+
565
+ def new(*args, **kwargs):
566
+ return Expectation(*args, **kwargs)
@@ -0,0 +1,115 @@
1
+ import builtins # noqa: F401
2
+ from files_sdk.api import Api # noqa: F401
3
+ from files_sdk.list_obj import ListObj
4
+ from files_sdk.error import ( # noqa: F401
5
+ InvalidParameterError,
6
+ MissingParameterError,
7
+ NotImplementedError,
8
+ )
9
+
10
+
11
+ class ExpectationEvaluation:
12
+ default_attributes = {
13
+ "id": None, # int64 - ExpectationEvaluation ID
14
+ "workspace_id": None, # int64 - Workspace ID. `0` means the default workspace.
15
+ "expectation_id": None, # int64 - Expectation ID.
16
+ "status": None, # string - Evaluation status.
17
+ "opened_via": None, # string - How the evaluation window was opened.
18
+ "opened_at": None, # date-time - When the evaluation row was opened.
19
+ "window_start_at": None, # date-time - Logical start of the candidate window.
20
+ "window_end_at": None, # date-time - Actual candidate cutoff boundary for the window.
21
+ "deadline_at": None, # date-time - Logical due boundary for schedule-driven windows.
22
+ "late_acceptance_cutoff_at": None, # date-time - Logical cutoff for late acceptance, when present.
23
+ "hard_close_at": None, # date-time - Hard stop after which the window may not remain open.
24
+ "closed_at": None, # date-time - When the evaluation row was finalized.
25
+ "matched_files": None, # array(object) - Captured evidence for files that matched the window.
26
+ "missing_files": None, # array(object) - Captured evidence for required files that were missing.
27
+ "criteria_errors": None, # array(object) - Captured criteria failures for the window.
28
+ "summary": None, # object - Compact evaluator summary payload.
29
+ "created_at": None, # date-time - Creation time.
30
+ "updated_at": None, # date-time - Last update time.
31
+ }
32
+
33
+ def __init__(self, attributes=None, options=None):
34
+ if not isinstance(attributes, dict):
35
+ attributes = {}
36
+ if not isinstance(options, dict):
37
+ options = {}
38
+ self.set_attributes(attributes)
39
+ self.options = options
40
+
41
+ def set_attributes(self, attributes):
42
+ for (
43
+ attribute,
44
+ default_value,
45
+ ) in ExpectationEvaluation.default_attributes.items():
46
+ value = attributes.get(attribute, default_value)
47
+ setattr(self, attribute, value)
48
+
49
+ def get_attributes(self):
50
+ attrs = {
51
+ k: getattr(self, k, None)
52
+ for k in ExpectationEvaluation.default_attributes
53
+ if getattr(self, k, None) is not None
54
+ }
55
+ return attrs
56
+
57
+
58
+ # Parameters:
59
+ # cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
60
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
61
+ # sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `workspace_id`, `created_at` or `expectation_id`.
62
+ # filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `expectation_id` and `workspace_id`. Valid field combinations are `[ workspace_id, expectation_id ]`.
63
+ def list(params=None, options=None):
64
+ if not isinstance(params, dict):
65
+ params = {}
66
+ if not isinstance(options, dict):
67
+ options = {}
68
+ if "cursor" in params and not isinstance(params["cursor"], str):
69
+ raise InvalidParameterError("Bad parameter: cursor must be an str")
70
+ if "per_page" in params and not isinstance(params["per_page"], int):
71
+ raise InvalidParameterError("Bad parameter: per_page must be an int")
72
+ if "sort_by" in params and not isinstance(params["sort_by"], dict):
73
+ raise InvalidParameterError("Bad parameter: sort_by must be an dict")
74
+ if "filter" in params and not isinstance(params["filter"], dict):
75
+ raise InvalidParameterError("Bad parameter: filter must be an dict")
76
+ return ListObj(
77
+ ExpectationEvaluation,
78
+ "GET",
79
+ "/expectation_evaluations",
80
+ params,
81
+ options,
82
+ )
83
+
84
+
85
+ def all(params=None, options=None):
86
+ list(params, options)
87
+
88
+
89
+ # Parameters:
90
+ # id (required) - int64 - Expectation Evaluation ID.
91
+ def find(id, params=None, options=None):
92
+ if not isinstance(params, dict):
93
+ params = {}
94
+ if not isinstance(options, dict):
95
+ options = {}
96
+ params["id"] = id
97
+ if "id" in params and not isinstance(params["id"], int):
98
+ raise InvalidParameterError("Bad parameter: id must be an int")
99
+ if "id" not in params:
100
+ raise MissingParameterError("Parameter missing: id")
101
+ response, options = Api.send_request(
102
+ "GET",
103
+ "/expectation_evaluations/{id}".format(id=params["id"]),
104
+ params,
105
+ options,
106
+ )
107
+ return ExpectationEvaluation(response.data, options)
108
+
109
+
110
+ def get(id, params=None, options=None):
111
+ find(id, params, options)
112
+
113
+
114
+ def new(*args, **kwargs):
115
+ return ExpectationEvaluation(*args, **kwargs)
@@ -0,0 +1,253 @@
1
+ import builtins # noqa: F401
2
+ from files_sdk.api import Api # noqa: F401
3
+ from files_sdk.list_obj import ListObj
4
+ from files_sdk.error import ( # noqa: F401
5
+ InvalidParameterError,
6
+ MissingParameterError,
7
+ NotImplementedError,
8
+ )
9
+
10
+
11
+ class ExpectationIncident:
12
+ default_attributes = {
13
+ "id": None, # int64 - Expectation Incident ID
14
+ "workspace_id": None, # int64 - Workspace ID. `0` means the default workspace.
15
+ "expectation_id": None, # int64 - Expectation ID.
16
+ "status": None, # string - Incident status.
17
+ "opened_at": None, # date-time - When the incident was opened.
18
+ "last_failed_at": None, # date-time - When the most recent failing evaluation contributing to the incident occurred.
19
+ "acknowledged_at": None, # date-time - When the incident was acknowledged.
20
+ "snoozed_until": None, # date-time - When the current snooze expires.
21
+ "resolved_at": None, # date-time - When the incident was resolved.
22
+ "opened_by_evaluation_id": None, # int64 - Evaluation that first opened the incident.
23
+ "last_evaluation_id": None, # int64 - Most recent evaluation linked to the incident.
24
+ "resolved_by_evaluation_id": None, # int64 - Evaluation that resolved the incident.
25
+ "summary": None, # object - Compact incident summary payload.
26
+ "created_at": None, # date-time - Creation time.
27
+ "updated_at": None, # date-time - Last update time.
28
+ }
29
+
30
+ def __init__(self, attributes=None, options=None):
31
+ if not isinstance(attributes, dict):
32
+ attributes = {}
33
+ if not isinstance(options, dict):
34
+ options = {}
35
+ self.set_attributes(attributes)
36
+ self.options = options
37
+
38
+ def set_attributes(self, attributes):
39
+ for (
40
+ attribute,
41
+ default_value,
42
+ ) in ExpectationIncident.default_attributes.items():
43
+ value = attributes.get(attribute, default_value)
44
+ setattr(self, attribute, value)
45
+
46
+ def get_attributes(self):
47
+ attrs = {
48
+ k: getattr(self, k, None)
49
+ for k in ExpectationIncident.default_attributes
50
+ if getattr(self, k, None) is not None
51
+ }
52
+ return attrs
53
+
54
+ # Resolve an expectation incident
55
+ def resolve(self, params=None):
56
+ if not isinstance(params, dict):
57
+ params = {}
58
+
59
+ if hasattr(self, "id") and self.id:
60
+ params["id"] = self.id
61
+ else:
62
+ raise MissingParameterError("Current object doesn't have a id")
63
+ if "id" not in params:
64
+ raise MissingParameterError("Parameter missing: id")
65
+ if "id" in params and not isinstance(params["id"], int):
66
+ raise InvalidParameterError("Bad parameter: id must be an int")
67
+ response, _options = Api.send_request(
68
+ "POST",
69
+ "/expectation_incidents/{id}/resolve".format(id=params["id"]),
70
+ params,
71
+ self.options,
72
+ )
73
+ return response.data
74
+
75
+ # Snooze an expectation incident until a specified time
76
+ #
77
+ # Parameters:
78
+ # snoozed_until (required) - string - Time until which the incident should remain snoozed.
79
+ def snooze(self, params=None):
80
+ if not isinstance(params, dict):
81
+ params = {}
82
+
83
+ if hasattr(self, "id") and self.id:
84
+ params["id"] = self.id
85
+ else:
86
+ raise MissingParameterError("Current object doesn't have a id")
87
+ if "id" not in params:
88
+ raise MissingParameterError("Parameter missing: id")
89
+ if "snoozed_until" not in params:
90
+ raise MissingParameterError("Parameter missing: snoozed_until")
91
+ if "id" in params and not isinstance(params["id"], int):
92
+ raise InvalidParameterError("Bad parameter: id must be an int")
93
+ if "snoozed_until" in params and not isinstance(
94
+ params["snoozed_until"], str
95
+ ):
96
+ raise InvalidParameterError(
97
+ "Bad parameter: snoozed_until must be an str"
98
+ )
99
+ response, _options = Api.send_request(
100
+ "POST",
101
+ "/expectation_incidents/{id}/snooze".format(id=params["id"]),
102
+ params,
103
+ self.options,
104
+ )
105
+ return response.data
106
+
107
+ # Acknowledge an expectation incident
108
+ def acknowledge(self, params=None):
109
+ if not isinstance(params, dict):
110
+ params = {}
111
+
112
+ if hasattr(self, "id") and self.id:
113
+ params["id"] = self.id
114
+ else:
115
+ raise MissingParameterError("Current object doesn't have a id")
116
+ if "id" not in params:
117
+ raise MissingParameterError("Parameter missing: id")
118
+ if "id" in params and not isinstance(params["id"], int):
119
+ raise InvalidParameterError("Bad parameter: id must be an int")
120
+ response, _options = Api.send_request(
121
+ "POST",
122
+ "/expectation_incidents/{id}/acknowledge".format(id=params["id"]),
123
+ params,
124
+ self.options,
125
+ )
126
+ return response.data
127
+
128
+
129
+ # Parameters:
130
+ # cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
131
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
132
+ # sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `workspace_id`, `created_at` or `expectation_id`.
133
+ # filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `expectation_id` and `workspace_id`. Valid field combinations are `[ workspace_id, expectation_id ]`.
134
+ def list(params=None, options=None):
135
+ if not isinstance(params, dict):
136
+ params = {}
137
+ if not isinstance(options, dict):
138
+ options = {}
139
+ if "cursor" in params and not isinstance(params["cursor"], str):
140
+ raise InvalidParameterError("Bad parameter: cursor must be an str")
141
+ if "per_page" in params and not isinstance(params["per_page"], int):
142
+ raise InvalidParameterError("Bad parameter: per_page must be an int")
143
+ if "sort_by" in params and not isinstance(params["sort_by"], dict):
144
+ raise InvalidParameterError("Bad parameter: sort_by must be an dict")
145
+ if "filter" in params and not isinstance(params["filter"], dict):
146
+ raise InvalidParameterError("Bad parameter: filter must be an dict")
147
+ return ListObj(
148
+ ExpectationIncident, "GET", "/expectation_incidents", params, options
149
+ )
150
+
151
+
152
+ def all(params=None, options=None):
153
+ list(params, options)
154
+
155
+
156
+ # Parameters:
157
+ # id (required) - int64 - Expectation Incident ID.
158
+ def find(id, params=None, options=None):
159
+ if not isinstance(params, dict):
160
+ params = {}
161
+ if not isinstance(options, dict):
162
+ options = {}
163
+ params["id"] = id
164
+ if "id" in params and not isinstance(params["id"], int):
165
+ raise InvalidParameterError("Bad parameter: id must be an int")
166
+ if "id" not in params:
167
+ raise MissingParameterError("Parameter missing: id")
168
+ response, options = Api.send_request(
169
+ "GET",
170
+ "/expectation_incidents/{id}".format(id=params["id"]),
171
+ params,
172
+ options,
173
+ )
174
+ return ExpectationIncident(response.data, options)
175
+
176
+
177
+ def get(id, params=None, options=None):
178
+ find(id, params, options)
179
+
180
+
181
+ # Resolve an expectation incident
182
+ def resolve(id, params=None, options=None):
183
+ if not isinstance(params, dict):
184
+ params = {}
185
+ if not isinstance(options, dict):
186
+ options = {}
187
+ params["id"] = id
188
+ if "id" in params and not isinstance(params["id"], int):
189
+ raise InvalidParameterError("Bad parameter: id must be an int")
190
+ if "id" not in params:
191
+ raise MissingParameterError("Parameter missing: id")
192
+ response, options = Api.send_request(
193
+ "POST",
194
+ "/expectation_incidents/{id}/resolve".format(id=params["id"]),
195
+ params,
196
+ options,
197
+ )
198
+ return ExpectationIncident(response.data, options)
199
+
200
+
201
+ # Snooze an expectation incident until a specified time
202
+ #
203
+ # Parameters:
204
+ # snoozed_until (required) - string - Time until which the incident should remain snoozed.
205
+ def snooze(id, params=None, options=None):
206
+ if not isinstance(params, dict):
207
+ params = {}
208
+ if not isinstance(options, dict):
209
+ options = {}
210
+ params["id"] = id
211
+ if "id" in params and not isinstance(params["id"], int):
212
+ raise InvalidParameterError("Bad parameter: id must be an int")
213
+ if "snoozed_until" in params and not isinstance(
214
+ params["snoozed_until"], str
215
+ ):
216
+ raise InvalidParameterError(
217
+ "Bad parameter: snoozed_until must be an str"
218
+ )
219
+ if "id" not in params:
220
+ raise MissingParameterError("Parameter missing: id")
221
+ if "snoozed_until" not in params:
222
+ raise MissingParameterError("Parameter missing: snoozed_until")
223
+ response, options = Api.send_request(
224
+ "POST",
225
+ "/expectation_incidents/{id}/snooze".format(id=params["id"]),
226
+ params,
227
+ options,
228
+ )
229
+ return ExpectationIncident(response.data, options)
230
+
231
+
232
+ # Acknowledge an expectation incident
233
+ def acknowledge(id, params=None, options=None):
234
+ if not isinstance(params, dict):
235
+ params = {}
236
+ if not isinstance(options, dict):
237
+ options = {}
238
+ params["id"] = id
239
+ if "id" in params and not isinstance(params["id"], int):
240
+ raise InvalidParameterError("Bad parameter: id must be an int")
241
+ if "id" not in params:
242
+ raise MissingParameterError("Parameter missing: id")
243
+ response, options = Api.send_request(
244
+ "POST",
245
+ "/expectation_incidents/{id}/acknowledge".format(id=params["id"]),
246
+ params,
247
+ options,
248
+ )
249
+ return ExpectationIncident(response.data, options)
250
+
251
+
252
+ def new(*args, **kwargs):
253
+ return ExpectationIncident(*args, **kwargs)