Skip to content

Auto-generated code for main #2548

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 108 additions & 4 deletions elasticsearch/_async/client/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ async def delete(
self,
*,
connector_id: str,
delete_sync_jobs: bool,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
human: t.Optional[bool] = None,
Expand All @@ -81,12 +82,17 @@ async def delete(
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-connector-api.html>`_

:param connector_id: The unique identifier of the connector to be deleted
:param delete_sync_jobs: Determines whether associated sync jobs are also deleted.
"""
if connector_id in SKIP_IN_PATH:
raise ValueError("Empty value passed for parameter 'connector_id'")
if delete_sync_jobs is None:
raise ValueError("Empty value passed for parameter 'delete_sync_jobs'")
__path_parts: t.Dict[str, str] = {"connector_id": _quote(connector_id)}
__path = f'/_connector/{__path_parts["connector_id"]}'
__query: t.Dict[str, t.Any] = {}
if delete_sync_jobs is not None:
__query["delete_sync_jobs"] = delete_sync_jobs
if error_trace is not None:
__query["error_trace"] = error_trace
if filter_path is not None:
Expand Down Expand Up @@ -742,6 +748,46 @@ async def sync_job_post(
path_parts=__path_parts,
)

@_rewrite_parameters()
async def update_active_filtering(
self,
*,
connector_id: str,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
human: t.Optional[bool] = None,
pretty: t.Optional[bool] = None,
) -> ObjectApiResponse[t.Any]:
"""
Activates the draft filtering rules if they are in a validated state.

`<https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-filtering-api.html>`_

:param connector_id: The unique identifier of the connector to be updated
"""
if connector_id in SKIP_IN_PATH:
raise ValueError("Empty value passed for parameter 'connector_id'")
__path_parts: t.Dict[str, str] = {"connector_id": _quote(connector_id)}
__path = f'/_connector/{__path_parts["connector_id"]}/_filtering/_activate'
__query: t.Dict[str, t.Any] = {}
if error_trace is not None:
__query["error_trace"] = error_trace
if filter_path is not None:
__query["filter_path"] = filter_path
if human is not None:
__query["human"] = human
if pretty is not None:
__query["pretty"] = pretty
__headers = {"accept": "application/json"}
return await self.perform_request( # type: ignore[return-value]
"PUT",
__path,
params=__query,
headers=__headers,
endpoint_id="connector.update_active_filtering",
path_parts=__path_parts,
)

@_rewrite_parameters(
body_fields=("api_key_id", "api_key_secret_id"),
)
Expand Down Expand Up @@ -903,17 +949,19 @@ async def update_error(
)

@_rewrite_parameters(
body_fields=("filtering",),
body_fields=("advanced_snippet", "filtering", "rules"),
)
async def update_filtering(
self,
*,
connector_id: str,
filtering: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
advanced_snippet: t.Optional[t.Mapping[str, t.Any]] = None,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
filtering: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
human: t.Optional[bool] = None,
pretty: t.Optional[bool] = None,
rules: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
body: t.Optional[t.Dict[str, t.Any]] = None,
) -> ObjectApiResponse[t.Any]:
"""
Expand All @@ -922,12 +970,12 @@ async def update_filtering(
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-filtering-api.html>`_

:param connector_id: The unique identifier of the connector to be updated
:param advanced_snippet:
:param filtering:
:param rules:
"""
if connector_id in SKIP_IN_PATH:
raise ValueError("Empty value passed for parameter 'connector_id'")
if filtering is None and body is None:
raise ValueError("Empty value passed for parameter 'filtering'")
__path_parts: t.Dict[str, str] = {"connector_id": _quote(connector_id)}
__path = f'/_connector/{__path_parts["connector_id"]}/_filtering'
__query: t.Dict[str, t.Any] = {}
Expand All @@ -941,8 +989,12 @@ async def update_filtering(
if pretty is not None:
__query["pretty"] = pretty
if not __body:
if advanced_snippet is not None:
__body["advanced_snippet"] = advanced_snippet
if filtering is not None:
__body["filtering"] = filtering
if rules is not None:
__body["rules"] = rules
__headers = {"accept": "application/json", "content-type": "application/json"}
return await self.perform_request( # type: ignore[return-value]
"PUT",
Expand All @@ -954,6 +1006,58 @@ async def update_filtering(
path_parts=__path_parts,
)

@_rewrite_parameters(
body_fields=("validation",),
)
async def update_filtering_validation(
self,
*,
connector_id: str,
validation: t.Optional[t.Mapping[str, t.Any]] = None,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
human: t.Optional[bool] = None,
pretty: t.Optional[bool] = None,
body: t.Optional[t.Dict[str, t.Any]] = None,
) -> ObjectApiResponse[t.Any]:
"""
Updates the validation info of the draft filtering rules.

`<https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-filtering-validation-api.html>`_

:param connector_id: The unique identifier of the connector to be updated
:param validation:
"""
if connector_id in SKIP_IN_PATH:
raise ValueError("Empty value passed for parameter 'connector_id'")
if validation is None and body is None:
raise ValueError("Empty value passed for parameter 'validation'")
__path_parts: t.Dict[str, str] = {"connector_id": _quote(connector_id)}
__path = f'/_connector/{__path_parts["connector_id"]}/_filtering/_validation'
__query: t.Dict[str, t.Any] = {}
__body: t.Dict[str, t.Any] = body if body is not None else {}
if error_trace is not None:
__query["error_trace"] = error_trace
if filter_path is not None:
__query["filter_path"] = filter_path
if human is not None:
__query["human"] = human
if pretty is not None:
__query["pretty"] = pretty
if not __body:
if validation is not None:
__body["validation"] = validation
__headers = {"accept": "application/json", "content-type": "application/json"}
return await self.perform_request( # type: ignore[return-value]
"PUT",
__path,
params=__query,
headers=__headers,
body=__body,
endpoint_id="connector.update_filtering_validation",
path_parts=__path_parts,
)

@_rewrite_parameters(
body_fields=("index_name",),
)
Expand Down
38 changes: 19 additions & 19 deletions elasticsearch/_async/client/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
class InferenceClient(NamespacedClient):

@_rewrite_parameters()
async def delete_model(
async def delete(
self,
*,
inference_id: str,
Expand All @@ -42,7 +42,7 @@ async def delete_model(
pretty: t.Optional[bool] = None,
) -> ObjectApiResponse[t.Any]:
"""
Delete model in the Inference API
Delete an inference endpoint

`<https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-inference-api.html>`_

Expand Down Expand Up @@ -78,12 +78,12 @@ async def delete_model(
__path,
params=__query,
headers=__headers,
endpoint_id="inference.delete_model",
endpoint_id="inference.delete",
path_parts=__path_parts,
)

@_rewrite_parameters()
async def get_model(
async def get(
self,
*,
task_type: t.Optional[
Expand All @@ -99,7 +99,7 @@ async def get_model(
pretty: t.Optional[bool] = None,
) -> ObjectApiResponse[t.Any]:
"""
Get a model in the Inference API
Get an inference endpoint

`<https://www.elastic.co/guide/en/elasticsearch/reference/master/get-inference-api.html>`_

Expand Down Expand Up @@ -134,7 +134,7 @@ async def get_model(
__path,
params=__query,
headers=__headers,
endpoint_id="inference.get_model",
endpoint_id="inference.get",
path_parts=__path_parts,
)

Expand Down Expand Up @@ -162,12 +162,12 @@ async def inference(
body: t.Optional[t.Dict[str, t.Any]] = None,
) -> ObjectApiResponse[t.Any]:
"""
Perform inference on a model
Perform inference

`<https://www.elastic.co/guide/en/elasticsearch/reference/master/post-inference-api.html>`_

:param inference_id: The inference Id
:param input: Text input to the model. Either a string or an array of strings.
:param input: Inference input. Either a string or an array of strings.
:param task_type: The task type
:param query: Query input, required for rerank task. Not required for other tasks.
:param task_settings: Optional task settings
Expand Down Expand Up @@ -225,13 +225,13 @@ async def inference(
)

@_rewrite_parameters(
body_name="model_config",
body_name="inference_config",
)
async def put_model(
async def put(
self,
*,
inference_id: str,
model_config: t.Optional[t.Mapping[str, t.Any]] = None,
inference_config: t.Optional[t.Mapping[str, t.Any]] = None,
body: t.Optional[t.Mapping[str, t.Any]] = None,
task_type: t.Optional[
t.Union[
Expand All @@ -245,22 +245,22 @@ async def put_model(
pretty: t.Optional[bool] = None,
) -> ObjectApiResponse[t.Any]:
"""
Configure a model for use in the Inference API
Configure an inference endpoint for use in the Inference API

`<https://www.elastic.co/guide/en/elasticsearch/reference/master/put-inference-api.html>`_

:param inference_id: The inference Id
:param model_config:
:param inference_config:
:param task_type: The task type
"""
if inference_id in SKIP_IN_PATH:
raise ValueError("Empty value passed for parameter 'inference_id'")
if model_config is None and body is None:
if inference_config is None and body is None:
raise ValueError(
"Empty value passed for parameters 'model_config' and 'body', one of them should be set."
"Empty value passed for parameters 'inference_config' and 'body', one of them should be set."
)
elif model_config is not None and body is not None:
raise ValueError("Cannot set both 'model_config' and 'body'")
elif inference_config is not None and body is not None:
raise ValueError("Cannot set both 'inference_config' and 'body'")
__path_parts: t.Dict[str, str]
if task_type not in SKIP_IN_PATH and inference_id not in SKIP_IN_PATH:
__path_parts = {
Expand All @@ -282,14 +282,14 @@ async def put_model(
__query["human"] = human
if pretty is not None:
__query["pretty"] = pretty
__body = model_config if model_config is not None else body
__body = inference_config if inference_config is not None else body
__headers = {"accept": "application/json", "content-type": "application/json"}
return await self.perform_request( # type: ignore[return-value]
"PUT",
__path,
params=__query,
headers=__headers,
body=__body,
endpoint_id="inference.put_model",
endpoint_id="inference.put",
path_parts=__path_parts,
)
Loading
Loading