Skip to content

Auto-generated code for main #2525

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
Apr 24, 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
20 changes: 11 additions & 9 deletions elasticsearch/_async/client/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,16 +661,17 @@ async def post_voting_config_exclusions(
)

@_rewrite_parameters(
body_fields=("template", "allow_auto_create", "meta", "version"),
body_fields=("template", "deprecated", "meta", "version"),
parameter_aliases={"_meta": "meta"},
)
async def put_component_template(
self,
*,
name: str,
template: t.Optional[t.Mapping[str, t.Any]] = None,
allow_auto_create: t.Optional[bool] = None,
cause: t.Optional[str] = None,
create: t.Optional[bool] = None,
deprecated: t.Optional[bool] = None,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
human: t.Optional[bool] = None,
Expand Down Expand Up @@ -698,13 +699,12 @@ async def put_component_template(
update settings API.
:param template: The template to be applied which includes mappings, settings,
or aliases configuration.
:param allow_auto_create: This setting overrides the value of the `action.auto_create_index`
cluster setting. If set to `true` in a template, then indices can be automatically
created using that template even if auto-creation of indices is disabled
via `actions.auto_create_index`. If set to `false` then data streams matching
the template must always be explicitly created.
:param cause:
:param create: If `true`, this request cannot replace or update existing component
templates.
:param deprecated: Marks this index template as deprecated. When creating or
updating a non-deprecated index template that uses deprecated components,
Elasticsearch will emit a deprecation warning.
:param master_timeout: Period to wait for a connection to the master node. If
no response is received before the timeout expires, the request fails and
returns an error.
Expand All @@ -724,6 +724,8 @@ async def put_component_template(
__path = f'/_component_template/{__path_parts["name"]}'
__query: t.Dict[str, t.Any] = {}
__body: t.Dict[str, t.Any] = body if body is not None else {}
if cause is not None:
__query["cause"] = cause
if create is not None:
__query["create"] = create
if error_trace is not None:
Expand All @@ -739,8 +741,8 @@ async def put_component_template(
if not __body:
if template is not None:
__body["template"] = template
if allow_auto_create is not None:
__body["allow_auto_create"] = allow_auto_create
if deprecated is not None:
__body["deprecated"] = deprecated
if meta is not None:
__body["_meta"] = meta
if version is not None:
Expand Down
256 changes: 256 additions & 0 deletions elasticsearch/_async/client/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,262 @@ async def put(
path_parts=__path_parts,
)

@_rewrite_parameters()
async def sync_job_cancel(
self,
*,
connector_sync_job_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]:
"""
Cancels a connector sync job.

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

:param connector_sync_job_id: The unique identifier of the connector sync job
"""
if connector_sync_job_id in SKIP_IN_PATH:
raise ValueError("Empty value passed for parameter 'connector_sync_job_id'")
__path_parts: t.Dict[str, str] = {
"connector_sync_job_id": _quote(connector_sync_job_id)
}
__path = (
f'/_connector/_sync_job/{__path_parts["connector_sync_job_id"]}/_cancel'
)
__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.sync_job_cancel",
path_parts=__path_parts,
)

@_rewrite_parameters()
async def sync_job_delete(
self,
*,
connector_sync_job_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]:
"""
Deletes a connector sync job.

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

:param connector_sync_job_id: The unique identifier of the connector sync job
to be deleted
"""
if connector_sync_job_id in SKIP_IN_PATH:
raise ValueError("Empty value passed for parameter 'connector_sync_job_id'")
__path_parts: t.Dict[str, str] = {
"connector_sync_job_id": _quote(connector_sync_job_id)
}
__path = f'/_connector/_sync_job/{__path_parts["connector_sync_job_id"]}'
__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]
"DELETE",
__path,
params=__query,
headers=__headers,
endpoint_id="connector.sync_job_delete",
path_parts=__path_parts,
)

@_rewrite_parameters()
async def sync_job_get(
self,
*,
connector_sync_job_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]:
"""
Returns the details about a connector sync job.

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

:param connector_sync_job_id: The unique identifier of the connector sync job
"""
if connector_sync_job_id in SKIP_IN_PATH:
raise ValueError("Empty value passed for parameter 'connector_sync_job_id'")
__path_parts: t.Dict[str, str] = {
"connector_sync_job_id": _quote(connector_sync_job_id)
}
__path = f'/_connector/_sync_job/{__path_parts["connector_sync_job_id"]}'
__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]
"GET",
__path,
params=__query,
headers=__headers,
endpoint_id="connector.sync_job_get",
path_parts=__path_parts,
)

@_rewrite_parameters(
parameter_aliases={"from": "from_"},
)
async def sync_job_list(
self,
*,
connector_id: t.Optional[str] = None,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
from_: t.Optional[int] = None,
human: t.Optional[bool] = None,
job_type: t.Optional[
t.Sequence[
t.Union["t.Literal['access_control', 'full', 'incremental']", str]
]
] = None,
pretty: t.Optional[bool] = None,
size: t.Optional[int] = None,
status: t.Optional[
t.Union[
"t.Literal['canceled', 'canceling', 'completed', 'error', 'in_progress', 'pending', 'suspended']",
str,
]
] = None,
) -> ObjectApiResponse[t.Any]:
"""
Lists all connector sync jobs.

`<https://www.elastic.co/guide/en/elasticsearch/reference/{list}/list-connector-sync-jobs-api.html>`_

:param connector_id: A connector id to fetch connector sync jobs for
:param from_: Starting offset (default: 0)
:param job_type: A comma-separated list of job types to fetch the sync jobs for
:param size: Specifies a max number of results to get
:param status: A sync job status to fetch connector sync jobs for
"""
__path_parts: t.Dict[str, str] = {}
__path = "/_connector/_sync_job"
__query: t.Dict[str, t.Any] = {}
if connector_id is not None:
__query["connector_id"] = connector_id
if error_trace is not None:
__query["error_trace"] = error_trace
if filter_path is not None:
__query["filter_path"] = filter_path
if from_ is not None:
__query["from"] = from_
if human is not None:
__query["human"] = human
if job_type is not None:
__query["job_type"] = job_type
if pretty is not None:
__query["pretty"] = pretty
if size is not None:
__query["size"] = size
if status is not None:
__query["status"] = status
__headers = {"accept": "application/json"}
return await self.perform_request( # type: ignore[return-value]
"GET",
__path,
params=__query,
headers=__headers,
endpoint_id="connector.sync_job_list",
path_parts=__path_parts,
)

@_rewrite_parameters(
body_fields=("id", "job_type", "trigger_method"),
)
async def sync_job_post(
self,
*,
id: t.Optional[str] = None,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
human: t.Optional[bool] = None,
job_type: t.Optional[
t.Union["t.Literal['access_control', 'full', 'incremental']", str]
] = None,
pretty: t.Optional[bool] = None,
trigger_method: t.Optional[
t.Union["t.Literal['on_demand', 'scheduled']", str]
] = None,
body: t.Optional[t.Dict[str, t.Any]] = None,
) -> ObjectApiResponse[t.Any]:
"""
Creates a connector sync job.

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

:param id: The id of the associated connector
:param job_type:
:param trigger_method:
"""
if id is None and body is None:
raise ValueError("Empty value passed for parameter 'id'")
__path_parts: t.Dict[str, str] = {}
__path = "/_connector/_sync_job"
__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 id is not None:
__body["id"] = id
if job_type is not None:
__body["job_type"] = job_type
if trigger_method is not None:
__body["trigger_method"] = trigger_method
__headers = {"accept": "application/json", "content-type": "application/json"}
return await self.perform_request( # type: ignore[return-value]
"POST",
__path,
params=__query,
headers=__headers,
body=__body,
endpoint_id="connector.sync_job_post",
path_parts=__path_parts,
)

@_rewrite_parameters(
body_fields=("api_key_id", "api_key_secret_id"),
)
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