Skip to content

Commit

Permalink
Auto-generated API code (#2534)
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored May 2, 2024
1 parent 784674f commit 90aa5cb
Show file tree
Hide file tree
Showing 4 changed files with 242 additions and 20 deletions.
122 changes: 113 additions & 9 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/8.14/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 @@ -168,26 +174,26 @@ async def last_sync(
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
human: t.Optional[bool] = None,
last_access_control_sync_error: t.Optional[t.Union[None, t.Any]] = None,
last_access_control_sync_scheduled_at: t.Optional[str] = None,
last_access_control_sync_scheduled_at: t.Optional[t.Union[str, t.Any]] = None,
last_access_control_sync_status: t.Optional[
t.Union[
"t.Literal['canceled', 'canceling', 'completed', 'error', 'in_progress', 'pending', 'suspended']",
str,
]
] = None,
last_deleted_document_count: t.Optional[int] = None,
last_incremental_sync_scheduled_at: t.Optional[str] = None,
last_incremental_sync_scheduled_at: t.Optional[t.Union[str, t.Any]] = None,
last_indexed_document_count: t.Optional[int] = None,
last_seen: t.Optional[t.Union[None, t.Any]] = None,
last_sync_error: t.Optional[t.Union[None, t.Any]] = None,
last_sync_scheduled_at: t.Optional[str] = None,
last_sync_scheduled_at: t.Optional[t.Union[str, t.Any]] = None,
last_sync_status: t.Optional[
t.Union[
"t.Literal['canceled', 'canceling', 'completed', 'error', 'in_progress', 'pending', 'suspended']",
str,
]
] = None,
last_synced: t.Optional[str] = None,
last_synced: t.Optional[t.Union[str, t.Any]] = None,
pretty: t.Optional[bool] = None,
body: t.Optional[t.Dict[str, t.Any]] = None,
) -> ObjectApiResponse[t.Any]:
Expand Down Expand Up @@ -643,7 +649,7 @@ async def sync_job_list(
"""
Lists all connector sync jobs.
`<https://www.elastic.co/guide/en/elasticsearch/reference/{list}/list-connector-sync-jobs-api.html>`_
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.14/list-connector-sync-jobs-api.html>`_
:param connector_id: A connector id to fetch connector sync jobs for
:param from_: Starting offset (default: 0)
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/8.14/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/8.14/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/8.14/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
9 changes: 8 additions & 1 deletion elasticsearch/_async/client/esql.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@
class EsqlClient(NamespacedClient):

@_rewrite_parameters(
body_fields=("query", "columnar", "filter", "locale", "params"),
body_fields=("query", "version", "columnar", "filter", "locale", "params"),
ignore_deprecated_options={"params"},
)
async def query(
self,
*,
query: t.Optional[str] = None,
version: t.Optional[t.Union["t.Literal['2024.04.01']", str]] = None,
columnar: t.Optional[bool] = None,
delimiter: t.Optional[str] = None,
error_trace: t.Optional[bool] = None,
Expand All @@ -52,6 +53,8 @@ async def query(
:param query: The ES|QL query API accepts an ES|QL query string in the query
parameter, runs it, and returns the results.
:param version: The version of the ES|QL language in which the "query" field
was written.
:param columnar: By default, ES|QL returns results as rows. For example, FROM
returns each individual document as one row. For the JSON, YAML, CBOR and
smile formats, ES|QL can return the results in a columnar fashion where one
Expand All @@ -68,6 +71,8 @@ async def query(
"""
if query is None and body is None:
raise ValueError("Empty value passed for parameter 'query'")
if version is None and body is None:
raise ValueError("Empty value passed for parameter 'version'")
__path_parts: t.Dict[str, str] = {}
__path = "/_query"
__query: t.Dict[str, t.Any] = {}
Expand All @@ -87,6 +92,8 @@ async def query(
if not __body:
if query is not None:
__body["query"] = query
if version is not None:
__body["version"] = version
if columnar is not None:
__body["columnar"] = columnar
if filter is not None:
Expand Down
Loading

0 comments on commit 90aa5cb

Please sign in to comment.