Skip to content

Commit 1a6c30e

Browse files
Auto-generated API code (#2548)
1 parent 2aef84e commit 1a6c30e

File tree

4 files changed

+254
-46
lines changed

4 files changed

+254
-46
lines changed

elasticsearch/_async/client/connector.py

Lines changed: 108 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ async def delete(
7070
self,
7171
*,
7272
connector_id: str,
73+
delete_sync_jobs: bool,
7374
error_trace: t.Optional[bool] = None,
7475
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
7576
human: t.Optional[bool] = None,
@@ -81,12 +82,17 @@ async def delete(
8182
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-connector-api.html>`_
8283
8384
:param connector_id: The unique identifier of the connector to be deleted
85+
:param delete_sync_jobs: Determines whether associated sync jobs are also deleted.
8486
"""
8587
if connector_id in SKIP_IN_PATH:
8688
raise ValueError("Empty value passed for parameter 'connector_id'")
89+
if delete_sync_jobs is None:
90+
raise ValueError("Empty value passed for parameter 'delete_sync_jobs'")
8791
__path_parts: t.Dict[str, str] = {"connector_id": _quote(connector_id)}
8892
__path = f'/_connector/{__path_parts["connector_id"]}'
8993
__query: t.Dict[str, t.Any] = {}
94+
if delete_sync_jobs is not None:
95+
__query["delete_sync_jobs"] = delete_sync_jobs
9096
if error_trace is not None:
9197
__query["error_trace"] = error_trace
9298
if filter_path is not None:
@@ -742,6 +748,46 @@ async def sync_job_post(
742748
path_parts=__path_parts,
743749
)
744750

751+
@_rewrite_parameters()
752+
async def update_active_filtering(
753+
self,
754+
*,
755+
connector_id: str,
756+
error_trace: t.Optional[bool] = None,
757+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
758+
human: t.Optional[bool] = None,
759+
pretty: t.Optional[bool] = None,
760+
) -> ObjectApiResponse[t.Any]:
761+
"""
762+
Activates the draft filtering rules if they are in a validated state.
763+
764+
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-filtering-api.html>`_
765+
766+
:param connector_id: The unique identifier of the connector to be updated
767+
"""
768+
if connector_id in SKIP_IN_PATH:
769+
raise ValueError("Empty value passed for parameter 'connector_id'")
770+
__path_parts: t.Dict[str, str] = {"connector_id": _quote(connector_id)}
771+
__path = f'/_connector/{__path_parts["connector_id"]}/_filtering/_activate'
772+
__query: t.Dict[str, t.Any] = {}
773+
if error_trace is not None:
774+
__query["error_trace"] = error_trace
775+
if filter_path is not None:
776+
__query["filter_path"] = filter_path
777+
if human is not None:
778+
__query["human"] = human
779+
if pretty is not None:
780+
__query["pretty"] = pretty
781+
__headers = {"accept": "application/json"}
782+
return await self.perform_request( # type: ignore[return-value]
783+
"PUT",
784+
__path,
785+
params=__query,
786+
headers=__headers,
787+
endpoint_id="connector.update_active_filtering",
788+
path_parts=__path_parts,
789+
)
790+
745791
@_rewrite_parameters(
746792
body_fields=("api_key_id", "api_key_secret_id"),
747793
)
@@ -903,17 +949,19 @@ async def update_error(
903949
)
904950

905951
@_rewrite_parameters(
906-
body_fields=("filtering",),
952+
body_fields=("advanced_snippet", "filtering", "rules"),
907953
)
908954
async def update_filtering(
909955
self,
910956
*,
911957
connector_id: str,
912-
filtering: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
958+
advanced_snippet: t.Optional[t.Mapping[str, t.Any]] = None,
913959
error_trace: t.Optional[bool] = None,
914960
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
961+
filtering: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
915962
human: t.Optional[bool] = None,
916963
pretty: t.Optional[bool] = None,
964+
rules: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
917965
body: t.Optional[t.Dict[str, t.Any]] = None,
918966
) -> ObjectApiResponse[t.Any]:
919967
"""
@@ -922,12 +970,12 @@ async def update_filtering(
922970
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-filtering-api.html>`_
923971
924972
:param connector_id: The unique identifier of the connector to be updated
973+
:param advanced_snippet:
925974
:param filtering:
975+
:param rules:
926976
"""
927977
if connector_id in SKIP_IN_PATH:
928978
raise ValueError("Empty value passed for parameter 'connector_id'")
929-
if filtering is None and body is None:
930-
raise ValueError("Empty value passed for parameter 'filtering'")
931979
__path_parts: t.Dict[str, str] = {"connector_id": _quote(connector_id)}
932980
__path = f'/_connector/{__path_parts["connector_id"]}/_filtering'
933981
__query: t.Dict[str, t.Any] = {}
@@ -941,8 +989,12 @@ async def update_filtering(
941989
if pretty is not None:
942990
__query["pretty"] = pretty
943991
if not __body:
992+
if advanced_snippet is not None:
993+
__body["advanced_snippet"] = advanced_snippet
944994
if filtering is not None:
945995
__body["filtering"] = filtering
996+
if rules is not None:
997+
__body["rules"] = rules
946998
__headers = {"accept": "application/json", "content-type": "application/json"}
947999
return await self.perform_request( # type: ignore[return-value]
9481000
"PUT",
@@ -954,6 +1006,58 @@ async def update_filtering(
9541006
path_parts=__path_parts,
9551007
)
9561008

1009+
@_rewrite_parameters(
1010+
body_fields=("validation",),
1011+
)
1012+
async def update_filtering_validation(
1013+
self,
1014+
*,
1015+
connector_id: str,
1016+
validation: t.Optional[t.Mapping[str, t.Any]] = None,
1017+
error_trace: t.Optional[bool] = None,
1018+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
1019+
human: t.Optional[bool] = None,
1020+
pretty: t.Optional[bool] = None,
1021+
body: t.Optional[t.Dict[str, t.Any]] = None,
1022+
) -> ObjectApiResponse[t.Any]:
1023+
"""
1024+
Updates the validation info of the draft filtering rules.
1025+
1026+
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-filtering-validation-api.html>`_
1027+
1028+
:param connector_id: The unique identifier of the connector to be updated
1029+
:param validation:
1030+
"""
1031+
if connector_id in SKIP_IN_PATH:
1032+
raise ValueError("Empty value passed for parameter 'connector_id'")
1033+
if validation is None and body is None:
1034+
raise ValueError("Empty value passed for parameter 'validation'")
1035+
__path_parts: t.Dict[str, str] = {"connector_id": _quote(connector_id)}
1036+
__path = f'/_connector/{__path_parts["connector_id"]}/_filtering/_validation'
1037+
__query: t.Dict[str, t.Any] = {}
1038+
__body: t.Dict[str, t.Any] = body if body is not None else {}
1039+
if error_trace is not None:
1040+
__query["error_trace"] = error_trace
1041+
if filter_path is not None:
1042+
__query["filter_path"] = filter_path
1043+
if human is not None:
1044+
__query["human"] = human
1045+
if pretty is not None:
1046+
__query["pretty"] = pretty
1047+
if not __body:
1048+
if validation is not None:
1049+
__body["validation"] = validation
1050+
__headers = {"accept": "application/json", "content-type": "application/json"}
1051+
return await self.perform_request( # type: ignore[return-value]
1052+
"PUT",
1053+
__path,
1054+
params=__query,
1055+
headers=__headers,
1056+
body=__body,
1057+
endpoint_id="connector.update_filtering_validation",
1058+
path_parts=__path_parts,
1059+
)
1060+
9571061
@_rewrite_parameters(
9581062
body_fields=("index_name",),
9591063
)

elasticsearch/_async/client/inference.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
class InferenceClient(NamespacedClient):
2727

2828
@_rewrite_parameters()
29-
async def delete_model(
29+
async def delete(
3030
self,
3131
*,
3232
inference_id: str,
@@ -42,7 +42,7 @@ async def delete_model(
4242
pretty: t.Optional[bool] = None,
4343
) -> ObjectApiResponse[t.Any]:
4444
"""
45-
Delete model in the Inference API
45+
Delete an inference endpoint
4646
4747
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-inference-api.html>`_
4848
@@ -78,12 +78,12 @@ async def delete_model(
7878
__path,
7979
params=__query,
8080
headers=__headers,
81-
endpoint_id="inference.delete_model",
81+
endpoint_id="inference.delete",
8282
path_parts=__path_parts,
8383
)
8484

8585
@_rewrite_parameters()
86-
async def get_model(
86+
async def get(
8787
self,
8888
*,
8989
task_type: t.Optional[
@@ -99,7 +99,7 @@ async def get_model(
9999
pretty: t.Optional[bool] = None,
100100
) -> ObjectApiResponse[t.Any]:
101101
"""
102-
Get a model in the Inference API
102+
Get an inference endpoint
103103
104104
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/get-inference-api.html>`_
105105
@@ -134,7 +134,7 @@ async def get_model(
134134
__path,
135135
params=__query,
136136
headers=__headers,
137-
endpoint_id="inference.get_model",
137+
endpoint_id="inference.get",
138138
path_parts=__path_parts,
139139
)
140140

@@ -162,12 +162,12 @@ async def inference(
162162
body: t.Optional[t.Dict[str, t.Any]] = None,
163163
) -> ObjectApiResponse[t.Any]:
164164
"""
165-
Perform inference on a model
165+
Perform inference
166166
167167
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/post-inference-api.html>`_
168168
169169
:param inference_id: The inference Id
170-
:param input: Text input to the model. Either a string or an array of strings.
170+
:param input: Inference input. Either a string or an array of strings.
171171
:param task_type: The task type
172172
:param query: Query input, required for rerank task. Not required for other tasks.
173173
:param task_settings: Optional task settings
@@ -225,13 +225,13 @@ async def inference(
225225
)
226226

227227
@_rewrite_parameters(
228-
body_name="model_config",
228+
body_name="inference_config",
229229
)
230-
async def put_model(
230+
async def put(
231231
self,
232232
*,
233233
inference_id: str,
234-
model_config: t.Optional[t.Mapping[str, t.Any]] = None,
234+
inference_config: t.Optional[t.Mapping[str, t.Any]] = None,
235235
body: t.Optional[t.Mapping[str, t.Any]] = None,
236236
task_type: t.Optional[
237237
t.Union[
@@ -245,22 +245,22 @@ async def put_model(
245245
pretty: t.Optional[bool] = None,
246246
) -> ObjectApiResponse[t.Any]:
247247
"""
248-
Configure a model for use in the Inference API
248+
Configure an inference endpoint for use in the Inference API
249249
250250
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/put-inference-api.html>`_
251251
252252
:param inference_id: The inference Id
253-
:param model_config:
253+
:param inference_config:
254254
:param task_type: The task type
255255
"""
256256
if inference_id in SKIP_IN_PATH:
257257
raise ValueError("Empty value passed for parameter 'inference_id'")
258-
if model_config is None and body is None:
258+
if inference_config is None and body is None:
259259
raise ValueError(
260-
"Empty value passed for parameters 'model_config' and 'body', one of them should be set."
260+
"Empty value passed for parameters 'inference_config' and 'body', one of them should be set."
261261
)
262-
elif model_config is not None and body is not None:
263-
raise ValueError("Cannot set both 'model_config' and 'body'")
262+
elif inference_config is not None and body is not None:
263+
raise ValueError("Cannot set both 'inference_config' and 'body'")
264264
__path_parts: t.Dict[str, str]
265265
if task_type not in SKIP_IN_PATH and inference_id not in SKIP_IN_PATH:
266266
__path_parts = {
@@ -282,14 +282,14 @@ async def put_model(
282282
__query["human"] = human
283283
if pretty is not None:
284284
__query["pretty"] = pretty
285-
__body = model_config if model_config is not None else body
285+
__body = inference_config if inference_config is not None else body
286286
__headers = {"accept": "application/json", "content-type": "application/json"}
287287
return await self.perform_request( # type: ignore[return-value]
288288
"PUT",
289289
__path,
290290
params=__query,
291291
headers=__headers,
292292
body=__body,
293-
endpoint_id="inference.put_model",
293+
endpoint_id="inference.put",
294294
path_parts=__path_parts,
295295
)

0 commit comments

Comments
 (0)