From 9a8978e5161fd3a9716bcafa275c480d0352e285 Mon Sep 17 00:00:00 2001 From: Elastic Machine Date: Mon, 26 Aug 2024 06:03:50 +0000 Subject: [PATCH 1/2] Auto-generated API code --- elasticsearch/_async/client/__init__.py | 4 ++++ elasticsearch/_async/client/synonyms.py | 4 +++- elasticsearch/_sync/client/__init__.py | 4 ++++ elasticsearch/_sync/client/synonyms.py | 4 +++- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/elasticsearch/_async/client/__init__.py b/elasticsearch/_async/client/__init__.py index 72b0ba4ab..a91cfad90 100644 --- a/elasticsearch/_async/client/__init__.py +++ b/elasticsearch/_async/client/__init__.py @@ -4980,6 +4980,7 @@ async def update_by_query( pipeline: t.Optional[str] = None, preference: t.Optional[str] = None, pretty: t.Optional[bool] = None, + q: t.Optional[str] = None, query: t.Optional[t.Mapping[str, t.Any]] = None, refresh: t.Optional[bool] = None, request_cache: t.Optional[bool] = None, @@ -5046,6 +5047,7 @@ async def update_by_query( parameter. :param preference: Specifies the node or shard the operation should be performed on. Random by default. + :param q: Query in the Lucene query string syntax. :param query: Specifies the documents to update using the Query DSL. :param refresh: If `true`, Elasticsearch refreshes affected shards to make the operation visible to search. @@ -5130,6 +5132,8 @@ async def update_by_query( __query["preference"] = preference if pretty is not None: __query["pretty"] = pretty + if q is not None: + __query["q"] = q if refresh is not None: __query["refresh"] = refresh if request_cache is not None: diff --git a/elasticsearch/_async/client/synonyms.py b/elasticsearch/_async/client/synonyms.py index ac8c69ce0..d052bb921 100644 --- a/elasticsearch/_async/client/synonyms.py +++ b/elasticsearch/_async/client/synonyms.py @@ -262,7 +262,9 @@ async def put_synonym( self, *, id: str, - synonyms_set: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None, + synonyms_set: t.Optional[ + t.Union[t.Mapping[str, t.Any], t.Sequence[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, diff --git a/elasticsearch/_sync/client/__init__.py b/elasticsearch/_sync/client/__init__.py index 9079ca3aa..be12e179b 100644 --- a/elasticsearch/_sync/client/__init__.py +++ b/elasticsearch/_sync/client/__init__.py @@ -4978,6 +4978,7 @@ def update_by_query( pipeline: t.Optional[str] = None, preference: t.Optional[str] = None, pretty: t.Optional[bool] = None, + q: t.Optional[str] = None, query: t.Optional[t.Mapping[str, t.Any]] = None, refresh: t.Optional[bool] = None, request_cache: t.Optional[bool] = None, @@ -5044,6 +5045,7 @@ def update_by_query( parameter. :param preference: Specifies the node or shard the operation should be performed on. Random by default. + :param q: Query in the Lucene query string syntax. :param query: Specifies the documents to update using the Query DSL. :param refresh: If `true`, Elasticsearch refreshes affected shards to make the operation visible to search. @@ -5128,6 +5130,8 @@ def update_by_query( __query["preference"] = preference if pretty is not None: __query["pretty"] = pretty + if q is not None: + __query["q"] = q if refresh is not None: __query["refresh"] = refresh if request_cache is not None: diff --git a/elasticsearch/_sync/client/synonyms.py b/elasticsearch/_sync/client/synonyms.py index 9a045c25e..8fc75ee47 100644 --- a/elasticsearch/_sync/client/synonyms.py +++ b/elasticsearch/_sync/client/synonyms.py @@ -262,7 +262,9 @@ def put_synonym( self, *, id: str, - synonyms_set: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None, + synonyms_set: t.Optional[ + t.Union[t.Mapping[str, t.Any], t.Sequence[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, From a253fc93d8ba6223538379b4e9d37c8757d97418 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Fri, 6 Sep 2024 17:40:18 +0400 Subject: [PATCH 2/2] Auto-generated API code --- elasticsearch/_async/client/indices.py | 13 ++ elasticsearch/_async/client/ingest.py | 175 +++++++++++++++++++++++++ elasticsearch/_sync/client/indices.py | 13 ++ elasticsearch/_sync/client/ingest.py | 175 +++++++++++++++++++++++++ 4 files changed, 376 insertions(+) diff --git a/elasticsearch/_async/client/indices.py b/elasticsearch/_async/client/indices.py index b83489d97..f1e974865 100644 --- a/elasticsearch/_async/client/indices.py +++ b/elasticsearch/_async/client/indices.py @@ -3614,6 +3614,7 @@ async def resolve_index( self, *, name: t.Union[str, t.Sequence[str]], + allow_no_indices: t.Optional[bool] = None, error_trace: t.Optional[bool] = None, expand_wildcards: t.Optional[ t.Union[ @@ -3625,6 +3626,7 @@ async def resolve_index( ] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + ignore_unavailable: t.Optional[bool] = None, pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ @@ -3636,16 +3638,25 @@ async def resolve_index( :param name: Comma-separated name(s) or index pattern(s) of the indices, aliases, and data streams to resolve. Resources on remote clusters can be specified using the ``:`` syntax. + :param allow_no_indices: If `false`, the request returns an error if any wildcard + expression, index alias, or `_all` value targets only missing or closed indices. + This behavior applies even if the request targets other open indices. For + example, a request targeting `foo*,bar*` returns an error if an index starts + with `foo` but no index starts with `bar`. :param expand_wildcards: Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") __path_parts: t.Dict[str, str] = {"name": _quote(name)} __path = f'/_resolve/index/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} + if allow_no_indices is not None: + __query["allow_no_indices"] = allow_no_indices if error_trace is not None: __query["error_trace"] = error_trace if expand_wildcards is not None: @@ -3654,6 +3665,8 @@ async def resolve_index( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if ignore_unavailable is not None: + __query["ignore_unavailable"] = ignore_unavailable if pretty is not None: __query["pretty"] = pretty __headers = {"accept": "application/json"} diff --git a/elasticsearch/_async/client/ingest.py b/elasticsearch/_async/client/ingest.py index 45dcc7d1b..4b81b435d 100644 --- a/elasticsearch/_async/client/ingest.py +++ b/elasticsearch/_async/client/ingest.py @@ -25,6 +25,57 @@ class IngestClient(NamespacedClient): + @_rewrite_parameters() + async def delete_geoip_database( + self, + *, + id: t.Union[str, t.Sequence[str]], + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + Deletes a geoip database configuration. + + ``_ + + :param id: A comma-separated list of geoip database configurations to delete + :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. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'id'") + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_ingest/geoip/database/{__path_parts["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 master_timeout is not None: + __query["master_timeout"] = master_timeout + if pretty is not None: + __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout + __headers = {"accept": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="ingest.delete_geoip_database", + path_parts=__path_parts, + ) + @_rewrite_parameters() async def delete_pipeline( self, @@ -112,6 +163,57 @@ async def geo_ip_stats( path_parts=__path_parts, ) + @_rewrite_parameters() + async def get_geoip_database( + self, + *, + id: t.Optional[t.Union[str, t.Sequence[str]]] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + Returns information about one or more geoip database configurations. + + ``_ + + :param id: Comma-separated list of database configuration IDs to retrieve. Wildcard + (`*`) expressions are supported. To get all database configurations, omit + this parameter or use `*`. + :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. + """ + __path_parts: t.Dict[str, str] + if id not in SKIP_IN_PATH: + __path_parts = {"id": _quote(id)} + __path = f'/_ingest/geoip/database/{__path_parts["id"]}' + else: + __path_parts = {} + __path = "/_ingest/geoip/database" + __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 master_timeout is not None: + __query["master_timeout"] = master_timeout + 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="ingest.get_geoip_database", + path_parts=__path_parts, + ) + @_rewrite_parameters() async def get_pipeline( self, @@ -205,6 +307,79 @@ async def processor_grok( path_parts=__path_parts, ) + @_rewrite_parameters( + body_fields=("maxmind", "name"), + ) + async def put_geoip_database( + self, + *, + id: str, + maxmind: t.Optional[t.Mapping[str, t.Any]] = None, + name: 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, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + Returns information about one or more geoip database configurations. + + ``_ + + :param id: ID of the database configuration to create or update. + :param maxmind: The configuration necessary to identify which IP geolocation + provider to use to download the database, as well as any provider-specific + configuration necessary for such downloading. At present, the only supported + provider is maxmind, and the maxmind provider requires that an account_id + (string) is configured. + :param name: The provider-assigned name of the IP geolocation database to download. + :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. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'id'") + if maxmind is None and body is None: + raise ValueError("Empty value passed for parameter 'maxmind'") + if name is None and body is None: + raise ValueError("Empty value passed for parameter 'name'") + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_ingest/geoip/database/{__path_parts["id"]}' + __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 master_timeout is not None: + __query["master_timeout"] = master_timeout + if pretty is not None: + __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout + if not __body: + if maxmind is not None: + __body["maxmind"] = maxmind + if name is not None: + __body["name"] = name + __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="ingest.put_geoip_database", + path_parts=__path_parts, + ) + @_rewrite_parameters( body_fields=("description", "meta", "on_failure", "processors", "version"), parameter_aliases={"_meta": "meta"}, diff --git a/elasticsearch/_sync/client/indices.py b/elasticsearch/_sync/client/indices.py index 4c527bf3a..2f218c8f3 100644 --- a/elasticsearch/_sync/client/indices.py +++ b/elasticsearch/_sync/client/indices.py @@ -3614,6 +3614,7 @@ def resolve_index( self, *, name: t.Union[str, t.Sequence[str]], + allow_no_indices: t.Optional[bool] = None, error_trace: t.Optional[bool] = None, expand_wildcards: t.Optional[ t.Union[ @@ -3625,6 +3626,7 @@ def resolve_index( ] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + ignore_unavailable: t.Optional[bool] = None, pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ @@ -3636,16 +3638,25 @@ def resolve_index( :param name: Comma-separated name(s) or index pattern(s) of the indices, aliases, and data streams to resolve. Resources on remote clusters can be specified using the ``:`` syntax. + :param allow_no_indices: If `false`, the request returns an error if any wildcard + expression, index alias, or `_all` value targets only missing or closed indices. + This behavior applies even if the request targets other open indices. For + example, a request targeting `foo*,bar*` returns an error if an index starts + with `foo` but no index starts with `bar`. :param expand_wildcards: Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + :param ignore_unavailable: If `false`, the request returns an error if it targets + a missing or closed index. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") __path_parts: t.Dict[str, str] = {"name": _quote(name)} __path = f'/_resolve/index/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} + if allow_no_indices is not None: + __query["allow_no_indices"] = allow_no_indices if error_trace is not None: __query["error_trace"] = error_trace if expand_wildcards is not None: @@ -3654,6 +3665,8 @@ def resolve_index( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if ignore_unavailable is not None: + __query["ignore_unavailable"] = ignore_unavailable if pretty is not None: __query["pretty"] = pretty __headers = {"accept": "application/json"} diff --git a/elasticsearch/_sync/client/ingest.py b/elasticsearch/_sync/client/ingest.py index 30eef5f9c..317aff910 100644 --- a/elasticsearch/_sync/client/ingest.py +++ b/elasticsearch/_sync/client/ingest.py @@ -25,6 +25,57 @@ class IngestClient(NamespacedClient): + @_rewrite_parameters() + def delete_geoip_database( + self, + *, + id: t.Union[str, t.Sequence[str]], + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + Deletes a geoip database configuration. + + ``_ + + :param id: A comma-separated list of geoip database configurations to delete + :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. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'id'") + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_ingest/geoip/database/{__path_parts["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 master_timeout is not None: + __query["master_timeout"] = master_timeout + if pretty is not None: + __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout + __headers = {"accept": "application/json"} + return self.perform_request( # type: ignore[return-value] + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="ingest.delete_geoip_database", + path_parts=__path_parts, + ) + @_rewrite_parameters() def delete_pipeline( self, @@ -112,6 +163,57 @@ def geo_ip_stats( path_parts=__path_parts, ) + @_rewrite_parameters() + def get_geoip_database( + self, + *, + id: t.Optional[t.Union[str, t.Sequence[str]]] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + Returns information about one or more geoip database configurations. + + ``_ + + :param id: Comma-separated list of database configuration IDs to retrieve. Wildcard + (`*`) expressions are supported. To get all database configurations, omit + this parameter or use `*`. + :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. + """ + __path_parts: t.Dict[str, str] + if id not in SKIP_IN_PATH: + __path_parts = {"id": _quote(id)} + __path = f'/_ingest/geoip/database/{__path_parts["id"]}' + else: + __path_parts = {} + __path = "/_ingest/geoip/database" + __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 master_timeout is not None: + __query["master_timeout"] = master_timeout + if pretty is not None: + __query["pretty"] = pretty + __headers = {"accept": "application/json"} + return self.perform_request( # type: ignore[return-value] + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ingest.get_geoip_database", + path_parts=__path_parts, + ) + @_rewrite_parameters() def get_pipeline( self, @@ -205,6 +307,79 @@ def processor_grok( path_parts=__path_parts, ) + @_rewrite_parameters( + body_fields=("maxmind", "name"), + ) + def put_geoip_database( + self, + *, + id: str, + maxmind: t.Optional[t.Mapping[str, t.Any]] = None, + name: 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, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + Returns information about one or more geoip database configurations. + + ``_ + + :param id: ID of the database configuration to create or update. + :param maxmind: The configuration necessary to identify which IP geolocation + provider to use to download the database, as well as any provider-specific + configuration necessary for such downloading. At present, the only supported + provider is maxmind, and the maxmind provider requires that an account_id + (string) is configured. + :param name: The provider-assigned name of the IP geolocation database to download. + :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. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'id'") + if maxmind is None and body is None: + raise ValueError("Empty value passed for parameter 'maxmind'") + if name is None and body is None: + raise ValueError("Empty value passed for parameter 'name'") + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_ingest/geoip/database/{__path_parts["id"]}' + __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 master_timeout is not None: + __query["master_timeout"] = master_timeout + if pretty is not None: + __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout + if not __body: + if maxmind is not None: + __body["maxmind"] = maxmind + if name is not None: + __body["name"] = name + __headers = {"accept": "application/json", "content-type": "application/json"} + return self.perform_request( # type: ignore[return-value] + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ingest.put_geoip_database", + path_parts=__path_parts, + ) + @_rewrite_parameters( body_fields=("description", "meta", "on_failure", "processors", "version"), parameter_aliases={"_meta": "meta"},