diff --git a/dev-requirements.txt b/dev-requirements.txt index 7e3f4c9f4..b5b92c283 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,4 +1,5 @@ -elastic-transport>=8.0.0b1, <9 +# TODO switch back to elastic-transport>=8,<9 between elastic-transport release and elasticsearch-py release +elastic-transport @ git+https://github.com/elastic/elastic-transport-python requests>=2, <3 aiohttp pytest @@ -28,4 +29,4 @@ protobuf<4; python_version<="3.7" # Override Read the Docs default (sphinx<2 and sphinx-rtd-theme<0.5) sphinx>2 sphinx-rtd-theme>0.5 -sphinx-autodoc-typehints \ No newline at end of file +sphinx-autodoc-typehints diff --git a/elasticsearch/_async/client/__init__.py b/elasticsearch/_async/client/__init__.py index cc8b2a40b..9d97a2ab0 100644 --- a/elasticsearch/_async/client/__init__.py +++ b/elasticsearch/_async/client/__init__.py @@ -674,9 +674,12 @@ async def bulk( ) elif operations is not None and body is not None: raise ValueError("Cannot set both 'operations' and 'body'") + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_bulk" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_bulk' else: + __path_parts = {} __path = "/_bulk" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -711,7 +714,13 @@ async def bulk( "content-type": "application/x-ndjson", } return await self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="bulk", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -734,6 +743,7 @@ async def clear_scroll( :param scroll_id: Scroll IDs to clear. To clear all scroll IDs, use `_all`. """ + __path_parts: t.Dict[str, str] = {} __path = "/_search/scroll" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -754,7 +764,13 @@ async def clear_scroll( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers, body=__body + "DELETE", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="clear_scroll", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -779,6 +795,7 @@ async def close_point_in_time( """ if id is None and body is None: raise ValueError("Empty value passed for parameter 'id'") + __path_parts: t.Dict[str, str] = {} __path = "/_pit" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -799,7 +816,13 @@ async def close_point_in_time( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers, body=__body + "DELETE", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="close_point_in_time", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -879,9 +902,12 @@ async def count( If a query reaches this limit, Elasticsearch terminates the query early. Elasticsearch collects documents before sorting. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_count" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_count' else: + __path_parts = {} __path = "/_count" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -930,7 +956,13 @@ async def count( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="count", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1004,7 +1036,8 @@ async def create( ) elif document is not None and body is not None: raise ValueError("Cannot set both 'document' and 'body'") - __path = f"/{_quote(index)}/_create/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"index": _quote(index), "id": _quote(id)} + __path = f'/{__path_parts["index"]}/_create/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -1031,7 +1064,13 @@ async def create( __body = document if document 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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="create", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1088,7 +1127,8 @@ async def delete( raise ValueError("Empty value passed for parameter 'index'") if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/{_quote(index)}/_doc/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"index": _quote(index), "id": _quote(id)} + __path = f'/{__path_parts["index"]}/_doc/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -1116,7 +1156,12 @@ async def delete( __query["wait_for_active_shards"] = wait_for_active_shards __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="delete", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1247,7 +1292,8 @@ async def delete_by_query( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_delete_by_query" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_delete_by_query' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} # The 'sort' parameter with a colon can't be encoded to the body. @@ -1334,7 +1380,13 @@ async def delete_by_query( __body["slice"] = slice __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="delete_by_query", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1359,7 +1411,8 @@ async def delete_by_query_rethrottle( """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") - __path = f"/_delete_by_query/{_quote(task_id)}/_rethrottle" + __path_parts: t.Dict[str, str] = {"task_id": _quote(task_id)} + __path = f'/_delete_by_query/{__path_parts["task_id"]}/_rethrottle' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -1373,7 +1426,12 @@ async def delete_by_query_rethrottle( __query["requests_per_second"] = requests_per_second __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="delete_by_query_rethrottle", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1404,7 +1462,8 @@ async def delete_script( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_scripts/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_scripts/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -1420,7 +1479,12 @@ async def delete_script( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="delete_script", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1484,7 +1548,8 @@ async def exists( raise ValueError("Empty value passed for parameter 'index'") if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/{_quote(index)}/_doc/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"index": _quote(index), "id": _quote(id)} + __path = f'/{__path_parts["index"]}/_doc/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -1516,7 +1581,12 @@ async def exists( __query["version_type"] = version_type __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "HEAD", __path, params=__query, headers=__headers + "HEAD", + __path, + params=__query, + headers=__headers, + endpoint_id="exists", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1576,7 +1646,8 @@ async def exists_source( raise ValueError("Empty value passed for parameter 'index'") if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/{_quote(index)}/_source/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"index": _quote(index), "id": _quote(id)} + __path = f'/{__path_parts["index"]}/_source/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -1606,7 +1677,12 @@ async def exists_source( __query["version_type"] = version_type __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "HEAD", __path, params=__query, headers=__headers + "HEAD", + __path, + params=__query, + headers=__headers, + endpoint_id="exists_source", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1676,7 +1752,8 @@ async def explain( raise ValueError("Empty value passed for parameter 'index'") if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/{_quote(index)}/_explain/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"index": _quote(index), "id": _quote(id)} + __path = f'/{__path_parts["index"]}/_explain/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} if analyze_wildcard is not None: @@ -1720,7 +1797,13 @@ async def explain( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="explain", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1786,9 +1869,12 @@ async def field_caps( :param types: Only return results for fields that have one of the types in the list """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_field_caps" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_field_caps' else: + __path_parts = {} __path = "/_field_caps" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -1827,7 +1913,13 @@ async def field_caps( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="field_caps", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1890,7 +1982,8 @@ async def get( raise ValueError("Empty value passed for parameter 'index'") if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/{_quote(index)}/_doc/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"index": _quote(index), "id": _quote(id)} + __path = f'/{__path_parts["index"]}/_doc/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -1922,7 +2015,12 @@ async def get( __query["version_type"] = version_type __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="get", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1948,7 +2046,8 @@ async def get_script( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_scripts/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_scripts/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -1962,7 +2061,12 @@ async def get_script( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="get_script", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1979,6 +2083,7 @@ async def get_script_context( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_script_context" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1991,7 +2096,12 @@ async def get_script_context( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="get_script_context", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -2008,6 +2118,7 @@ async def get_script_languages( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_script_language" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -2020,7 +2131,12 @@ async def get_script_languages( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="get_script_languages", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2081,7 +2197,8 @@ async def get_source( raise ValueError("Empty value passed for parameter 'index'") if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/{_quote(index)}/_source/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"index": _quote(index), "id": _quote(id)} + __path = f'/{__path_parts["index"]}/_source/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -2113,7 +2230,12 @@ async def get_source( __query["version_type"] = version_type __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="get_source", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -2140,9 +2262,12 @@ async def health_report( :param timeout: Explicit operation timeout. :param verbose: Opt-in for more information about the health of the system. """ + __path_parts: t.Dict[str, str] if feature not in SKIP_IN_PATH: - __path = f"/_health_report/{_quote(feature)}" + __path_parts = {"feature": _quote(feature)} + __path = f'/_health_report/{__path_parts["feature"]}' else: + __path_parts = {} __path = "/_health_report" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -2161,7 +2286,12 @@ async def health_report( __query["verbose"] = verbose __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="health_report", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2242,11 +2372,14 @@ async def index( ) elif document is not None and body is not None: raise ValueError("Cannot set both 'document' and 'body'") + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH and id not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_doc/{_quote(id)}" + __path_parts = {"index": _quote(index), "id": _quote(id)} + __path = f'/{__path_parts["index"]}/_doc/{__path_parts["id"]}' __method = "PUT" elif index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_doc" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_doc' __method = "POST" else: raise ValueError("Couldn't find a path for the given parameters") @@ -2284,7 +2417,13 @@ async def index( __body = document if document is not None else body __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] - __method, __path, params=__query, headers=__headers, body=__body + __method, + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="index", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -2301,6 +2440,7 @@ async def info( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -2313,7 +2453,12 @@ async def info( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="info", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2376,7 +2521,8 @@ async def knn_search( raise ValueError("Empty value passed for parameter 'index'") if knn is None and body is None: raise ValueError("Empty value passed for parameter 'knn'") - __path = f"/{_quote(index)}/_knn_search" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_knn_search' __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: @@ -2408,7 +2554,13 @@ async def knn_search( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="knn_search", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2469,9 +2621,12 @@ async def mget( :param stored_fields: If `true`, retrieves the document fields stored in the index rather than the document `_source`. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_mget" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_mget' else: + __path_parts = {} __path = "/_mget" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -2506,7 +2661,13 @@ async def mget( __body["ids"] = ids __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="mget", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2591,9 +2752,12 @@ async def msearch( ) elif searches is not None and body is not None: raise ValueError("Cannot set both 'searches' and 'body'") + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_msearch" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_msearch' else: + __path_parts = {} __path = "/_msearch" __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: @@ -2634,7 +2798,13 @@ async def msearch( "content-type": "application/x-ndjson", } return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="msearch", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2684,9 +2854,12 @@ async def msearch_template( ) elif search_templates is not None and body is not None: raise ValueError("Cannot set both 'search_templates' and 'body'") + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_msearch/template" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_msearch/template' else: + __path_parts = {} __path = "/_msearch/template" __query: t.Dict[str, t.Any] = {} if ccs_minimize_roundtrips is not None: @@ -2713,7 +2886,13 @@ async def msearch_template( "content-type": "application/x-ndjson", } return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="msearch_template", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2770,9 +2949,12 @@ async def mtermvectors( :param version: If `true`, returns the document version as part of a hit. :param version_type: Specific version type. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_mtermvectors" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_mtermvectors' else: + __path_parts = {} __path = "/_mtermvectors" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -2817,7 +2999,13 @@ async def mtermvectors( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="mtermvectors", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -2864,7 +3052,8 @@ async def open_point_in_time( raise ValueError("Empty value passed for parameter 'index'") if keep_alive is None: raise ValueError("Empty value passed for parameter 'keep_alive'") - __path = f"/{_quote(index)}/_pit" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_pit' __query: t.Dict[str, t.Any] = {} if keep_alive is not None: __query["keep_alive"] = keep_alive @@ -2886,7 +3075,12 @@ async def open_point_in_time( __query["routing"] = routing __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="open_point_in_time", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2930,10 +3124,13 @@ async def put_script( raise ValueError("Empty value passed for parameter 'id'") if script is None and body is None: raise ValueError("Empty value passed for parameter 'script'") + __path_parts: t.Dict[str, str] if id not in SKIP_IN_PATH and context not in SKIP_IN_PATH: - __path = f"/_scripts/{_quote(id)}/{_quote(context)}" + __path_parts = {"id": _quote(id), "context": _quote(context)} + __path = f'/_scripts/{__path_parts["id"]}/{__path_parts["context"]}' elif id not in SKIP_IN_PATH: - __path = f"/_scripts/{_quote(id)}" + __path_parts = {"id": _quote(id)} + __path = f'/_scripts/{__path_parts["id"]}' else: raise ValueError("Couldn't find a path for the given parameters") __query: t.Dict[str, t.Any] = {} @@ -2955,7 +3152,13 @@ async def put_script( __body["script"] = script __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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="put_script", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3010,9 +3213,12 @@ async def rank_eval( """ if requests is None and body is None: raise ValueError("Empty value passed for parameter 'requests'") + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_rank_eval" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_rank_eval' else: + __path_parts = {} __path = "/_rank_eval" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -3039,7 +3245,13 @@ async def rank_eval( __body["metric"] = metric __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="rank_eval", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3105,6 +3317,7 @@ async def reindex( raise ValueError("Empty value passed for parameter 'dest'") if source is None and body is None: raise ValueError("Empty value passed for parameter 'source'") + __path_parts: t.Dict[str, str] = {} __path = "/_reindex" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -3147,7 +3360,13 @@ async def reindex( __body["size"] = size __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="reindex", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -3172,7 +3391,8 @@ async def reindex_rethrottle( """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") - __path = f"/_reindex/{_quote(task_id)}/_rethrottle" + __path_parts: t.Dict[str, str] = {"task_id": _quote(task_id)} + __path = f'/_reindex/{__path_parts["task_id"]}/_rethrottle' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -3186,7 +3406,12 @@ async def reindex_rethrottle( __query["requests_per_second"] = requests_per_second __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="reindex_rethrottle", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3220,9 +3445,12 @@ async def render_search_template( search API's request body. These parameters also support Mustache variables. If no `id` or `` is specified, this parameter is required. """ + __path_parts: t.Dict[str, str] if id not in SKIP_IN_PATH: - __path = f"/_render/template/{_quote(id)}" + __path_parts = {"id": _quote(id)} + __path = f'/_render/template/{__path_parts["id"]}' else: + __path_parts = {} __path = "/_render/template" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -3247,7 +3475,13 @@ async def render_search_template( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="render_search_template", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3274,6 +3508,7 @@ async def scripts_painless_execute( :param context_setup: Additional parameters for the `context`. :param script: The Painless script to execute. """ + __path_parts: t.Dict[str, str] = {} __path = "/_scripts/painless/_execute" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -3298,7 +3533,13 @@ async def scripts_painless_execute( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="scripts_painless_execute", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3329,6 +3570,7 @@ async def scroll( """ if scroll_id is None and body is None: raise ValueError("Empty value passed for parameter 'scroll_id'") + __path_parts: t.Dict[str, str] = {} __path = "/_search/scroll" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -3353,7 +3595,13 @@ async def scroll( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="scroll", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3682,9 +3930,12 @@ async def search( by their respective types in the response. :param version: If true, returns document version as part of a hit. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_search" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_search' else: + __path_parts = {} __path = "/_search" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -3840,7 +4091,13 @@ async def search( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="search", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3955,7 +4212,14 @@ async def search_mvt( raise ValueError("Empty value passed for parameter 'x'") if y in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'y'") - __path = f"/{_quote(index)}/_mvt/{_quote(field)}/{_quote(zoom)}/{_quote(x)}/{_quote(y)}" + __path_parts: t.Dict[str, str] = { + "index": _quote(index), + "field": _quote(field), + "zoom": _quote(zoom), + "x": _quote(x), + "y": _quote(y), + } + __path = f'/{__path_parts["index"]}/_mvt/{__path_parts["field"]}/{__path_parts["zoom"]}/{__path_parts["x"]}/{__path_parts["y"]}' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} # The 'sort' parameter with a colon can't be encoded to the body. @@ -4012,7 +4276,13 @@ async def search_mvt( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="search_mvt", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -4063,9 +4333,12 @@ async def search_shards( on. Random by default. :param routing: Custom value used to route operations to a specific shard. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_search_shards" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_search_shards' else: + __path_parts = {} __path = "/_search_shards" __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: @@ -4090,7 +4363,12 @@ async def search_shards( __query["routing"] = routing __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="search_shards", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -4175,9 +4453,12 @@ async def search_template( :param typed_keys: If `true`, the response prefixes aggregation and suggester names with their respective types. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_search/template" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_search/template' else: + __path_parts = {} __path = "/_search/template" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -4224,7 +4505,13 @@ async def search_template( __body["source"] = source __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="search_template", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -4283,7 +4570,8 @@ async def terms_enum( raise ValueError("Empty value passed for parameter 'index'") if field is None and body is None: raise ValueError("Empty value passed for parameter 'field'") - __path = f"/{_quote(index)}/_terms_enum" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_terms_enum' __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: @@ -4315,7 +4603,13 @@ async def terms_enum( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="terms_enum", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -4379,10 +4673,13 @@ async def termvectors( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH and id not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_termvectors/{_quote(id)}" + __path_parts = {"index": _quote(index), "id": _quote(id)} + __path = f'/{__path_parts["index"]}/_termvectors/{__path_parts["id"]}' elif index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_termvectors" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_termvectors' else: raise ValueError("Couldn't find a path for the given parameters") __query: t.Dict[str, t.Any] = {} @@ -4430,7 +4727,13 @@ async def termvectors( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="termvectors", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -4527,7 +4830,8 @@ async def update( raise ValueError("Empty value passed for parameter 'index'") if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/{_quote(index)}/_update/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"index": _quote(index), "id": _quote(id)} + __path = f'/{__path_parts["index"]}/_update/{__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: @@ -4577,7 +4881,13 @@ async def update( __body["upsert"] = upsert __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="update", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -4719,7 +5029,8 @@ async def update_by_query( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_update_by_query" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_update_by_query' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} # The 'sort' parameter with a colon can't be encoded to the body. @@ -4814,7 +5125,13 @@ async def update_by_query( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="update_by_query", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -4839,7 +5156,8 @@ async def update_by_query_rethrottle( """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") - __path = f"/_update_by_query/{_quote(task_id)}/_rethrottle" + __path_parts: t.Dict[str, str] = {"task_id": _quote(task_id)} + __path = f'/_update_by_query/{__path_parts["task_id"]}/_rethrottle' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -4853,5 +5171,10 @@ async def update_by_query_rethrottle( __query["requests_per_second"] = requests_per_second __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="update_by_query_rethrottle", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/_base.py b/elasticsearch/_async/client/_base.py index ddd622e25..0f7410fc0 100644 --- a/elasticsearch/_async/client/_base.py +++ b/elasticsearch/_async/client/_base.py @@ -257,6 +257,8 @@ async def perform_request( params: Optional[Mapping[str, Any]] = None, headers: Optional[Mapping[str, str]] = None, body: Optional[Any] = None, + endpoint_id: Union[DefaultType, str] = DEFAULT, + path_parts: Union[DefaultType, Mapping[str, Any]] = DEFAULT, ) -> ApiResponse[Any]: if headers: request_headers = self._headers.copy() @@ -292,6 +294,8 @@ def mimetype_header_to_compat(header: str) -> None: retry_on_status=self._retry_on_status, retry_on_timeout=self._retry_on_timeout, client_meta=self._client_meta, + endpoint_id=endpoint_id, + path_parts=path_parts, ) # HEAD with a 404 is returned as a normal response @@ -383,9 +387,17 @@ async def perform_request( params: Optional[Mapping[str, Any]] = None, headers: Optional[Mapping[str, str]] = None, body: Optional[Any] = None, + endpoint_id: Union[DefaultType, str] = DEFAULT, + path_parts: Union[DefaultType, Mapping[str, Any]] = DEFAULT, ) -> ApiResponse[Any]: # Use the internal clients .perform_request() implementation # so we take advantage of their transport options. return await self._client.perform_request( - method, path, params=params, headers=headers, body=body + method, + path, + params=params, + headers=headers, + body=body, + endpoint_id=endpoint_id, + path_parts=path_parts, ) diff --git a/elasticsearch/_async/client/async_search.py b/elasticsearch/_async/client/async_search.py index a24e9ded3..60c1078c7 100644 --- a/elasticsearch/_async/client/async_search.py +++ b/elasticsearch/_async/client/async_search.py @@ -45,7 +45,8 @@ async def delete( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_async_search/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_async_search/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -57,7 +58,12 @@ async def delete( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="async_search.delete", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -99,7 +105,8 @@ async def get( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_async_search/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_async_search/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -117,7 +124,12 @@ async def get( __query["wait_for_completion_timeout"] = wait_for_completion_timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="async_search.get", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -140,7 +152,8 @@ async def status( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_async_search/status/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_async_search/status/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -152,7 +165,12 @@ async def status( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="async_search.status", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -428,9 +446,12 @@ async def submit( up to a certain timeout. When the async search completes within the timeout, the response won’t include the ID as the results are not stored in the cluster. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_async_search" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_async_search' else: + __path_parts = {} __path = "/_async_search" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -590,5 +611,11 @@ async def submit( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="async_search.submit", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/autoscaling.py b/elasticsearch/_async/client/autoscaling.py index 0217821e3..cc6fb85ee 100644 --- a/elasticsearch/_async/client/autoscaling.py +++ b/elasticsearch/_async/client/autoscaling.py @@ -45,7 +45,8 @@ async def delete_autoscaling_policy( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_autoscaling/policy/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_autoscaling/policy/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -57,7 +58,12 @@ async def delete_autoscaling_policy( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="autoscaling.delete_autoscaling_policy", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -75,6 +81,7 @@ async def get_autoscaling_capacity( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_autoscaling/capacity" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -87,7 +94,12 @@ async def get_autoscaling_capacity( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="autoscaling.get_autoscaling_capacity", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -110,7 +122,8 @@ async def get_autoscaling_policy( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_autoscaling/policy/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_autoscaling/policy/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -122,7 +135,12 @@ async def get_autoscaling_policy( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="autoscaling.get_autoscaling_policy", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -156,7 +174,8 @@ async def put_autoscaling_policy( ) elif policy is not None and body is not None: raise ValueError("Cannot set both 'policy' and 'body'") - __path = f"/_autoscaling/policy/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_autoscaling/policy/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -169,5 +188,11 @@ async def put_autoscaling_policy( __body = policy if policy 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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="autoscaling.put_autoscaling_policy", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/cat.py b/elasticsearch/_async/client/cat.py index f0de2a115..9685998dd 100644 --- a/elasticsearch/_async/client/cat.py +++ b/elasticsearch/_async/client/cat.py @@ -77,9 +77,12 @@ async def aliases( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: - __path = f"/_cat/aliases/{_quote(name)}" + __path_parts = {"name": _quote(name)} + __path = f'/_cat/aliases/{__path_parts["name"]}' else: + __path_parts = {} __path = "/_cat/aliases" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -108,7 +111,12 @@ async def aliases( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.aliases", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -157,9 +165,12 @@ async def allocation( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if node_id not in SKIP_IN_PATH: - __path = f"/_cat/allocation/{_quote(node_id)}" + __path_parts = {"node_id": _quote(node_id)} + __path = f'/_cat/allocation/{__path_parts["node_id"]}' else: + __path_parts = {} __path = "/_cat/allocation" __query: t.Dict[str, t.Any] = {} if bytes is not None: @@ -188,7 +199,12 @@ async def allocation( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.allocation", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -232,9 +248,12 @@ async def component_templates( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: - __path = f"/_cat/component_templates/{_quote(name)}" + __path_parts = {"name": _quote(name)} + __path = f'/_cat/component_templates/{__path_parts["name"]}' else: + __path_parts = {} __path = "/_cat/component_templates" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -261,7 +280,12 @@ async def component_templates( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.component_templates", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -307,9 +331,12 @@ async def count( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/_cat/count/{_quote(index)}" + __path_parts = {"index": _quote(index)} + __path = f'/_cat/count/{__path_parts["index"]}' else: + __path_parts = {} __path = "/_cat/count" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -336,7 +363,12 @@ async def count( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.count", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -385,9 +417,12 @@ async def fielddata( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if fields not in SKIP_IN_PATH: - __path = f"/_cat/fielddata/{_quote(fields)}" + __path_parts = {"fields": _quote(fields)} + __path = f'/_cat/fielddata/{__path_parts["fields"]}' else: + __path_parts = {} __path = "/_cat/fielddata" __query: t.Dict[str, t.Any] = {} if bytes is not None: @@ -416,7 +451,12 @@ async def fielddata( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.fielddata", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -463,6 +503,7 @@ async def health( :param ts: If true, returns `HH:MM:SS` and Unix epoch timestamps. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] = {} __path = "/_cat/health" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -493,7 +534,12 @@ async def health( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.health", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -534,6 +580,7 @@ async def help( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] = {} __path = "/_cat" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -560,7 +607,12 @@ async def help( __query["v"] = v __headers = {"accept": "text/plain"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.help", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -631,9 +683,12 @@ async def indices( :param time: The unit used to display time values. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/_cat/indices/{_quote(index)}" + __path_parts = {"index": _quote(index)} + __path = f'/_cat/indices/{__path_parts["index"]}' else: + __path_parts = {} __path = "/_cat/indices" __query: t.Dict[str, t.Any] = {} if bytes is not None: @@ -672,7 +727,12 @@ async def indices( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.indices", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -713,6 +773,7 @@ async def master( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] = {} __path = "/_cat/master" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -739,7 +800,12 @@ async def master( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.master", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -816,9 +882,12 @@ async def ml_data_frame_analytics( :param time: Unit used to display time values. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if id not in SKIP_IN_PATH: - __path = f"/_cat/ml/data_frame/analytics/{_quote(id)}" + __path_parts = {"id": _quote(id)} + __path = f'/_cat/ml/data_frame/analytics/{__path_parts["id"]}' else: + __path_parts = {} __path = "/_cat/ml/data_frame/analytics" __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: @@ -851,7 +920,12 @@ async def ml_data_frame_analytics( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.ml_data_frame_analytics", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -932,9 +1006,12 @@ async def ml_datafeeds( :param time: The unit used to display time values. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if datafeed_id not in SKIP_IN_PATH: - __path = f"/_cat/ml/datafeeds/{_quote(datafeed_id)}" + __path_parts = {"datafeed_id": _quote(datafeed_id)} + __path = f'/_cat/ml/datafeeds/{__path_parts["datafeed_id"]}' else: + __path_parts = {} __path = "/_cat/ml/datafeeds" __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: @@ -965,7 +1042,12 @@ async def ml_datafeeds( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.ml_datafeeds", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1049,9 +1131,12 @@ async def ml_jobs( :param time: The unit used to display time values. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if job_id not in SKIP_IN_PATH: - __path = f"/_cat/ml/anomaly_detectors/{_quote(job_id)}" + __path_parts = {"job_id": _quote(job_id)} + __path = f'/_cat/ml/anomaly_detectors/{__path_parts["job_id"]}' else: + __path_parts = {} __path = "/_cat/ml/anomaly_detectors" __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: @@ -1084,7 +1169,12 @@ async def ml_jobs( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.ml_jobs", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1170,9 +1260,12 @@ async def ml_trained_models( :param size: The maximum number of transforms to display. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if model_id not in SKIP_IN_PATH: - __path = f"/_cat/ml/trained_models/{_quote(model_id)}" + __path_parts = {"model_id": _quote(model_id)} + __path = f'/_cat/ml/trained_models/{__path_parts["model_id"]}' else: + __path_parts = {} __path = "/_cat/ml/trained_models" __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: @@ -1207,7 +1300,12 @@ async def ml_trained_models( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.ml_trained_models", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1248,6 +1346,7 @@ async def nodeattrs( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] = {} __path = "/_cat/nodeattrs" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1274,7 +1373,12 @@ async def nodeattrs( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.nodeattrs", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1325,6 +1429,7 @@ async def nodes( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] = {} __path = "/_cat/nodes" __query: t.Dict[str, t.Any] = {} if bytes is not None: @@ -1357,7 +1462,12 @@ async def nodes( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.nodes", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1398,6 +1508,7 @@ async def pending_tasks( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] = {} __path = "/_cat/pending_tasks" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1424,7 +1535,12 @@ async def pending_tasks( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.pending_tasks", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1465,6 +1581,7 @@ async def plugins( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] = {} __path = "/_cat/plugins" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1491,7 +1608,12 @@ async def plugins( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.plugins", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1545,9 +1667,12 @@ async def recovery( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/_cat/recovery/{_quote(index)}" + __path_parts = {"index": _quote(index)} + __path = f'/_cat/recovery/{__path_parts["index"]}' else: + __path_parts = {} __path = "/_cat/recovery" __query: t.Dict[str, t.Any] = {} if active_only is not None: @@ -1580,7 +1705,12 @@ async def recovery( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.recovery", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1621,6 +1751,7 @@ async def repositories( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] = {} __path = "/_cat/repositories" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1647,7 +1778,12 @@ async def repositories( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.repositories", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1696,9 +1832,12 @@ async def segments( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/_cat/segments/{_quote(index)}" + __path_parts = {"index": _quote(index)} + __path = f'/_cat/segments/{__path_parts["index"]}' else: + __path_parts = {} __path = "/_cat/segments" __query: t.Dict[str, t.Any] = {} if bytes is not None: @@ -1727,7 +1866,12 @@ async def segments( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.segments", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1776,9 +1920,12 @@ async def shards( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/_cat/shards/{_quote(index)}" + __path_parts = {"index": _quote(index)} + __path = f'/_cat/shards/{__path_parts["index"]}' else: + __path_parts = {} __path = "/_cat/shards" __query: t.Dict[str, t.Any] = {} if bytes is not None: @@ -1807,7 +1954,12 @@ async def shards( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.shards", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1855,9 +2007,12 @@ async def snapshots( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if repository not in SKIP_IN_PATH: - __path = f"/_cat/snapshots/{_quote(repository)}" + __path_parts = {"repository": _quote(repository)} + __path = f'/_cat/snapshots/{__path_parts["repository"]}' else: + __path_parts = {} __path = "/_cat/snapshots" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1886,7 +2041,12 @@ async def snapshots( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.snapshots", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1938,6 +2098,7 @@ async def tasks( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] = {} __path = "/_cat/tasks" __query: t.Dict[str, t.Any] = {} if actions is not None: @@ -1972,7 +2133,12 @@ async def tasks( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.tasks", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -2016,9 +2182,12 @@ async def templates( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: - __path = f"/_cat/templates/{_quote(name)}" + __path_parts = {"name": _quote(name)} + __path = f'/_cat/templates/{__path_parts["name"]}' else: + __path_parts = {} __path = "/_cat/templates" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -2045,7 +2214,12 @@ async def templates( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.templates", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -2094,9 +2268,12 @@ async def thread_pool( :param time: The unit used to display time values. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if thread_pool_patterns not in SKIP_IN_PATH: - __path = f"/_cat/thread_pool/{_quote(thread_pool_patterns)}" + __path_parts = {"thread_pool_patterns": _quote(thread_pool_patterns)} + __path = f'/_cat/thread_pool/{__path_parts["thread_pool_patterns"]}' else: + __path_parts = {} __path = "/_cat/thread_pool" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -2125,7 +2302,12 @@ async def thread_pool( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.thread_pool", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2213,9 +2395,12 @@ async def transforms( :param time: The unit used to display time values. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if transform_id not in SKIP_IN_PATH: - __path = f"/_cat/transforms/{_quote(transform_id)}" + __path_parts = {"transform_id": _quote(transform_id)} + __path = f'/_cat/transforms/{__path_parts["transform_id"]}' else: + __path_parts = {} __path = "/_cat/transforms" __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: @@ -2250,5 +2435,10 @@ async def transforms( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.transforms", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/ccr.py b/elasticsearch/_async/client/ccr.py index 7c65dbeac..c926d0892 100644 --- a/elasticsearch/_async/client/ccr.py +++ b/elasticsearch/_async/client/ccr.py @@ -44,7 +44,8 @@ async def delete_auto_follow_pattern( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_ccr/auto_follow/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_ccr/auto_follow/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -56,7 +57,12 @@ async def delete_auto_follow_pattern( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="ccr.delete_auto_follow_pattern", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -129,7 +135,8 @@ async def follow( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_ccr/follow" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_ccr/follow' __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: @@ -175,7 +182,13 @@ async def follow( __body["remote_cluster"] = remote_cluster __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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ccr.follow", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -199,7 +212,8 @@ async def follow_info( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_ccr/info" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_ccr/info' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -211,7 +225,12 @@ async def follow_info( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ccr.follow_info", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -235,7 +254,8 @@ async def follow_stats( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_ccr/stats" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_ccr/stats' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -247,7 +267,12 @@ async def follow_stats( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ccr.follow_stats", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -286,7 +311,8 @@ async def forget_follower( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_ccr/forget_follower" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_ccr/forget_follower' __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: @@ -308,7 +334,13 @@ async def forget_follower( __body["leader_remote_cluster"] = leader_remote_cluster __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ccr.forget_follower", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -330,9 +362,12 @@ async def get_auto_follow_pattern( :param name: Specifies the auto-follow pattern collection that you want to retrieve. If you do not specify a name, the API returns information for all collections. """ + __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: - __path = f"/_ccr/auto_follow/{_quote(name)}" + __path_parts = {"name": _quote(name)} + __path = f'/_ccr/auto_follow/{__path_parts["name"]}' else: + __path_parts = {} __path = "/_ccr/auto_follow" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -345,7 +380,12 @@ async def get_auto_follow_pattern( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ccr.get_auto_follow_pattern", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -368,7 +408,8 @@ async def pause_auto_follow_pattern( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_ccr/auto_follow/{_quote(name)}/pause" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_ccr/auto_follow/{__path_parts["name"]}/pause' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -380,7 +421,12 @@ async def pause_auto_follow_pattern( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="ccr.pause_auto_follow_pattern", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -404,7 +450,8 @@ async def pause_follow( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_ccr/pause_follow" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_ccr/pause_follow' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -416,7 +463,12 @@ async def pause_follow( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="ccr.pause_follow", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -521,7 +573,8 @@ async def put_auto_follow_pattern( raise ValueError("Empty value passed for parameter 'name'") if remote_cluster is None and body is None: raise ValueError("Empty value passed for parameter 'remote_cluster'") - __path = f"/_ccr/auto_follow/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_ccr/auto_follow/{__path_parts["name"]}' __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: @@ -573,7 +626,13 @@ async def put_auto_follow_pattern( __body["settings"] = settings __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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ccr.put_auto_follow_pattern", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -596,7 +655,8 @@ async def resume_auto_follow_pattern( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_ccr/auto_follow/{_quote(name)}/resume" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_ccr/auto_follow/{__path_parts["name"]}/resume' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -608,7 +668,12 @@ async def resume_auto_follow_pattern( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="ccr.resume_auto_follow_pattern", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -668,7 +733,8 @@ async def resume_follow( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_ccr/resume_follow" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_ccr/resume_follow' __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: @@ -712,7 +778,13 @@ async def resume_follow( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ccr.resume_follow", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -729,6 +801,7 @@ async def stats( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_ccr/stats" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -741,7 +814,12 @@ async def stats( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ccr.stats", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -765,7 +843,8 @@ async def unfollow( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_ccr/unfollow" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_ccr/unfollow' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -777,5 +856,10 @@ async def unfollow( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="ccr.unfollow", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/cluster.py b/elasticsearch/_async/client/cluster.py index 4ab157c66..1c0a884cb 100644 --- a/elasticsearch/_async/client/cluster.py +++ b/elasticsearch/_async/client/cluster.py @@ -60,6 +60,7 @@ async def allocation_explain( :param shard: Specifies the ID of the shard that you would like an explanation for. """ + __path_parts: t.Dict[str, str] = {} __path = "/_cluster/allocation/explain" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -90,7 +91,13 @@ async def allocation_explain( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="cluster.allocation_explain", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -122,7 +129,8 @@ async def delete_component_template( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_component_template/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_component_template/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -138,7 +146,12 @@ async def delete_component_template( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="cluster.delete_component_template", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -163,6 +176,7 @@ async def delete_voting_config_exclusions( configuration exclusions list is cleared even if some excluded nodes are still in the cluster. """ + __path_parts: t.Dict[str, str] = {} __path = "/_cluster/voting_config_exclusions" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -177,7 +191,12 @@ async def delete_voting_config_exclusions( __query["wait_for_removal"] = wait_for_removal __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="cluster.delete_voting_config_exclusions", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -210,7 +229,8 @@ async def exists_component_template( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_component_template/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_component_template/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -226,7 +246,12 @@ async def exists_component_template( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "HEAD", __path, params=__query, headers=__headers + "HEAD", + __path, + params=__query, + headers=__headers, + endpoint_id="cluster.exists_component_template", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -261,9 +286,12 @@ async def get_component_template( no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: - __path = f"/_component_template/{_quote(name)}" + __path_parts = {"name": _quote(name)} + __path = f'/_component_template/{__path_parts["name"]}' else: + __path_parts = {} __path = "/_component_template" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -284,7 +312,12 @@ async def get_component_template( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cluster.get_component_template", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -316,6 +349,7 @@ async def get_settings( :param timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] = {} __path = "/_cluster/settings" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -336,7 +370,12 @@ async def get_settings( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cluster.get_settings", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -419,9 +458,12 @@ async def health( provided) until the status of the cluster changes to the one provided or better, i.e. green > yellow > red. By default, will not wait for any status. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/_cluster/health/{_quote(index)}" + __path_parts = {"index": _quote(index)} + __path = f'/_cluster/health/{__path_parts["index"]}' else: + __path_parts = {} __path = "/_cluster/health" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -456,7 +498,12 @@ async def health( __query["wait_for_status"] = wait_for_status __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cluster.health", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -488,7 +535,8 @@ async def info( """ if target in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'target'") - __path = f"/_info/{_quote(target)}" + __path_parts: t.Dict[str, str] = {"target": _quote(target)} + __path = f'/_info/{__path_parts["target"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -500,7 +548,12 @@ async def info( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cluster.info", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -528,6 +581,7 @@ async def pending_tasks( no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] = {} __path = "/_cluster/pending_tasks" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -544,7 +598,12 @@ async def pending_tasks( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cluster.pending_tasks", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -574,6 +633,7 @@ async def post_voting_config_exclusions( If the timeout expires before the appropriate condition is satisfied, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] = {} __path = "/_cluster/voting_config_exclusions" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -592,7 +652,12 @@ async def post_voting_config_exclusions( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="cluster.post_voting_config_exclusions", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -655,7 +720,8 @@ async def put_component_template( raise ValueError("Empty value passed for parameter 'name'") if template is None and body is None: raise ValueError("Empty value passed for parameter 'template'") - __path = f"/_component_template/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __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 create is not None: @@ -681,7 +747,13 @@ async def put_component_template( __body["version"] = version __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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="cluster.put_component_template", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -714,6 +786,7 @@ async def put_settings( :param timeout: Explicit operation timeout :param transient: """ + __path_parts: t.Dict[str, str] = {} __path = "/_cluster/settings" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -738,7 +811,13 @@ async def put_settings( __body["transient"] = transient __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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="cluster.put_settings", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -755,6 +834,7 @@ async def remote_info( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_remote/info" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -767,7 +847,12 @@ async def remote_info( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cluster.remote_info", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -810,6 +895,7 @@ async def reroute( :param timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] = {} __path = "/_cluster/reroute" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -842,7 +928,13 @@ async def reroute( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="cluster.reroute", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -899,13 +991,18 @@ async def state( :param wait_for_timeout: The maximum time to wait for wait_for_metadata_version before timing out """ + __path_parts: t.Dict[str, str] if metric not in SKIP_IN_PATH and index not in SKIP_IN_PATH: - __path = f"/_cluster/state/{_quote(metric)}/{_quote(index)}" + __path_parts = {"metric": _quote(metric), "index": _quote(index)} + __path = f'/_cluster/state/{__path_parts["metric"]}/{__path_parts["index"]}' elif metric not in SKIP_IN_PATH: - __path = f"/_cluster/state/{_quote(metric)}" + __path_parts = {"metric": _quote(metric)} + __path = f'/_cluster/state/{__path_parts["metric"]}' elif index not in SKIP_IN_PATH: - __path = f"/_cluster/state/_all/{_quote(index)}" + __path_parts = {"index": _quote(index)} + __path = f'/_cluster/state/_all/{__path_parts["index"]}' else: + __path_parts = {} __path = "/_cluster/state" __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: @@ -934,7 +1031,12 @@ async def state( __query["wait_for_timeout"] = wait_for_timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cluster.state", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -962,9 +1064,12 @@ async def stats( timed out nodes are included in the response’s `_nodes.failed` property. Defaults to no timeout. """ + __path_parts: t.Dict[str, str] if node_id not in SKIP_IN_PATH: - __path = f"/_cluster/stats/nodes/{_quote(node_id)}" + __path_parts = {"node_id": _quote(node_id)} + __path = f'/_cluster/stats/nodes/{__path_parts["node_id"]}' else: + __path_parts = {} __path = "/_cluster/stats" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -981,5 +1086,10 @@ async def stats( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cluster.stats", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/dangling_indices.py b/elasticsearch/_async/client/dangling_indices.py index 7dc8543ee..ec3d44f9d 100644 --- a/elasticsearch/_async/client/dangling_indices.py +++ b/elasticsearch/_async/client/dangling_indices.py @@ -55,7 +55,8 @@ async def delete_dangling_index( raise ValueError("Empty value passed for parameter 'index_uuid'") if accept_data_loss is None: raise ValueError("Empty value passed for parameter 'accept_data_loss'") - __path = f"/_dangling/{_quote(index_uuid)}" + __path_parts: t.Dict[str, str] = {"index_uuid": _quote(index_uuid)} + __path = f'/_dangling/{__path_parts["index_uuid"]}' __query: t.Dict[str, t.Any] = {} if accept_data_loss is not None: __query["accept_data_loss"] = accept_data_loss @@ -73,7 +74,12 @@ async def delete_dangling_index( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="dangling_indices.delete_dangling_index", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -106,7 +112,8 @@ async def import_dangling_index( raise ValueError("Empty value passed for parameter 'index_uuid'") if accept_data_loss is None: raise ValueError("Empty value passed for parameter 'accept_data_loss'") - __path = f"/_dangling/{_quote(index_uuid)}" + __path_parts: t.Dict[str, str] = {"index_uuid": _quote(index_uuid)} + __path = f'/_dangling/{__path_parts["index_uuid"]}' __query: t.Dict[str, t.Any] = {} if accept_data_loss is not None: __query["accept_data_loss"] = accept_data_loss @@ -124,7 +131,12 @@ async def import_dangling_index( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="dangling_indices.import_dangling_index", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -141,6 +153,7 @@ async def list_dangling_indices( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_dangling" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -153,5 +166,10 @@ async def list_dangling_indices( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="dangling_indices.list_dangling_indices", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/enrich.py b/elasticsearch/_async/client/enrich.py index 174fc17ba..8d052015f 100644 --- a/elasticsearch/_async/client/enrich.py +++ b/elasticsearch/_async/client/enrich.py @@ -44,7 +44,8 @@ async def delete_policy( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_enrich/policy/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_enrich/policy/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -56,7 +57,12 @@ async def delete_policy( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="enrich.delete_policy", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -81,7 +87,8 @@ async def execute_policy( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_enrich/policy/{_quote(name)}/_execute" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_enrich/policy/{__path_parts["name"]}/_execute' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -95,7 +102,12 @@ async def execute_policy( __query["wait_for_completion"] = wait_for_completion __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers + "PUT", + __path, + params=__query, + headers=__headers, + endpoint_id="enrich.execute_policy", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -116,9 +128,12 @@ async def get_policy( :param name: Comma-separated list of enrich policy names used to limit the request. To return information for all enrich policies, omit this parameter. """ + __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: - __path = f"/_enrich/policy/{_quote(name)}" + __path_parts = {"name": _quote(name)} + __path = f'/_enrich/policy/{__path_parts["name"]}' else: + __path_parts = {} __path = "/_enrich/policy" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -131,7 +146,12 @@ async def get_policy( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="enrich.get_policy", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -164,7 +184,8 @@ async def put_policy( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_enrich/policy/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_enrich/policy/{__path_parts["name"]}' __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: @@ -184,7 +205,13 @@ async def put_policy( __body["range"] = range __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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="enrich.put_policy", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -202,6 +229,7 @@ async def stats( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_enrich/_stats" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -214,5 +242,10 @@ async def stats( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="enrich.stats", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/eql.py b/elasticsearch/_async/client/eql.py index df6f8d1b3..f839f5f4f 100644 --- a/elasticsearch/_async/client/eql.py +++ b/elasticsearch/_async/client/eql.py @@ -47,7 +47,8 @@ async def delete( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_eql/search/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_eql/search/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -59,7 +60,12 @@ async def delete( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="eql.delete", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -91,7 +97,8 @@ async def get( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_eql/search/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_eql/search/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -107,7 +114,12 @@ async def get( __query["wait_for_completion_timeout"] = wait_for_completion_timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="eql.get", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -130,7 +142,8 @@ async def get_status( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_eql/search/status/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_eql/search/status/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -142,7 +155,12 @@ async def get_status( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="eql.get_status", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -238,7 +256,8 @@ async def search( raise ValueError("Empty value passed for parameter 'index'") if query is None and body is None: raise ValueError("Empty value passed for parameter 'query'") - __path = f"/{_quote(index)}/_eql/search" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_eql/search' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} if allow_no_indices is not None: @@ -286,5 +305,11 @@ async def search( __body["wait_for_completion_timeout"] = wait_for_completion_timeout __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="eql.search", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/esql.py b/elasticsearch/_async/client/esql.py index 4cd50e2e3..aa9e9dcb4 100644 --- a/elasticsearch/_async/client/esql.py +++ b/elasticsearch/_async/client/esql.py @@ -68,6 +68,7 @@ async def query( """ if query is None and body is None: raise ValueError("Empty value passed for parameter 'query'") + __path_parts: t.Dict[str, str] = {} __path = "/_query" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -96,5 +97,11 @@ async def query( __body["params"] = params __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="esql.query", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/features.py b/elasticsearch/_async/client/features.py index c7c2242a1..4738013f2 100644 --- a/elasticsearch/_async/client/features.py +++ b/elasticsearch/_async/client/features.py @@ -40,6 +40,7 @@ async def get_features( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_features" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -52,7 +53,12 @@ async def get_features( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="features.get_features", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -69,6 +75,7 @@ async def reset_features( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_features/_reset" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -81,5 +88,10 @@ async def reset_features( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="features.reset_features", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/fleet.py b/elasticsearch/_async/client/fleet.py index 3f948791b..fdda240c3 100644 --- a/elasticsearch/_async/client/fleet.py +++ b/elasticsearch/_async/client/fleet.py @@ -59,7 +59,8 @@ async def global_checkpoints( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_fleet/global_checkpoints" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_fleet/global_checkpoints' __query: t.Dict[str, t.Any] = {} if checkpoints is not None: __query["checkpoints"] = checkpoints @@ -79,7 +80,12 @@ async def global_checkpoints( __query["wait_for_index"] = wait_for_index __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="fleet.global_checkpoints", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -171,9 +177,12 @@ async def msearch( ) elif searches is not None and body is not None: raise ValueError("Cannot set both 'searches' and 'body'") + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_fleet/_fleet_msearch" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_fleet/_fleet_msearch' else: + __path_parts = {} __path = "/_fleet/_fleet_msearch" __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: @@ -216,7 +225,13 @@ async def msearch( "content-type": "application/x-ndjson", } return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="fleet.msearch", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -460,7 +475,8 @@ async def search( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_fleet/_fleet_search" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_fleet/_fleet_search' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} # The 'sort' parameter with a colon can't be encoded to the body. @@ -613,5 +629,11 @@ async def search( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="fleet.search", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/graph.py b/elasticsearch/_async/client/graph.py index 87ef452ae..bf07018fb 100644 --- a/elasticsearch/_async/client/graph.py +++ b/elasticsearch/_async/client/graph.py @@ -65,7 +65,8 @@ async def explore( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_graph/explore" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_graph/explore' __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: @@ -95,5 +96,11 @@ async def explore( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="graph.explore", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/ilm.py b/elasticsearch/_async/client/ilm.py index 27fe5090c..a36661c77 100644 --- a/elasticsearch/_async/client/ilm.py +++ b/elasticsearch/_async/client/ilm.py @@ -54,7 +54,8 @@ async def delete_lifecycle( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_ilm/policy/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"policy": _quote(name)} + __path = f'/_ilm/policy/{__path_parts["policy"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -70,7 +71,12 @@ async def delete_lifecycle( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="ilm.delete_lifecycle", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -111,7 +117,8 @@ async def explain_lifecycle( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_ilm/explain" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_ilm/explain' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -131,7 +138,12 @@ async def explain_lifecycle( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ilm.explain_lifecycle", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -161,9 +173,12 @@ async def get_lifecycle( :param timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: - __path = f"/_ilm/policy/{_quote(name)}" + __path_parts = {"policy": _quote(name)} + __path = f'/_ilm/policy/{__path_parts["policy"]}' else: + __path_parts = {} __path = "/_ilm/policy" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -180,7 +195,12 @@ async def get_lifecycle( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ilm.get_lifecycle", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -197,6 +217,7 @@ async def get_status( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_ilm/status" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -209,7 +230,12 @@ async def get_status( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ilm.get_status", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -239,6 +265,7 @@ async def migrate_to_data_tiers( :param legacy_template_to_delete: :param node_attribute: """ + __path_parts: t.Dict[str, str] = {} __path = "/_ilm/migrate_to_data_tiers" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -263,7 +290,13 @@ async def migrate_to_data_tiers( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ilm.migrate_to_data_tiers", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -292,7 +325,8 @@ async def move_to_step( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/_ilm/move/{_quote(index)}" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/_ilm/move/{__path_parts["index"]}' __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: @@ -314,7 +348,13 @@ async def move_to_step( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ilm.move_to_step", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -350,7 +390,8 @@ async def put_lifecycle( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_ilm/policy/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"policy": _quote(name)} + __path = f'/_ilm/policy/{__path_parts["policy"]}' __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: @@ -374,7 +415,13 @@ async def put_lifecycle( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ilm.put_lifecycle", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -396,7 +443,8 @@ async def remove_policy( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_ilm/remove" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_ilm/remove' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -408,7 +456,12 @@ async def remove_policy( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="ilm.remove_policy", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -431,7 +484,8 @@ async def retry( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_ilm/retry" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_ilm/retry' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -443,7 +497,12 @@ async def retry( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="ilm.retry", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -467,6 +526,7 @@ async def start( :param master_timeout: :param timeout: """ + __path_parts: t.Dict[str, str] = {} __path = "/_ilm/start" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -483,7 +543,12 @@ async def start( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="ilm.start", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -508,6 +573,7 @@ async def stop( :param master_timeout: :param timeout: """ + __path_parts: t.Dict[str, str] = {} __path = "/_ilm/stop" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -524,5 +590,10 @@ async def stop( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="ilm.stop", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/indices.py b/elasticsearch/_async/client/indices.py index ccce5b597..093a8bb47 100644 --- a/elasticsearch/_async/client/indices.py +++ b/elasticsearch/_async/client/indices.py @@ -71,7 +71,11 @@ async def add_block( raise ValueError("Empty value passed for parameter 'index'") if block in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'block'") - __path = f"/{_quote(index)}/_block/{_quote(block)}" + __path_parts: t.Dict[str, str] = { + "index": _quote(index), + "block": _quote(block), + } + __path = f'/{__path_parts["index"]}/_block/{__path_parts["block"]}' __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: __query["allow_no_indices"] = allow_no_indices @@ -93,7 +97,12 @@ async def add_block( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers + "PUT", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.add_block", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -155,9 +164,12 @@ async def analyze( as a multi-value field. :param tokenizer: Tokenizer to use to convert text into tokens. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_analyze" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_analyze' else: + __path_parts = {} __path = "/_analyze" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -194,7 +206,13 @@ async def analyze( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.analyze", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -245,9 +263,12 @@ async def clear_cache( :param query: If `true`, clears the query cache. :param request: If `true`, clears the request cache. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_cache/clear" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_cache/clear' else: + __path_parts = {} __path = "/_cache/clear" __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: @@ -274,7 +295,12 @@ async def clear_cache( __query["request"] = request __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.clear_cache", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -322,7 +348,11 @@ async def clone( raise ValueError("Empty value passed for parameter 'index'") if target in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'target'") - __path = f"/{_quote(index)}/_clone/{_quote(target)}" + __path_parts: t.Dict[str, str] = { + "index": _quote(index), + "target": _quote(target), + } + __path = f'/{__path_parts["index"]}/_clone/{__path_parts["target"]}' __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: @@ -350,7 +380,13 @@ async def clone( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.clone", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -407,7 +443,8 @@ async def close( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_close" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_close' __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: __query["allow_no_indices"] = allow_no_indices @@ -431,7 +468,12 @@ async def close( __query["wait_for_active_shards"] = wait_for_active_shards __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.close", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -478,7 +520,8 @@ async def create( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}' __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: @@ -508,7 +551,13 @@ async def create( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.create", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -534,7 +583,8 @@ async def create_data_stream( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_data_stream/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_data_stream/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -546,7 +596,12 @@ async def create_data_stream( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers + "PUT", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.create_data_stream", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -578,9 +633,12 @@ async def data_streams_stats( :param expand_wildcards: Type of data stream that wildcard patterns can match. Supports comma-separated values, such as `open,hidden`. """ + __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: - __path = f"/_data_stream/{_quote(name)}/_stats" + __path_parts = {"name": _quote(name)} + __path = f'/_data_stream/{__path_parts["name"]}/_stats' else: + __path_parts = {} __path = "/_data_stream/_stats" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -595,7 +653,12 @@ async def data_streams_stats( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.data_streams_stats", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -648,7 +711,8 @@ async def delete( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}' __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: __query["allow_no_indices"] = allow_no_indices @@ -670,7 +734,12 @@ async def delete( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.delete", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -707,7 +776,8 @@ async def delete_alias( raise ValueError("Empty value passed for parameter 'index'") if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/{_quote(index)}/_alias/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"index": _quote(index), "name": _quote(name)} + __path = f'/{__path_parts["index"]}/_alias/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -723,7 +793,12 @@ async def delete_alias( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.delete_alias", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -762,7 +837,8 @@ async def delete_data_lifecycle( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_data_stream/{_quote(name)}/_lifecycle" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_data_stream/{__path_parts["name"]}/_lifecycle' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -780,7 +856,12 @@ async def delete_data_lifecycle( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.delete_data_lifecycle", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -813,7 +894,8 @@ async def delete_data_stream( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_data_stream/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_data_stream/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -827,7 +909,12 @@ async def delete_data_stream( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.delete_data_stream", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -859,7 +946,8 @@ async def delete_index_template( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_index_template/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_index_template/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -875,7 +963,12 @@ async def delete_index_template( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.delete_index_template", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -907,7 +1000,8 @@ async def delete_template( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_template/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_template/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -923,7 +1017,12 @@ async def delete_template( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.delete_template", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -975,7 +1074,8 @@ async def disk_usage( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_disk_usage" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_disk_usage' __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: __query["allow_no_indices"] = allow_no_indices @@ -997,7 +1097,12 @@ async def disk_usage( __query["run_expensive_tasks"] = run_expensive_tasks __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.disk_usage", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1034,7 +1139,11 @@ async def downsample( ) elif config is not None and body is not None: raise ValueError("Cannot set both 'config' and 'body'") - __path = f"/{_quote(index)}/_downsample/{_quote(target_index)}" + __path_parts: t.Dict[str, str] = { + "index": _quote(index), + "target_index": _quote(target_index), + } + __path = f'/{__path_parts["index"]}/_downsample/{__path_parts["target_index"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -1047,7 +1156,13 @@ async def downsample( __body = config if config is not None else body __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.downsample", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1096,7 +1211,8 @@ async def exists( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}' __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: __query["allow_no_indices"] = allow_no_indices @@ -1120,7 +1236,12 @@ async def exists( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "HEAD", __path, params=__query, headers=__headers + "HEAD", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.exists", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1168,10 +1289,13 @@ async def exists_alias( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH and name not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_alias/{_quote(name)}" + __path_parts = {"index": _quote(index), "name": _quote(name)} + __path = f'/{__path_parts["index"]}/_alias/{__path_parts["name"]}' elif name not in SKIP_IN_PATH: - __path = f"/_alias/{_quote(name)}" + __path_parts = {"name": _quote(name)} + __path = f'/_alias/{__path_parts["name"]}' else: raise ValueError("Couldn't find a path for the given parameters") __query: t.Dict[str, t.Any] = {} @@ -1193,7 +1317,12 @@ async def exists_alias( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "HEAD", __path, params=__query, headers=__headers + "HEAD", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.exists_alias", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1222,7 +1351,8 @@ async def exists_index_template( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_index_template/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_index_template/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -1236,7 +1366,12 @@ async def exists_index_template( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "HEAD", __path, params=__query, headers=__headers + "HEAD", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.exists_index_template", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1267,7 +1402,8 @@ async def exists_template( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_template/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_template/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -1285,7 +1421,12 @@ async def exists_template( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "HEAD", __path, params=__query, headers=__headers + "HEAD", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.exists_template", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1315,7 +1456,8 @@ async def explain_data_lifecycle( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_lifecycle/explain" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_lifecycle/explain' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -1331,7 +1473,12 @@ async def explain_data_lifecycle( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.explain_data_lifecycle", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1393,7 +1540,8 @@ async def field_usage_stats( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_field_usage_stats" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_field_usage_stats' __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: __query["allow_no_indices"] = allow_no_indices @@ -1419,7 +1567,12 @@ async def field_usage_stats( __query["wait_for_active_shards"] = wait_for_active_shards __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.field_usage_stats", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1467,9 +1620,12 @@ async def flush( when another flush operation is running. If `false`, Elasticsearch returns an error if you request a flush when another flush operation is running. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_flush" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_flush' else: + __path_parts = {} __path = "/_flush" __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: @@ -1492,7 +1648,12 @@ async def flush( __query["wait_if_ongoing"] = wait_if_ongoing __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.flush", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1542,9 +1703,12 @@ async def forcemerge( :param wait_for_completion: Should the request wait until the force merge is completed. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_forcemerge" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_forcemerge' else: + __path_parts = {} __path = "/_forcemerge" __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: @@ -1571,7 +1735,12 @@ async def forcemerge( __query["wait_for_completion"] = wait_for_completion __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.forcemerge", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1638,7 +1807,8 @@ async def get( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}' __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: __query["allow_no_indices"] = allow_no_indices @@ -1666,7 +1836,12 @@ async def get( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.get", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1713,13 +1888,18 @@ async def get_alias( :param local: If `true`, the request retrieves information from the local node only. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH and name not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_alias/{_quote(name)}" + __path_parts = {"index": _quote(index), "name": _quote(name)} + __path = f'/{__path_parts["index"]}/_alias/{__path_parts["name"]}' elif index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_alias" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_alias' elif name not in SKIP_IN_PATH: - __path = f"/_alias/{_quote(name)}" + __path_parts = {"name": _quote(name)} + __path = f'/_alias/{__path_parts["name"]}' else: + __path_parts = {} __path = "/_alias" __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: @@ -1740,7 +1920,12 @@ async def get_alias( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.get_alias", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1777,7 +1962,8 @@ async def get_data_lifecycle( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_data_stream/{_quote(name)}/_lifecycle" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_data_stream/{__path_parts["name"]}/_lifecycle' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -1793,7 +1979,12 @@ async def get_data_lifecycle( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.get_data_lifecycle", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1828,9 +2019,12 @@ async def get_data_stream( :param include_defaults: If true, returns all relevant default configurations for the index template. """ + __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: - __path = f"/_data_stream/{_quote(name)}" + __path_parts = {"name": _quote(name)} + __path = f'/_data_stream/{__path_parts["name"]}' else: + __path_parts = {} __path = "/_data_stream" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1847,7 +2041,12 @@ async def get_data_stream( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.get_data_stream", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1898,10 +2097,13 @@ async def get_field_mapping( """ if fields in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'fields'") + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH and fields not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_mapping/field/{_quote(fields)}" + __path_parts = {"index": _quote(index), "fields": _quote(fields)} + __path = f'/{__path_parts["index"]}/_mapping/field/{__path_parts["fields"]}' elif fields not in SKIP_IN_PATH: - __path = f"/_mapping/field/{_quote(fields)}" + __path_parts = {"fields": _quote(fields)} + __path = f'/_mapping/field/{__path_parts["fields"]}' else: raise ValueError("Couldn't find a path for the given parameters") __query: t.Dict[str, t.Any] = {} @@ -1925,7 +2127,12 @@ async def get_field_mapping( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.get_field_mapping", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1961,9 +2168,12 @@ async def get_index_template( no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: - __path = f"/_index_template/{_quote(name)}" + __path_parts = {"name": _quote(name)} + __path = f'/_index_template/{__path_parts["name"]}' else: + __path_parts = {} __path = "/_index_template" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1984,7 +2194,12 @@ async def get_index_template( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.get_index_template", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -2034,9 +2249,12 @@ async def get_mapping( no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_mapping" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_mapping' else: + __path_parts = {} __path = "/_mapping" __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: @@ -2059,7 +2277,12 @@ async def get_mapping( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.get_mapping", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -2117,13 +2340,18 @@ async def get_settings( no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH and name not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_settings/{_quote(name)}" + __path_parts = {"index": _quote(index), "name": _quote(name)} + __path = f'/{__path_parts["index"]}/_settings/{__path_parts["name"]}' elif index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_settings" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_settings' elif name not in SKIP_IN_PATH: - __path = f"/_settings/{_quote(name)}" + __path_parts = {"name": _quote(name)} + __path = f'/_settings/{__path_parts["name"]}' else: + __path_parts = {} __path = "/_settings" __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: @@ -2150,7 +2378,12 @@ async def get_settings( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.get_settings", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -2183,9 +2416,12 @@ async def get_template( no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: - __path = f"/_template/{_quote(name)}" + __path_parts = {"name": _quote(name)} + __path = f'/_template/{__path_parts["name"]}' else: + __path_parts = {} __path = "/_template" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -2204,7 +2440,12 @@ async def get_template( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.get_template", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -2226,7 +2467,8 @@ async def migrate_to_data_stream( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_data_stream/_migrate/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_data_stream/_migrate/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -2238,7 +2480,12 @@ async def migrate_to_data_stream( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.migrate_to_data_stream", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2263,6 +2510,7 @@ async def modify_data_stream( """ if actions is None and body is None: raise ValueError("Empty value passed for parameter 'actions'") + __path_parts: t.Dict[str, str] = {} __path = "/_data_stream/_modify" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -2279,7 +2527,13 @@ async def modify_data_stream( __body["actions"] = actions __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.modify_data_stream", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -2340,7 +2594,8 @@ async def open( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_open" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_open' __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: __query["allow_no_indices"] = allow_no_indices @@ -2364,7 +2619,12 @@ async def open( __query["wait_for_active_shards"] = wait_for_active_shards __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.open", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -2387,7 +2647,8 @@ async def promote_data_stream( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_data_stream/_promote/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_data_stream/_promote/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -2399,7 +2660,12 @@ async def promote_data_stream( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.promote_data_stream", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2466,7 +2732,8 @@ async def put_alias( raise ValueError("Empty value passed for parameter 'index'") if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/{_quote(index)}/_alias/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"index": _quote(index), "name": _quote(name)} + __path = f'/{__path_parts["index"]}/_alias/{__path_parts["name"]}' __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: @@ -2498,7 +2765,13 @@ async def put_alias( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.put_alias", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2555,7 +2828,8 @@ async def put_data_lifecycle( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_data_stream/{_quote(name)}/_lifecycle" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_data_stream/{__path_parts["name"]}/_lifecycle' __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: @@ -2583,7 +2857,13 @@ async def put_data_lifecycle( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.put_data_lifecycle", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2645,7 +2925,8 @@ async def put_index_template( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_index_template/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_index_template/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} if create is not None: @@ -2675,7 +2956,13 @@ async def put_index_template( __body["version"] = version __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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.put_index_template", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2785,7 +3072,8 @@ async def put_mapping( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_mapping" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_mapping' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} if allow_no_indices is not None: @@ -2833,7 +3121,13 @@ async def put_mapping( __body["_source"] = source __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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.put_mapping", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2899,9 +3193,12 @@ async def put_settings( ) elif settings is not None and body is not None: raise ValueError("Cannot set both 'settings' and 'body'") + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_settings" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_settings' else: + __path_parts = {} __path = "/_settings" __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: @@ -2929,7 +3226,13 @@ async def put_settings( __body = settings if settings 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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.put_settings", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2992,7 +3295,8 @@ async def put_template( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_template/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_template/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} if create is not None: @@ -3026,7 +3330,13 @@ async def put_template( __body["version"] = version __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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.put_template", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -3053,9 +3363,12 @@ async def recovery( :param detailed: If `true`, the response includes detailed information about shard recoveries. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_recovery" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_recovery' else: + __path_parts = {} __path = "/_recovery" __query: t.Dict[str, t.Any] = {} if active_only is not None: @@ -3072,7 +3385,12 @@ async def recovery( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.recovery", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -3113,9 +3431,12 @@ async def refresh( :param ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_refresh" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_refresh' else: + __path_parts = {} __path = "/_refresh" __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: @@ -3134,7 +3455,12 @@ async def refresh( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.refresh", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -3173,7 +3499,8 @@ async def reload_search_analyzers( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_reload_search_analyzers" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_reload_search_analyzers' __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: __query["allow_no_indices"] = allow_no_indices @@ -3191,7 +3518,12 @@ async def reload_search_analyzers( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.reload_search_analyzers", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -3240,7 +3572,8 @@ async def resolve_cluster( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_resolve/cluster/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_resolve/cluster/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: __query["allow_no_indices"] = allow_no_indices @@ -3260,7 +3593,12 @@ async def resolve_cluster( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.resolve_cluster", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -3296,7 +3634,8 @@ async def resolve_index( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_resolve/index/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_resolve/index/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -3310,7 +3649,12 @@ async def resolve_index( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.resolve_index", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3373,10 +3717,13 @@ async def rollover( """ if alias in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'alias'") + __path_parts: t.Dict[str, str] if alias not in SKIP_IN_PATH and new_index not in SKIP_IN_PATH: - __path = f"/{_quote(alias)}/_rollover/{_quote(new_index)}" + __path_parts = {"alias": _quote(alias), "new_index": _quote(new_index)} + __path = f'/{__path_parts["alias"]}/_rollover/{__path_parts["new_index"]}' elif alias not in SKIP_IN_PATH: - __path = f"/{_quote(alias)}/_rollover" + __path_parts = {"alias": _quote(alias)} + __path = f'/{__path_parts["alias"]}/_rollover' else: raise ValueError("Couldn't find a path for the given parameters") __query: t.Dict[str, t.Any] = {} @@ -3412,7 +3759,13 @@ async def rollover( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.rollover", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -3455,9 +3808,12 @@ async def segments( a missing or closed index. :param verbose: If `true`, the request returns a verbose response. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_segments" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_segments' else: + __path_parts = {} __path = "/_segments" __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: @@ -3478,7 +3834,12 @@ async def segments( __query["verbose"] = verbose __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.segments", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -3523,9 +3884,12 @@ async def shard_stores( in the response. :param status: List of shard health statuses used to limit the request. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_shard_stores" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_shard_stores' else: + __path_parts = {} __path = "/_shard_stores" __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: @@ -3546,7 +3910,12 @@ async def shard_stores( __query["status"] = status __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.shard_stores", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3594,7 +3963,11 @@ async def shrink( raise ValueError("Empty value passed for parameter 'index'") if target in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'target'") - __path = f"/{_quote(index)}/_shrink/{_quote(target)}" + __path_parts: t.Dict[str, str] = { + "index": _quote(index), + "target": _quote(target), + } + __path = f'/{__path_parts["index"]}/_shrink/{__path_parts["target"]}' __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: @@ -3622,7 +3995,13 @@ async def shrink( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.shrink", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3704,7 +4083,8 @@ async def simulate_index_template( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_index_template/_simulate_index/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_index_template/_simulate_index/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} if create is not None: @@ -3744,7 +4124,13 @@ async def simulate_index_template( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.simulate_index_template", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3791,9 +4177,12 @@ async def simulate_template( ) elif template is not None and body is not None: raise ValueError("Cannot set both 'template' and 'body'") + __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: - __path = f"/_index_template/_simulate/{_quote(name)}" + __path_parts = {"name": _quote(name)} + __path = f'/_index_template/_simulate/{__path_parts["name"]}' else: + __path_parts = {} __path = "/_index_template/_simulate" __query: t.Dict[str, t.Any] = {} if create is not None: @@ -3817,7 +4206,13 @@ async def simulate_template( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.simulate_template", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3865,7 +4260,11 @@ async def split( raise ValueError("Empty value passed for parameter 'index'") if target in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'target'") - __path = f"/{_quote(index)}/_split/{_quote(target)}" + __path_parts: t.Dict[str, str] = { + "index": _quote(index), + "target": _quote(target), + } + __path = f'/{__path_parts["index"]}/_split/{__path_parts["target"]}' __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: @@ -3893,7 +4292,13 @@ async def split( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.split", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -3955,13 +4360,18 @@ async def stats( :param level: Indicates whether statistics are aggregated at the cluster, index, or shard level. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH and metric not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_stats/{_quote(metric)}" + __path_parts = {"index": _quote(index), "metric": _quote(metric)} + __path = f'/{__path_parts["index"]}/_stats/{__path_parts["metric"]}' elif index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_stats" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_stats' elif metric not in SKIP_IN_PATH: - __path = f"/_stats/{_quote(metric)}" + __path_parts = {"metric": _quote(metric)} + __path = f'/_stats/{__path_parts["metric"]}' else: + __path_parts = {} __path = "/_stats" __query: t.Dict[str, t.Any] = {} if completion_fields is not None: @@ -3992,7 +4402,12 @@ async def stats( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.stats", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -4047,7 +4462,8 @@ async def unfreeze( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_unfreeze" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_unfreeze' __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: __query["allow_no_indices"] = allow_no_indices @@ -4071,7 +4487,12 @@ async def unfreeze( __query["wait_for_active_shards"] = wait_for_active_shards __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.unfreeze", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -4103,6 +4524,7 @@ async def update_aliases( :param timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] = {} __path = "/_aliases" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -4123,7 +4545,13 @@ async def update_aliases( __body["actions"] = actions __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.update_aliases", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -4195,9 +4623,12 @@ async def validate_query( :param rewrite: If `true`, returns a more detailed explanation showing the actual Lucene query that will be executed. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_validate/query" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_validate/query' else: + __path_parts = {} __path = "/_validate/query" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -4242,5 +4673,11 @@ async def validate_query( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.validate_query", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/inference.py b/elasticsearch/_async/client/inference.py index b8593afa7..810a1a0be 100644 --- a/elasticsearch/_async/client/inference.py +++ b/elasticsearch/_async/client/inference.py @@ -48,10 +48,16 @@ async def delete_model( """ if inference_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'inference_id'") + __path_parts: t.Dict[str, str] if task_type not in SKIP_IN_PATH and inference_id not in SKIP_IN_PATH: - __path = f"/_inference/{_quote(task_type)}/{_quote(inference_id)}" + __path_parts = { + "task_type": _quote(task_type), + "inference_id": _quote(inference_id), + } + __path = f'/_inference/{__path_parts["task_type"]}/{__path_parts["inference_id"]}' elif inference_id not in SKIP_IN_PATH: - __path = f"/_inference/{_quote(inference_id)}" + __path_parts = {"inference_id": _quote(inference_id)} + __path = f'/_inference/{__path_parts["inference_id"]}' else: raise ValueError("Couldn't find a path for the given parameters") __query: t.Dict[str, t.Any] = {} @@ -65,7 +71,12 @@ async def delete_model( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="inference.delete_model", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -91,10 +102,16 @@ async def get_model( """ if inference_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'inference_id'") + __path_parts: t.Dict[str, str] if task_type not in SKIP_IN_PATH and inference_id not in SKIP_IN_PATH: - __path = f"/_inference/{_quote(task_type)}/{_quote(inference_id)}" + __path_parts = { + "task_type": _quote(task_type), + "inference_id": _quote(inference_id), + } + __path = f'/_inference/{__path_parts["task_type"]}/{__path_parts["inference_id"]}' elif inference_id not in SKIP_IN_PATH: - __path = f"/_inference/{_quote(inference_id)}" + __path_parts = {"inference_id": _quote(inference_id)} + __path = f'/_inference/{__path_parts["inference_id"]}' else: raise ValueError("Couldn't find a path for the given parameters") __query: t.Dict[str, t.Any] = {} @@ -108,7 +125,12 @@ async def get_model( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="inference.get_model", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -143,10 +165,16 @@ async def inference( raise ValueError("Empty value passed for parameter 'inference_id'") if input is None and body is None: raise ValueError("Empty value passed for parameter 'input'") + __path_parts: t.Dict[str, str] if task_type not in SKIP_IN_PATH and inference_id not in SKIP_IN_PATH: - __path = f"/_inference/{_quote(task_type)}/{_quote(inference_id)}" + __path_parts = { + "task_type": _quote(task_type), + "inference_id": _quote(inference_id), + } + __path = f'/_inference/{__path_parts["task_type"]}/{__path_parts["inference_id"]}' elif inference_id not in SKIP_IN_PATH: - __path = f"/_inference/{_quote(inference_id)}" + __path_parts = {"inference_id": _quote(inference_id)} + __path = f'/_inference/{__path_parts["inference_id"]}' else: raise ValueError("Couldn't find a path for the given parameters") __query: t.Dict[str, t.Any] = {} @@ -170,7 +198,13 @@ async def inference( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="inference.inference", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -207,10 +241,16 @@ async def put_model( ) elif model_config is not None and body is not None: raise ValueError("Cannot set both 'model_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 = f"/_inference/{_quote(task_type)}/{_quote(inference_id)}" + __path_parts = { + "task_type": _quote(task_type), + "inference_id": _quote(inference_id), + } + __path = f'/_inference/{__path_parts["task_type"]}/{__path_parts["inference_id"]}' elif inference_id not in SKIP_IN_PATH: - __path = f"/_inference/{_quote(inference_id)}" + __path_parts = {"inference_id": _quote(inference_id)} + __path = f'/_inference/{__path_parts["inference_id"]}' else: raise ValueError("Couldn't find a path for the given parameters") __query: t.Dict[str, t.Any] = {} @@ -229,5 +269,11 @@ async def put_model( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="inference.put_model", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/ingest.py b/elasticsearch/_async/client/ingest.py index 4f755f291..39a6caa76 100644 --- a/elasticsearch/_async/client/ingest.py +++ b/elasticsearch/_async/client/ingest.py @@ -54,7 +54,8 @@ async def delete_pipeline( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_ingest/pipeline/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_ingest/pipeline/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -70,7 +71,12 @@ async def delete_pipeline( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="ingest.delete_pipeline", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -87,6 +93,7 @@ async def geo_ip_stats( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_ingest/geoip/stats" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -99,7 +106,12 @@ async def geo_ip_stats( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ingest.geo_ip_stats", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -128,9 +140,12 @@ async def get_pipeline( returns an error. :param summary: Return pipelines without their definitions (default: false) """ + __path_parts: t.Dict[str, str] if id not in SKIP_IN_PATH: - __path = f"/_ingest/pipeline/{_quote(id)}" + __path_parts = {"id": _quote(id)} + __path = f'/_ingest/pipeline/{__path_parts["id"]}' else: + __path_parts = {} __path = "/_ingest/pipeline" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -147,7 +162,12 @@ async def get_pipeline( __query["summary"] = summary __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ingest.get_pipeline", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -164,6 +184,7 @@ async def processor_grok( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_ingest/processor/grok" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -176,7 +197,12 @@ async def processor_grok( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ingest.processor_grok", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -233,7 +259,8 @@ async def put_pipeline( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_ingest/pipeline/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_ingest/pipeline/{__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: @@ -263,7 +290,13 @@ async def put_pipeline( __body["version"] = version __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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ingest.put_pipeline", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -296,9 +329,12 @@ async def simulate( :param verbose: If `true`, the response includes output data for each processor in the executed pipeline. """ + __path_parts: t.Dict[str, str] if id not in SKIP_IN_PATH: - __path = f"/_ingest/pipeline/{_quote(id)}/_simulate" + __path_parts = {"id": _quote(id)} + __path = f'/_ingest/pipeline/{__path_parts["id"]}/_simulate' else: + __path_parts = {} __path = "/_ingest/pipeline/_simulate" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -319,5 +355,11 @@ async def simulate( __body["pipeline"] = pipeline __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ingest.simulate", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/license.py b/elasticsearch/_async/client/license.py index d9b271c86..8f13f9db8 100644 --- a/elasticsearch/_async/client/license.py +++ b/elasticsearch/_async/client/license.py @@ -39,6 +39,7 @@ async def delete( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_license" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -51,7 +52,12 @@ async def delete( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="license.delete", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -77,6 +83,7 @@ async def get( :param local: Specifies whether to retrieve local information. The default value is `false`, which means the information is retrieved from the master node. """ + __path_parts: t.Dict[str, str] = {} __path = "/_license" __query: t.Dict[str, t.Any] = {} if accept_enterprise is not None: @@ -93,7 +100,12 @@ async def get( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="license.get", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -110,6 +122,7 @@ async def get_basic_status( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_license/basic_status" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -122,7 +135,12 @@ async def get_basic_status( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="license.get_basic_status", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -139,6 +157,7 @@ async def get_trial_status( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_license/trial_status" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -151,7 +170,12 @@ async def get_trial_status( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="license.get_trial_status", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -179,6 +203,7 @@ async def post( :param licenses: A sequence of one or more JSON documents containing the license information. """ + __path_parts: t.Dict[str, str] = {} __path = "/_license" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -203,7 +228,13 @@ async def post( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="license.post", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -224,6 +255,7 @@ async def post_start_basic( :param acknowledge: whether the user has acknowledged acknowledge messages (default: false) """ + __path_parts: t.Dict[str, str] = {} __path = "/_license/start_basic" __query: t.Dict[str, t.Any] = {} if acknowledge is not None: @@ -238,7 +270,12 @@ async def post_start_basic( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="license.post_start_basic", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -261,6 +298,7 @@ async def post_start_trial( false) :param type_query_string: """ + __path_parts: t.Dict[str, str] = {} __path = "/_license/start_trial" __query: t.Dict[str, t.Any] = {} if acknowledge is not None: @@ -277,5 +315,10 @@ async def post_start_trial( __query["type_query_string"] = type_query_string __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="license.post_start_trial", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/logstash.py b/elasticsearch/_async/client/logstash.py index fad83e720..9abdd0c9a 100644 --- a/elasticsearch/_async/client/logstash.py +++ b/elasticsearch/_async/client/logstash.py @@ -44,7 +44,8 @@ async def delete_pipeline( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_logstash/pipeline/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_logstash/pipeline/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -56,7 +57,12 @@ async def delete_pipeline( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="logstash.delete_pipeline", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -76,9 +82,12 @@ async def get_pipeline( :param id: Comma-separated list of pipeline identifiers. """ + __path_parts: t.Dict[str, str] if id not in SKIP_IN_PATH: - __path = f"/_logstash/pipeline/{_quote(id)}" + __path_parts = {"id": _quote(id)} + __path = f'/_logstash/pipeline/{__path_parts["id"]}' else: + __path_parts = {} __path = "/_logstash/pipeline" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -91,7 +100,12 @@ async def get_pipeline( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="logstash.get_pipeline", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -124,7 +138,8 @@ async def put_pipeline( ) elif pipeline is not None and body is not None: raise ValueError("Cannot set both 'pipeline' and 'body'") - __path = f"/_logstash/pipeline/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_logstash/pipeline/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -137,5 +152,11 @@ async def put_pipeline( __body = pipeline if pipeline 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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="logstash.put_pipeline", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/migration.py b/elasticsearch/_async/client/migration.py index 76d77ddf5..59b8abb20 100644 --- a/elasticsearch/_async/client/migration.py +++ b/elasticsearch/_async/client/migration.py @@ -45,9 +45,12 @@ async def deprecations( :param index: Comma-separate list of data streams or indices to check. Wildcard (*) expressions are supported. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_migration/deprecations" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_migration/deprecations' else: + __path_parts = {} __path = "/_migration/deprecations" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -60,7 +63,12 @@ async def deprecations( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="migration.deprecations", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -77,6 +85,7 @@ async def get_feature_upgrade_status( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_migration/system_features" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -89,7 +98,12 @@ async def get_feature_upgrade_status( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="migration.get_feature_upgrade_status", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -106,6 +120,7 @@ async def post_feature_upgrade( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_migration/system_features" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -118,5 +133,10 @@ async def post_feature_upgrade( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="migration.post_feature_upgrade", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/ml.py b/elasticsearch/_async/client/ml.py index 03c274566..105a419b1 100644 --- a/elasticsearch/_async/client/ml.py +++ b/elasticsearch/_async/client/ml.py @@ -44,7 +44,10 @@ async def clear_trained_model_deployment_cache( """ if model_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'model_id'") - __path = f"/_ml/trained_models/{_quote(model_id)}/deployment/cache/_clear" + __path_parts: t.Dict[str, str] = {"model_id": _quote(model_id)} + __path = ( + f'/_ml/trained_models/{__path_parts["model_id"]}/deployment/cache/_clear' + ) __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -56,7 +59,12 @@ async def clear_trained_model_deployment_cache( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.clear_trained_model_deployment_cache", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -93,7 +101,8 @@ async def close_job( """ if job_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'job_id'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/_close" + __path_parts: t.Dict[str, str] = {"job_id": _quote(job_id)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/_close' __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: @@ -117,7 +126,13 @@ async def close_job( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.close_job", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -139,7 +154,8 @@ async def delete_calendar( """ if calendar_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'calendar_id'") - __path = f"/_ml/calendars/{_quote(calendar_id)}" + __path_parts: t.Dict[str, str] = {"calendar_id": _quote(calendar_id)} + __path = f'/_ml/calendars/{__path_parts["calendar_id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -151,7 +167,12 @@ async def delete_calendar( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.delete_calendar", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -178,7 +199,11 @@ async def delete_calendar_event( raise ValueError("Empty value passed for parameter 'calendar_id'") if event_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'event_id'") - __path = f"/_ml/calendars/{_quote(calendar_id)}/events/{_quote(event_id)}" + __path_parts: t.Dict[str, str] = { + "calendar_id": _quote(calendar_id), + "event_id": _quote(event_id), + } + __path = f'/_ml/calendars/{__path_parts["calendar_id"]}/events/{__path_parts["event_id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -190,7 +215,12 @@ async def delete_calendar_event( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.delete_calendar_event", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -217,7 +247,11 @@ async def delete_calendar_job( raise ValueError("Empty value passed for parameter 'calendar_id'") if job_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'job_id'") - __path = f"/_ml/calendars/{_quote(calendar_id)}/jobs/{_quote(job_id)}" + __path_parts: t.Dict[str, str] = { + "calendar_id": _quote(calendar_id), + "job_id": _quote(job_id), + } + __path = f'/_ml/calendars/{__path_parts["calendar_id"]}/jobs/{__path_parts["job_id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -229,7 +263,12 @@ async def delete_calendar_job( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.delete_calendar_job", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -256,7 +295,8 @@ async def delete_data_frame_analytics( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_ml/data_frame/analytics/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_ml/data_frame/analytics/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -272,7 +312,12 @@ async def delete_data_frame_analytics( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.delete_data_frame_analytics", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -300,7 +345,8 @@ async def delete_datafeed( """ if datafeed_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'datafeed_id'") - __path = f"/_ml/datafeeds/{_quote(datafeed_id)}" + __path_parts: t.Dict[str, str] = {"datafeed_id": _quote(datafeed_id)} + __path = f'/_ml/datafeeds/{__path_parts["datafeed_id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -314,7 +360,12 @@ async def delete_datafeed( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.delete_datafeed", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -344,9 +395,12 @@ async def delete_expired_data( :param timeout: How long can the underlying delete processes run until they are canceled. """ + __path_parts: t.Dict[str, str] if job_id not in SKIP_IN_PATH: - __path = f"/_ml/_delete_expired_data/{_quote(job_id)}" + __path_parts = {"job_id": _quote(job_id)} + __path = f'/_ml/_delete_expired_data/{__path_parts["job_id"]}' else: + __path_parts = {} __path = "/_ml/_delete_expired_data" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -369,7 +423,13 @@ async def delete_expired_data( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers, body=__body + "DELETE", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.delete_expired_data", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -391,7 +451,8 @@ async def delete_filter( """ if filter_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'filter_id'") - __path = f"/_ml/filters/{_quote(filter_id)}" + __path_parts: t.Dict[str, str] = {"filter_id": _quote(filter_id)} + __path = f'/_ml/filters/{__path_parts["filter_id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -403,7 +464,12 @@ async def delete_filter( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.delete_filter", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -438,10 +504,16 @@ async def delete_forecast( """ if job_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'job_id'") + __path_parts: t.Dict[str, str] if job_id not in SKIP_IN_PATH and forecast_id not in SKIP_IN_PATH: - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/_forecast/{_quote(forecast_id)}" + __path_parts = { + "job_id": _quote(job_id), + "forecast_id": _quote(forecast_id), + } + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/_forecast/{__path_parts["forecast_id"]}' elif job_id not in SKIP_IN_PATH: - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/_forecast" + __path_parts = {"job_id": _quote(job_id)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/_forecast' else: raise ValueError("Couldn't find a path for the given parameters") __query: t.Dict[str, t.Any] = {} @@ -459,7 +531,12 @@ async def delete_forecast( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.delete_forecast", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -491,7 +568,8 @@ async def delete_job( """ if job_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'job_id'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}" + __path_parts: t.Dict[str, str] = {"job_id": _quote(job_id)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}' __query: t.Dict[str, t.Any] = {} if delete_user_annotations is not None: __query["delete_user_annotations"] = delete_user_annotations @@ -509,7 +587,12 @@ async def delete_job( __query["wait_for_completion"] = wait_for_completion __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.delete_job", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -535,7 +618,11 @@ async def delete_model_snapshot( raise ValueError("Empty value passed for parameter 'job_id'") if snapshot_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'snapshot_id'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/model_snapshots/{_quote(snapshot_id)}" + __path_parts: t.Dict[str, str] = { + "job_id": _quote(job_id), + "snapshot_id": _quote(snapshot_id), + } + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/model_snapshots/{__path_parts["snapshot_id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -547,7 +634,12 @@ async def delete_model_snapshot( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.delete_model_snapshot", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -573,7 +665,8 @@ async def delete_trained_model( """ if model_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'model_id'") - __path = f"/_ml/trained_models/{_quote(model_id)}" + __path_parts: t.Dict[str, str] = {"model_id": _quote(model_id)} + __path = f'/_ml/trained_models/{__path_parts["model_id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -587,7 +680,12 @@ async def delete_trained_model( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.delete_trained_model", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -613,7 +711,11 @@ async def delete_trained_model_alias( raise ValueError("Empty value passed for parameter 'model_id'") if model_alias in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'model_alias'") - __path = f"/_ml/trained_models/{_quote(model_id)}/model_aliases/{_quote(model_alias)}" + __path_parts: t.Dict[str, str] = { + "model_id": _quote(model_id), + "model_alias": _quote(model_alias), + } + __path = f'/_ml/trained_models/{__path_parts["model_id"]}/model_aliases/{__path_parts["model_alias"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -625,7 +727,12 @@ async def delete_trained_model_alias( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.delete_trained_model_alias", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -667,6 +774,7 @@ async def estimate_model_memory( from the request if no detectors have a `by_field_name`, `over_field_name` or `partition_field_name`. """ + __path_parts: t.Dict[str, str] = {} __path = "/_ml/anomaly_detectors/_estimate_model_memory" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -687,7 +795,13 @@ async def estimate_model_memory( __body["overall_cardinality"] = overall_cardinality __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.estimate_model_memory", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -719,6 +833,7 @@ async def evaluate_data_frame( raise ValueError("Empty value passed for parameter 'evaluation'") if index is None and body is None: raise ValueError("Empty value passed for parameter 'index'") + __path_parts: t.Dict[str, str] = {} __path = "/_ml/data_frame/_evaluate" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -739,7 +854,13 @@ async def evaluate_data_frame( __body["query"] = query __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.evaluate_data_frame", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -805,9 +926,12 @@ async def explain_data_frame_analytics( :param source: The configuration of how to source the analysis data. It requires an index. Optionally, query and _source may be specified. """ + __path_parts: t.Dict[str, str] if id not in SKIP_IN_PATH: - __path = f"/_ml/data_frame/analytics/{_quote(id)}/_explain" + __path_parts = {"id": _quote(id)} + __path = f'/_ml/data_frame/analytics/{__path_parts["id"]}/_explain' else: + __path_parts = {} __path = "/_ml/data_frame/analytics/_explain" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -842,7 +966,13 @@ async def explain_data_frame_analytics( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.explain_data_frame_analytics", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -877,7 +1007,8 @@ async def flush_job( """ if job_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'job_id'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/_flush" + __path_parts: t.Dict[str, str] = {"job_id": _quote(job_id)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/_flush' __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: @@ -905,7 +1036,13 @@ async def flush_job( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.flush_job", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -938,7 +1075,8 @@ async def forecast( """ if job_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'job_id'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/_forecast" + __path_parts: t.Dict[str, str] = {"job_id": _quote(job_id)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/_forecast' __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: @@ -962,7 +1100,13 @@ async def forecast( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.forecast", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1022,10 +1166,13 @@ async def get_buckets( """ if job_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'job_id'") + __path_parts: t.Dict[str, str] if job_id not in SKIP_IN_PATH and timestamp not in SKIP_IN_PATH: - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/results/buckets/{_quote(timestamp)}" + __path_parts = {"job_id": _quote(job_id), "timestamp": _quote(timestamp)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/results/buckets/{__path_parts["timestamp"]}' elif job_id not in SKIP_IN_PATH: - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/results/buckets" + __path_parts = {"job_id": _quote(job_id)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/results/buckets' else: raise ValueError("Couldn't find a path for the given parameters") __query: t.Dict[str, t.Any] = {} @@ -1065,7 +1212,13 @@ async def get_buckets( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.get_buckets", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1103,7 +1256,8 @@ async def get_calendar_events( """ if calendar_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'calendar_id'") - __path = f"/_ml/calendars/{_quote(calendar_id)}/events" + __path_parts: t.Dict[str, str] = {"calendar_id": _quote(calendar_id)} + __path = f'/_ml/calendars/{__path_parts["calendar_id"]}/events' __query: t.Dict[str, t.Any] = {} if end is not None: __query["end"] = end @@ -1125,7 +1279,12 @@ async def get_calendar_events( __query["start"] = start __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.get_calendar_events", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1160,9 +1319,12 @@ async def get_calendars( :param size: Specifies the maximum number of calendars to obtain. This parameter is supported only when you omit the calendar identifier. """ + __path_parts: t.Dict[str, str] if calendar_id not in SKIP_IN_PATH: - __path = f"/_ml/calendars/{_quote(calendar_id)}" + __path_parts = {"calendar_id": _quote(calendar_id)} + __path = f'/_ml/calendars/{__path_parts["calendar_id"]}' else: + __path_parts = {} __path = "/_ml/calendars" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -1187,7 +1349,13 @@ async def get_calendars( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.get_calendars", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1227,10 +1395,18 @@ async def get_categories( """ if job_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'job_id'") + __path_parts: t.Dict[str, str] if job_id not in SKIP_IN_PATH and category_id not in SKIP_IN_PATH: - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/results/categories/{_quote(category_id)}" + __path_parts = { + "job_id": _quote(job_id), + "category_id": _quote(category_id), + } + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/results/categories/{__path_parts["category_id"]}' elif job_id not in SKIP_IN_PATH: - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/results/categories" + __path_parts = {"job_id": _quote(job_id)} + __path = ( + f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/results/categories' + ) else: raise ValueError("Couldn't find a path for the given parameters") __query: t.Dict[str, t.Any] = {} @@ -1258,7 +1434,13 @@ async def get_categories( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.get_categories", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1299,9 +1481,12 @@ async def get_data_frame_analytics( :param from_: Skips the specified number of data frame analytics jobs. :param size: Specifies the maximum number of data frame analytics jobs to obtain. """ + __path_parts: t.Dict[str, str] if id not in SKIP_IN_PATH: - __path = f"/_ml/data_frame/analytics/{_quote(id)}" + __path_parts = {"id": _quote(id)} + __path = f'/_ml/data_frame/analytics/{__path_parts["id"]}' else: + __path_parts = {} __path = "/_ml/data_frame/analytics" __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: @@ -1322,7 +1507,12 @@ async def get_data_frame_analytics( __query["size"] = size __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.get_data_frame_analytics", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1361,9 +1551,12 @@ async def get_data_frame_analytics_stats( :param size: Specifies the maximum number of data frame analytics jobs to obtain. :param verbose: Defines whether the stats response should be verbose. """ + __path_parts: t.Dict[str, str] if id not in SKIP_IN_PATH: - __path = f"/_ml/data_frame/analytics/{_quote(id)}/_stats" + __path_parts = {"id": _quote(id)} + __path = f'/_ml/data_frame/analytics/{__path_parts["id"]}/_stats' else: + __path_parts = {} __path = "/_ml/data_frame/analytics/_stats" __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: @@ -1384,7 +1577,12 @@ async def get_data_frame_analytics_stats( __query["verbose"] = verbose __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.get_data_frame_analytics_stats", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1414,9 +1612,12 @@ async def get_datafeed_stats( when there are partial matches. If this parameter is `false`, the request returns a `404` status code when there are no matches or only partial matches. """ + __path_parts: t.Dict[str, str] if datafeed_id not in SKIP_IN_PATH: - __path = f"/_ml/datafeeds/{_quote(datafeed_id)}/_stats" + __path_parts = {"datafeed_id": _quote(datafeed_id)} + __path = f'/_ml/datafeeds/{__path_parts["datafeed_id"]}/_stats' else: + __path_parts = {} __path = "/_ml/datafeeds/_stats" __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: @@ -1431,7 +1632,12 @@ async def get_datafeed_stats( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.get_datafeed_stats", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1465,9 +1671,12 @@ async def get_datafeeds( the configuration on retrieval. This allows the configuration to be in an acceptable format to be retrieved and then added to another cluster. """ + __path_parts: t.Dict[str, str] if datafeed_id not in SKIP_IN_PATH: - __path = f"/_ml/datafeeds/{_quote(datafeed_id)}" + __path_parts = {"datafeed_id": _quote(datafeed_id)} + __path = f'/_ml/datafeeds/{__path_parts["datafeed_id"]}' else: + __path_parts = {} __path = "/_ml/datafeeds" __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: @@ -1484,7 +1693,12 @@ async def get_datafeeds( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.get_datafeeds", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1510,9 +1724,12 @@ async def get_filters( :param from_: Skips the specified number of filters. :param size: Specifies the maximum number of filters to obtain. """ + __path_parts: t.Dict[str, str] if filter_id not in SKIP_IN_PATH: - __path = f"/_ml/filters/{_quote(filter_id)}" + __path_parts = {"filter_id": _quote(filter_id)} + __path = f'/_ml/filters/{__path_parts["filter_id"]}' else: + __path_parts = {} __path = "/_ml/filters" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1529,7 +1746,12 @@ async def get_filters( __query["size"] = size __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.get_filters", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1579,7 +1801,8 @@ async def get_influencers( """ if job_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'job_id'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/results/influencers" + __path_parts: t.Dict[str, str] = {"job_id": _quote(job_id)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/results/influencers' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} if desc is not None: @@ -1615,7 +1838,13 @@ async def get_influencers( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.get_influencers", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1646,9 +1875,12 @@ async def get_job_stats( partial matches. If `false`, the API returns a `404` status code when there are no matches or only partial matches. """ + __path_parts: t.Dict[str, str] if job_id not in SKIP_IN_PATH: - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/_stats" + __path_parts = {"job_id": _quote(job_id)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/_stats' else: + __path_parts = {} __path = "/_ml/anomaly_detectors/_stats" __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: @@ -1663,7 +1895,12 @@ async def get_job_stats( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.get_job_stats", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1697,9 +1934,12 @@ async def get_jobs( the configuration on retrieval. This allows the configuration to be in an acceptable format to be retrieved and then added to another cluster. """ + __path_parts: t.Dict[str, str] if job_id not in SKIP_IN_PATH: - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}" + __path_parts = {"job_id": _quote(job_id)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}' else: + __path_parts = {} __path = "/_ml/anomaly_detectors" __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: @@ -1716,7 +1956,12 @@ async def get_jobs( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.get_jobs", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1746,9 +1991,12 @@ async def get_memory_stats( :param timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] if node_id not in SKIP_IN_PATH: - __path = f"/_ml/memory/{_quote(node_id)}/_stats" + __path_parts = {"node_id": _quote(node_id)} + __path = f'/_ml/memory/{__path_parts["node_id"]}/_stats' else: + __path_parts = {} __path = "/_ml/memory/_stats" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1765,7 +2013,12 @@ async def get_memory_stats( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.get_memory_stats", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1803,7 +2056,11 @@ async def get_model_snapshot_upgrade_stats( raise ValueError("Empty value passed for parameter 'job_id'") if snapshot_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'snapshot_id'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/model_snapshots/{_quote(snapshot_id)}/_upgrade/_stats" + __path_parts: t.Dict[str, str] = { + "job_id": _quote(job_id), + "snapshot_id": _quote(snapshot_id), + } + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/model_snapshots/{__path_parts["snapshot_id"]}/_upgrade/_stats' __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: __query["allow_no_match"] = allow_no_match @@ -1817,7 +2074,12 @@ async def get_model_snapshot_upgrade_stats( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.get_model_snapshot_upgrade_stats", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1863,10 +2125,16 @@ async def get_model_snapshots( """ if job_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'job_id'") + __path_parts: t.Dict[str, str] if job_id not in SKIP_IN_PATH and snapshot_id not in SKIP_IN_PATH: - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/model_snapshots/{_quote(snapshot_id)}" + __path_parts = { + "job_id": _quote(job_id), + "snapshot_id": _quote(snapshot_id), + } + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/model_snapshots/{__path_parts["snapshot_id"]}' elif job_id not in SKIP_IN_PATH: - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/model_snapshots" + __path_parts = {"job_id": _quote(job_id)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/model_snapshots' else: raise ValueError("Couldn't find a path for the given parameters") __query: t.Dict[str, t.Any] = {} @@ -1900,7 +2168,13 @@ async def get_model_snapshots( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.get_model_snapshots", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1954,7 +2228,10 @@ async def get_overall_buckets( """ if job_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'job_id'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/results/overall_buckets" + __path_parts: t.Dict[str, str] = {"job_id": _quote(job_id)} + __path = ( + f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/results/overall_buckets' + ) __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: @@ -1986,7 +2263,13 @@ async def get_overall_buckets( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.get_overall_buckets", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2039,7 +2322,8 @@ async def get_records( """ if job_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'job_id'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/results/records" + __path_parts: t.Dict[str, str] = {"job_id": _quote(job_id)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/results/records' __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: @@ -2075,7 +2359,13 @@ async def get_records( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.get_records", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2127,9 +2417,12 @@ async def get_trained_models( tags, or none. When supplied, only trained models that contain all the supplied tags are returned. """ + __path_parts: t.Dict[str, str] if model_id not in SKIP_IN_PATH: - __path = f"/_ml/trained_models/{_quote(model_id)}" + __path_parts = {"model_id": _quote(model_id)} + __path = f'/_ml/trained_models/{__path_parts["model_id"]}' else: + __path_parts = {} __path = "/_ml/trained_models" __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: @@ -2156,7 +2449,12 @@ async def get_trained_models( __query["tags"] = tags __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.get_trained_models", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2189,9 +2487,12 @@ async def get_trained_models_stats( :param from_: Skips the specified number of models. :param size: Specifies the maximum number of models to obtain. """ + __path_parts: t.Dict[str, str] if model_id not in SKIP_IN_PATH: - __path = f"/_ml/trained_models/{_quote(model_id)}/_stats" + __path_parts = {"model_id": _quote(model_id)} + __path = f'/_ml/trained_models/{__path_parts["model_id"]}/_stats' else: + __path_parts = {} __path = "/_ml/trained_models/_stats" __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: @@ -2210,7 +2511,12 @@ async def get_trained_models_stats( __query["size"] = size __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.get_trained_models_stats", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2247,7 +2553,8 @@ async def infer_trained_model( raise ValueError("Empty value passed for parameter 'model_id'") if docs is None and body is None: raise ValueError("Empty value passed for parameter 'docs'") - __path = f"/_ml/trained_models/{_quote(model_id)}/_infer" + __path_parts: t.Dict[str, str] = {"model_id": _quote(model_id)} + __path = f'/_ml/trained_models/{__path_parts["model_id"]}/_infer' __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: @@ -2267,7 +2574,13 @@ async def infer_trained_model( __body["inference_config"] = inference_config __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.infer_trained_model", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -2284,6 +2597,7 @@ async def info( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_ml/info" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -2296,7 +2610,12 @@ async def info( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.info", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2323,7 +2642,8 @@ async def open_job( """ if job_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'job_id'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/_open" + __path_parts: t.Dict[str, str] = {"job_id": _quote(job_id)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/_open' __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: @@ -2343,7 +2663,13 @@ async def open_job( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.open_job", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2374,7 +2700,8 @@ async def post_calendar_events( raise ValueError("Empty value passed for parameter 'calendar_id'") if events is None and body is None: raise ValueError("Empty value passed for parameter 'events'") - __path = f"/_ml/calendars/{_quote(calendar_id)}/events" + __path_parts: t.Dict[str, str] = {"calendar_id": _quote(calendar_id)} + __path = f'/_ml/calendars/{__path_parts["calendar_id"]}/events' __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: @@ -2390,7 +2717,13 @@ async def post_calendar_events( __body["events"] = events __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.post_calendar_events", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2428,7 +2761,8 @@ async def post_data( ) elif data is not None and body is not None: raise ValueError("Cannot set both 'data' and 'body'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/_data" + __path_parts: t.Dict[str, str] = {"job_id": _quote(job_id)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/_data' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -2448,7 +2782,13 @@ async def post_data( "content-type": "application/x-ndjson", } return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.post_data", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2475,9 +2815,12 @@ async def preview_data_frame_analytics( analytics jobs. Note that `id` and `dest` don’t need to be provided in the context of this API. """ + __path_parts: t.Dict[str, str] if id not in SKIP_IN_PATH: - __path = f"/_ml/data_frame/analytics/{_quote(id)}/_preview" + __path_parts = {"id": _quote(id)} + __path = f'/_ml/data_frame/analytics/{__path_parts["id"]}/_preview' else: + __path_parts = {} __path = "/_ml/data_frame/analytics/_preview" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -2498,7 +2841,13 @@ async def preview_data_frame_analytics( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.preview_data_frame_analytics", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2538,9 +2887,12 @@ async def preview_datafeed( object unless you also supply a `datafeed_config` object. :param start: The start time from where the datafeed preview should begin """ + __path_parts: t.Dict[str, str] if datafeed_id not in SKIP_IN_PATH: - __path = f"/_ml/datafeeds/{_quote(datafeed_id)}/_preview" + __path_parts = {"datafeed_id": _quote(datafeed_id)} + __path = f'/_ml/datafeeds/{__path_parts["datafeed_id"]}/_preview' else: + __path_parts = {} __path = "/_ml/datafeeds/_preview" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -2567,7 +2919,13 @@ async def preview_datafeed( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.preview_datafeed", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2596,7 +2954,8 @@ async def put_calendar( """ if calendar_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'calendar_id'") - __path = f"/_ml/calendars/{_quote(calendar_id)}" + __path_parts: t.Dict[str, str] = {"calendar_id": _quote(calendar_id)} + __path = f'/_ml/calendars/{__path_parts["calendar_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: @@ -2618,7 +2977,13 @@ async def put_calendar( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.put_calendar", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -2645,7 +3010,11 @@ async def put_calendar_job( raise ValueError("Empty value passed for parameter 'calendar_id'") if job_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'job_id'") - __path = f"/_ml/calendars/{_quote(calendar_id)}/jobs/{_quote(job_id)}" + __path_parts: t.Dict[str, str] = { + "calendar_id": _quote(calendar_id), + "job_id": _quote(job_id), + } + __path = f'/_ml/calendars/{__path_parts["calendar_id"]}/jobs/{__path_parts["job_id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -2657,7 +3026,12 @@ async def put_calendar_job( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers + "PUT", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.put_calendar_job", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2763,7 +3137,8 @@ async def put_data_frame_analytics( raise ValueError("Empty value passed for parameter 'dest'") if source is None and body is None: raise ValueError("Empty value passed for parameter 'source'") - __path = f"/_ml/data_frame/analytics/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_ml/data_frame/analytics/{__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: @@ -2797,7 +3172,13 @@ async def put_data_frame_analytics( __body["version"] = version __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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.put_data_frame_analytics", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2932,7 +3313,8 @@ async def put_datafeed( """ if datafeed_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'datafeed_id'") - __path = f"/_ml/datafeeds/{_quote(datafeed_id)}" + __path_parts: t.Dict[str, str] = {"datafeed_id": _quote(datafeed_id)} + __path = f'/_ml/datafeeds/{__path_parts["datafeed_id"]}' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} if allow_no_indices is not None: @@ -2984,7 +3366,13 @@ async def put_datafeed( __body["scroll_size"] = scroll_size __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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.put_datafeed", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3014,7 +3402,8 @@ async def put_filter( """ if filter_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'filter_id'") - __path = f"/_ml/filters/{_quote(filter_id)}" + __path_parts: t.Dict[str, str] = {"filter_id": _quote(filter_id)} + __path = f'/_ml/filters/{__path_parts["filter_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: @@ -3032,7 +3421,13 @@ async def put_filter( __body["items"] = items __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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.put_filter", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3165,7 +3560,8 @@ async def put_job( raise ValueError("Empty value passed for parameter 'analysis_config'") if data_description is None and body is None: raise ValueError("Empty value passed for parameter 'data_description'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}" + __path_parts: t.Dict[str, str] = {"job_id": _quote(job_id)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_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: @@ -3211,7 +3607,13 @@ async def put_job( __body["results_retention_days"] = results_retention_days __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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.put_job", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3288,7 +3690,8 @@ async def put_trained_model( """ if model_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'model_id'") - __path = f"/_ml/trained_models/{_quote(model_id)}" + __path_parts: t.Dict[str, str] = {"model_id": _quote(model_id)} + __path = f'/_ml/trained_models/{__path_parts["model_id"]}' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} if defer_definition_decompression is not None: @@ -3324,7 +3727,13 @@ async def put_trained_model( __body["tags"] = tags __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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.put_trained_model", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -3355,7 +3764,11 @@ async def put_trained_model_alias( raise ValueError("Empty value passed for parameter 'model_id'") if model_alias in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'model_alias'") - __path = f"/_ml/trained_models/{_quote(model_id)}/model_aliases/{_quote(model_alias)}" + __path_parts: t.Dict[str, str] = { + "model_id": _quote(model_id), + "model_alias": _quote(model_alias), + } + __path = f'/_ml/trained_models/{__path_parts["model_id"]}/model_aliases/{__path_parts["model_alias"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -3369,7 +3782,12 @@ async def put_trained_model_alias( __query["reassign"] = reassign __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers + "PUT", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.put_trained_model_alias", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3417,7 +3835,11 @@ async def put_trained_model_definition_part( ) if total_parts is None and body is None: raise ValueError("Empty value passed for parameter 'total_parts'") - __path = f"/_ml/trained_models/{_quote(model_id)}/definition/{_quote(part)}" + __path_parts: t.Dict[str, str] = { + "model_id": _quote(model_id), + "part": _quote(part), + } + __path = f'/_ml/trained_models/{__path_parts["model_id"]}/definition/{__path_parts["part"]}' __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: @@ -3437,7 +3859,13 @@ async def put_trained_model_definition_part( __body["total_parts"] = total_parts __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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.put_trained_model_definition_part", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3470,7 +3898,8 @@ async def put_trained_model_vocabulary( raise ValueError("Empty value passed for parameter 'model_id'") if vocabulary is None and body is None: raise ValueError("Empty value passed for parameter 'vocabulary'") - __path = f"/_ml/trained_models/{_quote(model_id)}/vocabulary" + __path_parts: t.Dict[str, str] = {"model_id": _quote(model_id)} + __path = f'/_ml/trained_models/{__path_parts["model_id"]}/vocabulary' __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: @@ -3490,7 +3919,13 @@ async def put_trained_model_vocabulary( __body["scores"] = scores __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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.put_trained_model_vocabulary", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -3519,7 +3954,8 @@ async def reset_job( """ if job_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'job_id'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/_reset" + __path_parts: t.Dict[str, str] = {"job_id": _quote(job_id)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/_reset' __query: t.Dict[str, t.Any] = {} if delete_user_annotations is not None: __query["delete_user_annotations"] = delete_user_annotations @@ -3535,7 +3971,12 @@ async def reset_job( __query["wait_for_completion"] = wait_for_completion __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.reset_job", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3569,7 +4010,11 @@ async def revert_model_snapshot( raise ValueError("Empty value passed for parameter 'job_id'") if snapshot_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'snapshot_id'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/model_snapshots/{_quote(snapshot_id)}/_revert" + __path_parts: t.Dict[str, str] = { + "job_id": _quote(job_id), + "snapshot_id": _quote(snapshot_id), + } + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/model_snapshots/{__path_parts["snapshot_id"]}/_revert' __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: @@ -3589,7 +4034,13 @@ async def revert_model_snapshot( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.revert_model_snapshot", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -3614,6 +4065,7 @@ async def set_upgrade_mode( starting. :param timeout: The time to wait for the request to be completed. """ + __path_parts: t.Dict[str, str] = {} __path = "/_ml/set_upgrade_mode" __query: t.Dict[str, t.Any] = {} if enabled is not None: @@ -3630,7 +4082,12 @@ async def set_upgrade_mode( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.set_upgrade_mode", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -3657,7 +4114,8 @@ async def start_data_frame_analytics( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_ml/data_frame/analytics/{_quote(id)}/_start" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_ml/data_frame/analytics/{__path_parts["id"]}/_start' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -3671,7 +4129,12 @@ async def start_data_frame_analytics( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.start_data_frame_analytics", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3705,7 +4168,8 @@ async def start_datafeed( """ if datafeed_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'datafeed_id'") - __path = f"/_ml/datafeeds/{_quote(datafeed_id)}/_start" + __path_parts: t.Dict[str, str] = {"datafeed_id": _quote(datafeed_id)} + __path = f'/_ml/datafeeds/{__path_parts["datafeed_id"]}/_start' __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: @@ -3729,7 +4193,13 @@ async def start_datafeed( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.start_datafeed", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -3785,7 +4255,8 @@ async def start_trained_model_deployment( """ if model_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'model_id'") - __path = f"/_ml/trained_models/{_quote(model_id)}/deployment/_start" + __path_parts: t.Dict[str, str] = {"model_id": _quote(model_id)} + __path = f'/_ml/trained_models/{__path_parts["model_id"]}/deployment/_start' __query: t.Dict[str, t.Any] = {} if cache_size is not None: __query["cache_size"] = cache_size @@ -3813,7 +4284,12 @@ async def start_trained_model_deployment( __query["wait_for"] = wait_for __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.start_trained_model_deployment", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -3851,7 +4327,8 @@ async def stop_data_frame_analytics( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_ml/data_frame/analytics/{_quote(id)}/_stop" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_ml/data_frame/analytics/{__path_parts["id"]}/_stop' __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: __query["allow_no_match"] = allow_no_match @@ -3869,7 +4346,12 @@ async def stop_data_frame_analytics( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.stop_data_frame_analytics", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3904,7 +4386,8 @@ async def stop_datafeed( """ if datafeed_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'datafeed_id'") - __path = f"/_ml/datafeeds/{_quote(datafeed_id)}/_stop" + __path_parts: t.Dict[str, str] = {"datafeed_id": _quote(datafeed_id)} + __path = f'/_ml/datafeeds/{__path_parts["datafeed_id"]}/_stop' __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: @@ -3928,7 +4411,13 @@ async def stop_datafeed( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.stop_datafeed", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -3961,7 +4450,8 @@ async def stop_trained_model_deployment( """ if model_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'model_id'") - __path = f"/_ml/trained_models/{_quote(model_id)}/deployment/_stop" + __path_parts: t.Dict[str, str] = {"model_id": _quote(model_id)} + __path = f'/_ml/trained_models/{__path_parts["model_id"]}/deployment/_stop' __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: __query["allow_no_match"] = allow_no_match @@ -3977,7 +4467,12 @@ async def stop_trained_model_deployment( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.stop_trained_model_deployment", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -4025,7 +4520,8 @@ async def update_data_frame_analytics( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_ml/data_frame/analytics/{_quote(id)}/_update" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_ml/data_frame/analytics/{__path_parts["id"]}/_update' __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: @@ -4047,7 +4543,13 @@ async def update_data_frame_analytics( __body["model_memory_limit"] = model_memory_limit __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.update_data_frame_analytics", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -4190,7 +4692,8 @@ async def update_datafeed( """ if datafeed_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'datafeed_id'") - __path = f"/_ml/datafeeds/{_quote(datafeed_id)}/_update" + __path_parts: t.Dict[str, str] = {"datafeed_id": _quote(datafeed_id)} + __path = f'/_ml/datafeeds/{__path_parts["datafeed_id"]}/_update' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} if allow_no_indices is not None: @@ -4240,7 +4743,13 @@ async def update_datafeed( __body["scroll_size"] = scroll_size __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.update_datafeed", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -4271,7 +4780,8 @@ async def update_filter( """ if filter_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'filter_id'") - __path = f"/_ml/filters/{_quote(filter_id)}/_update" + __path_parts: t.Dict[str, str] = {"filter_id": _quote(filter_id)} + __path = f'/_ml/filters/{__path_parts["filter_id"]}/_update' __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: @@ -4291,7 +4801,13 @@ async def update_filter( __body["remove_items"] = remove_items __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.update_filter", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -4398,7 +4914,8 @@ async def update_job( """ if job_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'job_id'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/_update" + __path_parts: t.Dict[str, str] = {"job_id": _quote(job_id)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/_update' __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: @@ -4444,7 +4961,13 @@ async def update_job( __body["results_retention_days"] = results_retention_days __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.update_job", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -4479,7 +5002,11 @@ async def update_model_snapshot( raise ValueError("Empty value passed for parameter 'job_id'") if snapshot_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'snapshot_id'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/model_snapshots/{_quote(snapshot_id)}/_update" + __path_parts: t.Dict[str, str] = { + "job_id": _quote(job_id), + "snapshot_id": _quote(snapshot_id), + } + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/model_snapshots/{__path_parts["snapshot_id"]}/_update' __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: @@ -4497,7 +5024,13 @@ async def update_model_snapshot( __body["retain"] = retain __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.update_model_snapshot", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -4530,7 +5063,11 @@ async def upgrade_job_snapshot( raise ValueError("Empty value passed for parameter 'job_id'") if snapshot_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'snapshot_id'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/model_snapshots/{_quote(snapshot_id)}/_upgrade" + __path_parts: t.Dict[str, str] = { + "job_id": _quote(job_id), + "snapshot_id": _quote(snapshot_id), + } + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/model_snapshots/{__path_parts["snapshot_id"]}/_upgrade' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -4546,7 +5083,12 @@ async def upgrade_job_snapshot( __query["wait_for_completion"] = wait_for_completion __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.upgrade_job_snapshot", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -4595,6 +5137,7 @@ async def validate( :param model_snapshot_retention_days: :param results_index_name: """ + __path_parts: t.Dict[str, str] = {} __path = "/_ml/anomaly_detectors/_validate" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -4627,7 +5170,13 @@ async def validate( __body["results_index_name"] = results_index_name __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.validate", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -4656,6 +5205,7 @@ async def validate_detector( ) elif detector is not None and body is not None: raise ValueError("Cannot set both 'detector' and 'body'") + __path_parts: t.Dict[str, str] = {} __path = "/_ml/anomaly_detectors/_validate/detector" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -4669,5 +5219,11 @@ async def validate_detector( __body = detector if detector is not None else body __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.validate_detector", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/monitoring.py b/elasticsearch/_async/client/monitoring.py index 17093ee1b..c4712d340 100644 --- a/elasticsearch/_async/client/monitoring.py +++ b/elasticsearch/_async/client/monitoring.py @@ -63,6 +63,7 @@ async def bulk( raise ValueError("Empty value passed for parameter 'system_api_version'") if system_id is None: raise ValueError("Empty value passed for parameter 'system_id'") + __path_parts: t.Dict[str, str] = {} __path = "/_monitoring/bulk" __query: t.Dict[str, t.Any] = {} if interval is not None: @@ -85,5 +86,11 @@ async def bulk( "content-type": "application/x-ndjson", } return await self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="monitoring.bulk", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/nodes.py b/elasticsearch/_async/client/nodes.py index a0d5bb73a..04537a400 100644 --- a/elasticsearch/_async/client/nodes.py +++ b/elasticsearch/_async/client/nodes.py @@ -50,7 +50,11 @@ async def clear_repositories_metering_archive( raise ValueError("Empty value passed for parameter 'node_id'") if max_archive_version in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'max_archive_version'") - __path = f"/_nodes/{_quote(node_id)}/_repositories_metering/{_quote(max_archive_version)}" + __path_parts: t.Dict[str, str] = { + "node_id": _quote(node_id), + "max_archive_version": _quote(max_archive_version), + } + __path = f'/_nodes/{__path_parts["node_id"]}/_repositories_metering/{__path_parts["max_archive_version"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -62,7 +66,12 @@ async def clear_repositories_metering_archive( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="nodes.clear_repositories_metering_archive", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -85,7 +94,8 @@ async def get_repositories_metering_info( """ if node_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'node_id'") - __path = f"/_nodes/{_quote(node_id)}/_repositories_metering" + __path_parts: t.Dict[str, str] = {"node_id": _quote(node_id)} + __path = f'/_nodes/{__path_parts["node_id"]}/_repositories_metering' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -97,7 +107,12 @@ async def get_repositories_metering_info( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="nodes.get_repositories_metering_info", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -143,9 +158,12 @@ async def hot_threads( the timeout expires, the request fails and returns an error. :param type: The type to sample. """ + __path_parts: t.Dict[str, str] if node_id not in SKIP_IN_PATH: - __path = f"/_nodes/{_quote(node_id)}/hot_threads" + __path_parts = {"node_id": _quote(node_id)} + __path = f'/_nodes/{__path_parts["node_id"]}/hot_threads' else: + __path_parts = {} __path = "/_nodes/hot_threads" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -174,7 +192,12 @@ async def hot_threads( __query["type"] = type __headers = {"accept": "text/plain"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="nodes.hot_threads", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -209,13 +232,18 @@ async def info( :param timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] if node_id not in SKIP_IN_PATH and metric not in SKIP_IN_PATH: - __path = f"/_nodes/{_quote(node_id)}/{_quote(metric)}" + __path_parts = {"node_id": _quote(node_id), "metric": _quote(metric)} + __path = f'/_nodes/{__path_parts["node_id"]}/{__path_parts["metric"]}' elif node_id not in SKIP_IN_PATH: - __path = f"/_nodes/{_quote(node_id)}" + __path_parts = {"node_id": _quote(node_id)} + __path = f'/_nodes/{__path_parts["node_id"]}' elif metric not in SKIP_IN_PATH: - __path = f"/_nodes/{_quote(metric)}" + __path_parts = {"metric": _quote(metric)} + __path = f'/_nodes/{__path_parts["metric"]}' else: + __path_parts = {} __path = "/_nodes" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -234,7 +262,12 @@ async def info( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="nodes.info", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -262,9 +295,12 @@ async def reload_secure_settings( :param timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] if node_id not in SKIP_IN_PATH: - __path = f"/_nodes/{_quote(node_id)}/reload_secure_settings" + __path_parts = {"node_id": _quote(node_id)} + __path = f'/_nodes/{__path_parts["node_id"]}/reload_secure_settings' else: + __path_parts = {} __path = "/_nodes/reload_secure_settings" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -287,7 +323,13 @@ async def reload_secure_settings( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="nodes.reload_secure_settings", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -350,21 +392,37 @@ async def stats( :param types: A comma-separated list of document types for the indexing index metric. """ + __path_parts: t.Dict[str, str] if ( node_id not in SKIP_IN_PATH and metric not in SKIP_IN_PATH and index_metric not in SKIP_IN_PATH ): - __path = f"/_nodes/{_quote(node_id)}/stats/{_quote(metric)}/{_quote(index_metric)}" + __path_parts = { + "node_id": _quote(node_id), + "metric": _quote(metric), + "index_metric": _quote(index_metric), + } + __path = f'/_nodes/{__path_parts["node_id"]}/stats/{__path_parts["metric"]}/{__path_parts["index_metric"]}' elif node_id not in SKIP_IN_PATH and metric not in SKIP_IN_PATH: - __path = f"/_nodes/{_quote(node_id)}/stats/{_quote(metric)}" + __path_parts = {"node_id": _quote(node_id), "metric": _quote(metric)} + __path = f'/_nodes/{__path_parts["node_id"]}/stats/{__path_parts["metric"]}' elif metric not in SKIP_IN_PATH and index_metric not in SKIP_IN_PATH: - __path = f"/_nodes/stats/{_quote(metric)}/{_quote(index_metric)}" + __path_parts = { + "metric": _quote(metric), + "index_metric": _quote(index_metric), + } + __path = ( + f'/_nodes/stats/{__path_parts["metric"]}/{__path_parts["index_metric"]}' + ) elif node_id not in SKIP_IN_PATH: - __path = f"/_nodes/{_quote(node_id)}/stats" + __path_parts = {"node_id": _quote(node_id)} + __path = f'/_nodes/{__path_parts["node_id"]}/stats' elif metric not in SKIP_IN_PATH: - __path = f"/_nodes/stats/{_quote(metric)}" + __path_parts = {"metric": _quote(metric)} + __path = f'/_nodes/stats/{__path_parts["metric"]}' else: + __path_parts = {} __path = "/_nodes/stats" __query: t.Dict[str, t.Any] = {} if completion_fields is not None: @@ -397,7 +455,12 @@ async def stats( __query["types"] = types __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="nodes.stats", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -425,13 +488,18 @@ async def usage( :param timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] if node_id not in SKIP_IN_PATH and metric not in SKIP_IN_PATH: - __path = f"/_nodes/{_quote(node_id)}/usage/{_quote(metric)}" + __path_parts = {"node_id": _quote(node_id), "metric": _quote(metric)} + __path = f'/_nodes/{__path_parts["node_id"]}/usage/{__path_parts["metric"]}' elif node_id not in SKIP_IN_PATH: - __path = f"/_nodes/{_quote(node_id)}/usage" + __path_parts = {"node_id": _quote(node_id)} + __path = f'/_nodes/{__path_parts["node_id"]}/usage' elif metric not in SKIP_IN_PATH: - __path = f"/_nodes/usage/{_quote(metric)}" + __path_parts = {"metric": _quote(metric)} + __path = f'/_nodes/usage/{__path_parts["metric"]}' else: + __path_parts = {} __path = "/_nodes/usage" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -446,5 +514,10 @@ async def usage( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="nodes.usage", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/query_ruleset.py b/elasticsearch/_async/client/query_ruleset.py index 652318c86..a295e2154 100644 --- a/elasticsearch/_async/client/query_ruleset.py +++ b/elasticsearch/_async/client/query_ruleset.py @@ -44,7 +44,8 @@ async def delete( """ if ruleset_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'ruleset_id'") - __path = f"/_query_rules/{_quote(ruleset_id)}" + __path_parts: t.Dict[str, str] = {"ruleset_id": _quote(ruleset_id)} + __path = f'/_query_rules/{__path_parts["ruleset_id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -56,7 +57,12 @@ async def delete( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="query_ruleset.delete", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -78,7 +84,8 @@ async def get( """ if ruleset_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'ruleset_id'") - __path = f"/_query_rules/{_quote(ruleset_id)}" + __path_parts: t.Dict[str, str] = {"ruleset_id": _quote(ruleset_id)} + __path = f'/_query_rules/{__path_parts["ruleset_id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -90,7 +97,12 @@ async def get( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="query_ruleset.get", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -114,6 +126,7 @@ async def list( :param from_: Starting offset (default: 0) :param size: specifies a max number of results to get """ + __path_parts: t.Dict[str, str] = {} __path = "/_query_rules" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -130,7 +143,12 @@ async def list( __query["size"] = size __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="query_ruleset.list", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -160,7 +178,8 @@ async def put( raise ValueError("Empty value passed for parameter 'ruleset_id'") if rules is None and body is None: raise ValueError("Empty value passed for parameter 'rules'") - __path = f"/_query_rules/{_quote(ruleset_id)}" + __path_parts: t.Dict[str, str] = {"ruleset_id": _quote(ruleset_id)} + __path = f'/_query_rules/{__path_parts["ruleset_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: @@ -176,5 +195,11 @@ async def put( __body["rules"] = rules __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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="query_ruleset.put", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/rollup.py b/elasticsearch/_async/client/rollup.py index a6a2f2909..2d4c7ba37 100644 --- a/elasticsearch/_async/client/rollup.py +++ b/elasticsearch/_async/client/rollup.py @@ -44,7 +44,8 @@ async def delete_job( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_rollup/job/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_rollup/job/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -56,7 +57,12 @@ async def delete_job( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="rollup.delete_job", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -77,9 +83,12 @@ async def get_jobs( :param id: Identifier for the rollup job. If it is `_all` or omitted, the API returns all rollup jobs. """ + __path_parts: t.Dict[str, str] if id not in SKIP_IN_PATH: - __path = f"/_rollup/job/{_quote(id)}" + __path_parts = {"id": _quote(id)} + __path = f'/_rollup/job/{__path_parts["id"]}' else: + __path_parts = {} __path = "/_rollup/job" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -92,7 +101,12 @@ async def get_jobs( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="rollup.get_jobs", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -114,9 +128,12 @@ async def get_rollup_caps( :param id: Index, indices or index-pattern to return rollup capabilities for. `_all` may be used to fetch rollup capabilities from all jobs. """ + __path_parts: t.Dict[str, str] if id not in SKIP_IN_PATH: - __path = f"/_rollup/data/{_quote(id)}" + __path_parts = {"id": _quote(id)} + __path = f'/_rollup/data/{__path_parts["id"]}' else: + __path_parts = {} __path = "/_rollup/data" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -129,7 +146,12 @@ async def get_rollup_caps( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="rollup.get_rollup_caps", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -153,7 +175,8 @@ async def get_rollup_index_caps( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_rollup/data" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_rollup/data' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -165,7 +188,12 @@ async def get_rollup_index_caps( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="rollup.get_rollup_index_caps", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -256,7 +284,8 @@ async def put_job( raise ValueError("Empty value passed for parameter 'page_size'") if rollup_index is None and body is None: raise ValueError("Empty value passed for parameter 'rollup_index'") - __path = f"/_rollup/job/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_rollup/job/{__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: @@ -286,7 +315,13 @@ async def put_job( __body["timeout"] = timeout __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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="rollup.put_job", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -325,7 +360,8 @@ async def rollup_search( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_rollup_search" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_rollup_search' __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: @@ -351,7 +387,13 @@ async def rollup_search( __body["size"] = size __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="rollup.rollup_search", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -373,7 +415,8 @@ async def start_job( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_rollup/job/{_quote(id)}/_start" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_rollup/job/{__path_parts["id"]}/_start' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -385,7 +428,12 @@ async def start_job( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="rollup.start_job", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -415,7 +463,8 @@ async def stop_job( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_rollup/job/{_quote(id)}/_stop" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_rollup/job/{__path_parts["id"]}/_stop' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -431,5 +480,10 @@ async def stop_job( __query["wait_for_completion"] = wait_for_completion __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="rollup.stop_job", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/search_application.py b/elasticsearch/_async/client/search_application.py index 56d29acc5..98ef43726 100644 --- a/elasticsearch/_async/client/search_application.py +++ b/elasticsearch/_async/client/search_application.py @@ -44,7 +44,8 @@ async def delete( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_application/search_application/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_application/search_application/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -56,7 +57,12 @@ async def delete( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="search_application.delete", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -78,7 +84,8 @@ async def delete_behavioral_analytics( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_application/analytics/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_application/analytics/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -90,7 +97,12 @@ async def delete_behavioral_analytics( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="search_application.delete_behavioral_analytics", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -112,7 +124,8 @@ async def get( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_application/search_application/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_application/search_application/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -124,7 +137,12 @@ async def get( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="search_application.get", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -144,9 +162,12 @@ async def get_behavioral_analytics( :param name: A list of analytics collections to limit the returned information """ + __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: - __path = f"/_application/analytics/{_quote(name)}" + __path_parts = {"name": _quote(name)} + __path = f'/_application/analytics/{__path_parts["name"]}' else: + __path_parts = {} __path = "/_application/analytics" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -159,7 +180,12 @@ async def get_behavioral_analytics( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="search_application.get_behavioral_analytics", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -185,6 +211,7 @@ async def list( :param q: Query in the Lucene query string syntax. :param size: Specifies a max number of results to get. """ + __path_parts: t.Dict[str, str] = {} __path = "/_application/search_application" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -203,7 +230,12 @@ async def list( __query["size"] = size __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="search_application.list", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -239,7 +271,8 @@ async def put( ) elif search_application is not None and body is not None: raise ValueError("Cannot set both 'search_application' and 'body'") - __path = f"/_application/search_application/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_application/search_application/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if create is not None: __query["create"] = create @@ -254,7 +287,13 @@ async def put( __body = search_application if search_application 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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="search_application.put", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -276,7 +315,8 @@ async def put_behavioral_analytics( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_application/analytics/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_application/analytics/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -288,7 +328,12 @@ async def put_behavioral_analytics( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers + "PUT", + __path, + params=__query, + headers=__headers, + endpoint_id="search_application.put_behavioral_analytics", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -317,7 +362,8 @@ async def search( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_application/search_application/{_quote(name)}/_search" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_application/search_application/{__path_parts["name"]}/_search' __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: @@ -337,5 +383,11 @@ async def search( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="search_application.search", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/searchable_snapshots.py b/elasticsearch/_async/client/searchable_snapshots.py index 7ca726863..bd503717f 100644 --- a/elasticsearch/_async/client/searchable_snapshots.py +++ b/elasticsearch/_async/client/searchable_snapshots.py @@ -48,9 +48,12 @@ async def cache_stats( to, leave empty to get information from all nodes :param master_timeout: """ + __path_parts: t.Dict[str, str] if node_id not in SKIP_IN_PATH: - __path = f"/_searchable_snapshots/{_quote(node_id)}/cache/stats" + __path_parts = {"node_id": _quote(node_id)} + __path = f'/_searchable_snapshots/{__path_parts["node_id"]}/cache/stats' else: + __path_parts = {} __path = "/_searchable_snapshots/cache/stats" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -65,7 +68,12 @@ async def cache_stats( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="searchable_snapshots.cache_stats", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -102,9 +110,12 @@ async def clear_cache( :param ignore_unavailable: Whether specified concrete indices should be ignored when unavailable (missing or closed) """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_searchable_snapshots/cache/clear" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_searchable_snapshots/cache/clear' else: + __path_parts = {} __path = "/_searchable_snapshots/cache/clear" __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: @@ -123,7 +134,12 @@ async def clear_cache( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="searchable_snapshots.clear_cache", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -178,7 +194,13 @@ async def mount( raise ValueError("Empty value passed for parameter 'snapshot'") if index is None and body is None: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/_snapshot/{_quote(repository)}/{_quote(snapshot)}/_mount" + __path_parts: t.Dict[str, str] = { + "repository": _quote(repository), + "snapshot": _quote(snapshot), + } + __path = ( + f'/_snapshot/{__path_parts["repository"]}/{__path_parts["snapshot"]}/_mount' + ) __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: @@ -206,7 +228,13 @@ async def mount( __body["renamed_index"] = renamed_index __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="searchable_snapshots.mount", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -230,9 +258,12 @@ async def stats( :param index: A comma-separated list of index names :param level: Return stats aggregated at cluster, index or shard level """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_searchable_snapshots/stats" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_searchable_snapshots/stats' else: + __path_parts = {} __path = "/_searchable_snapshots/stats" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -247,5 +278,10 @@ async def stats( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="searchable_snapshots.stats", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/security.py b/elasticsearch/_async/client/security.py index 7f15f7a9f..4d26e7899 100644 --- a/elasticsearch/_async/client/security.py +++ b/elasticsearch/_async/client/security.py @@ -55,6 +55,7 @@ async def activate_user_profile( """ if grant_type is None and body is None: raise ValueError("Empty value passed for parameter 'grant_type'") + __path_parts: t.Dict[str, str] = {} __path = "/_security/profile/_activate" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -77,7 +78,13 @@ async def activate_user_profile( __body["username"] = username __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.activate_user_profile", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -95,6 +102,7 @@ async def authenticate( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_security/_authenticate" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -107,7 +115,12 @@ async def authenticate( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="security.authenticate", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -145,9 +158,12 @@ async def change_password( this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. """ + __path_parts: t.Dict[str, str] if username not in SKIP_IN_PATH: - __path = f"/_security/user/{_quote(username)}/_password" + __path_parts = {"username": _quote(username)} + __path = f'/_security/user/{__path_parts["username"]}/_password' else: + __path_parts = {} __path = "/_security/user/_password" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -168,7 +184,13 @@ async def change_password( __body["password_hash"] = password_hash __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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.change_password", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -191,7 +213,8 @@ async def clear_api_key_cache( """ if ids in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'ids'") - __path = f"/_security/api_key/{_quote(ids)}/_clear_cache" + __path_parts: t.Dict[str, str] = {"ids": _quote(ids)} + __path = f'/_security/api_key/{__path_parts["ids"]}/_clear_cache' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -203,7 +226,12 @@ async def clear_api_key_cache( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="security.clear_api_key_cache", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -225,7 +253,8 @@ async def clear_cached_privileges( """ if application in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'application'") - __path = f"/_security/privilege/{_quote(application)}/_clear_cache" + __path_parts: t.Dict[str, str] = {"application": _quote(application)} + __path = f'/_security/privilege/{__path_parts["application"]}/_clear_cache' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -237,7 +266,12 @@ async def clear_cached_privileges( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="security.clear_cached_privileges", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -262,7 +296,8 @@ async def clear_cached_realms( """ if realms in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'realms'") - __path = f"/_security/realm/{_quote(realms)}/_clear_cache" + __path_parts: t.Dict[str, str] = {"realms": _quote(realms)} + __path = f'/_security/realm/{__path_parts["realms"]}/_clear_cache' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -276,7 +311,12 @@ async def clear_cached_realms( __query["usernames"] = usernames __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="security.clear_cached_realms", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -298,7 +338,8 @@ async def clear_cached_roles( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_security/role/{_quote(name)}/_clear_cache" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_security/role/{__path_parts["name"]}/_clear_cache' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -310,7 +351,12 @@ async def clear_cached_roles( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="security.clear_cached_roles", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -340,7 +386,12 @@ async def clear_cached_service_tokens( raise ValueError("Empty value passed for parameter 'service'") if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_security/service/{_quote(namespace)}/{_quote(service)}/credential/token/{_quote(name)}/_clear_cache" + __path_parts: t.Dict[str, str] = { + "namespace": _quote(namespace), + "service": _quote(service), + "name": _quote(name), + } + __path = f'/_security/service/{__path_parts["namespace"]}/{__path_parts["service"]}/credential/token/{__path_parts["name"]}/_clear_cache' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -352,7 +403,12 @@ async def clear_cached_service_tokens( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="security.clear_cached_service_tokens", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -397,6 +453,7 @@ async def create_api_key( is the same as the request for create role API. For more details, see create or update roles API. """ + __path_parts: t.Dict[str, str] = {} __path = "/_security/api_key" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -421,7 +478,13 @@ async def create_api_key( __body["role_descriptors"] = role_descriptors __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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.create_api_key", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -455,15 +518,22 @@ async def create_service_token( raise ValueError("Empty value passed for parameter 'namespace'") if service in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'service'") + __path_parts: t.Dict[str, str] if ( namespace not in SKIP_IN_PATH and service not in SKIP_IN_PATH and name not in SKIP_IN_PATH ): - __path = f"/_security/service/{_quote(namespace)}/{_quote(service)}/credential/token/{_quote(name)}" + __path_parts = { + "namespace": _quote(namespace), + "service": _quote(service), + "name": _quote(name), + } + __path = f'/_security/service/{__path_parts["namespace"]}/{__path_parts["service"]}/credential/token/{__path_parts["name"]}' __method = "PUT" elif namespace not in SKIP_IN_PATH and service not in SKIP_IN_PATH: - __path = f"/_security/service/{_quote(namespace)}/{_quote(service)}/credential/token" + __path_parts = {"namespace": _quote(namespace), "service": _quote(service)} + __path = f'/_security/service/{__path_parts["namespace"]}/{__path_parts["service"]}/credential/token' __method = "POST" else: raise ValueError("Couldn't find a path for the given parameters") @@ -480,7 +550,12 @@ async def create_service_token( __query["refresh"] = refresh __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - __method, __path, params=__query, headers=__headers + __method, + __path, + params=__query, + headers=__headers, + endpoint_id="security.create_service_token", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -512,7 +587,13 @@ async def delete_privileges( raise ValueError("Empty value passed for parameter 'application'") if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_security/privilege/{_quote(application)}/{_quote(name)}" + __path_parts: t.Dict[str, str] = { + "application": _quote(application), + "name": _quote(name), + } + __path = ( + f'/_security/privilege/{__path_parts["application"]}/{__path_parts["name"]}' + ) __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -526,7 +607,12 @@ async def delete_privileges( __query["refresh"] = refresh __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="security.delete_privileges", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -554,7 +640,8 @@ async def delete_role( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_security/role/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_security/role/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -568,7 +655,12 @@ async def delete_role( __query["refresh"] = refresh __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="security.delete_role", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -596,7 +688,8 @@ async def delete_role_mapping( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_security/role_mapping/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_security/role_mapping/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -610,7 +703,12 @@ async def delete_role_mapping( __query["refresh"] = refresh __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="security.delete_role_mapping", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -646,7 +744,12 @@ async def delete_service_token( raise ValueError("Empty value passed for parameter 'service'") if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_security/service/{_quote(namespace)}/{_quote(service)}/credential/token/{_quote(name)}" + __path_parts: t.Dict[str, str] = { + "namespace": _quote(namespace), + "service": _quote(service), + "name": _quote(name), + } + __path = f'/_security/service/{__path_parts["namespace"]}/{__path_parts["service"]}/credential/token/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -660,7 +763,12 @@ async def delete_service_token( __query["refresh"] = refresh __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="security.delete_service_token", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -688,7 +796,8 @@ async def delete_user( """ if username in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'username'") - __path = f"/_security/user/{_quote(username)}" + __path_parts: t.Dict[str, str] = {"username": _quote(username)} + __path = f'/_security/user/{__path_parts["username"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -702,7 +811,12 @@ async def delete_user( __query["refresh"] = refresh __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="security.delete_user", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -730,7 +844,8 @@ async def disable_user( """ if username in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'username'") - __path = f"/_security/user/{_quote(username)}/_disable" + __path_parts: t.Dict[str, str] = {"username": _quote(username)} + __path = f'/_security/user/{__path_parts["username"]}/_disable' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -744,7 +859,12 @@ async def disable_user( __query["refresh"] = refresh __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers + "PUT", + __path, + params=__query, + headers=__headers, + endpoint_id="security.disable_user", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -772,7 +892,8 @@ async def disable_user_profile( """ if uid in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'uid'") - __path = f"/_security/profile/{_quote(uid)}/_disable" + __path_parts: t.Dict[str, str] = {"uid": _quote(uid)} + __path = f'/_security/profile/{__path_parts["uid"]}/_disable' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -786,7 +907,12 @@ async def disable_user_profile( __query["refresh"] = refresh __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers + "PUT", + __path, + params=__query, + headers=__headers, + endpoint_id="security.disable_user_profile", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -814,7 +940,8 @@ async def enable_user( """ if username in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'username'") - __path = f"/_security/user/{_quote(username)}/_enable" + __path_parts: t.Dict[str, str] = {"username": _quote(username)} + __path = f'/_security/user/{__path_parts["username"]}/_enable' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -828,7 +955,12 @@ async def enable_user( __query["refresh"] = refresh __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers + "PUT", + __path, + params=__query, + headers=__headers, + endpoint_id="security.enable_user", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -856,7 +988,8 @@ async def enable_user_profile( """ if uid in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'uid'") - __path = f"/_security/profile/{_quote(uid)}/_enable" + __path_parts: t.Dict[str, str] = {"uid": _quote(uid)} + __path = f'/_security/profile/{__path_parts["uid"]}/_enable' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -870,7 +1003,12 @@ async def enable_user_profile( __query["refresh"] = refresh __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers + "PUT", + __path, + params=__query, + headers=__headers, + endpoint_id="security.enable_user_profile", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -888,6 +1026,7 @@ async def enroll_kibana( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_security/enroll/kibana" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -900,7 +1039,12 @@ async def enroll_kibana( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="security.enroll_kibana", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -917,6 +1061,7 @@ async def enroll_node( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_security/enroll/node" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -929,7 +1074,12 @@ async def enroll_node( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="security.enroll_node", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -974,6 +1124,7 @@ async def get_api_key( associated with the API key. An API key's actual permission is the intersection of its assigned role descriptors and the owner user's role descriptors. """ + __path_parts: t.Dict[str, str] = {} __path = "/_security/api_key" __query: t.Dict[str, t.Any] = {} if active_only is not None: @@ -1000,7 +1151,12 @@ async def get_api_key( __query["with_limited_by"] = with_limited_by __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="security.get_api_key", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1018,6 +1174,7 @@ async def get_builtin_privileges( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_security/privilege/_builtin" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1030,7 +1187,12 @@ async def get_builtin_privileges( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="security.get_builtin_privileges", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1052,11 +1214,15 @@ async def get_privileges( :param application: Application name :param name: Privilege name """ + __path_parts: t.Dict[str, str] if application not in SKIP_IN_PATH and name not in SKIP_IN_PATH: - __path = f"/_security/privilege/{_quote(application)}/{_quote(name)}" + __path_parts = {"application": _quote(application), "name": _quote(name)} + __path = f'/_security/privilege/{__path_parts["application"]}/{__path_parts["name"]}' elif application not in SKIP_IN_PATH: - __path = f"/_security/privilege/{_quote(application)}" + __path_parts = {"application": _quote(application)} + __path = f'/_security/privilege/{__path_parts["application"]}' else: + __path_parts = {} __path = "/_security/privilege" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1069,7 +1235,12 @@ async def get_privileges( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="security.get_privileges", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1091,9 +1262,12 @@ async def get_role( list. If you do not specify this parameter, the API returns information about all roles. """ + __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: - __path = f"/_security/role/{_quote(name)}" + __path_parts = {"name": _quote(name)} + __path = f'/_security/role/{__path_parts["name"]}' else: + __path_parts = {} __path = "/_security/role" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1106,7 +1280,12 @@ async def get_role( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="security.get_role", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1130,9 +1309,12 @@ async def get_role_mapping( mapping names as a comma-separated list. If you do not specify this parameter, the API returns information about all role mappings. """ + __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: - __path = f"/_security/role_mapping/{_quote(name)}" + __path_parts = {"name": _quote(name)} + __path = f'/_security/role_mapping/{__path_parts["name"]}' else: + __path_parts = {} __path = "/_security/role_mapping" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1145,7 +1327,12 @@ async def get_role_mapping( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="security.get_role_mapping", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1170,11 +1357,15 @@ async def get_service_accounts( :param service: Name of the service name. Omit this parameter to retrieve information about all service accounts that belong to the specified `namespace`. """ + __path_parts: t.Dict[str, str] if namespace not in SKIP_IN_PATH and service not in SKIP_IN_PATH: - __path = f"/_security/service/{_quote(namespace)}/{_quote(service)}" + __path_parts = {"namespace": _quote(namespace), "service": _quote(service)} + __path = f'/_security/service/{__path_parts["namespace"]}/{__path_parts["service"]}' elif namespace not in SKIP_IN_PATH: - __path = f"/_security/service/{_quote(namespace)}" + __path_parts = {"namespace": _quote(namespace)} + __path = f'/_security/service/{__path_parts["namespace"]}' else: + __path_parts = {} __path = "/_security/service" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1187,7 +1378,12 @@ async def get_service_accounts( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="security.get_service_accounts", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1213,7 +1409,11 @@ async def get_service_credentials( raise ValueError("Empty value passed for parameter 'namespace'") if service in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'service'") - __path = f"/_security/service/{_quote(namespace)}/{_quote(service)}/credential" + __path_parts: t.Dict[str, str] = { + "namespace": _quote(namespace), + "service": _quote(service), + } + __path = f'/_security/service/{__path_parts["namespace"]}/{__path_parts["service"]}/credential' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -1225,7 +1425,12 @@ async def get_service_credentials( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="security.get_service_credentials", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1270,6 +1475,7 @@ async def get_token( :param scope: :param username: """ + __path_parts: t.Dict[str, str] = {} __path = "/_security/oauth2/token" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -1296,7 +1502,13 @@ async def get_token( __body["username"] = username __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.get_token", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1321,9 +1533,12 @@ async def get_user( :param with_profile_uid: If true will return the User Profile ID for a user, if any. """ + __path_parts: t.Dict[str, str] if username not in SKIP_IN_PATH: - __path = f"/_security/user/{_quote(username)}" + __path_parts = {"username": _quote(username)} + __path = f'/_security/user/{__path_parts["username"]}' else: + __path_parts = {} __path = "/_security/user" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1338,7 +1553,12 @@ async def get_user( __query["with_profile_uid"] = with_profile_uid __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="security.get_user", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1365,6 +1585,7 @@ async def get_user_privileges( the API returns information about all privileges for the requested application. :param username: """ + __path_parts: t.Dict[str, str] = {} __path = "/_security/user/_privileges" __query: t.Dict[str, t.Any] = {} if application is not None: @@ -1383,7 +1604,12 @@ async def get_user_privileges( __query["username"] = username __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="security.get_user_privileges", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1410,7 +1636,8 @@ async def get_user_profile( """ if uid in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'uid'") - __path = f"/_security/profile/{_quote(uid)}" + __path_parts: t.Dict[str, str] = {"uid": _quote(uid)} + __path = f'/_security/profile/{__path_parts["uid"]}' __query: t.Dict[str, t.Any] = {} if data is not None: __query["data"] = data @@ -1424,7 +1651,12 @@ async def get_user_profile( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="security.get_user_profile", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1477,6 +1709,7 @@ async def grant_api_key( raise ValueError("Empty value passed for parameter 'api_key'") if grant_type is None and body is None: raise ValueError("Empty value passed for parameter 'grant_type'") + __path_parts: t.Dict[str, str] = {} __path = "/_security/api_key/grant" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -1503,7 +1736,13 @@ async def grant_api_key( __body["username"] = username __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.grant_api_key", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1539,9 +1778,12 @@ async def has_privileges( :param cluster: A list of the cluster privileges that you want to check. :param index: """ + __path_parts: t.Dict[str, str] if user not in SKIP_IN_PATH: - __path = f"/_security/user/{_quote(user)}/_has_privileges" + __path_parts = {"user": _quote(user)} + __path = f'/_security/user/{__path_parts["user"]}/_has_privileges' else: + __path_parts = {} __path = "/_security/user/_has_privileges" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -1562,7 +1804,13 @@ async def has_privileges( __body["index"] = index __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.has_privileges", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1593,6 +1841,7 @@ async def has_privileges_user_profile( raise ValueError("Empty value passed for parameter 'privileges'") if uids is None and body is None: raise ValueError("Empty value passed for parameter 'uids'") + __path_parts: t.Dict[str, str] = {} __path = "/_security/profile/_has_privileges" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -1611,7 +1860,13 @@ async def has_privileges_user_profile( __body["uids"] = uids __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.has_privileges_user_profile", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1651,6 +1906,7 @@ async def invalidate_api_key( :param username: The username of a user. This parameter cannot be used with either `ids` or `name`, or when `owner` flag is set to `true`. """ + __path_parts: t.Dict[str, str] = {} __path = "/_security/api_key" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -1677,7 +1933,13 @@ async def invalidate_api_key( __body["username"] = username __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers, body=__body + "DELETE", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.invalidate_api_key", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1706,6 +1968,7 @@ async def invalidate_token( :param token: :param username: """ + __path_parts: t.Dict[str, str] = {} __path = "/_security/oauth2/token" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -1728,7 +1991,13 @@ async def invalidate_token( __body["username"] = username __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers, body=__body + "DELETE", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.invalidate_token", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1765,6 +2034,7 @@ async def put_privileges( ) elif privileges is not None and body is not None: raise ValueError("Cannot set both 'privileges' and 'body'") + __path_parts: t.Dict[str, str] = {} __path = "/_security/privilege" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1780,7 +2050,13 @@ async def put_privileges( __body = privileges if privileges 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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.put_privileges", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1850,7 +2126,8 @@ async def put_role( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_security/role/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_security/role/{__path_parts["name"]}' __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: @@ -1880,7 +2157,13 @@ async def put_role( __body["transient_metadata"] = transient_metadata __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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.put_role", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1930,7 +2213,8 @@ async def put_role_mapping( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_security/role_mapping/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_security/role_mapping/{__path_parts["name"]}' __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: @@ -1958,7 +2242,13 @@ async def put_role_mapping( __body["run_as"] = run_as __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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.put_role_mapping", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2012,7 +2302,8 @@ async def put_user( """ if username in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'username'") - __path = f"/_security/user/{_quote(username)}" + __path_parts: t.Dict[str, str] = {"username": _quote(username)} + __path = f'/_security/user/{__path_parts["username"]}' __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: @@ -2042,7 +2333,13 @@ async def put_user( __body["roles"] = roles __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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.put_user", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2094,6 +2391,7 @@ async def query_api_keys( associated with the API key. An API key's actual permission is the intersection of its assigned role descriptors and the owner user's role descriptors. """ + __path_parts: t.Dict[str, str] = {} __path = "/_security/_query/api_key" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -2135,7 +2433,13 @@ async def query_api_keys( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.query_api_keys", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2170,6 +2474,7 @@ async def saml_authenticate( raise ValueError("Empty value passed for parameter 'content'") if ids is None and body is None: raise ValueError("Empty value passed for parameter 'ids'") + __path_parts: t.Dict[str, str] = {} __path = "/_security/saml/authenticate" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -2190,7 +2495,13 @@ async def saml_authenticate( __body["realm"] = realm __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.saml_authenticate", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2228,6 +2539,7 @@ async def saml_complete_logout( raise ValueError("Empty value passed for parameter 'ids'") if realm is None and body is None: raise ValueError("Empty value passed for parameter 'realm'") + __path_parts: t.Dict[str, str] = {} __path = "/_security/saml/complete_logout" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -2250,7 +2562,13 @@ async def saml_complete_logout( __body["query_string"] = query_string __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.saml_complete_logout", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2291,6 +2609,7 @@ async def saml_invalidate( """ if query_string is None and body is None: raise ValueError("Empty value passed for parameter 'query_string'") + __path_parts: t.Dict[str, str] = {} __path = "/_security/saml/invalidate" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -2311,7 +2630,13 @@ async def saml_invalidate( __body["realm"] = realm __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.saml_invalidate", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2343,6 +2668,7 @@ async def saml_logout( """ if token is None and body is None: raise ValueError("Empty value passed for parameter 'token'") + __path_parts: t.Dict[str, str] = {} __path = "/_security/saml/logout" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -2361,7 +2687,13 @@ async def saml_logout( __body["refresh_token"] = refresh_token __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.saml_logout", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2394,6 +2726,7 @@ async def saml_prepare_authentication( API returns as the RelayState query parameter. If the Authentication Request is signed, this value is used as part of the signature computation. """ + __path_parts: t.Dict[str, str] = {} __path = "/_security/saml/prepare" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -2414,7 +2747,13 @@ async def saml_prepare_authentication( __body["relay_state"] = relay_state __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.saml_prepare_authentication", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -2436,7 +2775,8 @@ async def saml_service_provider_metadata( """ if realm_name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'realm_name'") - __path = f"/_security/saml/metadata/{_quote(realm_name)}" + __path_parts: t.Dict[str, str] = {"realm_name": _quote(realm_name)} + __path = f'/_security/saml/metadata/{__path_parts["realm_name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -2448,7 +2788,12 @@ async def saml_service_provider_metadata( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="security.saml_service_provider_metadata", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2484,6 +2829,7 @@ async def suggest_user_profiles( Name-related fields are the user's `username`, `full_name`, and `email`. :param size: Number of profiles to return. """ + __path_parts: t.Dict[str, str] = {} __path = "/_security/profile/_suggest" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -2510,7 +2856,13 @@ async def suggest_user_profiles( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.suggest_user_profiles", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2550,7 +2902,8 @@ async def update_api_key( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_security/api_key/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_security/api_key/{__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: @@ -2574,7 +2927,13 @@ async def update_api_key( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.update_api_key", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2617,7 +2976,8 @@ async def update_user_profile_data( """ if uid in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'uid'") - __path = f"/_security/profile/{_quote(uid)}/_data" + __path_parts: t.Dict[str, str] = {"uid": _quote(uid)} + __path = f'/_security/profile/{__path_parts["uid"]}/_data' __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: @@ -2641,5 +3001,11 @@ async def update_user_profile_data( __body["labels"] = labels __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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.update_user_profile_data", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/shutdown.py b/elasticsearch/_async/client/shutdown.py index 0bf76e4a6..0b0c46391 100644 --- a/elasticsearch/_async/client/shutdown.py +++ b/elasticsearch/_async/client/shutdown.py @@ -56,7 +56,8 @@ async def delete_node( """ if node_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'node_id'") - __path = f"/_nodes/{_quote(node_id)}/shutdown" + __path_parts: t.Dict[str, str] = {"node_id": _quote(node_id)} + __path = f'/_nodes/{__path_parts["node_id"]}/shutdown' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -72,7 +73,12 @@ async def delete_node( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="shutdown.delete_node", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -104,9 +110,12 @@ async def get_node( :param timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] if node_id not in SKIP_IN_PATH: - __path = f"/_nodes/{_quote(node_id)}/shutdown" + __path_parts = {"node_id": _quote(node_id)} + __path = f'/_nodes/{__path_parts["node_id"]}/shutdown' else: + __path_parts = {} __path = "/_nodes/shutdown" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -123,7 +132,12 @@ async def get_node( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="shutdown.get_node", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -196,7 +210,8 @@ async def put_node( raise ValueError("Empty value passed for parameter 'reason'") if type is None and body is None: raise ValueError("Empty value passed for parameter 'type'") - __path = f"/_nodes/{_quote(node_id)}/shutdown" + __path_parts: t.Dict[str, str] = {"node_id": _quote(node_id)} + __path = f'/_nodes/{__path_parts["node_id"]}/shutdown' __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: @@ -222,5 +237,11 @@ async def put_node( __body["target_node_name"] = target_node_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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="shutdown.put_node", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/slm.py b/elasticsearch/_async/client/slm.py index 5a8e297e5..28f1cfb15 100644 --- a/elasticsearch/_async/client/slm.py +++ b/elasticsearch/_async/client/slm.py @@ -44,7 +44,8 @@ async def delete_lifecycle( """ if policy_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'policy_id'") - __path = f"/_slm/policy/{_quote(policy_id)}" + __path_parts: t.Dict[str, str] = {"policy_id": _quote(policy_id)} + __path = f'/_slm/policy/{__path_parts["policy_id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -56,7 +57,12 @@ async def delete_lifecycle( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="slm.delete_lifecycle", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -79,7 +85,8 @@ async def execute_lifecycle( """ if policy_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'policy_id'") - __path = f"/_slm/policy/{_quote(policy_id)}/_execute" + __path_parts: t.Dict[str, str] = {"policy_id": _quote(policy_id)} + __path = f'/_slm/policy/{__path_parts["policy_id"]}/_execute' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -91,7 +98,12 @@ async def execute_lifecycle( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers + "PUT", + __path, + params=__query, + headers=__headers, + endpoint_id="slm.execute_lifecycle", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -108,6 +120,7 @@ async def execute_retention( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_slm/_execute_retention" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -120,7 +133,12 @@ async def execute_retention( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="slm.execute_retention", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -141,9 +159,12 @@ async def get_lifecycle( :param policy_id: Comma-separated list of snapshot lifecycle policies to retrieve """ + __path_parts: t.Dict[str, str] if policy_id not in SKIP_IN_PATH: - __path = f"/_slm/policy/{_quote(policy_id)}" + __path_parts = {"policy_id": _quote(policy_id)} + __path = f'/_slm/policy/{__path_parts["policy_id"]}' else: + __path_parts = {} __path = "/_slm/policy" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -156,7 +177,12 @@ async def get_lifecycle( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="slm.get_lifecycle", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -174,6 +200,7 @@ async def get_stats( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_slm/stats" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -186,7 +213,12 @@ async def get_stats( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="slm.get_stats", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -203,6 +235,7 @@ async def get_status( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_slm/status" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -215,7 +248,12 @@ async def get_status( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="slm.get_status", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -266,7 +304,8 @@ async def put_lifecycle( """ if policy_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'policy_id'") - __path = f"/_slm/policy/{_quote(policy_id)}" + __path_parts: t.Dict[str, str] = {"policy_id": _quote(policy_id)} + __path = f'/_slm/policy/{__path_parts["policy_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: @@ -298,7 +337,13 @@ async def put_lifecycle( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="slm.put_lifecycle", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -315,6 +360,7 @@ async def start( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_slm/start" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -327,7 +373,12 @@ async def start( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="slm.start", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -344,6 +395,7 @@ async def stop( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_slm/stop" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -356,5 +408,10 @@ async def stop( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="slm.stop", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/snapshot.py b/elasticsearch/_async/client/snapshot.py index f78b92d03..f9d1d95bd 100644 --- a/elasticsearch/_async/client/snapshot.py +++ b/elasticsearch/_async/client/snapshot.py @@ -50,7 +50,8 @@ async def cleanup_repository( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_snapshot/{_quote(name)}/_cleanup" + __path_parts: t.Dict[str, str] = {"repository": _quote(name)} + __path = f'/_snapshot/{__path_parts["repository"]}/_cleanup' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -66,7 +67,12 @@ async def cleanup_repository( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="snapshot.cleanup_repository", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -109,7 +115,12 @@ async def clone( raise ValueError("Empty value passed for parameter 'target_snapshot'") if indices is None and body is None: raise ValueError("Empty value passed for parameter 'indices'") - __path = f"/_snapshot/{_quote(repository)}/{_quote(snapshot)}/_clone/{_quote(target_snapshot)}" + __path_parts: t.Dict[str, str] = { + "repository": _quote(repository), + "snapshot": _quote(snapshot), + "target_snapshot": _quote(target_snapshot), + } + __path = f'/_snapshot/{__path_parts["repository"]}/{__path_parts["snapshot"]}/_clone/{__path_parts["target_snapshot"]}' __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: @@ -129,7 +140,13 @@ async def clone( __body["indices"] = indices __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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="snapshot.clone", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -203,7 +220,11 @@ async def create( raise ValueError("Empty value passed for parameter 'repository'") if snapshot in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'snapshot'") - __path = f"/_snapshot/{_quote(repository)}/{_quote(snapshot)}" + __path_parts: t.Dict[str, str] = { + "repository": _quote(repository), + "snapshot": _quote(snapshot), + } + __path = f'/_snapshot/{__path_parts["repository"]}/{__path_parts["snapshot"]}' __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: @@ -237,7 +258,13 @@ async def create( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="snapshot.create", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -278,7 +305,8 @@ async def create_repository( ) elif repository is not None and body is not None: raise ValueError("Cannot set both 'repository' and 'body'") - __path = f"/_snapshot/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"repository": _quote(name)} + __path = f'/_snapshot/{__path_parts["repository"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -297,7 +325,13 @@ async def create_repository( __body = repository if repository 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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="snapshot.create_repository", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -327,7 +361,11 @@ async def delete( raise ValueError("Empty value passed for parameter 'repository'") if snapshot in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'snapshot'") - __path = f"/_snapshot/{_quote(repository)}/{_quote(snapshot)}" + __path_parts: t.Dict[str, str] = { + "repository": _quote(repository), + "snapshot": _quote(snapshot), + } + __path = f'/_snapshot/{__path_parts["repository"]}/{__path_parts["snapshot"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -341,7 +379,12 @@ async def delete( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="snapshot.delete", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -370,7 +413,8 @@ async def delete_repository( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_snapshot/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"repository": _quote(name)} + __path = f'/_snapshot/{__path_parts["repository"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -386,7 +430,12 @@ async def delete_repository( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="snapshot.delete_repository", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -470,7 +519,11 @@ async def get( raise ValueError("Empty value passed for parameter 'repository'") if snapshot in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'snapshot'") - __path = f"/_snapshot/{_quote(repository)}/{_quote(snapshot)}" + __path_parts: t.Dict[str, str] = { + "repository": _quote(repository), + "snapshot": _quote(snapshot), + } + __path = f'/_snapshot/{__path_parts["repository"]}/{__path_parts["snapshot"]}' __query: t.Dict[str, t.Any] = {} if after is not None: __query["after"] = after @@ -508,7 +561,12 @@ async def get( __query["verbose"] = verbose __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="snapshot.get", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -535,9 +593,12 @@ async def get_repository( node (default: false) :param master_timeout: Explicit operation timeout for connection to master node """ + __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: - __path = f"/_snapshot/{_quote(name)}" + __path_parts = {"repository": _quote(name)} + __path = f'/_snapshot/{__path_parts["repository"]}' else: + __path_parts = {} __path = "/_snapshot" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -554,7 +615,12 @@ async def get_repository( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="snapshot.get_repository", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -621,7 +687,11 @@ async def restore( raise ValueError("Empty value passed for parameter 'repository'") if snapshot in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'snapshot'") - __path = f"/_snapshot/{_quote(repository)}/{_quote(snapshot)}/_restore" + __path_parts: t.Dict[str, str] = { + "repository": _quote(repository), + "snapshot": _quote(snapshot), + } + __path = f'/_snapshot/{__path_parts["repository"]}/{__path_parts["snapshot"]}/_restore' __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: @@ -663,7 +733,13 @@ async def restore( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="snapshot.restore", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -692,11 +768,18 @@ async def status( to false which means a SnapshotMissingException is thrown :param master_timeout: Explicit operation timeout for connection to master node """ + __path_parts: t.Dict[str, str] if repository not in SKIP_IN_PATH and snapshot not in SKIP_IN_PATH: - __path = f"/_snapshot/{_quote(repository)}/{_quote(snapshot)}/_status" + __path_parts = { + "repository": _quote(repository), + "snapshot": _quote(snapshot), + } + __path = f'/_snapshot/{__path_parts["repository"]}/{__path_parts["snapshot"]}/_status' elif repository not in SKIP_IN_PATH: - __path = f"/_snapshot/{_quote(repository)}/_status" + __path_parts = {"repository": _quote(repository)} + __path = f'/_snapshot/{__path_parts["repository"]}/_status' else: + __path_parts = {} __path = "/_snapshot/_status" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -713,7 +796,12 @@ async def status( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="snapshot.status", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -741,7 +829,8 @@ async def verify_repository( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_snapshot/{_quote(name)}/_verify" + __path_parts: t.Dict[str, str] = {"repository": _quote(name)} + __path = f'/_snapshot/{__path_parts["repository"]}/_verify' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -757,5 +846,10 @@ async def verify_repository( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="snapshot.verify_repository", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/sql.py b/elasticsearch/_async/client/sql.py index 08f4de9af..3f48b593b 100644 --- a/elasticsearch/_async/client/sql.py +++ b/elasticsearch/_async/client/sql.py @@ -47,6 +47,7 @@ async def clear_cursor( """ if cursor is None and body is None: raise ValueError("Empty value passed for parameter 'cursor'") + __path_parts: t.Dict[str, str] = {} __path = "/_sql/close" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -63,7 +64,13 @@ async def clear_cursor( __body["cursor"] = cursor __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="sql.clear_cursor", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -86,7 +93,8 @@ async def delete_async( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_sql/async/delete/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_sql/async/delete/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -98,7 +106,12 @@ async def delete_async( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="sql.delete_async", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -136,7 +149,8 @@ async def get_async( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_sql/async/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_sql/async/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if delimiter is not None: __query["delimiter"] = delimiter @@ -156,7 +170,12 @@ async def get_async( __query["wait_for_completion_timeout"] = wait_for_completion_timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="sql.get_async", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -179,7 +198,8 @@ async def get_async_status( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_sql/async/status/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_sql/async/status/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -191,7 +211,12 @@ async def get_async_status( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="sql.get_async_status", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -281,6 +306,7 @@ async def query( to no timeout, meaning the request waits for complete search results. If the search doesn’t finish within this period, the search becomes async. """ + __path_parts: t.Dict[str, str] = {} __path = "/_sql" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -329,7 +355,13 @@ async def query( __body["wait_for_completion_timeout"] = wait_for_completion_timeout __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="sql.query", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -360,6 +392,7 @@ async def translate( """ if query is None and body is None: raise ValueError("Empty value passed for parameter 'query'") + __path_parts: t.Dict[str, str] = {} __path = "/_sql/translate" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -382,5 +415,11 @@ async def translate( __body["time_zone"] = time_zone __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="sql.translate", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/ssl.py b/elasticsearch/_async/client/ssl.py index 8700662a0..3915cb663 100644 --- a/elasticsearch/_async/client/ssl.py +++ b/elasticsearch/_async/client/ssl.py @@ -40,6 +40,7 @@ async def certificates( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_ssl/certificates" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -52,5 +53,10 @@ async def certificates( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ssl.certificates", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/synonyms.py b/elasticsearch/_async/client/synonyms.py index 3d074023a..12eb6446f 100644 --- a/elasticsearch/_async/client/synonyms.py +++ b/elasticsearch/_async/client/synonyms.py @@ -44,7 +44,8 @@ async def delete_synonym( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_synonyms/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_synonyms/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -56,7 +57,12 @@ async def delete_synonym( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="synonyms.delete_synonym", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -82,7 +88,11 @@ async def delete_synonym_rule( raise ValueError("Empty value passed for parameter 'set_id'") if rule_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'rule_id'") - __path = f"/_synonyms/{_quote(set_id)}/{_quote(rule_id)}" + __path_parts: t.Dict[str, str] = { + "set_id": _quote(set_id), + "rule_id": _quote(rule_id), + } + __path = f'/_synonyms/{__path_parts["set_id"]}/{__path_parts["rule_id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -94,7 +104,12 @@ async def delete_synonym_rule( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="synonyms.delete_synonym_rule", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -122,7 +137,8 @@ async def get_synonym( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_synonyms/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_synonyms/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -138,7 +154,12 @@ async def get_synonym( __query["size"] = size __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="synonyms.get_synonym", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -164,7 +185,11 @@ async def get_synonym_rule( raise ValueError("Empty value passed for parameter 'set_id'") if rule_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'rule_id'") - __path = f"/_synonyms/{_quote(set_id)}/{_quote(rule_id)}" + __path_parts: t.Dict[str, str] = { + "set_id": _quote(set_id), + "rule_id": _quote(rule_id), + } + __path = f'/_synonyms/{__path_parts["set_id"]}/{__path_parts["rule_id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -176,7 +201,12 @@ async def get_synonym_rule( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="synonyms.get_synonym_rule", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -200,6 +230,7 @@ async def get_synonyms_sets( :param from_: Starting offset :param size: specifies a max number of results to get """ + __path_parts: t.Dict[str, str] = {} __path = "/_synonyms" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -216,7 +247,12 @@ async def get_synonyms_sets( __query["size"] = size __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="synonyms.get_synonyms_sets", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -245,7 +281,8 @@ async def put_synonym( raise ValueError("Empty value passed for parameter 'id'") if synonyms_set is None and body is None: raise ValueError("Empty value passed for parameter 'synonyms_set'") - __path = f"/_synonyms/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_synonyms/{__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: @@ -261,7 +298,13 @@ async def put_synonym( __body["synonyms_set"] = synonyms_set __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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="synonyms.put_synonym", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -294,7 +337,11 @@ async def put_synonym_rule( raise ValueError("Empty value passed for parameter 'rule_id'") if synonyms is None and body is None: raise ValueError("Empty value passed for parameter 'synonyms'") - __path = f"/_synonyms/{_quote(set_id)}/{_quote(rule_id)}" + __path_parts: t.Dict[str, str] = { + "set_id": _quote(set_id), + "rule_id": _quote(rule_id), + } + __path = f'/_synonyms/{__path_parts["set_id"]}/{__path_parts["rule_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: @@ -310,5 +357,11 @@ async def put_synonym_rule( __body["synonyms"] = synonyms __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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="synonyms.put_synonym_rule", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/tasks.py b/elasticsearch/_async/client/tasks.py index ffef31090..fea7452a0 100644 --- a/elasticsearch/_async/client/tasks.py +++ b/elasticsearch/_async/client/tasks.py @@ -52,9 +52,12 @@ async def cancel( :param wait_for_completion: Should the request block until the cancellation of the task and its descendant tasks is completed. Defaults to false """ + __path_parts: t.Dict[str, str] if task_id not in SKIP_IN_PATH: - __path = f"/_tasks/{_quote(task_id)}/_cancel" + __path_parts = {"task_id": _quote(task_id)} + __path = f'/_tasks/{__path_parts["task_id"]}/_cancel' else: + __path_parts = {} __path = "/_tasks/_cancel" __query: t.Dict[str, t.Any] = {} if actions is not None: @@ -75,7 +78,12 @@ async def cancel( __query["wait_for_completion"] = wait_for_completion __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="tasks.cancel", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -103,7 +111,8 @@ async def get( """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") - __path = f"/_tasks/{_quote(task_id)}" + __path_parts: t.Dict[str, str] = {"task_id": _quote(task_id)} + __path = f'/_tasks/{__path_parts["task_id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -119,7 +128,12 @@ async def get( __query["wait_for_completion"] = wait_for_completion __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="tasks.get", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -165,6 +179,7 @@ async def list( :param wait_for_completion: If `true`, the request blocks until the operation is complete. """ + __path_parts: t.Dict[str, str] = {} __path = "/_tasks" __query: t.Dict[str, t.Any] = {} if actions is not None: @@ -193,5 +208,10 @@ async def list( __query["wait_for_completion"] = wait_for_completion __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="tasks.list", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/text_structure.py b/elasticsearch/_async/client/text_structure.py index 8bad62538..937e5a704 100644 --- a/elasticsearch/_async/client/text_structure.py +++ b/elasticsearch/_async/client/text_structure.py @@ -127,6 +127,7 @@ async def find_structure( ) elif text_files is not None and body is not None: raise ValueError("Cannot set both 'text_files' and 'body'") + __path_parts: t.Dict[str, str] = {} __path = "/_text_structure/find_structure" __query: t.Dict[str, t.Any] = {} if charset is not None: @@ -165,7 +166,13 @@ async def find_structure( "content-type": "application/x-ndjson", } return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="text_structure.find_structure", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -197,6 +204,7 @@ async def test_grok_pattern( raise ValueError("Empty value passed for parameter 'grok_pattern'") if text is None and body is None: raise ValueError("Empty value passed for parameter 'text'") + __path_parts: t.Dict[str, str] = {} __path = "/_text_structure/test_grok_pattern" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -217,5 +225,11 @@ async def test_grok_pattern( __body["text"] = text __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="text_structure.test_grok_pattern", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/transform.py b/elasticsearch/_async/client/transform.py index 7754b8457..e9c445fa0 100644 --- a/elasticsearch/_async/client/transform.py +++ b/elasticsearch/_async/client/transform.py @@ -55,7 +55,8 @@ async def delete_transform( """ if transform_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'transform_id'") - __path = f"/_transform/{_quote(transform_id)}" + __path_parts: t.Dict[str, str] = {"transform_id": _quote(transform_id)} + __path = f'/_transform/{__path_parts["transform_id"]}' __query: t.Dict[str, t.Any] = {} if delete_dest_index is not None: __query["delete_dest_index"] = delete_dest_index @@ -73,7 +74,12 @@ async def delete_transform( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="transform.delete_transform", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -111,9 +117,12 @@ async def get_transform( :param from_: Skips the specified number of transforms. :param size: Specifies the maximum number of transforms to obtain. """ + __path_parts: t.Dict[str, str] if transform_id not in SKIP_IN_PATH: - __path = f"/_transform/{_quote(transform_id)}" + __path_parts = {"transform_id": _quote(transform_id)} + __path = f'/_transform/{__path_parts["transform_id"]}' else: + __path_parts = {} __path = "/_transform" __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: @@ -134,7 +143,12 @@ async def get_transform( __query["size"] = size __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="transform.get_transform", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -172,7 +186,8 @@ async def get_transform_stats( """ if transform_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'transform_id'") - __path = f"/_transform/{_quote(transform_id)}/_stats" + __path_parts: t.Dict[str, str] = {"transform_id": _quote(transform_id)} + __path = f'/_transform/{__path_parts["transform_id"]}/_stats' __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: __query["allow_no_match"] = allow_no_match @@ -192,7 +207,12 @@ async def get_transform_stats( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="transform.get_transform_stats", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -255,9 +275,12 @@ async def preview_transform( :param timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] if transform_id not in SKIP_IN_PATH: - __path = f"/_transform/{_quote(transform_id)}/_preview" + __path_parts = {"transform_id": _quote(transform_id)} + __path = f'/_transform/{__path_parts["transform_id"]}/_preview' else: + __path_parts = {} __path = "/_transform/_preview" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -296,7 +319,13 @@ async def preview_transform( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="transform.preview_transform", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -377,7 +406,8 @@ async def put_transform( raise ValueError("Empty value passed for parameter 'dest'") if source is None and body is None: raise ValueError("Empty value passed for parameter 'source'") - __path = f"/_transform/{_quote(transform_id)}" + __path_parts: t.Dict[str, str] = {"transform_id": _quote(transform_id)} + __path = f'/_transform/{__path_parts["transform_id"]}' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} if defer_validation is not None: @@ -415,7 +445,13 @@ async def put_transform( __body["sync"] = sync __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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="transform.put_transform", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -443,7 +479,8 @@ async def reset_transform( """ if transform_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'transform_id'") - __path = f"/_transform/{_quote(transform_id)}/_reset" + __path_parts: t.Dict[str, str] = {"transform_id": _quote(transform_id)} + __path = f'/_transform/{__path_parts["transform_id"]}/_reset' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -457,7 +494,12 @@ async def reset_transform( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="transform.reset_transform", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -481,7 +523,8 @@ async def schedule_now_transform( """ if transform_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'transform_id'") - __path = f"/_transform/{_quote(transform_id)}/_schedule_now" + __path_parts: t.Dict[str, str] = {"transform_id": _quote(transform_id)} + __path = f'/_transform/{__path_parts["transform_id"]}/_schedule_now' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -495,7 +538,12 @@ async def schedule_now_transform( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="transform.schedule_now_transform", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -526,7 +574,8 @@ async def start_transform( """ if transform_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'transform_id'") - __path = f"/_transform/{_quote(transform_id)}/_start" + __path_parts: t.Dict[str, str] = {"transform_id": _quote(transform_id)} + __path = f'/_transform/{__path_parts["transform_id"]}/_start' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -542,7 +591,12 @@ async def start_transform( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="transform.start_transform", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -589,7 +643,8 @@ async def stop_transform( """ if transform_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'transform_id'") - __path = f"/_transform/{_quote(transform_id)}/_stop" + __path_parts: t.Dict[str, str] = {"transform_id": _quote(transform_id)} + __path = f'/_transform/{__path_parts["transform_id"]}/_stop' __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: __query["allow_no_match"] = allow_no_match @@ -611,7 +666,12 @@ async def stop_transform( __query["wait_for_completion"] = wait_for_completion __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="transform.stop_transform", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -673,7 +733,8 @@ async def update_transform( """ if transform_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'transform_id'") - __path = f"/_transform/{_quote(transform_id)}/_update" + __path_parts: t.Dict[str, str] = {"transform_id": _quote(transform_id)} + __path = f'/_transform/{__path_parts["transform_id"]}/_update' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} if defer_validation is not None: @@ -707,7 +768,13 @@ async def update_transform( __body["sync"] = sync __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 + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="transform.update_transform", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -730,6 +797,7 @@ async def upgrade_transforms( :param timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] = {} __path = "/_transform/_upgrade" __query: t.Dict[str, t.Any] = {} if dry_run is not None: @@ -746,5 +814,10 @@ async def upgrade_transforms( __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="transform.upgrade_transforms", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/watcher.py b/elasticsearch/_async/client/watcher.py index be166d248..6d7b4e17e 100644 --- a/elasticsearch/_async/client/watcher.py +++ b/elasticsearch/_async/client/watcher.py @@ -46,10 +46,16 @@ async def ack_watch( """ if watch_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'watch_id'") + __path_parts: t.Dict[str, str] if watch_id not in SKIP_IN_PATH and action_id not in SKIP_IN_PATH: - __path = f"/_watcher/watch/{_quote(watch_id)}/_ack/{_quote(action_id)}" + __path_parts = { + "watch_id": _quote(watch_id), + "action_id": _quote(action_id), + } + __path = f'/_watcher/watch/{__path_parts["watch_id"]}/_ack/{__path_parts["action_id"]}' elif watch_id not in SKIP_IN_PATH: - __path = f"/_watcher/watch/{_quote(watch_id)}/_ack" + __path_parts = {"watch_id": _quote(watch_id)} + __path = f'/_watcher/watch/{__path_parts["watch_id"]}/_ack' else: raise ValueError("Couldn't find a path for the given parameters") __query: t.Dict[str, t.Any] = {} @@ -63,7 +69,12 @@ async def ack_watch( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers + "PUT", + __path, + params=__query, + headers=__headers, + endpoint_id="watcher.ack_watch", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -85,7 +96,8 @@ async def activate_watch( """ if watch_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'watch_id'") - __path = f"/_watcher/watch/{_quote(watch_id)}/_activate" + __path_parts: t.Dict[str, str] = {"watch_id": _quote(watch_id)} + __path = f'/_watcher/watch/{__path_parts["watch_id"]}/_activate' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -97,7 +109,12 @@ async def activate_watch( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers + "PUT", + __path, + params=__query, + headers=__headers, + endpoint_id="watcher.activate_watch", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -119,7 +136,8 @@ async def deactivate_watch( """ if watch_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'watch_id'") - __path = f"/_watcher/watch/{_quote(watch_id)}/_deactivate" + __path_parts: t.Dict[str, str] = {"watch_id": _quote(watch_id)} + __path = f'/_watcher/watch/{__path_parts["watch_id"]}/_deactivate' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -131,7 +149,12 @@ async def deactivate_watch( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers + "PUT", + __path, + params=__query, + headers=__headers, + endpoint_id="watcher.deactivate_watch", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -153,7 +176,8 @@ async def delete_watch( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_watcher/watch/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_watcher/watch/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -165,7 +189,12 @@ async def delete_watch( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="watcher.delete_watch", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -229,9 +258,12 @@ async def execute_watch( the request. This watch is not persisted to the index and record_execution cannot be set. """ + __path_parts: t.Dict[str, str] if id not in SKIP_IN_PATH: - __path = f"/_watcher/watch/{_quote(id)}/_execute" + __path_parts = {"id": _quote(id)} + __path = f'/_watcher/watch/{__path_parts["id"]}/_execute' else: + __path_parts = {} __path = "/_watcher/watch/_execute" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -266,7 +298,13 @@ async def execute_watch( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="watcher.execute_watch", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -288,7 +326,8 @@ async def get_watch( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_watcher/watch/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_watcher/watch/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -300,7 +339,12 @@ async def get_watch( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="watcher.get_watch", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -357,7 +401,8 @@ async def put_watch( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_watcher/watch/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_watcher/watch/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} if active is not None: @@ -397,7 +442,13 @@ async def put_watch( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="watcher.put_watch", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -437,6 +488,7 @@ async def query_watches( :param size: The number of hits to return. Needs to be non-negative. :param sort: Optional sort definition. """ + __path_parts: t.Dict[str, str] = {} __path = "/_watcher/_query/watches" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -476,7 +528,13 @@ async def query_watches( if __body is not None: __headers["content-type"] = "application/json" return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="watcher.query_watches", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -493,6 +551,7 @@ async def start( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_watcher/_start" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -505,7 +564,12 @@ async def start( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="watcher.start", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -541,9 +605,12 @@ async def stats( :param emit_stacktraces: Defines whether stack traces are generated for each watch that is running. """ + __path_parts: t.Dict[str, str] if metric not in SKIP_IN_PATH: - __path = f"/_watcher/stats/{_quote(metric)}" + __path_parts = {"metric": _quote(metric)} + __path = f'/_watcher/stats/{__path_parts["metric"]}' else: + __path_parts = {} __path = "/_watcher/stats" __query: t.Dict[str, t.Any] = {} if emit_stacktraces is not None: @@ -558,7 +625,12 @@ async def stats( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="watcher.stats", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -575,6 +647,7 @@ async def stop( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_watcher/_stop" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -587,5 +660,10 @@ async def stop( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="watcher.stop", + path_parts=__path_parts, ) diff --git a/elasticsearch/_async/client/xpack.py b/elasticsearch/_async/client/xpack.py index 93308c7da..7acf84d28 100644 --- a/elasticsearch/_async/client/xpack.py +++ b/elasticsearch/_async/client/xpack.py @@ -49,6 +49,7 @@ async def info( :param categories: A comma-separated list of the information categories to include in the response. For example, `build,license,features`. """ + __path_parts: t.Dict[str, str] = {} __path = "/_xpack" __query: t.Dict[str, t.Any] = {} if accept_enterprise is not None: @@ -65,7 +66,12 @@ async def info( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="xpack.info", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -89,6 +95,7 @@ async def usage( no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] = {} __path = "/_xpack/usage" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -103,5 +110,10 @@ async def usage( __query["pretty"] = pretty __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="xpack.usage", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/__init__.py b/elasticsearch/_sync/client/__init__.py index 6eda21719..77e5088ca 100644 --- a/elasticsearch/_sync/client/__init__.py +++ b/elasticsearch/_sync/client/__init__.py @@ -672,9 +672,12 @@ def bulk( ) elif operations is not None and body is not None: raise ValueError("Cannot set both 'operations' and 'body'") + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_bulk" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_bulk' else: + __path_parts = {} __path = "/_bulk" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -709,7 +712,13 @@ def bulk( "content-type": "application/x-ndjson", } return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="bulk", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -732,6 +741,7 @@ def clear_scroll( :param scroll_id: Scroll IDs to clear. To clear all scroll IDs, use `_all`. """ + __path_parts: t.Dict[str, str] = {} __path = "/_search/scroll" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -752,7 +762,13 @@ def clear_scroll( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers, body=__body + "DELETE", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="clear_scroll", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -777,6 +793,7 @@ def close_point_in_time( """ if id is None and body is None: raise ValueError("Empty value passed for parameter 'id'") + __path_parts: t.Dict[str, str] = {} __path = "/_pit" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -797,7 +814,13 @@ def close_point_in_time( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers, body=__body + "DELETE", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="close_point_in_time", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -877,9 +900,12 @@ def count( If a query reaches this limit, Elasticsearch terminates the query early. Elasticsearch collects documents before sorting. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_count" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_count' else: + __path_parts = {} __path = "/_count" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -928,7 +954,13 @@ def count( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="count", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1002,7 +1034,8 @@ def create( ) elif document is not None and body is not None: raise ValueError("Cannot set both 'document' and 'body'") - __path = f"/{_quote(index)}/_create/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"index": _quote(index), "id": _quote(id)} + __path = f'/{__path_parts["index"]}/_create/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -1029,7 +1062,13 @@ def create( __body = document if document is not None else body __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="create", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1086,7 +1125,8 @@ def delete( raise ValueError("Empty value passed for parameter 'index'") if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/{_quote(index)}/_doc/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"index": _quote(index), "id": _quote(id)} + __path = f'/{__path_parts["index"]}/_doc/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -1114,7 +1154,12 @@ def delete( __query["wait_for_active_shards"] = wait_for_active_shards __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="delete", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1245,7 +1290,8 @@ def delete_by_query( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_delete_by_query" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_delete_by_query' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} # The 'sort' parameter with a colon can't be encoded to the body. @@ -1332,7 +1378,13 @@ def delete_by_query( __body["slice"] = slice __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="delete_by_query", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1357,7 +1409,8 @@ def delete_by_query_rethrottle( """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") - __path = f"/_delete_by_query/{_quote(task_id)}/_rethrottle" + __path_parts: t.Dict[str, str] = {"task_id": _quote(task_id)} + __path = f'/_delete_by_query/{__path_parts["task_id"]}/_rethrottle' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -1371,7 +1424,12 @@ def delete_by_query_rethrottle( __query["requests_per_second"] = requests_per_second __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="delete_by_query_rethrottle", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1402,7 +1460,8 @@ def delete_script( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_scripts/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_scripts/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -1418,7 +1477,12 @@ def delete_script( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="delete_script", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1482,7 +1546,8 @@ def exists( raise ValueError("Empty value passed for parameter 'index'") if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/{_quote(index)}/_doc/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"index": _quote(index), "id": _quote(id)} + __path = f'/{__path_parts["index"]}/_doc/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -1514,7 +1579,12 @@ def exists( __query["version_type"] = version_type __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "HEAD", __path, params=__query, headers=__headers + "HEAD", + __path, + params=__query, + headers=__headers, + endpoint_id="exists", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1574,7 +1644,8 @@ def exists_source( raise ValueError("Empty value passed for parameter 'index'") if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/{_quote(index)}/_source/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"index": _quote(index), "id": _quote(id)} + __path = f'/{__path_parts["index"]}/_source/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -1604,7 +1675,12 @@ def exists_source( __query["version_type"] = version_type __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "HEAD", __path, params=__query, headers=__headers + "HEAD", + __path, + params=__query, + headers=__headers, + endpoint_id="exists_source", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1674,7 +1750,8 @@ def explain( raise ValueError("Empty value passed for parameter 'index'") if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/{_quote(index)}/_explain/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"index": _quote(index), "id": _quote(id)} + __path = f'/{__path_parts["index"]}/_explain/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} if analyze_wildcard is not None: @@ -1718,7 +1795,13 @@ def explain( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="explain", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1784,9 +1867,12 @@ def field_caps( :param types: Only return results for fields that have one of the types in the list """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_field_caps" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_field_caps' else: + __path_parts = {} __path = "/_field_caps" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -1825,7 +1911,13 @@ def field_caps( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="field_caps", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1888,7 +1980,8 @@ def get( raise ValueError("Empty value passed for parameter 'index'") if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/{_quote(index)}/_doc/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"index": _quote(index), "id": _quote(id)} + __path = f'/{__path_parts["index"]}/_doc/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -1920,7 +2013,12 @@ def get( __query["version_type"] = version_type __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="get", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1946,7 +2044,8 @@ def get_script( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_scripts/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_scripts/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -1960,7 +2059,12 @@ def get_script( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="get_script", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1977,6 +2081,7 @@ def get_script_context( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_script_context" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1989,7 +2094,12 @@ def get_script_context( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="get_script_context", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -2006,6 +2116,7 @@ def get_script_languages( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_script_language" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -2018,7 +2129,12 @@ def get_script_languages( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="get_script_languages", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2079,7 +2195,8 @@ def get_source( raise ValueError("Empty value passed for parameter 'index'") if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/{_quote(index)}/_source/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"index": _quote(index), "id": _quote(id)} + __path = f'/{__path_parts["index"]}/_source/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -2111,7 +2228,12 @@ def get_source( __query["version_type"] = version_type __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="get_source", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -2138,9 +2260,12 @@ def health_report( :param timeout: Explicit operation timeout. :param verbose: Opt-in for more information about the health of the system. """ + __path_parts: t.Dict[str, str] if feature not in SKIP_IN_PATH: - __path = f"/_health_report/{_quote(feature)}" + __path_parts = {"feature": _quote(feature)} + __path = f'/_health_report/{__path_parts["feature"]}' else: + __path_parts = {} __path = "/_health_report" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -2159,7 +2284,12 @@ def health_report( __query["verbose"] = verbose __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="health_report", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2240,11 +2370,14 @@ def index( ) elif document is not None and body is not None: raise ValueError("Cannot set both 'document' and 'body'") + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH and id not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_doc/{_quote(id)}" + __path_parts = {"index": _quote(index), "id": _quote(id)} + __path = f'/{__path_parts["index"]}/_doc/{__path_parts["id"]}' __method = "PUT" elif index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_doc" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_doc' __method = "POST" else: raise ValueError("Couldn't find a path for the given parameters") @@ -2282,7 +2415,13 @@ def index( __body = document if document is not None else body __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - __method, __path, params=__query, headers=__headers, body=__body + __method, + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="index", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -2299,6 +2438,7 @@ def info( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -2311,7 +2451,12 @@ def info( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="info", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2374,7 +2519,8 @@ def knn_search( raise ValueError("Empty value passed for parameter 'index'") if knn is None and body is None: raise ValueError("Empty value passed for parameter 'knn'") - __path = f"/{_quote(index)}/_knn_search" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_knn_search' __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: @@ -2406,7 +2552,13 @@ def knn_search( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="knn_search", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2467,9 +2619,12 @@ def mget( :param stored_fields: If `true`, retrieves the document fields stored in the index rather than the document `_source`. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_mget" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_mget' else: + __path_parts = {} __path = "/_mget" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -2504,7 +2659,13 @@ def mget( __body["ids"] = ids __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="mget", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2589,9 +2750,12 @@ def msearch( ) elif searches is not None and body is not None: raise ValueError("Cannot set both 'searches' and 'body'") + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_msearch" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_msearch' else: + __path_parts = {} __path = "/_msearch" __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: @@ -2632,7 +2796,13 @@ def msearch( "content-type": "application/x-ndjson", } return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="msearch", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2682,9 +2852,12 @@ def msearch_template( ) elif search_templates is not None and body is not None: raise ValueError("Cannot set both 'search_templates' and 'body'") + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_msearch/template" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_msearch/template' else: + __path_parts = {} __path = "/_msearch/template" __query: t.Dict[str, t.Any] = {} if ccs_minimize_roundtrips is not None: @@ -2711,7 +2884,13 @@ def msearch_template( "content-type": "application/x-ndjson", } return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="msearch_template", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2768,9 +2947,12 @@ def mtermvectors( :param version: If `true`, returns the document version as part of a hit. :param version_type: Specific version type. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_mtermvectors" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_mtermvectors' else: + __path_parts = {} __path = "/_mtermvectors" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -2815,7 +2997,13 @@ def mtermvectors( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="mtermvectors", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -2862,7 +3050,8 @@ def open_point_in_time( raise ValueError("Empty value passed for parameter 'index'") if keep_alive is None: raise ValueError("Empty value passed for parameter 'keep_alive'") - __path = f"/{_quote(index)}/_pit" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_pit' __query: t.Dict[str, t.Any] = {} if keep_alive is not None: __query["keep_alive"] = keep_alive @@ -2884,7 +3073,12 @@ def open_point_in_time( __query["routing"] = routing __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="open_point_in_time", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2928,10 +3122,13 @@ def put_script( raise ValueError("Empty value passed for parameter 'id'") if script is None and body is None: raise ValueError("Empty value passed for parameter 'script'") + __path_parts: t.Dict[str, str] if id not in SKIP_IN_PATH and context not in SKIP_IN_PATH: - __path = f"/_scripts/{_quote(id)}/{_quote(context)}" + __path_parts = {"id": _quote(id), "context": _quote(context)} + __path = f'/_scripts/{__path_parts["id"]}/{__path_parts["context"]}' elif id not in SKIP_IN_PATH: - __path = f"/_scripts/{_quote(id)}" + __path_parts = {"id": _quote(id)} + __path = f'/_scripts/{__path_parts["id"]}' else: raise ValueError("Couldn't find a path for the given parameters") __query: t.Dict[str, t.Any] = {} @@ -2953,7 +3150,13 @@ def put_script( __body["script"] = script __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="put_script", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3008,9 +3211,12 @@ def rank_eval( """ if requests is None and body is None: raise ValueError("Empty value passed for parameter 'requests'") + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_rank_eval" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_rank_eval' else: + __path_parts = {} __path = "/_rank_eval" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -3037,7 +3243,13 @@ def rank_eval( __body["metric"] = metric __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="rank_eval", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3103,6 +3315,7 @@ def reindex( raise ValueError("Empty value passed for parameter 'dest'") if source is None and body is None: raise ValueError("Empty value passed for parameter 'source'") + __path_parts: t.Dict[str, str] = {} __path = "/_reindex" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -3145,7 +3358,13 @@ def reindex( __body["size"] = size __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="reindex", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -3170,7 +3389,8 @@ def reindex_rethrottle( """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") - __path = f"/_reindex/{_quote(task_id)}/_rethrottle" + __path_parts: t.Dict[str, str] = {"task_id": _quote(task_id)} + __path = f'/_reindex/{__path_parts["task_id"]}/_rethrottle' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -3184,7 +3404,12 @@ def reindex_rethrottle( __query["requests_per_second"] = requests_per_second __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="reindex_rethrottle", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3218,9 +3443,12 @@ def render_search_template( search API's request body. These parameters also support Mustache variables. If no `id` or `` is specified, this parameter is required. """ + __path_parts: t.Dict[str, str] if id not in SKIP_IN_PATH: - __path = f"/_render/template/{_quote(id)}" + __path_parts = {"id": _quote(id)} + __path = f'/_render/template/{__path_parts["id"]}' else: + __path_parts = {} __path = "/_render/template" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -3245,7 +3473,13 @@ def render_search_template( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="render_search_template", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3272,6 +3506,7 @@ def scripts_painless_execute( :param context_setup: Additional parameters for the `context`. :param script: The Painless script to execute. """ + __path_parts: t.Dict[str, str] = {} __path = "/_scripts/painless/_execute" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -3296,7 +3531,13 @@ def scripts_painless_execute( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="scripts_painless_execute", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3327,6 +3568,7 @@ def scroll( """ if scroll_id is None and body is None: raise ValueError("Empty value passed for parameter 'scroll_id'") + __path_parts: t.Dict[str, str] = {} __path = "/_search/scroll" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -3351,7 +3593,13 @@ def scroll( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="scroll", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3680,9 +3928,12 @@ def search( by their respective types in the response. :param version: If true, returns document version as part of a hit. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_search" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_search' else: + __path_parts = {} __path = "/_search" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -3838,7 +4089,13 @@ def search( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="search", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3953,7 +4210,14 @@ def search_mvt( raise ValueError("Empty value passed for parameter 'x'") if y in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'y'") - __path = f"/{_quote(index)}/_mvt/{_quote(field)}/{_quote(zoom)}/{_quote(x)}/{_quote(y)}" + __path_parts: t.Dict[str, str] = { + "index": _quote(index), + "field": _quote(field), + "zoom": _quote(zoom), + "x": _quote(x), + "y": _quote(y), + } + __path = f'/{__path_parts["index"]}/_mvt/{__path_parts["field"]}/{__path_parts["zoom"]}/{__path_parts["x"]}/{__path_parts["y"]}' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} # The 'sort' parameter with a colon can't be encoded to the body. @@ -4010,7 +4274,13 @@ def search_mvt( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="search_mvt", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -4061,9 +4331,12 @@ def search_shards( on. Random by default. :param routing: Custom value used to route operations to a specific shard. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_search_shards" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_search_shards' else: + __path_parts = {} __path = "/_search_shards" __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: @@ -4088,7 +4361,12 @@ def search_shards( __query["routing"] = routing __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="search_shards", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -4173,9 +4451,12 @@ def search_template( :param typed_keys: If `true`, the response prefixes aggregation and suggester names with their respective types. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_search/template" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_search/template' else: + __path_parts = {} __path = "/_search/template" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -4222,7 +4503,13 @@ def search_template( __body["source"] = source __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="search_template", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -4281,7 +4568,8 @@ def terms_enum( raise ValueError("Empty value passed for parameter 'index'") if field is None and body is None: raise ValueError("Empty value passed for parameter 'field'") - __path = f"/{_quote(index)}/_terms_enum" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_terms_enum' __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: @@ -4313,7 +4601,13 @@ def terms_enum( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="terms_enum", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -4377,10 +4671,13 @@ def termvectors( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH and id not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_termvectors/{_quote(id)}" + __path_parts = {"index": _quote(index), "id": _quote(id)} + __path = f'/{__path_parts["index"]}/_termvectors/{__path_parts["id"]}' elif index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_termvectors" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_termvectors' else: raise ValueError("Couldn't find a path for the given parameters") __query: t.Dict[str, t.Any] = {} @@ -4428,7 +4725,13 @@ def termvectors( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="termvectors", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -4525,7 +4828,8 @@ def update( raise ValueError("Empty value passed for parameter 'index'") if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/{_quote(index)}/_update/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"index": _quote(index), "id": _quote(id)} + __path = f'/{__path_parts["index"]}/_update/{__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: @@ -4575,7 +4879,13 @@ def update( __body["upsert"] = upsert __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="update", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -4717,7 +5027,8 @@ def update_by_query( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_update_by_query" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_update_by_query' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} # The 'sort' parameter with a colon can't be encoded to the body. @@ -4812,7 +5123,13 @@ def update_by_query( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="update_by_query", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -4837,7 +5154,8 @@ def update_by_query_rethrottle( """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") - __path = f"/_update_by_query/{_quote(task_id)}/_rethrottle" + __path_parts: t.Dict[str, str] = {"task_id": _quote(task_id)} + __path = f'/_update_by_query/{__path_parts["task_id"]}/_rethrottle' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -4851,5 +5169,10 @@ def update_by_query_rethrottle( __query["requests_per_second"] = requests_per_second __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="update_by_query_rethrottle", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/_base.py b/elasticsearch/_sync/client/_base.py index ea08f7f62..581e8ac6c 100644 --- a/elasticsearch/_sync/client/_base.py +++ b/elasticsearch/_sync/client/_base.py @@ -257,6 +257,8 @@ def perform_request( params: Optional[Mapping[str, Any]] = None, headers: Optional[Mapping[str, str]] = None, body: Optional[Any] = None, + endpoint_id: Union[DefaultType, str] = DEFAULT, + path_parts: Union[DefaultType, Mapping[str, Any]] = DEFAULT, ) -> ApiResponse[Any]: if headers: request_headers = self._headers.copy() @@ -292,6 +294,8 @@ def mimetype_header_to_compat(header: str) -> None: retry_on_status=self._retry_on_status, retry_on_timeout=self._retry_on_timeout, client_meta=self._client_meta, + endpoint_id=endpoint_id, + path_parts=path_parts, ) # HEAD with a 404 is returned as a normal response @@ -383,9 +387,17 @@ def perform_request( params: Optional[Mapping[str, Any]] = None, headers: Optional[Mapping[str, str]] = None, body: Optional[Any] = None, + endpoint_id: Union[DefaultType, str] = DEFAULT, + path_parts: Union[DefaultType, Mapping[str, Any]] = DEFAULT, ) -> ApiResponse[Any]: # Use the internal clients .perform_request() implementation # so we take advantage of their transport options. return self._client.perform_request( - method, path, params=params, headers=headers, body=body + method, + path, + params=params, + headers=headers, + body=body, + endpoint_id=endpoint_id, + path_parts=path_parts, ) diff --git a/elasticsearch/_sync/client/async_search.py b/elasticsearch/_sync/client/async_search.py index 9882b2b81..0e6f63dd8 100644 --- a/elasticsearch/_sync/client/async_search.py +++ b/elasticsearch/_sync/client/async_search.py @@ -45,7 +45,8 @@ def delete( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_async_search/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_async_search/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -57,7 +58,12 @@ def delete( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="async_search.delete", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -99,7 +105,8 @@ def get( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_async_search/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_async_search/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -117,7 +124,12 @@ def get( __query["wait_for_completion_timeout"] = wait_for_completion_timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="async_search.get", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -140,7 +152,8 @@ def status( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_async_search/status/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_async_search/status/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -152,7 +165,12 @@ def status( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="async_search.status", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -428,9 +446,12 @@ def submit( up to a certain timeout. When the async search completes within the timeout, the response won’t include the ID as the results are not stored in the cluster. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_async_search" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_async_search' else: + __path_parts = {} __path = "/_async_search" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -590,5 +611,11 @@ def submit( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="async_search.submit", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/autoscaling.py b/elasticsearch/_sync/client/autoscaling.py index e441b9d9c..13f04aa08 100644 --- a/elasticsearch/_sync/client/autoscaling.py +++ b/elasticsearch/_sync/client/autoscaling.py @@ -45,7 +45,8 @@ def delete_autoscaling_policy( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_autoscaling/policy/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_autoscaling/policy/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -57,7 +58,12 @@ def delete_autoscaling_policy( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="autoscaling.delete_autoscaling_policy", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -75,6 +81,7 @@ def get_autoscaling_capacity( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_autoscaling/capacity" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -87,7 +94,12 @@ def get_autoscaling_capacity( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="autoscaling.get_autoscaling_capacity", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -110,7 +122,8 @@ def get_autoscaling_policy( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_autoscaling/policy/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_autoscaling/policy/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -122,7 +135,12 @@ def get_autoscaling_policy( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="autoscaling.get_autoscaling_policy", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -156,7 +174,8 @@ def put_autoscaling_policy( ) elif policy is not None and body is not None: raise ValueError("Cannot set both 'policy' and 'body'") - __path = f"/_autoscaling/policy/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_autoscaling/policy/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -169,5 +188,11 @@ def put_autoscaling_policy( __body = policy if policy is not None else body __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="autoscaling.put_autoscaling_policy", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/cat.py b/elasticsearch/_sync/client/cat.py index c174c7719..1537e5bbe 100644 --- a/elasticsearch/_sync/client/cat.py +++ b/elasticsearch/_sync/client/cat.py @@ -77,9 +77,12 @@ def aliases( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: - __path = f"/_cat/aliases/{_quote(name)}" + __path_parts = {"name": _quote(name)} + __path = f'/_cat/aliases/{__path_parts["name"]}' else: + __path_parts = {} __path = "/_cat/aliases" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -108,7 +111,12 @@ def aliases( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.aliases", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -157,9 +165,12 @@ def allocation( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if node_id not in SKIP_IN_PATH: - __path = f"/_cat/allocation/{_quote(node_id)}" + __path_parts = {"node_id": _quote(node_id)} + __path = f'/_cat/allocation/{__path_parts["node_id"]}' else: + __path_parts = {} __path = "/_cat/allocation" __query: t.Dict[str, t.Any] = {} if bytes is not None: @@ -188,7 +199,12 @@ def allocation( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.allocation", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -232,9 +248,12 @@ def component_templates( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: - __path = f"/_cat/component_templates/{_quote(name)}" + __path_parts = {"name": _quote(name)} + __path = f'/_cat/component_templates/{__path_parts["name"]}' else: + __path_parts = {} __path = "/_cat/component_templates" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -261,7 +280,12 @@ def component_templates( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.component_templates", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -307,9 +331,12 @@ def count( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/_cat/count/{_quote(index)}" + __path_parts = {"index": _quote(index)} + __path = f'/_cat/count/{__path_parts["index"]}' else: + __path_parts = {} __path = "/_cat/count" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -336,7 +363,12 @@ def count( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.count", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -385,9 +417,12 @@ def fielddata( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if fields not in SKIP_IN_PATH: - __path = f"/_cat/fielddata/{_quote(fields)}" + __path_parts = {"fields": _quote(fields)} + __path = f'/_cat/fielddata/{__path_parts["fields"]}' else: + __path_parts = {} __path = "/_cat/fielddata" __query: t.Dict[str, t.Any] = {} if bytes is not None: @@ -416,7 +451,12 @@ def fielddata( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.fielddata", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -463,6 +503,7 @@ def health( :param ts: If true, returns `HH:MM:SS` and Unix epoch timestamps. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] = {} __path = "/_cat/health" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -493,7 +534,12 @@ def health( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.health", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -534,6 +580,7 @@ def help( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] = {} __path = "/_cat" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -560,7 +607,12 @@ def help( __query["v"] = v __headers = {"accept": "text/plain"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.help", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -631,9 +683,12 @@ def indices( :param time: The unit used to display time values. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/_cat/indices/{_quote(index)}" + __path_parts = {"index": _quote(index)} + __path = f'/_cat/indices/{__path_parts["index"]}' else: + __path_parts = {} __path = "/_cat/indices" __query: t.Dict[str, t.Any] = {} if bytes is not None: @@ -672,7 +727,12 @@ def indices( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.indices", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -713,6 +773,7 @@ def master( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] = {} __path = "/_cat/master" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -739,7 +800,12 @@ def master( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.master", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -816,9 +882,12 @@ def ml_data_frame_analytics( :param time: Unit used to display time values. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if id not in SKIP_IN_PATH: - __path = f"/_cat/ml/data_frame/analytics/{_quote(id)}" + __path_parts = {"id": _quote(id)} + __path = f'/_cat/ml/data_frame/analytics/{__path_parts["id"]}' else: + __path_parts = {} __path = "/_cat/ml/data_frame/analytics" __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: @@ -851,7 +920,12 @@ def ml_data_frame_analytics( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.ml_data_frame_analytics", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -932,9 +1006,12 @@ def ml_datafeeds( :param time: The unit used to display time values. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if datafeed_id not in SKIP_IN_PATH: - __path = f"/_cat/ml/datafeeds/{_quote(datafeed_id)}" + __path_parts = {"datafeed_id": _quote(datafeed_id)} + __path = f'/_cat/ml/datafeeds/{__path_parts["datafeed_id"]}' else: + __path_parts = {} __path = "/_cat/ml/datafeeds" __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: @@ -965,7 +1042,12 @@ def ml_datafeeds( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.ml_datafeeds", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1049,9 +1131,12 @@ def ml_jobs( :param time: The unit used to display time values. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if job_id not in SKIP_IN_PATH: - __path = f"/_cat/ml/anomaly_detectors/{_quote(job_id)}" + __path_parts = {"job_id": _quote(job_id)} + __path = f'/_cat/ml/anomaly_detectors/{__path_parts["job_id"]}' else: + __path_parts = {} __path = "/_cat/ml/anomaly_detectors" __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: @@ -1084,7 +1169,12 @@ def ml_jobs( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.ml_jobs", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1170,9 +1260,12 @@ def ml_trained_models( :param size: The maximum number of transforms to display. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if model_id not in SKIP_IN_PATH: - __path = f"/_cat/ml/trained_models/{_quote(model_id)}" + __path_parts = {"model_id": _quote(model_id)} + __path = f'/_cat/ml/trained_models/{__path_parts["model_id"]}' else: + __path_parts = {} __path = "/_cat/ml/trained_models" __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: @@ -1207,7 +1300,12 @@ def ml_trained_models( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.ml_trained_models", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1248,6 +1346,7 @@ def nodeattrs( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] = {} __path = "/_cat/nodeattrs" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1274,7 +1373,12 @@ def nodeattrs( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.nodeattrs", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1325,6 +1429,7 @@ def nodes( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] = {} __path = "/_cat/nodes" __query: t.Dict[str, t.Any] = {} if bytes is not None: @@ -1357,7 +1462,12 @@ def nodes( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.nodes", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1398,6 +1508,7 @@ def pending_tasks( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] = {} __path = "/_cat/pending_tasks" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1424,7 +1535,12 @@ def pending_tasks( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.pending_tasks", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1465,6 +1581,7 @@ def plugins( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] = {} __path = "/_cat/plugins" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1491,7 +1608,12 @@ def plugins( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.plugins", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1545,9 +1667,12 @@ def recovery( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/_cat/recovery/{_quote(index)}" + __path_parts = {"index": _quote(index)} + __path = f'/_cat/recovery/{__path_parts["index"]}' else: + __path_parts = {} __path = "/_cat/recovery" __query: t.Dict[str, t.Any] = {} if active_only is not None: @@ -1580,7 +1705,12 @@ def recovery( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.recovery", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1621,6 +1751,7 @@ def repositories( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] = {} __path = "/_cat/repositories" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1647,7 +1778,12 @@ def repositories( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.repositories", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1696,9 +1832,12 @@ def segments( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/_cat/segments/{_quote(index)}" + __path_parts = {"index": _quote(index)} + __path = f'/_cat/segments/{__path_parts["index"]}' else: + __path_parts = {} __path = "/_cat/segments" __query: t.Dict[str, t.Any] = {} if bytes is not None: @@ -1727,7 +1866,12 @@ def segments( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.segments", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1776,9 +1920,12 @@ def shards( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/_cat/shards/{_quote(index)}" + __path_parts = {"index": _quote(index)} + __path = f'/_cat/shards/{__path_parts["index"]}' else: + __path_parts = {} __path = "/_cat/shards" __query: t.Dict[str, t.Any] = {} if bytes is not None: @@ -1807,7 +1954,12 @@ def shards( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.shards", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1855,9 +2007,12 @@ def snapshots( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if repository not in SKIP_IN_PATH: - __path = f"/_cat/snapshots/{_quote(repository)}" + __path_parts = {"repository": _quote(repository)} + __path = f'/_cat/snapshots/{__path_parts["repository"]}' else: + __path_parts = {} __path = "/_cat/snapshots" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1886,7 +2041,12 @@ def snapshots( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.snapshots", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1938,6 +2098,7 @@ def tasks( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] = {} __path = "/_cat/tasks" __query: t.Dict[str, t.Any] = {} if actions is not None: @@ -1972,7 +2133,12 @@ def tasks( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.tasks", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -2016,9 +2182,12 @@ def templates( a suffix to the column name. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: - __path = f"/_cat/templates/{_quote(name)}" + __path_parts = {"name": _quote(name)} + __path = f'/_cat/templates/{__path_parts["name"]}' else: + __path_parts = {} __path = "/_cat/templates" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -2045,7 +2214,12 @@ def templates( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.templates", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -2094,9 +2268,12 @@ def thread_pool( :param time: The unit used to display time values. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if thread_pool_patterns not in SKIP_IN_PATH: - __path = f"/_cat/thread_pool/{_quote(thread_pool_patterns)}" + __path_parts = {"thread_pool_patterns": _quote(thread_pool_patterns)} + __path = f'/_cat/thread_pool/{__path_parts["thread_pool_patterns"]}' else: + __path_parts = {} __path = "/_cat/thread_pool" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -2125,7 +2302,12 @@ def thread_pool( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.thread_pool", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2213,9 +2395,12 @@ def transforms( :param time: The unit used to display time values. :param v: When set to `true` will enable verbose output. """ + __path_parts: t.Dict[str, str] if transform_id not in SKIP_IN_PATH: - __path = f"/_cat/transforms/{_quote(transform_id)}" + __path_parts = {"transform_id": _quote(transform_id)} + __path = f'/_cat/transforms/{__path_parts["transform_id"]}' else: + __path_parts = {} __path = "/_cat/transforms" __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: @@ -2250,5 +2435,10 @@ def transforms( __query["v"] = v __headers = {"accept": "text/plain,application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cat.transforms", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/ccr.py b/elasticsearch/_sync/client/ccr.py index a121a8274..7a9f793bb 100644 --- a/elasticsearch/_sync/client/ccr.py +++ b/elasticsearch/_sync/client/ccr.py @@ -44,7 +44,8 @@ def delete_auto_follow_pattern( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_ccr/auto_follow/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_ccr/auto_follow/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -56,7 +57,12 @@ def delete_auto_follow_pattern( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="ccr.delete_auto_follow_pattern", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -129,7 +135,8 @@ def follow( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_ccr/follow" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_ccr/follow' __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: @@ -175,7 +182,13 @@ def follow( __body["remote_cluster"] = remote_cluster __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ccr.follow", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -199,7 +212,8 @@ def follow_info( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_ccr/info" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_ccr/info' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -211,7 +225,12 @@ def follow_info( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ccr.follow_info", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -235,7 +254,8 @@ def follow_stats( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_ccr/stats" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_ccr/stats' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -247,7 +267,12 @@ def follow_stats( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ccr.follow_stats", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -286,7 +311,8 @@ def forget_follower( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_ccr/forget_follower" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_ccr/forget_follower' __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: @@ -308,7 +334,13 @@ def forget_follower( __body["leader_remote_cluster"] = leader_remote_cluster __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ccr.forget_follower", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -330,9 +362,12 @@ def get_auto_follow_pattern( :param name: Specifies the auto-follow pattern collection that you want to retrieve. If you do not specify a name, the API returns information for all collections. """ + __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: - __path = f"/_ccr/auto_follow/{_quote(name)}" + __path_parts = {"name": _quote(name)} + __path = f'/_ccr/auto_follow/{__path_parts["name"]}' else: + __path_parts = {} __path = "/_ccr/auto_follow" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -345,7 +380,12 @@ def get_auto_follow_pattern( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ccr.get_auto_follow_pattern", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -368,7 +408,8 @@ def pause_auto_follow_pattern( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_ccr/auto_follow/{_quote(name)}/pause" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_ccr/auto_follow/{__path_parts["name"]}/pause' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -380,7 +421,12 @@ def pause_auto_follow_pattern( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="ccr.pause_auto_follow_pattern", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -404,7 +450,8 @@ def pause_follow( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_ccr/pause_follow" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_ccr/pause_follow' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -416,7 +463,12 @@ def pause_follow( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="ccr.pause_follow", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -521,7 +573,8 @@ def put_auto_follow_pattern( raise ValueError("Empty value passed for parameter 'name'") if remote_cluster is None and body is None: raise ValueError("Empty value passed for parameter 'remote_cluster'") - __path = f"/_ccr/auto_follow/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_ccr/auto_follow/{__path_parts["name"]}' __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: @@ -573,7 +626,13 @@ def put_auto_follow_pattern( __body["settings"] = settings __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ccr.put_auto_follow_pattern", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -596,7 +655,8 @@ def resume_auto_follow_pattern( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_ccr/auto_follow/{_quote(name)}/resume" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_ccr/auto_follow/{__path_parts["name"]}/resume' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -608,7 +668,12 @@ def resume_auto_follow_pattern( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="ccr.resume_auto_follow_pattern", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -668,7 +733,8 @@ def resume_follow( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_ccr/resume_follow" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_ccr/resume_follow' __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: @@ -712,7 +778,13 @@ def resume_follow( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ccr.resume_follow", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -729,6 +801,7 @@ def stats( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_ccr/stats" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -741,7 +814,12 @@ def stats( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ccr.stats", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -765,7 +843,8 @@ def unfollow( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_ccr/unfollow" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_ccr/unfollow' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -777,5 +856,10 @@ def unfollow( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="ccr.unfollow", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/cluster.py b/elasticsearch/_sync/client/cluster.py index f8eecb4a5..345d463dd 100644 --- a/elasticsearch/_sync/client/cluster.py +++ b/elasticsearch/_sync/client/cluster.py @@ -60,6 +60,7 @@ def allocation_explain( :param shard: Specifies the ID of the shard that you would like an explanation for. """ + __path_parts: t.Dict[str, str] = {} __path = "/_cluster/allocation/explain" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -90,7 +91,13 @@ def allocation_explain( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="cluster.allocation_explain", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -122,7 +129,8 @@ def delete_component_template( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_component_template/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_component_template/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -138,7 +146,12 @@ def delete_component_template( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="cluster.delete_component_template", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -163,6 +176,7 @@ def delete_voting_config_exclusions( configuration exclusions list is cleared even if some excluded nodes are still in the cluster. """ + __path_parts: t.Dict[str, str] = {} __path = "/_cluster/voting_config_exclusions" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -177,7 +191,12 @@ def delete_voting_config_exclusions( __query["wait_for_removal"] = wait_for_removal __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="cluster.delete_voting_config_exclusions", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -210,7 +229,8 @@ def exists_component_template( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_component_template/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_component_template/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -226,7 +246,12 @@ def exists_component_template( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "HEAD", __path, params=__query, headers=__headers + "HEAD", + __path, + params=__query, + headers=__headers, + endpoint_id="cluster.exists_component_template", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -261,9 +286,12 @@ def get_component_template( no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: - __path = f"/_component_template/{_quote(name)}" + __path_parts = {"name": _quote(name)} + __path = f'/_component_template/{__path_parts["name"]}' else: + __path_parts = {} __path = "/_component_template" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -284,7 +312,12 @@ def get_component_template( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cluster.get_component_template", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -316,6 +349,7 @@ def get_settings( :param timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] = {} __path = "/_cluster/settings" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -336,7 +370,12 @@ def get_settings( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cluster.get_settings", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -419,9 +458,12 @@ def health( provided) until the status of the cluster changes to the one provided or better, i.e. green > yellow > red. By default, will not wait for any status. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/_cluster/health/{_quote(index)}" + __path_parts = {"index": _quote(index)} + __path = f'/_cluster/health/{__path_parts["index"]}' else: + __path_parts = {} __path = "/_cluster/health" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -456,7 +498,12 @@ def health( __query["wait_for_status"] = wait_for_status __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cluster.health", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -488,7 +535,8 @@ def info( """ if target in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'target'") - __path = f"/_info/{_quote(target)}" + __path_parts: t.Dict[str, str] = {"target": _quote(target)} + __path = f'/_info/{__path_parts["target"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -500,7 +548,12 @@ def info( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cluster.info", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -528,6 +581,7 @@ def pending_tasks( no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] = {} __path = "/_cluster/pending_tasks" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -544,7 +598,12 @@ def pending_tasks( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cluster.pending_tasks", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -574,6 +633,7 @@ def post_voting_config_exclusions( If the timeout expires before the appropriate condition is satisfied, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] = {} __path = "/_cluster/voting_config_exclusions" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -592,7 +652,12 @@ def post_voting_config_exclusions( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="cluster.post_voting_config_exclusions", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -655,7 +720,8 @@ def put_component_template( raise ValueError("Empty value passed for parameter 'name'") if template is None and body is None: raise ValueError("Empty value passed for parameter 'template'") - __path = f"/_component_template/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __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 create is not None: @@ -681,7 +747,13 @@ def put_component_template( __body["version"] = version __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="cluster.put_component_template", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -714,6 +786,7 @@ def put_settings( :param timeout: Explicit operation timeout :param transient: """ + __path_parts: t.Dict[str, str] = {} __path = "/_cluster/settings" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -738,7 +811,13 @@ def put_settings( __body["transient"] = transient __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="cluster.put_settings", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -755,6 +834,7 @@ def remote_info( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_remote/info" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -767,7 +847,12 @@ def remote_info( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cluster.remote_info", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -810,6 +895,7 @@ def reroute( :param timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] = {} __path = "/_cluster/reroute" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -842,7 +928,13 @@ def reroute( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="cluster.reroute", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -899,13 +991,18 @@ def state( :param wait_for_timeout: The maximum time to wait for wait_for_metadata_version before timing out """ + __path_parts: t.Dict[str, str] if metric not in SKIP_IN_PATH and index not in SKIP_IN_PATH: - __path = f"/_cluster/state/{_quote(metric)}/{_quote(index)}" + __path_parts = {"metric": _quote(metric), "index": _quote(index)} + __path = f'/_cluster/state/{__path_parts["metric"]}/{__path_parts["index"]}' elif metric not in SKIP_IN_PATH: - __path = f"/_cluster/state/{_quote(metric)}" + __path_parts = {"metric": _quote(metric)} + __path = f'/_cluster/state/{__path_parts["metric"]}' elif index not in SKIP_IN_PATH: - __path = f"/_cluster/state/_all/{_quote(index)}" + __path_parts = {"index": _quote(index)} + __path = f'/_cluster/state/_all/{__path_parts["index"]}' else: + __path_parts = {} __path = "/_cluster/state" __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: @@ -934,7 +1031,12 @@ def state( __query["wait_for_timeout"] = wait_for_timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cluster.state", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -962,9 +1064,12 @@ def stats( timed out nodes are included in the response’s `_nodes.failed` property. Defaults to no timeout. """ + __path_parts: t.Dict[str, str] if node_id not in SKIP_IN_PATH: - __path = f"/_cluster/stats/nodes/{_quote(node_id)}" + __path_parts = {"node_id": _quote(node_id)} + __path = f'/_cluster/stats/nodes/{__path_parts["node_id"]}' else: + __path_parts = {} __path = "/_cluster/stats" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -981,5 +1086,10 @@ def stats( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="cluster.stats", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/dangling_indices.py b/elasticsearch/_sync/client/dangling_indices.py index 995d46847..8067c1b85 100644 --- a/elasticsearch/_sync/client/dangling_indices.py +++ b/elasticsearch/_sync/client/dangling_indices.py @@ -55,7 +55,8 @@ def delete_dangling_index( raise ValueError("Empty value passed for parameter 'index_uuid'") if accept_data_loss is None: raise ValueError("Empty value passed for parameter 'accept_data_loss'") - __path = f"/_dangling/{_quote(index_uuid)}" + __path_parts: t.Dict[str, str] = {"index_uuid": _quote(index_uuid)} + __path = f'/_dangling/{__path_parts["index_uuid"]}' __query: t.Dict[str, t.Any] = {} if accept_data_loss is not None: __query["accept_data_loss"] = accept_data_loss @@ -73,7 +74,12 @@ def delete_dangling_index( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="dangling_indices.delete_dangling_index", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -106,7 +112,8 @@ def import_dangling_index( raise ValueError("Empty value passed for parameter 'index_uuid'") if accept_data_loss is None: raise ValueError("Empty value passed for parameter 'accept_data_loss'") - __path = f"/_dangling/{_quote(index_uuid)}" + __path_parts: t.Dict[str, str] = {"index_uuid": _quote(index_uuid)} + __path = f'/_dangling/{__path_parts["index_uuid"]}' __query: t.Dict[str, t.Any] = {} if accept_data_loss is not None: __query["accept_data_loss"] = accept_data_loss @@ -124,7 +131,12 @@ def import_dangling_index( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="dangling_indices.import_dangling_index", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -141,6 +153,7 @@ def list_dangling_indices( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_dangling" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -153,5 +166,10 @@ def list_dangling_indices( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="dangling_indices.list_dangling_indices", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/enrich.py b/elasticsearch/_sync/client/enrich.py index f98f162c4..741efc12f 100644 --- a/elasticsearch/_sync/client/enrich.py +++ b/elasticsearch/_sync/client/enrich.py @@ -44,7 +44,8 @@ def delete_policy( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_enrich/policy/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_enrich/policy/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -56,7 +57,12 @@ def delete_policy( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="enrich.delete_policy", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -81,7 +87,8 @@ def execute_policy( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_enrich/policy/{_quote(name)}/_execute" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_enrich/policy/{__path_parts["name"]}/_execute' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -95,7 +102,12 @@ def execute_policy( __query["wait_for_completion"] = wait_for_completion __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers + "PUT", + __path, + params=__query, + headers=__headers, + endpoint_id="enrich.execute_policy", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -116,9 +128,12 @@ def get_policy( :param name: Comma-separated list of enrich policy names used to limit the request. To return information for all enrich policies, omit this parameter. """ + __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: - __path = f"/_enrich/policy/{_quote(name)}" + __path_parts = {"name": _quote(name)} + __path = f'/_enrich/policy/{__path_parts["name"]}' else: + __path_parts = {} __path = "/_enrich/policy" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -131,7 +146,12 @@ def get_policy( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="enrich.get_policy", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -164,7 +184,8 @@ def put_policy( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_enrich/policy/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_enrich/policy/{__path_parts["name"]}' __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: @@ -184,7 +205,13 @@ def put_policy( __body["range"] = range __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="enrich.put_policy", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -202,6 +229,7 @@ def stats( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_enrich/_stats" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -214,5 +242,10 @@ def stats( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="enrich.stats", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/eql.py b/elasticsearch/_sync/client/eql.py index a1ad470f8..824144878 100644 --- a/elasticsearch/_sync/client/eql.py +++ b/elasticsearch/_sync/client/eql.py @@ -47,7 +47,8 @@ def delete( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_eql/search/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_eql/search/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -59,7 +60,12 @@ def delete( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="eql.delete", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -91,7 +97,8 @@ def get( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_eql/search/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_eql/search/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -107,7 +114,12 @@ def get( __query["wait_for_completion_timeout"] = wait_for_completion_timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="eql.get", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -130,7 +142,8 @@ def get_status( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_eql/search/status/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_eql/search/status/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -142,7 +155,12 @@ def get_status( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="eql.get_status", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -238,7 +256,8 @@ def search( raise ValueError("Empty value passed for parameter 'index'") if query is None and body is None: raise ValueError("Empty value passed for parameter 'query'") - __path = f"/{_quote(index)}/_eql/search" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_eql/search' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} if allow_no_indices is not None: @@ -286,5 +305,11 @@ def search( __body["wait_for_completion_timeout"] = wait_for_completion_timeout __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="eql.search", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/esql.py b/elasticsearch/_sync/client/esql.py index 2b5ac804c..f30f6fd09 100644 --- a/elasticsearch/_sync/client/esql.py +++ b/elasticsearch/_sync/client/esql.py @@ -68,6 +68,7 @@ def query( """ if query is None and body is None: raise ValueError("Empty value passed for parameter 'query'") + __path_parts: t.Dict[str, str] = {} __path = "/_query" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -96,5 +97,11 @@ def query( __body["params"] = params __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="esql.query", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/features.py b/elasticsearch/_sync/client/features.py index 6470a3acb..0adb4973e 100644 --- a/elasticsearch/_sync/client/features.py +++ b/elasticsearch/_sync/client/features.py @@ -40,6 +40,7 @@ def get_features( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_features" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -52,7 +53,12 @@ def get_features( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="features.get_features", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -69,6 +75,7 @@ def reset_features( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_features/_reset" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -81,5 +88,10 @@ def reset_features( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="features.reset_features", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/fleet.py b/elasticsearch/_sync/client/fleet.py index 77d43b90c..7048c5b33 100644 --- a/elasticsearch/_sync/client/fleet.py +++ b/elasticsearch/_sync/client/fleet.py @@ -59,7 +59,8 @@ def global_checkpoints( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_fleet/global_checkpoints" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_fleet/global_checkpoints' __query: t.Dict[str, t.Any] = {} if checkpoints is not None: __query["checkpoints"] = checkpoints @@ -79,7 +80,12 @@ def global_checkpoints( __query["wait_for_index"] = wait_for_index __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="fleet.global_checkpoints", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -171,9 +177,12 @@ def msearch( ) elif searches is not None and body is not None: raise ValueError("Cannot set both 'searches' and 'body'") + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_fleet/_fleet_msearch" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_fleet/_fleet_msearch' else: + __path_parts = {} __path = "/_fleet/_fleet_msearch" __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: @@ -216,7 +225,13 @@ def msearch( "content-type": "application/x-ndjson", } return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="fleet.msearch", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -460,7 +475,8 @@ def search( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_fleet/_fleet_search" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_fleet/_fleet_search' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} # The 'sort' parameter with a colon can't be encoded to the body. @@ -613,5 +629,11 @@ def search( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="fleet.search", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/graph.py b/elasticsearch/_sync/client/graph.py index 100080a3f..527adc5c2 100644 --- a/elasticsearch/_sync/client/graph.py +++ b/elasticsearch/_sync/client/graph.py @@ -65,7 +65,8 @@ def explore( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_graph/explore" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_graph/explore' __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: @@ -95,5 +96,11 @@ def explore( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="graph.explore", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/ilm.py b/elasticsearch/_sync/client/ilm.py index b88a286b1..79821d5e7 100644 --- a/elasticsearch/_sync/client/ilm.py +++ b/elasticsearch/_sync/client/ilm.py @@ -54,7 +54,8 @@ def delete_lifecycle( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_ilm/policy/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"policy": _quote(name)} + __path = f'/_ilm/policy/{__path_parts["policy"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -70,7 +71,12 @@ def delete_lifecycle( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="ilm.delete_lifecycle", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -111,7 +117,8 @@ def explain_lifecycle( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_ilm/explain" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_ilm/explain' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -131,7 +138,12 @@ def explain_lifecycle( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ilm.explain_lifecycle", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -161,9 +173,12 @@ def get_lifecycle( :param timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: - __path = f"/_ilm/policy/{_quote(name)}" + __path_parts = {"policy": _quote(name)} + __path = f'/_ilm/policy/{__path_parts["policy"]}' else: + __path_parts = {} __path = "/_ilm/policy" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -180,7 +195,12 @@ def get_lifecycle( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ilm.get_lifecycle", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -197,6 +217,7 @@ def get_status( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_ilm/status" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -209,7 +230,12 @@ def get_status( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ilm.get_status", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -239,6 +265,7 @@ def migrate_to_data_tiers( :param legacy_template_to_delete: :param node_attribute: """ + __path_parts: t.Dict[str, str] = {} __path = "/_ilm/migrate_to_data_tiers" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -263,7 +290,13 @@ def migrate_to_data_tiers( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ilm.migrate_to_data_tiers", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -292,7 +325,8 @@ def move_to_step( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/_ilm/move/{_quote(index)}" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/_ilm/move/{__path_parts["index"]}' __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: @@ -314,7 +348,13 @@ def move_to_step( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ilm.move_to_step", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -350,7 +390,8 @@ def put_lifecycle( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_ilm/policy/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"policy": _quote(name)} + __path = f'/_ilm/policy/{__path_parts["policy"]}' __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: @@ -374,7 +415,13 @@ def put_lifecycle( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ilm.put_lifecycle", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -396,7 +443,8 @@ def remove_policy( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_ilm/remove" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_ilm/remove' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -408,7 +456,12 @@ def remove_policy( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="ilm.remove_policy", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -431,7 +484,8 @@ def retry( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_ilm/retry" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_ilm/retry' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -443,7 +497,12 @@ def retry( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="ilm.retry", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -467,6 +526,7 @@ def start( :param master_timeout: :param timeout: """ + __path_parts: t.Dict[str, str] = {} __path = "/_ilm/start" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -483,7 +543,12 @@ def start( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="ilm.start", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -508,6 +573,7 @@ def stop( :param master_timeout: :param timeout: """ + __path_parts: t.Dict[str, str] = {} __path = "/_ilm/stop" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -524,5 +590,10 @@ def stop( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="ilm.stop", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/indices.py b/elasticsearch/_sync/client/indices.py index 452ca8e1c..2fc82396d 100644 --- a/elasticsearch/_sync/client/indices.py +++ b/elasticsearch/_sync/client/indices.py @@ -71,7 +71,11 @@ def add_block( raise ValueError("Empty value passed for parameter 'index'") if block in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'block'") - __path = f"/{_quote(index)}/_block/{_quote(block)}" + __path_parts: t.Dict[str, str] = { + "index": _quote(index), + "block": _quote(block), + } + __path = f'/{__path_parts["index"]}/_block/{__path_parts["block"]}' __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: __query["allow_no_indices"] = allow_no_indices @@ -93,7 +97,12 @@ def add_block( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers + "PUT", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.add_block", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -155,9 +164,12 @@ def analyze( as a multi-value field. :param tokenizer: Tokenizer to use to convert text into tokens. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_analyze" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_analyze' else: + __path_parts = {} __path = "/_analyze" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -194,7 +206,13 @@ def analyze( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.analyze", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -245,9 +263,12 @@ def clear_cache( :param query: If `true`, clears the query cache. :param request: If `true`, clears the request cache. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_cache/clear" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_cache/clear' else: + __path_parts = {} __path = "/_cache/clear" __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: @@ -274,7 +295,12 @@ def clear_cache( __query["request"] = request __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.clear_cache", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -322,7 +348,11 @@ def clone( raise ValueError("Empty value passed for parameter 'index'") if target in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'target'") - __path = f"/{_quote(index)}/_clone/{_quote(target)}" + __path_parts: t.Dict[str, str] = { + "index": _quote(index), + "target": _quote(target), + } + __path = f'/{__path_parts["index"]}/_clone/{__path_parts["target"]}' __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: @@ -350,7 +380,13 @@ def clone( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.clone", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -407,7 +443,8 @@ def close( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_close" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_close' __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: __query["allow_no_indices"] = allow_no_indices @@ -431,7 +468,12 @@ def close( __query["wait_for_active_shards"] = wait_for_active_shards __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.close", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -478,7 +520,8 @@ def create( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}' __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: @@ -508,7 +551,13 @@ def create( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.create", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -534,7 +583,8 @@ def create_data_stream( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_data_stream/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_data_stream/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -546,7 +596,12 @@ def create_data_stream( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers + "PUT", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.create_data_stream", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -578,9 +633,12 @@ def data_streams_stats( :param expand_wildcards: Type of data stream that wildcard patterns can match. Supports comma-separated values, such as `open,hidden`. """ + __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: - __path = f"/_data_stream/{_quote(name)}/_stats" + __path_parts = {"name": _quote(name)} + __path = f'/_data_stream/{__path_parts["name"]}/_stats' else: + __path_parts = {} __path = "/_data_stream/_stats" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -595,7 +653,12 @@ def data_streams_stats( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.data_streams_stats", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -648,7 +711,8 @@ def delete( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}' __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: __query["allow_no_indices"] = allow_no_indices @@ -670,7 +734,12 @@ def delete( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.delete", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -707,7 +776,8 @@ def delete_alias( raise ValueError("Empty value passed for parameter 'index'") if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/{_quote(index)}/_alias/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"index": _quote(index), "name": _quote(name)} + __path = f'/{__path_parts["index"]}/_alias/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -723,7 +793,12 @@ def delete_alias( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.delete_alias", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -762,7 +837,8 @@ def delete_data_lifecycle( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_data_stream/{_quote(name)}/_lifecycle" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_data_stream/{__path_parts["name"]}/_lifecycle' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -780,7 +856,12 @@ def delete_data_lifecycle( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.delete_data_lifecycle", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -813,7 +894,8 @@ def delete_data_stream( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_data_stream/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_data_stream/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -827,7 +909,12 @@ def delete_data_stream( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.delete_data_stream", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -859,7 +946,8 @@ def delete_index_template( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_index_template/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_index_template/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -875,7 +963,12 @@ def delete_index_template( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.delete_index_template", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -907,7 +1000,8 @@ def delete_template( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_template/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_template/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -923,7 +1017,12 @@ def delete_template( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.delete_template", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -975,7 +1074,8 @@ def disk_usage( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_disk_usage" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_disk_usage' __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: __query["allow_no_indices"] = allow_no_indices @@ -997,7 +1097,12 @@ def disk_usage( __query["run_expensive_tasks"] = run_expensive_tasks __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.disk_usage", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1034,7 +1139,11 @@ def downsample( ) elif config is not None and body is not None: raise ValueError("Cannot set both 'config' and 'body'") - __path = f"/{_quote(index)}/_downsample/{_quote(target_index)}" + __path_parts: t.Dict[str, str] = { + "index": _quote(index), + "target_index": _quote(target_index), + } + __path = f'/{__path_parts["index"]}/_downsample/{__path_parts["target_index"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -1047,7 +1156,13 @@ def downsample( __body = config if config is not None else body __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.downsample", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1096,7 +1211,8 @@ def exists( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}' __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: __query["allow_no_indices"] = allow_no_indices @@ -1120,7 +1236,12 @@ def exists( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "HEAD", __path, params=__query, headers=__headers + "HEAD", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.exists", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1168,10 +1289,13 @@ def exists_alias( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH and name not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_alias/{_quote(name)}" + __path_parts = {"index": _quote(index), "name": _quote(name)} + __path = f'/{__path_parts["index"]}/_alias/{__path_parts["name"]}' elif name not in SKIP_IN_PATH: - __path = f"/_alias/{_quote(name)}" + __path_parts = {"name": _quote(name)} + __path = f'/_alias/{__path_parts["name"]}' else: raise ValueError("Couldn't find a path for the given parameters") __query: t.Dict[str, t.Any] = {} @@ -1193,7 +1317,12 @@ def exists_alias( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "HEAD", __path, params=__query, headers=__headers + "HEAD", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.exists_alias", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1222,7 +1351,8 @@ def exists_index_template( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_index_template/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_index_template/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -1236,7 +1366,12 @@ def exists_index_template( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "HEAD", __path, params=__query, headers=__headers + "HEAD", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.exists_index_template", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1267,7 +1402,8 @@ def exists_template( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_template/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_template/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -1285,7 +1421,12 @@ def exists_template( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "HEAD", __path, params=__query, headers=__headers + "HEAD", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.exists_template", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1315,7 +1456,8 @@ def explain_data_lifecycle( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_lifecycle/explain" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_lifecycle/explain' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -1331,7 +1473,12 @@ def explain_data_lifecycle( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.explain_data_lifecycle", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1393,7 +1540,8 @@ def field_usage_stats( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_field_usage_stats" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_field_usage_stats' __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: __query["allow_no_indices"] = allow_no_indices @@ -1419,7 +1567,12 @@ def field_usage_stats( __query["wait_for_active_shards"] = wait_for_active_shards __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.field_usage_stats", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1467,9 +1620,12 @@ def flush( when another flush operation is running. If `false`, Elasticsearch returns an error if you request a flush when another flush operation is running. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_flush" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_flush' else: + __path_parts = {} __path = "/_flush" __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: @@ -1492,7 +1648,12 @@ def flush( __query["wait_if_ongoing"] = wait_if_ongoing __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.flush", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1542,9 +1703,12 @@ def forcemerge( :param wait_for_completion: Should the request wait until the force merge is completed. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_forcemerge" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_forcemerge' else: + __path_parts = {} __path = "/_forcemerge" __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: @@ -1571,7 +1735,12 @@ def forcemerge( __query["wait_for_completion"] = wait_for_completion __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.forcemerge", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1638,7 +1807,8 @@ def get( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}' __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: __query["allow_no_indices"] = allow_no_indices @@ -1666,7 +1836,12 @@ def get( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.get", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1713,13 +1888,18 @@ def get_alias( :param local: If `true`, the request retrieves information from the local node only. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH and name not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_alias/{_quote(name)}" + __path_parts = {"index": _quote(index), "name": _quote(name)} + __path = f'/{__path_parts["index"]}/_alias/{__path_parts["name"]}' elif index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_alias" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_alias' elif name not in SKIP_IN_PATH: - __path = f"/_alias/{_quote(name)}" + __path_parts = {"name": _quote(name)} + __path = f'/_alias/{__path_parts["name"]}' else: + __path_parts = {} __path = "/_alias" __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: @@ -1740,7 +1920,12 @@ def get_alias( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.get_alias", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1777,7 +1962,8 @@ def get_data_lifecycle( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_data_stream/{_quote(name)}/_lifecycle" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_data_stream/{__path_parts["name"]}/_lifecycle' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -1793,7 +1979,12 @@ def get_data_lifecycle( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.get_data_lifecycle", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1828,9 +2019,12 @@ def get_data_stream( :param include_defaults: If true, returns all relevant default configurations for the index template. """ + __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: - __path = f"/_data_stream/{_quote(name)}" + __path_parts = {"name": _quote(name)} + __path = f'/_data_stream/{__path_parts["name"]}' else: + __path_parts = {} __path = "/_data_stream" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1847,7 +2041,12 @@ def get_data_stream( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.get_data_stream", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1898,10 +2097,13 @@ def get_field_mapping( """ if fields in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'fields'") + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH and fields not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_mapping/field/{_quote(fields)}" + __path_parts = {"index": _quote(index), "fields": _quote(fields)} + __path = f'/{__path_parts["index"]}/_mapping/field/{__path_parts["fields"]}' elif fields not in SKIP_IN_PATH: - __path = f"/_mapping/field/{_quote(fields)}" + __path_parts = {"fields": _quote(fields)} + __path = f'/_mapping/field/{__path_parts["fields"]}' else: raise ValueError("Couldn't find a path for the given parameters") __query: t.Dict[str, t.Any] = {} @@ -1925,7 +2127,12 @@ def get_field_mapping( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.get_field_mapping", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1961,9 +2168,12 @@ def get_index_template( no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: - __path = f"/_index_template/{_quote(name)}" + __path_parts = {"name": _quote(name)} + __path = f'/_index_template/{__path_parts["name"]}' else: + __path_parts = {} __path = "/_index_template" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1984,7 +2194,12 @@ def get_index_template( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.get_index_template", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -2034,9 +2249,12 @@ def get_mapping( no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_mapping" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_mapping' else: + __path_parts = {} __path = "/_mapping" __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: @@ -2059,7 +2277,12 @@ def get_mapping( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.get_mapping", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -2117,13 +2340,18 @@ def get_settings( no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH and name not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_settings/{_quote(name)}" + __path_parts = {"index": _quote(index), "name": _quote(name)} + __path = f'/{__path_parts["index"]}/_settings/{__path_parts["name"]}' elif index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_settings" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_settings' elif name not in SKIP_IN_PATH: - __path = f"/_settings/{_quote(name)}" + __path_parts = {"name": _quote(name)} + __path = f'/_settings/{__path_parts["name"]}' else: + __path_parts = {} __path = "/_settings" __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: @@ -2150,7 +2378,12 @@ def get_settings( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.get_settings", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -2183,9 +2416,12 @@ def get_template( no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: - __path = f"/_template/{_quote(name)}" + __path_parts = {"name": _quote(name)} + __path = f'/_template/{__path_parts["name"]}' else: + __path_parts = {} __path = "/_template" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -2204,7 +2440,12 @@ def get_template( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.get_template", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -2226,7 +2467,8 @@ def migrate_to_data_stream( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_data_stream/_migrate/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_data_stream/_migrate/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -2238,7 +2480,12 @@ def migrate_to_data_stream( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.migrate_to_data_stream", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2263,6 +2510,7 @@ def modify_data_stream( """ if actions is None and body is None: raise ValueError("Empty value passed for parameter 'actions'") + __path_parts: t.Dict[str, str] = {} __path = "/_data_stream/_modify" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -2279,7 +2527,13 @@ def modify_data_stream( __body["actions"] = actions __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.modify_data_stream", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -2340,7 +2594,8 @@ def open( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_open" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_open' __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: __query["allow_no_indices"] = allow_no_indices @@ -2364,7 +2619,12 @@ def open( __query["wait_for_active_shards"] = wait_for_active_shards __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.open", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -2387,7 +2647,8 @@ def promote_data_stream( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_data_stream/_promote/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_data_stream/_promote/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -2399,7 +2660,12 @@ def promote_data_stream( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.promote_data_stream", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2466,7 +2732,8 @@ def put_alias( raise ValueError("Empty value passed for parameter 'index'") if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/{_quote(index)}/_alias/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"index": _quote(index), "name": _quote(name)} + __path = f'/{__path_parts["index"]}/_alias/{__path_parts["name"]}' __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: @@ -2498,7 +2765,13 @@ def put_alias( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.put_alias", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2555,7 +2828,8 @@ def put_data_lifecycle( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_data_stream/{_quote(name)}/_lifecycle" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_data_stream/{__path_parts["name"]}/_lifecycle' __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: @@ -2583,7 +2857,13 @@ def put_data_lifecycle( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.put_data_lifecycle", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2645,7 +2925,8 @@ def put_index_template( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_index_template/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_index_template/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} if create is not None: @@ -2675,7 +2956,13 @@ def put_index_template( __body["version"] = version __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.put_index_template", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2785,7 +3072,8 @@ def put_mapping( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_mapping" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_mapping' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} if allow_no_indices is not None: @@ -2833,7 +3121,13 @@ def put_mapping( __body["_source"] = source __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.put_mapping", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2899,9 +3193,12 @@ def put_settings( ) elif settings is not None and body is not None: raise ValueError("Cannot set both 'settings' and 'body'") + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_settings" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_settings' else: + __path_parts = {} __path = "/_settings" __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: @@ -2929,7 +3226,13 @@ def put_settings( __body = settings if settings is not None else body __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.put_settings", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2992,7 +3295,8 @@ def put_template( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_template/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_template/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} if create is not None: @@ -3026,7 +3330,13 @@ def put_template( __body["version"] = version __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.put_template", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -3053,9 +3363,12 @@ def recovery( :param detailed: If `true`, the response includes detailed information about shard recoveries. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_recovery" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_recovery' else: + __path_parts = {} __path = "/_recovery" __query: t.Dict[str, t.Any] = {} if active_only is not None: @@ -3072,7 +3385,12 @@ def recovery( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.recovery", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -3113,9 +3431,12 @@ def refresh( :param ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_refresh" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_refresh' else: + __path_parts = {} __path = "/_refresh" __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: @@ -3134,7 +3455,12 @@ def refresh( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.refresh", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -3173,7 +3499,8 @@ def reload_search_analyzers( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_reload_search_analyzers" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_reload_search_analyzers' __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: __query["allow_no_indices"] = allow_no_indices @@ -3191,7 +3518,12 @@ def reload_search_analyzers( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.reload_search_analyzers", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -3240,7 +3572,8 @@ def resolve_cluster( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_resolve/cluster/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_resolve/cluster/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: __query["allow_no_indices"] = allow_no_indices @@ -3260,7 +3593,12 @@ def resolve_cluster( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.resolve_cluster", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -3296,7 +3634,8 @@ def resolve_index( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_resolve/index/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_resolve/index/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -3310,7 +3649,12 @@ def resolve_index( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.resolve_index", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3373,10 +3717,13 @@ def rollover( """ if alias in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'alias'") + __path_parts: t.Dict[str, str] if alias not in SKIP_IN_PATH and new_index not in SKIP_IN_PATH: - __path = f"/{_quote(alias)}/_rollover/{_quote(new_index)}" + __path_parts = {"alias": _quote(alias), "new_index": _quote(new_index)} + __path = f'/{__path_parts["alias"]}/_rollover/{__path_parts["new_index"]}' elif alias not in SKIP_IN_PATH: - __path = f"/{_quote(alias)}/_rollover" + __path_parts = {"alias": _quote(alias)} + __path = f'/{__path_parts["alias"]}/_rollover' else: raise ValueError("Couldn't find a path for the given parameters") __query: t.Dict[str, t.Any] = {} @@ -3412,7 +3759,13 @@ def rollover( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.rollover", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -3455,9 +3808,12 @@ def segments( a missing or closed index. :param verbose: If `true`, the request returns a verbose response. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_segments" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_segments' else: + __path_parts = {} __path = "/_segments" __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: @@ -3478,7 +3834,12 @@ def segments( __query["verbose"] = verbose __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.segments", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -3523,9 +3884,12 @@ def shard_stores( in the response. :param status: List of shard health statuses used to limit the request. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_shard_stores" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_shard_stores' else: + __path_parts = {} __path = "/_shard_stores" __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: @@ -3546,7 +3910,12 @@ def shard_stores( __query["status"] = status __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.shard_stores", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3594,7 +3963,11 @@ def shrink( raise ValueError("Empty value passed for parameter 'index'") if target in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'target'") - __path = f"/{_quote(index)}/_shrink/{_quote(target)}" + __path_parts: t.Dict[str, str] = { + "index": _quote(index), + "target": _quote(target), + } + __path = f'/{__path_parts["index"]}/_shrink/{__path_parts["target"]}' __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: @@ -3622,7 +3995,13 @@ def shrink( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.shrink", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3704,7 +4083,8 @@ def simulate_index_template( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_index_template/_simulate_index/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_index_template/_simulate_index/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} if create is not None: @@ -3744,7 +4124,13 @@ def simulate_index_template( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.simulate_index_template", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3791,9 +4177,12 @@ def simulate_template( ) elif template is not None and body is not None: raise ValueError("Cannot set both 'template' and 'body'") + __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: - __path = f"/_index_template/_simulate/{_quote(name)}" + __path_parts = {"name": _quote(name)} + __path = f'/_index_template/_simulate/{__path_parts["name"]}' else: + __path_parts = {} __path = "/_index_template/_simulate" __query: t.Dict[str, t.Any] = {} if create is not None: @@ -3817,7 +4206,13 @@ def simulate_template( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.simulate_template", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3865,7 +4260,11 @@ def split( raise ValueError("Empty value passed for parameter 'index'") if target in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'target'") - __path = f"/{_quote(index)}/_split/{_quote(target)}" + __path_parts: t.Dict[str, str] = { + "index": _quote(index), + "target": _quote(target), + } + __path = f'/{__path_parts["index"]}/_split/{__path_parts["target"]}' __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: @@ -3893,7 +4292,13 @@ def split( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.split", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -3955,13 +4360,18 @@ def stats( :param level: Indicates whether statistics are aggregated at the cluster, index, or shard level. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH and metric not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_stats/{_quote(metric)}" + __path_parts = {"index": _quote(index), "metric": _quote(metric)} + __path = f'/{__path_parts["index"]}/_stats/{__path_parts["metric"]}' elif index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_stats" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_stats' elif metric not in SKIP_IN_PATH: - __path = f"/_stats/{_quote(metric)}" + __path_parts = {"metric": _quote(metric)} + __path = f'/_stats/{__path_parts["metric"]}' else: + __path_parts = {} __path = "/_stats" __query: t.Dict[str, t.Any] = {} if completion_fields is not None: @@ -3992,7 +4402,12 @@ def stats( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.stats", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -4047,7 +4462,8 @@ def unfreeze( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_unfreeze" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_unfreeze' __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: __query["allow_no_indices"] = allow_no_indices @@ -4071,7 +4487,12 @@ def unfreeze( __query["wait_for_active_shards"] = wait_for_active_shards __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.unfreeze", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -4103,6 +4524,7 @@ def update_aliases( :param timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] = {} __path = "/_aliases" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -4123,7 +4545,13 @@ def update_aliases( __body["actions"] = actions __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.update_aliases", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -4195,9 +4623,12 @@ def validate_query( :param rewrite: If `true`, returns a more detailed explanation showing the actual Lucene query that will be executed. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_validate/query" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_validate/query' else: + __path_parts = {} __path = "/_validate/query" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -4242,5 +4673,11 @@ def validate_query( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="indices.validate_query", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/inference.py b/elasticsearch/_sync/client/inference.py index a7f0ac1df..8391b99d3 100644 --- a/elasticsearch/_sync/client/inference.py +++ b/elasticsearch/_sync/client/inference.py @@ -48,10 +48,16 @@ def delete_model( """ if inference_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'inference_id'") + __path_parts: t.Dict[str, str] if task_type not in SKIP_IN_PATH and inference_id not in SKIP_IN_PATH: - __path = f"/_inference/{_quote(task_type)}/{_quote(inference_id)}" + __path_parts = { + "task_type": _quote(task_type), + "inference_id": _quote(inference_id), + } + __path = f'/_inference/{__path_parts["task_type"]}/{__path_parts["inference_id"]}' elif inference_id not in SKIP_IN_PATH: - __path = f"/_inference/{_quote(inference_id)}" + __path_parts = {"inference_id": _quote(inference_id)} + __path = f'/_inference/{__path_parts["inference_id"]}' else: raise ValueError("Couldn't find a path for the given parameters") __query: t.Dict[str, t.Any] = {} @@ -65,7 +71,12 @@ def delete_model( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="inference.delete_model", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -91,10 +102,16 @@ def get_model( """ if inference_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'inference_id'") + __path_parts: t.Dict[str, str] if task_type not in SKIP_IN_PATH and inference_id not in SKIP_IN_PATH: - __path = f"/_inference/{_quote(task_type)}/{_quote(inference_id)}" + __path_parts = { + "task_type": _quote(task_type), + "inference_id": _quote(inference_id), + } + __path = f'/_inference/{__path_parts["task_type"]}/{__path_parts["inference_id"]}' elif inference_id not in SKIP_IN_PATH: - __path = f"/_inference/{_quote(inference_id)}" + __path_parts = {"inference_id": _quote(inference_id)} + __path = f'/_inference/{__path_parts["inference_id"]}' else: raise ValueError("Couldn't find a path for the given parameters") __query: t.Dict[str, t.Any] = {} @@ -108,7 +125,12 @@ def get_model( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="inference.get_model", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -143,10 +165,16 @@ def inference( raise ValueError("Empty value passed for parameter 'inference_id'") if input is None and body is None: raise ValueError("Empty value passed for parameter 'input'") + __path_parts: t.Dict[str, str] if task_type not in SKIP_IN_PATH and inference_id not in SKIP_IN_PATH: - __path = f"/_inference/{_quote(task_type)}/{_quote(inference_id)}" + __path_parts = { + "task_type": _quote(task_type), + "inference_id": _quote(inference_id), + } + __path = f'/_inference/{__path_parts["task_type"]}/{__path_parts["inference_id"]}' elif inference_id not in SKIP_IN_PATH: - __path = f"/_inference/{_quote(inference_id)}" + __path_parts = {"inference_id": _quote(inference_id)} + __path = f'/_inference/{__path_parts["inference_id"]}' else: raise ValueError("Couldn't find a path for the given parameters") __query: t.Dict[str, t.Any] = {} @@ -170,7 +198,13 @@ def inference( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="inference.inference", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -207,10 +241,16 @@ def put_model( ) elif model_config is not None and body is not None: raise ValueError("Cannot set both 'model_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 = f"/_inference/{_quote(task_type)}/{_quote(inference_id)}" + __path_parts = { + "task_type": _quote(task_type), + "inference_id": _quote(inference_id), + } + __path = f'/_inference/{__path_parts["task_type"]}/{__path_parts["inference_id"]}' elif inference_id not in SKIP_IN_PATH: - __path = f"/_inference/{_quote(inference_id)}" + __path_parts = {"inference_id": _quote(inference_id)} + __path = f'/_inference/{__path_parts["inference_id"]}' else: raise ValueError("Couldn't find a path for the given parameters") __query: t.Dict[str, t.Any] = {} @@ -229,5 +269,11 @@ def put_model( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="inference.put_model", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/ingest.py b/elasticsearch/_sync/client/ingest.py index d871e88bd..bcf217012 100644 --- a/elasticsearch/_sync/client/ingest.py +++ b/elasticsearch/_sync/client/ingest.py @@ -54,7 +54,8 @@ def delete_pipeline( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_ingest/pipeline/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_ingest/pipeline/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -70,7 +71,12 @@ def delete_pipeline( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="ingest.delete_pipeline", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -87,6 +93,7 @@ def geo_ip_stats( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_ingest/geoip/stats" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -99,7 +106,12 @@ def geo_ip_stats( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ingest.geo_ip_stats", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -128,9 +140,12 @@ def get_pipeline( returns an error. :param summary: Return pipelines without their definitions (default: false) """ + __path_parts: t.Dict[str, str] if id not in SKIP_IN_PATH: - __path = f"/_ingest/pipeline/{_quote(id)}" + __path_parts = {"id": _quote(id)} + __path = f'/_ingest/pipeline/{__path_parts["id"]}' else: + __path_parts = {} __path = "/_ingest/pipeline" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -147,7 +162,12 @@ def get_pipeline( __query["summary"] = summary __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ingest.get_pipeline", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -164,6 +184,7 @@ def processor_grok( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_ingest/processor/grok" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -176,7 +197,12 @@ def processor_grok( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ingest.processor_grok", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -233,7 +259,8 @@ def put_pipeline( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_ingest/pipeline/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_ingest/pipeline/{__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: @@ -263,7 +290,13 @@ def put_pipeline( __body["version"] = version __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ingest.put_pipeline", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -296,9 +329,12 @@ def simulate( :param verbose: If `true`, the response includes output data for each processor in the executed pipeline. """ + __path_parts: t.Dict[str, str] if id not in SKIP_IN_PATH: - __path = f"/_ingest/pipeline/{_quote(id)}/_simulate" + __path_parts = {"id": _quote(id)} + __path = f'/_ingest/pipeline/{__path_parts["id"]}/_simulate' else: + __path_parts = {} __path = "/_ingest/pipeline/_simulate" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -319,5 +355,11 @@ def simulate( __body["pipeline"] = pipeline __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ingest.simulate", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/license.py b/elasticsearch/_sync/client/license.py index 62197f383..8824c699e 100644 --- a/elasticsearch/_sync/client/license.py +++ b/elasticsearch/_sync/client/license.py @@ -39,6 +39,7 @@ def delete( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_license" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -51,7 +52,12 @@ def delete( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="license.delete", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -77,6 +83,7 @@ def get( :param local: Specifies whether to retrieve local information. The default value is `false`, which means the information is retrieved from the master node. """ + __path_parts: t.Dict[str, str] = {} __path = "/_license" __query: t.Dict[str, t.Any] = {} if accept_enterprise is not None: @@ -93,7 +100,12 @@ def get( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="license.get", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -110,6 +122,7 @@ def get_basic_status( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_license/basic_status" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -122,7 +135,12 @@ def get_basic_status( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="license.get_basic_status", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -139,6 +157,7 @@ def get_trial_status( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_license/trial_status" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -151,7 +170,12 @@ def get_trial_status( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="license.get_trial_status", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -179,6 +203,7 @@ def post( :param licenses: A sequence of one or more JSON documents containing the license information. """ + __path_parts: t.Dict[str, str] = {} __path = "/_license" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -203,7 +228,13 @@ def post( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="license.post", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -224,6 +255,7 @@ def post_start_basic( :param acknowledge: whether the user has acknowledged acknowledge messages (default: false) """ + __path_parts: t.Dict[str, str] = {} __path = "/_license/start_basic" __query: t.Dict[str, t.Any] = {} if acknowledge is not None: @@ -238,7 +270,12 @@ def post_start_basic( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="license.post_start_basic", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -261,6 +298,7 @@ def post_start_trial( false) :param type_query_string: """ + __path_parts: t.Dict[str, str] = {} __path = "/_license/start_trial" __query: t.Dict[str, t.Any] = {} if acknowledge is not None: @@ -277,5 +315,10 @@ def post_start_trial( __query["type_query_string"] = type_query_string __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="license.post_start_trial", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/logstash.py b/elasticsearch/_sync/client/logstash.py index dbd45e308..7be9b8bcb 100644 --- a/elasticsearch/_sync/client/logstash.py +++ b/elasticsearch/_sync/client/logstash.py @@ -44,7 +44,8 @@ def delete_pipeline( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_logstash/pipeline/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_logstash/pipeline/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -56,7 +57,12 @@ def delete_pipeline( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="logstash.delete_pipeline", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -76,9 +82,12 @@ def get_pipeline( :param id: Comma-separated list of pipeline identifiers. """ + __path_parts: t.Dict[str, str] if id not in SKIP_IN_PATH: - __path = f"/_logstash/pipeline/{_quote(id)}" + __path_parts = {"id": _quote(id)} + __path = f'/_logstash/pipeline/{__path_parts["id"]}' else: + __path_parts = {} __path = "/_logstash/pipeline" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -91,7 +100,12 @@ def get_pipeline( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="logstash.get_pipeline", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -124,7 +138,8 @@ def put_pipeline( ) elif pipeline is not None and body is not None: raise ValueError("Cannot set both 'pipeline' and 'body'") - __path = f"/_logstash/pipeline/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_logstash/pipeline/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -137,5 +152,11 @@ def put_pipeline( __body = pipeline if pipeline is not None else body __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="logstash.put_pipeline", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/migration.py b/elasticsearch/_sync/client/migration.py index 090c1cbf4..384f43e6e 100644 --- a/elasticsearch/_sync/client/migration.py +++ b/elasticsearch/_sync/client/migration.py @@ -45,9 +45,12 @@ def deprecations( :param index: Comma-separate list of data streams or indices to check. Wildcard (*) expressions are supported. """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_migration/deprecations" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_migration/deprecations' else: + __path_parts = {} __path = "/_migration/deprecations" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -60,7 +63,12 @@ def deprecations( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="migration.deprecations", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -77,6 +85,7 @@ def get_feature_upgrade_status( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_migration/system_features" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -89,7 +98,12 @@ def get_feature_upgrade_status( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="migration.get_feature_upgrade_status", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -106,6 +120,7 @@ def post_feature_upgrade( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_migration/system_features" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -118,5 +133,10 @@ def post_feature_upgrade( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="migration.post_feature_upgrade", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/ml.py b/elasticsearch/_sync/client/ml.py index 14fd4bc8c..6bb2f4487 100644 --- a/elasticsearch/_sync/client/ml.py +++ b/elasticsearch/_sync/client/ml.py @@ -44,7 +44,10 @@ def clear_trained_model_deployment_cache( """ if model_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'model_id'") - __path = f"/_ml/trained_models/{_quote(model_id)}/deployment/cache/_clear" + __path_parts: t.Dict[str, str] = {"model_id": _quote(model_id)} + __path = ( + f'/_ml/trained_models/{__path_parts["model_id"]}/deployment/cache/_clear' + ) __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -56,7 +59,12 @@ def clear_trained_model_deployment_cache( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.clear_trained_model_deployment_cache", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -93,7 +101,8 @@ def close_job( """ if job_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'job_id'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/_close" + __path_parts: t.Dict[str, str] = {"job_id": _quote(job_id)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/_close' __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: @@ -117,7 +126,13 @@ def close_job( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.close_job", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -139,7 +154,8 @@ def delete_calendar( """ if calendar_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'calendar_id'") - __path = f"/_ml/calendars/{_quote(calendar_id)}" + __path_parts: t.Dict[str, str] = {"calendar_id": _quote(calendar_id)} + __path = f'/_ml/calendars/{__path_parts["calendar_id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -151,7 +167,12 @@ def delete_calendar( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.delete_calendar", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -178,7 +199,11 @@ def delete_calendar_event( raise ValueError("Empty value passed for parameter 'calendar_id'") if event_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'event_id'") - __path = f"/_ml/calendars/{_quote(calendar_id)}/events/{_quote(event_id)}" + __path_parts: t.Dict[str, str] = { + "calendar_id": _quote(calendar_id), + "event_id": _quote(event_id), + } + __path = f'/_ml/calendars/{__path_parts["calendar_id"]}/events/{__path_parts["event_id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -190,7 +215,12 @@ def delete_calendar_event( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.delete_calendar_event", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -217,7 +247,11 @@ def delete_calendar_job( raise ValueError("Empty value passed for parameter 'calendar_id'") if job_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'job_id'") - __path = f"/_ml/calendars/{_quote(calendar_id)}/jobs/{_quote(job_id)}" + __path_parts: t.Dict[str, str] = { + "calendar_id": _quote(calendar_id), + "job_id": _quote(job_id), + } + __path = f'/_ml/calendars/{__path_parts["calendar_id"]}/jobs/{__path_parts["job_id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -229,7 +263,12 @@ def delete_calendar_job( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.delete_calendar_job", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -256,7 +295,8 @@ def delete_data_frame_analytics( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_ml/data_frame/analytics/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_ml/data_frame/analytics/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -272,7 +312,12 @@ def delete_data_frame_analytics( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.delete_data_frame_analytics", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -300,7 +345,8 @@ def delete_datafeed( """ if datafeed_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'datafeed_id'") - __path = f"/_ml/datafeeds/{_quote(datafeed_id)}" + __path_parts: t.Dict[str, str] = {"datafeed_id": _quote(datafeed_id)} + __path = f'/_ml/datafeeds/{__path_parts["datafeed_id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -314,7 +360,12 @@ def delete_datafeed( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.delete_datafeed", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -344,9 +395,12 @@ def delete_expired_data( :param timeout: How long can the underlying delete processes run until they are canceled. """ + __path_parts: t.Dict[str, str] if job_id not in SKIP_IN_PATH: - __path = f"/_ml/_delete_expired_data/{_quote(job_id)}" + __path_parts = {"job_id": _quote(job_id)} + __path = f'/_ml/_delete_expired_data/{__path_parts["job_id"]}' else: + __path_parts = {} __path = "/_ml/_delete_expired_data" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -369,7 +423,13 @@ def delete_expired_data( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers, body=__body + "DELETE", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.delete_expired_data", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -391,7 +451,8 @@ def delete_filter( """ if filter_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'filter_id'") - __path = f"/_ml/filters/{_quote(filter_id)}" + __path_parts: t.Dict[str, str] = {"filter_id": _quote(filter_id)} + __path = f'/_ml/filters/{__path_parts["filter_id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -403,7 +464,12 @@ def delete_filter( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.delete_filter", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -438,10 +504,16 @@ def delete_forecast( """ if job_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'job_id'") + __path_parts: t.Dict[str, str] if job_id not in SKIP_IN_PATH and forecast_id not in SKIP_IN_PATH: - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/_forecast/{_quote(forecast_id)}" + __path_parts = { + "job_id": _quote(job_id), + "forecast_id": _quote(forecast_id), + } + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/_forecast/{__path_parts["forecast_id"]}' elif job_id not in SKIP_IN_PATH: - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/_forecast" + __path_parts = {"job_id": _quote(job_id)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/_forecast' else: raise ValueError("Couldn't find a path for the given parameters") __query: t.Dict[str, t.Any] = {} @@ -459,7 +531,12 @@ def delete_forecast( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.delete_forecast", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -491,7 +568,8 @@ def delete_job( """ if job_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'job_id'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}" + __path_parts: t.Dict[str, str] = {"job_id": _quote(job_id)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}' __query: t.Dict[str, t.Any] = {} if delete_user_annotations is not None: __query["delete_user_annotations"] = delete_user_annotations @@ -509,7 +587,12 @@ def delete_job( __query["wait_for_completion"] = wait_for_completion __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.delete_job", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -535,7 +618,11 @@ def delete_model_snapshot( raise ValueError("Empty value passed for parameter 'job_id'") if snapshot_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'snapshot_id'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/model_snapshots/{_quote(snapshot_id)}" + __path_parts: t.Dict[str, str] = { + "job_id": _quote(job_id), + "snapshot_id": _quote(snapshot_id), + } + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/model_snapshots/{__path_parts["snapshot_id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -547,7 +634,12 @@ def delete_model_snapshot( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.delete_model_snapshot", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -573,7 +665,8 @@ def delete_trained_model( """ if model_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'model_id'") - __path = f"/_ml/trained_models/{_quote(model_id)}" + __path_parts: t.Dict[str, str] = {"model_id": _quote(model_id)} + __path = f'/_ml/trained_models/{__path_parts["model_id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -587,7 +680,12 @@ def delete_trained_model( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.delete_trained_model", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -613,7 +711,11 @@ def delete_trained_model_alias( raise ValueError("Empty value passed for parameter 'model_id'") if model_alias in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'model_alias'") - __path = f"/_ml/trained_models/{_quote(model_id)}/model_aliases/{_quote(model_alias)}" + __path_parts: t.Dict[str, str] = { + "model_id": _quote(model_id), + "model_alias": _quote(model_alias), + } + __path = f'/_ml/trained_models/{__path_parts["model_id"]}/model_aliases/{__path_parts["model_alias"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -625,7 +727,12 @@ def delete_trained_model_alias( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.delete_trained_model_alias", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -667,6 +774,7 @@ def estimate_model_memory( from the request if no detectors have a `by_field_name`, `over_field_name` or `partition_field_name`. """ + __path_parts: t.Dict[str, str] = {} __path = "/_ml/anomaly_detectors/_estimate_model_memory" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -687,7 +795,13 @@ def estimate_model_memory( __body["overall_cardinality"] = overall_cardinality __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.estimate_model_memory", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -719,6 +833,7 @@ def evaluate_data_frame( raise ValueError("Empty value passed for parameter 'evaluation'") if index is None and body is None: raise ValueError("Empty value passed for parameter 'index'") + __path_parts: t.Dict[str, str] = {} __path = "/_ml/data_frame/_evaluate" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -739,7 +854,13 @@ def evaluate_data_frame( __body["query"] = query __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.evaluate_data_frame", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -805,9 +926,12 @@ def explain_data_frame_analytics( :param source: The configuration of how to source the analysis data. It requires an index. Optionally, query and _source may be specified. """ + __path_parts: t.Dict[str, str] if id not in SKIP_IN_PATH: - __path = f"/_ml/data_frame/analytics/{_quote(id)}/_explain" + __path_parts = {"id": _quote(id)} + __path = f'/_ml/data_frame/analytics/{__path_parts["id"]}/_explain' else: + __path_parts = {} __path = "/_ml/data_frame/analytics/_explain" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -842,7 +966,13 @@ def explain_data_frame_analytics( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.explain_data_frame_analytics", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -877,7 +1007,8 @@ def flush_job( """ if job_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'job_id'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/_flush" + __path_parts: t.Dict[str, str] = {"job_id": _quote(job_id)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/_flush' __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: @@ -905,7 +1036,13 @@ def flush_job( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.flush_job", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -938,7 +1075,8 @@ def forecast( """ if job_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'job_id'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/_forecast" + __path_parts: t.Dict[str, str] = {"job_id": _quote(job_id)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/_forecast' __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: @@ -962,7 +1100,13 @@ def forecast( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.forecast", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1022,10 +1166,13 @@ def get_buckets( """ if job_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'job_id'") + __path_parts: t.Dict[str, str] if job_id not in SKIP_IN_PATH and timestamp not in SKIP_IN_PATH: - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/results/buckets/{_quote(timestamp)}" + __path_parts = {"job_id": _quote(job_id), "timestamp": _quote(timestamp)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/results/buckets/{__path_parts["timestamp"]}' elif job_id not in SKIP_IN_PATH: - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/results/buckets" + __path_parts = {"job_id": _quote(job_id)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/results/buckets' else: raise ValueError("Couldn't find a path for the given parameters") __query: t.Dict[str, t.Any] = {} @@ -1065,7 +1212,13 @@ def get_buckets( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.get_buckets", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1103,7 +1256,8 @@ def get_calendar_events( """ if calendar_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'calendar_id'") - __path = f"/_ml/calendars/{_quote(calendar_id)}/events" + __path_parts: t.Dict[str, str] = {"calendar_id": _quote(calendar_id)} + __path = f'/_ml/calendars/{__path_parts["calendar_id"]}/events' __query: t.Dict[str, t.Any] = {} if end is not None: __query["end"] = end @@ -1125,7 +1279,12 @@ def get_calendar_events( __query["start"] = start __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.get_calendar_events", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1160,9 +1319,12 @@ def get_calendars( :param size: Specifies the maximum number of calendars to obtain. This parameter is supported only when you omit the calendar identifier. """ + __path_parts: t.Dict[str, str] if calendar_id not in SKIP_IN_PATH: - __path = f"/_ml/calendars/{_quote(calendar_id)}" + __path_parts = {"calendar_id": _quote(calendar_id)} + __path = f'/_ml/calendars/{__path_parts["calendar_id"]}' else: + __path_parts = {} __path = "/_ml/calendars" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -1187,7 +1349,13 @@ def get_calendars( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.get_calendars", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1227,10 +1395,18 @@ def get_categories( """ if job_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'job_id'") + __path_parts: t.Dict[str, str] if job_id not in SKIP_IN_PATH and category_id not in SKIP_IN_PATH: - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/results/categories/{_quote(category_id)}" + __path_parts = { + "job_id": _quote(job_id), + "category_id": _quote(category_id), + } + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/results/categories/{__path_parts["category_id"]}' elif job_id not in SKIP_IN_PATH: - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/results/categories" + __path_parts = {"job_id": _quote(job_id)} + __path = ( + f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/results/categories' + ) else: raise ValueError("Couldn't find a path for the given parameters") __query: t.Dict[str, t.Any] = {} @@ -1258,7 +1434,13 @@ def get_categories( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.get_categories", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1299,9 +1481,12 @@ def get_data_frame_analytics( :param from_: Skips the specified number of data frame analytics jobs. :param size: Specifies the maximum number of data frame analytics jobs to obtain. """ + __path_parts: t.Dict[str, str] if id not in SKIP_IN_PATH: - __path = f"/_ml/data_frame/analytics/{_quote(id)}" + __path_parts = {"id": _quote(id)} + __path = f'/_ml/data_frame/analytics/{__path_parts["id"]}' else: + __path_parts = {} __path = "/_ml/data_frame/analytics" __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: @@ -1322,7 +1507,12 @@ def get_data_frame_analytics( __query["size"] = size __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.get_data_frame_analytics", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1361,9 +1551,12 @@ def get_data_frame_analytics_stats( :param size: Specifies the maximum number of data frame analytics jobs to obtain. :param verbose: Defines whether the stats response should be verbose. """ + __path_parts: t.Dict[str, str] if id not in SKIP_IN_PATH: - __path = f"/_ml/data_frame/analytics/{_quote(id)}/_stats" + __path_parts = {"id": _quote(id)} + __path = f'/_ml/data_frame/analytics/{__path_parts["id"]}/_stats' else: + __path_parts = {} __path = "/_ml/data_frame/analytics/_stats" __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: @@ -1384,7 +1577,12 @@ def get_data_frame_analytics_stats( __query["verbose"] = verbose __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.get_data_frame_analytics_stats", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1414,9 +1612,12 @@ def get_datafeed_stats( when there are partial matches. If this parameter is `false`, the request returns a `404` status code when there are no matches or only partial matches. """ + __path_parts: t.Dict[str, str] if datafeed_id not in SKIP_IN_PATH: - __path = f"/_ml/datafeeds/{_quote(datafeed_id)}/_stats" + __path_parts = {"datafeed_id": _quote(datafeed_id)} + __path = f'/_ml/datafeeds/{__path_parts["datafeed_id"]}/_stats' else: + __path_parts = {} __path = "/_ml/datafeeds/_stats" __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: @@ -1431,7 +1632,12 @@ def get_datafeed_stats( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.get_datafeed_stats", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1465,9 +1671,12 @@ def get_datafeeds( the configuration on retrieval. This allows the configuration to be in an acceptable format to be retrieved and then added to another cluster. """ + __path_parts: t.Dict[str, str] if datafeed_id not in SKIP_IN_PATH: - __path = f"/_ml/datafeeds/{_quote(datafeed_id)}" + __path_parts = {"datafeed_id": _quote(datafeed_id)} + __path = f'/_ml/datafeeds/{__path_parts["datafeed_id"]}' else: + __path_parts = {} __path = "/_ml/datafeeds" __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: @@ -1484,7 +1693,12 @@ def get_datafeeds( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.get_datafeeds", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1510,9 +1724,12 @@ def get_filters( :param from_: Skips the specified number of filters. :param size: Specifies the maximum number of filters to obtain. """ + __path_parts: t.Dict[str, str] if filter_id not in SKIP_IN_PATH: - __path = f"/_ml/filters/{_quote(filter_id)}" + __path_parts = {"filter_id": _quote(filter_id)} + __path = f'/_ml/filters/{__path_parts["filter_id"]}' else: + __path_parts = {} __path = "/_ml/filters" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1529,7 +1746,12 @@ def get_filters( __query["size"] = size __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.get_filters", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1579,7 +1801,8 @@ def get_influencers( """ if job_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'job_id'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/results/influencers" + __path_parts: t.Dict[str, str] = {"job_id": _quote(job_id)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/results/influencers' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} if desc is not None: @@ -1615,7 +1838,13 @@ def get_influencers( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.get_influencers", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1646,9 +1875,12 @@ def get_job_stats( partial matches. If `false`, the API returns a `404` status code when there are no matches or only partial matches. """ + __path_parts: t.Dict[str, str] if job_id not in SKIP_IN_PATH: - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/_stats" + __path_parts = {"job_id": _quote(job_id)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/_stats' else: + __path_parts = {} __path = "/_ml/anomaly_detectors/_stats" __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: @@ -1663,7 +1895,12 @@ def get_job_stats( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.get_job_stats", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1697,9 +1934,12 @@ def get_jobs( the configuration on retrieval. This allows the configuration to be in an acceptable format to be retrieved and then added to another cluster. """ + __path_parts: t.Dict[str, str] if job_id not in SKIP_IN_PATH: - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}" + __path_parts = {"job_id": _quote(job_id)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}' else: + __path_parts = {} __path = "/_ml/anomaly_detectors" __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: @@ -1716,7 +1956,12 @@ def get_jobs( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.get_jobs", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1746,9 +1991,12 @@ def get_memory_stats( :param timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] if node_id not in SKIP_IN_PATH: - __path = f"/_ml/memory/{_quote(node_id)}/_stats" + __path_parts = {"node_id": _quote(node_id)} + __path = f'/_ml/memory/{__path_parts["node_id"]}/_stats' else: + __path_parts = {} __path = "/_ml/memory/_stats" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1765,7 +2013,12 @@ def get_memory_stats( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.get_memory_stats", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1803,7 +2056,11 @@ def get_model_snapshot_upgrade_stats( raise ValueError("Empty value passed for parameter 'job_id'") if snapshot_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'snapshot_id'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/model_snapshots/{_quote(snapshot_id)}/_upgrade/_stats" + __path_parts: t.Dict[str, str] = { + "job_id": _quote(job_id), + "snapshot_id": _quote(snapshot_id), + } + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/model_snapshots/{__path_parts["snapshot_id"]}/_upgrade/_stats' __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: __query["allow_no_match"] = allow_no_match @@ -1817,7 +2074,12 @@ def get_model_snapshot_upgrade_stats( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.get_model_snapshot_upgrade_stats", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1863,10 +2125,16 @@ def get_model_snapshots( """ if job_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'job_id'") + __path_parts: t.Dict[str, str] if job_id not in SKIP_IN_PATH and snapshot_id not in SKIP_IN_PATH: - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/model_snapshots/{_quote(snapshot_id)}" + __path_parts = { + "job_id": _quote(job_id), + "snapshot_id": _quote(snapshot_id), + } + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/model_snapshots/{__path_parts["snapshot_id"]}' elif job_id not in SKIP_IN_PATH: - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/model_snapshots" + __path_parts = {"job_id": _quote(job_id)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/model_snapshots' else: raise ValueError("Couldn't find a path for the given parameters") __query: t.Dict[str, t.Any] = {} @@ -1900,7 +2168,13 @@ def get_model_snapshots( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.get_model_snapshots", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1954,7 +2228,10 @@ def get_overall_buckets( """ if job_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'job_id'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/results/overall_buckets" + __path_parts: t.Dict[str, str] = {"job_id": _quote(job_id)} + __path = ( + f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/results/overall_buckets' + ) __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: @@ -1986,7 +2263,13 @@ def get_overall_buckets( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.get_overall_buckets", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2039,7 +2322,8 @@ def get_records( """ if job_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'job_id'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/results/records" + __path_parts: t.Dict[str, str] = {"job_id": _quote(job_id)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/results/records' __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: @@ -2075,7 +2359,13 @@ def get_records( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.get_records", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2127,9 +2417,12 @@ def get_trained_models( tags, or none. When supplied, only trained models that contain all the supplied tags are returned. """ + __path_parts: t.Dict[str, str] if model_id not in SKIP_IN_PATH: - __path = f"/_ml/trained_models/{_quote(model_id)}" + __path_parts = {"model_id": _quote(model_id)} + __path = f'/_ml/trained_models/{__path_parts["model_id"]}' else: + __path_parts = {} __path = "/_ml/trained_models" __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: @@ -2156,7 +2449,12 @@ def get_trained_models( __query["tags"] = tags __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.get_trained_models", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2189,9 +2487,12 @@ def get_trained_models_stats( :param from_: Skips the specified number of models. :param size: Specifies the maximum number of models to obtain. """ + __path_parts: t.Dict[str, str] if model_id not in SKIP_IN_PATH: - __path = f"/_ml/trained_models/{_quote(model_id)}/_stats" + __path_parts = {"model_id": _quote(model_id)} + __path = f'/_ml/trained_models/{__path_parts["model_id"]}/_stats' else: + __path_parts = {} __path = "/_ml/trained_models/_stats" __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: @@ -2210,7 +2511,12 @@ def get_trained_models_stats( __query["size"] = size __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.get_trained_models_stats", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2247,7 +2553,8 @@ def infer_trained_model( raise ValueError("Empty value passed for parameter 'model_id'") if docs is None and body is None: raise ValueError("Empty value passed for parameter 'docs'") - __path = f"/_ml/trained_models/{_quote(model_id)}/_infer" + __path_parts: t.Dict[str, str] = {"model_id": _quote(model_id)} + __path = f'/_ml/trained_models/{__path_parts["model_id"]}/_infer' __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: @@ -2267,7 +2574,13 @@ def infer_trained_model( __body["inference_config"] = inference_config __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.infer_trained_model", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -2284,6 +2597,7 @@ def info( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_ml/info" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -2296,7 +2610,12 @@ def info( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.info", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2323,7 +2642,8 @@ def open_job( """ if job_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'job_id'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/_open" + __path_parts: t.Dict[str, str] = {"job_id": _quote(job_id)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/_open' __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: @@ -2343,7 +2663,13 @@ def open_job( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.open_job", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2374,7 +2700,8 @@ def post_calendar_events( raise ValueError("Empty value passed for parameter 'calendar_id'") if events is None and body is None: raise ValueError("Empty value passed for parameter 'events'") - __path = f"/_ml/calendars/{_quote(calendar_id)}/events" + __path_parts: t.Dict[str, str] = {"calendar_id": _quote(calendar_id)} + __path = f'/_ml/calendars/{__path_parts["calendar_id"]}/events' __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: @@ -2390,7 +2717,13 @@ def post_calendar_events( __body["events"] = events __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.post_calendar_events", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2428,7 +2761,8 @@ def post_data( ) elif data is not None and body is not None: raise ValueError("Cannot set both 'data' and 'body'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/_data" + __path_parts: t.Dict[str, str] = {"job_id": _quote(job_id)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/_data' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -2448,7 +2782,13 @@ def post_data( "content-type": "application/x-ndjson", } return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.post_data", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2475,9 +2815,12 @@ def preview_data_frame_analytics( analytics jobs. Note that `id` and `dest` don’t need to be provided in the context of this API. """ + __path_parts: t.Dict[str, str] if id not in SKIP_IN_PATH: - __path = f"/_ml/data_frame/analytics/{_quote(id)}/_preview" + __path_parts = {"id": _quote(id)} + __path = f'/_ml/data_frame/analytics/{__path_parts["id"]}/_preview' else: + __path_parts = {} __path = "/_ml/data_frame/analytics/_preview" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -2498,7 +2841,13 @@ def preview_data_frame_analytics( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.preview_data_frame_analytics", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2538,9 +2887,12 @@ def preview_datafeed( object unless you also supply a `datafeed_config` object. :param start: The start time from where the datafeed preview should begin """ + __path_parts: t.Dict[str, str] if datafeed_id not in SKIP_IN_PATH: - __path = f"/_ml/datafeeds/{_quote(datafeed_id)}/_preview" + __path_parts = {"datafeed_id": _quote(datafeed_id)} + __path = f'/_ml/datafeeds/{__path_parts["datafeed_id"]}/_preview' else: + __path_parts = {} __path = "/_ml/datafeeds/_preview" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -2567,7 +2919,13 @@ def preview_datafeed( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.preview_datafeed", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2596,7 +2954,8 @@ def put_calendar( """ if calendar_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'calendar_id'") - __path = f"/_ml/calendars/{_quote(calendar_id)}" + __path_parts: t.Dict[str, str] = {"calendar_id": _quote(calendar_id)} + __path = f'/_ml/calendars/{__path_parts["calendar_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: @@ -2618,7 +2977,13 @@ def put_calendar( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.put_calendar", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -2645,7 +3010,11 @@ def put_calendar_job( raise ValueError("Empty value passed for parameter 'calendar_id'") if job_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'job_id'") - __path = f"/_ml/calendars/{_quote(calendar_id)}/jobs/{_quote(job_id)}" + __path_parts: t.Dict[str, str] = { + "calendar_id": _quote(calendar_id), + "job_id": _quote(job_id), + } + __path = f'/_ml/calendars/{__path_parts["calendar_id"]}/jobs/{__path_parts["job_id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -2657,7 +3026,12 @@ def put_calendar_job( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers + "PUT", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.put_calendar_job", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2763,7 +3137,8 @@ def put_data_frame_analytics( raise ValueError("Empty value passed for parameter 'dest'") if source is None and body is None: raise ValueError("Empty value passed for parameter 'source'") - __path = f"/_ml/data_frame/analytics/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_ml/data_frame/analytics/{__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: @@ -2797,7 +3172,13 @@ def put_data_frame_analytics( __body["version"] = version __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.put_data_frame_analytics", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2932,7 +3313,8 @@ def put_datafeed( """ if datafeed_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'datafeed_id'") - __path = f"/_ml/datafeeds/{_quote(datafeed_id)}" + __path_parts: t.Dict[str, str] = {"datafeed_id": _quote(datafeed_id)} + __path = f'/_ml/datafeeds/{__path_parts["datafeed_id"]}' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} if allow_no_indices is not None: @@ -2984,7 +3366,13 @@ def put_datafeed( __body["scroll_size"] = scroll_size __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.put_datafeed", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3014,7 +3402,8 @@ def put_filter( """ if filter_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'filter_id'") - __path = f"/_ml/filters/{_quote(filter_id)}" + __path_parts: t.Dict[str, str] = {"filter_id": _quote(filter_id)} + __path = f'/_ml/filters/{__path_parts["filter_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: @@ -3032,7 +3421,13 @@ def put_filter( __body["items"] = items __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.put_filter", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3165,7 +3560,8 @@ def put_job( raise ValueError("Empty value passed for parameter 'analysis_config'") if data_description is None and body is None: raise ValueError("Empty value passed for parameter 'data_description'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}" + __path_parts: t.Dict[str, str] = {"job_id": _quote(job_id)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_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: @@ -3211,7 +3607,13 @@ def put_job( __body["results_retention_days"] = results_retention_days __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.put_job", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3288,7 +3690,8 @@ def put_trained_model( """ if model_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'model_id'") - __path = f"/_ml/trained_models/{_quote(model_id)}" + __path_parts: t.Dict[str, str] = {"model_id": _quote(model_id)} + __path = f'/_ml/trained_models/{__path_parts["model_id"]}' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} if defer_definition_decompression is not None: @@ -3324,7 +3727,13 @@ def put_trained_model( __body["tags"] = tags __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.put_trained_model", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -3355,7 +3764,11 @@ def put_trained_model_alias( raise ValueError("Empty value passed for parameter 'model_id'") if model_alias in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'model_alias'") - __path = f"/_ml/trained_models/{_quote(model_id)}/model_aliases/{_quote(model_alias)}" + __path_parts: t.Dict[str, str] = { + "model_id": _quote(model_id), + "model_alias": _quote(model_alias), + } + __path = f'/_ml/trained_models/{__path_parts["model_id"]}/model_aliases/{__path_parts["model_alias"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -3369,7 +3782,12 @@ def put_trained_model_alias( __query["reassign"] = reassign __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers + "PUT", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.put_trained_model_alias", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3417,7 +3835,11 @@ def put_trained_model_definition_part( ) if total_parts is None and body is None: raise ValueError("Empty value passed for parameter 'total_parts'") - __path = f"/_ml/trained_models/{_quote(model_id)}/definition/{_quote(part)}" + __path_parts: t.Dict[str, str] = { + "model_id": _quote(model_id), + "part": _quote(part), + } + __path = f'/_ml/trained_models/{__path_parts["model_id"]}/definition/{__path_parts["part"]}' __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: @@ -3437,7 +3859,13 @@ def put_trained_model_definition_part( __body["total_parts"] = total_parts __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.put_trained_model_definition_part", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3470,7 +3898,8 @@ def put_trained_model_vocabulary( raise ValueError("Empty value passed for parameter 'model_id'") if vocabulary is None and body is None: raise ValueError("Empty value passed for parameter 'vocabulary'") - __path = f"/_ml/trained_models/{_quote(model_id)}/vocabulary" + __path_parts: t.Dict[str, str] = {"model_id": _quote(model_id)} + __path = f'/_ml/trained_models/{__path_parts["model_id"]}/vocabulary' __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: @@ -3490,7 +3919,13 @@ def put_trained_model_vocabulary( __body["scores"] = scores __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.put_trained_model_vocabulary", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -3519,7 +3954,8 @@ def reset_job( """ if job_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'job_id'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/_reset" + __path_parts: t.Dict[str, str] = {"job_id": _quote(job_id)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/_reset' __query: t.Dict[str, t.Any] = {} if delete_user_annotations is not None: __query["delete_user_annotations"] = delete_user_annotations @@ -3535,7 +3971,12 @@ def reset_job( __query["wait_for_completion"] = wait_for_completion __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.reset_job", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3569,7 +4010,11 @@ def revert_model_snapshot( raise ValueError("Empty value passed for parameter 'job_id'") if snapshot_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'snapshot_id'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/model_snapshots/{_quote(snapshot_id)}/_revert" + __path_parts: t.Dict[str, str] = { + "job_id": _quote(job_id), + "snapshot_id": _quote(snapshot_id), + } + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/model_snapshots/{__path_parts["snapshot_id"]}/_revert' __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: @@ -3589,7 +4034,13 @@ def revert_model_snapshot( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.revert_model_snapshot", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -3614,6 +4065,7 @@ def set_upgrade_mode( starting. :param timeout: The time to wait for the request to be completed. """ + __path_parts: t.Dict[str, str] = {} __path = "/_ml/set_upgrade_mode" __query: t.Dict[str, t.Any] = {} if enabled is not None: @@ -3630,7 +4082,12 @@ def set_upgrade_mode( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.set_upgrade_mode", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -3657,7 +4114,8 @@ def start_data_frame_analytics( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_ml/data_frame/analytics/{_quote(id)}/_start" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_ml/data_frame/analytics/{__path_parts["id"]}/_start' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -3671,7 +4129,12 @@ def start_data_frame_analytics( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.start_data_frame_analytics", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3705,7 +4168,8 @@ def start_datafeed( """ if datafeed_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'datafeed_id'") - __path = f"/_ml/datafeeds/{_quote(datafeed_id)}/_start" + __path_parts: t.Dict[str, str] = {"datafeed_id": _quote(datafeed_id)} + __path = f'/_ml/datafeeds/{__path_parts["datafeed_id"]}/_start' __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: @@ -3729,7 +4193,13 @@ def start_datafeed( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.start_datafeed", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -3785,7 +4255,8 @@ def start_trained_model_deployment( """ if model_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'model_id'") - __path = f"/_ml/trained_models/{_quote(model_id)}/deployment/_start" + __path_parts: t.Dict[str, str] = {"model_id": _quote(model_id)} + __path = f'/_ml/trained_models/{__path_parts["model_id"]}/deployment/_start' __query: t.Dict[str, t.Any] = {} if cache_size is not None: __query["cache_size"] = cache_size @@ -3813,7 +4284,12 @@ def start_trained_model_deployment( __query["wait_for"] = wait_for __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.start_trained_model_deployment", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -3851,7 +4327,8 @@ def stop_data_frame_analytics( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_ml/data_frame/analytics/{_quote(id)}/_stop" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_ml/data_frame/analytics/{__path_parts["id"]}/_stop' __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: __query["allow_no_match"] = allow_no_match @@ -3869,7 +4346,12 @@ def stop_data_frame_analytics( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.stop_data_frame_analytics", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -3904,7 +4386,8 @@ def stop_datafeed( """ if datafeed_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'datafeed_id'") - __path = f"/_ml/datafeeds/{_quote(datafeed_id)}/_stop" + __path_parts: t.Dict[str, str] = {"datafeed_id": _quote(datafeed_id)} + __path = f'/_ml/datafeeds/{__path_parts["datafeed_id"]}/_stop' __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: @@ -3928,7 +4411,13 @@ def stop_datafeed( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.stop_datafeed", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -3961,7 +4450,8 @@ def stop_trained_model_deployment( """ if model_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'model_id'") - __path = f"/_ml/trained_models/{_quote(model_id)}/deployment/_stop" + __path_parts: t.Dict[str, str] = {"model_id": _quote(model_id)} + __path = f'/_ml/trained_models/{__path_parts["model_id"]}/deployment/_stop' __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: __query["allow_no_match"] = allow_no_match @@ -3977,7 +4467,12 @@ def stop_trained_model_deployment( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.stop_trained_model_deployment", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -4025,7 +4520,8 @@ def update_data_frame_analytics( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_ml/data_frame/analytics/{_quote(id)}/_update" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_ml/data_frame/analytics/{__path_parts["id"]}/_update' __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: @@ -4047,7 +4543,13 @@ def update_data_frame_analytics( __body["model_memory_limit"] = model_memory_limit __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.update_data_frame_analytics", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -4190,7 +4692,8 @@ def update_datafeed( """ if datafeed_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'datafeed_id'") - __path = f"/_ml/datafeeds/{_quote(datafeed_id)}/_update" + __path_parts: t.Dict[str, str] = {"datafeed_id": _quote(datafeed_id)} + __path = f'/_ml/datafeeds/{__path_parts["datafeed_id"]}/_update' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} if allow_no_indices is not None: @@ -4240,7 +4743,13 @@ def update_datafeed( __body["scroll_size"] = scroll_size __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.update_datafeed", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -4271,7 +4780,8 @@ def update_filter( """ if filter_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'filter_id'") - __path = f"/_ml/filters/{_quote(filter_id)}/_update" + __path_parts: t.Dict[str, str] = {"filter_id": _quote(filter_id)} + __path = f'/_ml/filters/{__path_parts["filter_id"]}/_update' __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: @@ -4291,7 +4801,13 @@ def update_filter( __body["remove_items"] = remove_items __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.update_filter", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -4398,7 +4914,8 @@ def update_job( """ if job_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'job_id'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/_update" + __path_parts: t.Dict[str, str] = {"job_id": _quote(job_id)} + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/_update' __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: @@ -4444,7 +4961,13 @@ def update_job( __body["results_retention_days"] = results_retention_days __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.update_job", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -4479,7 +5002,11 @@ def update_model_snapshot( raise ValueError("Empty value passed for parameter 'job_id'") if snapshot_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'snapshot_id'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/model_snapshots/{_quote(snapshot_id)}/_update" + __path_parts: t.Dict[str, str] = { + "job_id": _quote(job_id), + "snapshot_id": _quote(snapshot_id), + } + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/model_snapshots/{__path_parts["snapshot_id"]}/_update' __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: @@ -4497,7 +5024,13 @@ def update_model_snapshot( __body["retain"] = retain __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.update_model_snapshot", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -4530,7 +5063,11 @@ def upgrade_job_snapshot( raise ValueError("Empty value passed for parameter 'job_id'") if snapshot_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'snapshot_id'") - __path = f"/_ml/anomaly_detectors/{_quote(job_id)}/model_snapshots/{_quote(snapshot_id)}/_upgrade" + __path_parts: t.Dict[str, str] = { + "job_id": _quote(job_id), + "snapshot_id": _quote(snapshot_id), + } + __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}/model_snapshots/{__path_parts["snapshot_id"]}/_upgrade' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -4546,7 +5083,12 @@ def upgrade_job_snapshot( __query["wait_for_completion"] = wait_for_completion __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="ml.upgrade_job_snapshot", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -4595,6 +5137,7 @@ def validate( :param model_snapshot_retention_days: :param results_index_name: """ + __path_parts: t.Dict[str, str] = {} __path = "/_ml/anomaly_detectors/_validate" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -4627,7 +5170,13 @@ def validate( __body["results_index_name"] = results_index_name __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.validate", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -4656,6 +5205,7 @@ def validate_detector( ) elif detector is not None and body is not None: raise ValueError("Cannot set both 'detector' and 'body'") + __path_parts: t.Dict[str, str] = {} __path = "/_ml/anomaly_detectors/_validate/detector" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -4669,5 +5219,11 @@ def validate_detector( __body = detector if detector is not None else body __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.validate_detector", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/monitoring.py b/elasticsearch/_sync/client/monitoring.py index d05ef9205..787896a3b 100644 --- a/elasticsearch/_sync/client/monitoring.py +++ b/elasticsearch/_sync/client/monitoring.py @@ -63,6 +63,7 @@ def bulk( raise ValueError("Empty value passed for parameter 'system_api_version'") if system_id is None: raise ValueError("Empty value passed for parameter 'system_id'") + __path_parts: t.Dict[str, str] = {} __path = "/_monitoring/bulk" __query: t.Dict[str, t.Any] = {} if interval is not None: @@ -85,5 +86,11 @@ def bulk( "content-type": "application/x-ndjson", } return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="monitoring.bulk", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/nodes.py b/elasticsearch/_sync/client/nodes.py index 42b6a9861..5b1855f54 100644 --- a/elasticsearch/_sync/client/nodes.py +++ b/elasticsearch/_sync/client/nodes.py @@ -50,7 +50,11 @@ def clear_repositories_metering_archive( raise ValueError("Empty value passed for parameter 'node_id'") if max_archive_version in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'max_archive_version'") - __path = f"/_nodes/{_quote(node_id)}/_repositories_metering/{_quote(max_archive_version)}" + __path_parts: t.Dict[str, str] = { + "node_id": _quote(node_id), + "max_archive_version": _quote(max_archive_version), + } + __path = f'/_nodes/{__path_parts["node_id"]}/_repositories_metering/{__path_parts["max_archive_version"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -62,7 +66,12 @@ def clear_repositories_metering_archive( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="nodes.clear_repositories_metering_archive", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -85,7 +94,8 @@ def get_repositories_metering_info( """ if node_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'node_id'") - __path = f"/_nodes/{_quote(node_id)}/_repositories_metering" + __path_parts: t.Dict[str, str] = {"node_id": _quote(node_id)} + __path = f'/_nodes/{__path_parts["node_id"]}/_repositories_metering' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -97,7 +107,12 @@ def get_repositories_metering_info( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="nodes.get_repositories_metering_info", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -143,9 +158,12 @@ def hot_threads( the timeout expires, the request fails and returns an error. :param type: The type to sample. """ + __path_parts: t.Dict[str, str] if node_id not in SKIP_IN_PATH: - __path = f"/_nodes/{_quote(node_id)}/hot_threads" + __path_parts = {"node_id": _quote(node_id)} + __path = f'/_nodes/{__path_parts["node_id"]}/hot_threads' else: + __path_parts = {} __path = "/_nodes/hot_threads" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -174,7 +192,12 @@ def hot_threads( __query["type"] = type __headers = {"accept": "text/plain"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="nodes.hot_threads", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -209,13 +232,18 @@ def info( :param timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] if node_id not in SKIP_IN_PATH and metric not in SKIP_IN_PATH: - __path = f"/_nodes/{_quote(node_id)}/{_quote(metric)}" + __path_parts = {"node_id": _quote(node_id), "metric": _quote(metric)} + __path = f'/_nodes/{__path_parts["node_id"]}/{__path_parts["metric"]}' elif node_id not in SKIP_IN_PATH: - __path = f"/_nodes/{_quote(node_id)}" + __path_parts = {"node_id": _quote(node_id)} + __path = f'/_nodes/{__path_parts["node_id"]}' elif metric not in SKIP_IN_PATH: - __path = f"/_nodes/{_quote(metric)}" + __path_parts = {"metric": _quote(metric)} + __path = f'/_nodes/{__path_parts["metric"]}' else: + __path_parts = {} __path = "/_nodes" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -234,7 +262,12 @@ def info( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="nodes.info", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -262,9 +295,12 @@ def reload_secure_settings( :param timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] if node_id not in SKIP_IN_PATH: - __path = f"/_nodes/{_quote(node_id)}/reload_secure_settings" + __path_parts = {"node_id": _quote(node_id)} + __path = f'/_nodes/{__path_parts["node_id"]}/reload_secure_settings' else: + __path_parts = {} __path = "/_nodes/reload_secure_settings" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -287,7 +323,13 @@ def reload_secure_settings( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="nodes.reload_secure_settings", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -350,21 +392,37 @@ def stats( :param types: A comma-separated list of document types for the indexing index metric. """ + __path_parts: t.Dict[str, str] if ( node_id not in SKIP_IN_PATH and metric not in SKIP_IN_PATH and index_metric not in SKIP_IN_PATH ): - __path = f"/_nodes/{_quote(node_id)}/stats/{_quote(metric)}/{_quote(index_metric)}" + __path_parts = { + "node_id": _quote(node_id), + "metric": _quote(metric), + "index_metric": _quote(index_metric), + } + __path = f'/_nodes/{__path_parts["node_id"]}/stats/{__path_parts["metric"]}/{__path_parts["index_metric"]}' elif node_id not in SKIP_IN_PATH and metric not in SKIP_IN_PATH: - __path = f"/_nodes/{_quote(node_id)}/stats/{_quote(metric)}" + __path_parts = {"node_id": _quote(node_id), "metric": _quote(metric)} + __path = f'/_nodes/{__path_parts["node_id"]}/stats/{__path_parts["metric"]}' elif metric not in SKIP_IN_PATH and index_metric not in SKIP_IN_PATH: - __path = f"/_nodes/stats/{_quote(metric)}/{_quote(index_metric)}" + __path_parts = { + "metric": _quote(metric), + "index_metric": _quote(index_metric), + } + __path = ( + f'/_nodes/stats/{__path_parts["metric"]}/{__path_parts["index_metric"]}' + ) elif node_id not in SKIP_IN_PATH: - __path = f"/_nodes/{_quote(node_id)}/stats" + __path_parts = {"node_id": _quote(node_id)} + __path = f'/_nodes/{__path_parts["node_id"]}/stats' elif metric not in SKIP_IN_PATH: - __path = f"/_nodes/stats/{_quote(metric)}" + __path_parts = {"metric": _quote(metric)} + __path = f'/_nodes/stats/{__path_parts["metric"]}' else: + __path_parts = {} __path = "/_nodes/stats" __query: t.Dict[str, t.Any] = {} if completion_fields is not None: @@ -397,7 +455,12 @@ def stats( __query["types"] = types __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="nodes.stats", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -425,13 +488,18 @@ def usage( :param timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] if node_id not in SKIP_IN_PATH and metric not in SKIP_IN_PATH: - __path = f"/_nodes/{_quote(node_id)}/usage/{_quote(metric)}" + __path_parts = {"node_id": _quote(node_id), "metric": _quote(metric)} + __path = f'/_nodes/{__path_parts["node_id"]}/usage/{__path_parts["metric"]}' elif node_id not in SKIP_IN_PATH: - __path = f"/_nodes/{_quote(node_id)}/usage" + __path_parts = {"node_id": _quote(node_id)} + __path = f'/_nodes/{__path_parts["node_id"]}/usage' elif metric not in SKIP_IN_PATH: - __path = f"/_nodes/usage/{_quote(metric)}" + __path_parts = {"metric": _quote(metric)} + __path = f'/_nodes/usage/{__path_parts["metric"]}' else: + __path_parts = {} __path = "/_nodes/usage" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -446,5 +514,10 @@ def usage( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="nodes.usage", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/query_ruleset.py b/elasticsearch/_sync/client/query_ruleset.py index 9fdaf8790..eb5b4f595 100644 --- a/elasticsearch/_sync/client/query_ruleset.py +++ b/elasticsearch/_sync/client/query_ruleset.py @@ -44,7 +44,8 @@ def delete( """ if ruleset_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'ruleset_id'") - __path = f"/_query_rules/{_quote(ruleset_id)}" + __path_parts: t.Dict[str, str] = {"ruleset_id": _quote(ruleset_id)} + __path = f'/_query_rules/{__path_parts["ruleset_id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -56,7 +57,12 @@ def delete( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="query_ruleset.delete", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -78,7 +84,8 @@ def get( """ if ruleset_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'ruleset_id'") - __path = f"/_query_rules/{_quote(ruleset_id)}" + __path_parts: t.Dict[str, str] = {"ruleset_id": _quote(ruleset_id)} + __path = f'/_query_rules/{__path_parts["ruleset_id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -90,7 +97,12 @@ def get( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="query_ruleset.get", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -114,6 +126,7 @@ def list( :param from_: Starting offset (default: 0) :param size: specifies a max number of results to get """ + __path_parts: t.Dict[str, str] = {} __path = "/_query_rules" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -130,7 +143,12 @@ def list( __query["size"] = size __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="query_ruleset.list", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -160,7 +178,8 @@ def put( raise ValueError("Empty value passed for parameter 'ruleset_id'") if rules is None and body is None: raise ValueError("Empty value passed for parameter 'rules'") - __path = f"/_query_rules/{_quote(ruleset_id)}" + __path_parts: t.Dict[str, str] = {"ruleset_id": _quote(ruleset_id)} + __path = f'/_query_rules/{__path_parts["ruleset_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: @@ -176,5 +195,11 @@ def put( __body["rules"] = rules __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="query_ruleset.put", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/rollup.py b/elasticsearch/_sync/client/rollup.py index 9200f1a12..ca58c24be 100644 --- a/elasticsearch/_sync/client/rollup.py +++ b/elasticsearch/_sync/client/rollup.py @@ -44,7 +44,8 @@ def delete_job( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_rollup/job/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_rollup/job/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -56,7 +57,12 @@ def delete_job( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="rollup.delete_job", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -77,9 +83,12 @@ def get_jobs( :param id: Identifier for the rollup job. If it is `_all` or omitted, the API returns all rollup jobs. """ + __path_parts: t.Dict[str, str] if id not in SKIP_IN_PATH: - __path = f"/_rollup/job/{_quote(id)}" + __path_parts = {"id": _quote(id)} + __path = f'/_rollup/job/{__path_parts["id"]}' else: + __path_parts = {} __path = "/_rollup/job" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -92,7 +101,12 @@ def get_jobs( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="rollup.get_jobs", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -114,9 +128,12 @@ def get_rollup_caps( :param id: Index, indices or index-pattern to return rollup capabilities for. `_all` may be used to fetch rollup capabilities from all jobs. """ + __path_parts: t.Dict[str, str] if id not in SKIP_IN_PATH: - __path = f"/_rollup/data/{_quote(id)}" + __path_parts = {"id": _quote(id)} + __path = f'/_rollup/data/{__path_parts["id"]}' else: + __path_parts = {} __path = "/_rollup/data" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -129,7 +146,12 @@ def get_rollup_caps( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="rollup.get_rollup_caps", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -153,7 +175,8 @@ def get_rollup_index_caps( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_rollup/data" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_rollup/data' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -165,7 +188,12 @@ def get_rollup_index_caps( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="rollup.get_rollup_index_caps", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -256,7 +284,8 @@ def put_job( raise ValueError("Empty value passed for parameter 'page_size'") if rollup_index is None and body is None: raise ValueError("Empty value passed for parameter 'rollup_index'") - __path = f"/_rollup/job/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_rollup/job/{__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: @@ -286,7 +315,13 @@ def put_job( __body["timeout"] = timeout __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="rollup.put_job", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -325,7 +360,8 @@ def rollup_search( """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/{_quote(index)}/_rollup_search" + __path_parts: t.Dict[str, str] = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_rollup_search' __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: @@ -351,7 +387,13 @@ def rollup_search( __body["size"] = size __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="rollup.rollup_search", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -373,7 +415,8 @@ def start_job( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_rollup/job/{_quote(id)}/_start" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_rollup/job/{__path_parts["id"]}/_start' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -385,7 +428,12 @@ def start_job( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="rollup.start_job", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -415,7 +463,8 @@ def stop_job( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_rollup/job/{_quote(id)}/_stop" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_rollup/job/{__path_parts["id"]}/_stop' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -431,5 +480,10 @@ def stop_job( __query["wait_for_completion"] = wait_for_completion __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="rollup.stop_job", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/search_application.py b/elasticsearch/_sync/client/search_application.py index c872bf930..48599d2ba 100644 --- a/elasticsearch/_sync/client/search_application.py +++ b/elasticsearch/_sync/client/search_application.py @@ -44,7 +44,8 @@ def delete( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_application/search_application/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_application/search_application/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -56,7 +57,12 @@ def delete( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="search_application.delete", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -78,7 +84,8 @@ def delete_behavioral_analytics( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_application/analytics/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_application/analytics/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -90,7 +97,12 @@ def delete_behavioral_analytics( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="search_application.delete_behavioral_analytics", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -112,7 +124,8 @@ def get( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_application/search_application/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_application/search_application/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -124,7 +137,12 @@ def get( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="search_application.get", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -144,9 +162,12 @@ def get_behavioral_analytics( :param name: A list of analytics collections to limit the returned information """ + __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: - __path = f"/_application/analytics/{_quote(name)}" + __path_parts = {"name": _quote(name)} + __path = f'/_application/analytics/{__path_parts["name"]}' else: + __path_parts = {} __path = "/_application/analytics" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -159,7 +180,12 @@ def get_behavioral_analytics( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="search_application.get_behavioral_analytics", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -185,6 +211,7 @@ def list( :param q: Query in the Lucene query string syntax. :param size: Specifies a max number of results to get. """ + __path_parts: t.Dict[str, str] = {} __path = "/_application/search_application" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -203,7 +230,12 @@ def list( __query["size"] = size __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="search_application.list", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -239,7 +271,8 @@ def put( ) elif search_application is not None and body is not None: raise ValueError("Cannot set both 'search_application' and 'body'") - __path = f"/_application/search_application/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_application/search_application/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if create is not None: __query["create"] = create @@ -254,7 +287,13 @@ def put( __body = search_application if search_application is not None else body __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="search_application.put", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -276,7 +315,8 @@ def put_behavioral_analytics( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_application/analytics/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_application/analytics/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -288,7 +328,12 @@ def put_behavioral_analytics( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers + "PUT", + __path, + params=__query, + headers=__headers, + endpoint_id="search_application.put_behavioral_analytics", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -317,7 +362,8 @@ def search( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_application/search_application/{_quote(name)}/_search" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_application/search_application/{__path_parts["name"]}/_search' __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: @@ -337,5 +383,11 @@ def search( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="search_application.search", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/searchable_snapshots.py b/elasticsearch/_sync/client/searchable_snapshots.py index 0d36d1ba9..db03e9738 100644 --- a/elasticsearch/_sync/client/searchable_snapshots.py +++ b/elasticsearch/_sync/client/searchable_snapshots.py @@ -48,9 +48,12 @@ def cache_stats( to, leave empty to get information from all nodes :param master_timeout: """ + __path_parts: t.Dict[str, str] if node_id not in SKIP_IN_PATH: - __path = f"/_searchable_snapshots/{_quote(node_id)}/cache/stats" + __path_parts = {"node_id": _quote(node_id)} + __path = f'/_searchable_snapshots/{__path_parts["node_id"]}/cache/stats' else: + __path_parts = {} __path = "/_searchable_snapshots/cache/stats" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -65,7 +68,12 @@ def cache_stats( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="searchable_snapshots.cache_stats", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -102,9 +110,12 @@ def clear_cache( :param ignore_unavailable: Whether specified concrete indices should be ignored when unavailable (missing or closed) """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_searchable_snapshots/cache/clear" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_searchable_snapshots/cache/clear' else: + __path_parts = {} __path = "/_searchable_snapshots/cache/clear" __query: t.Dict[str, t.Any] = {} if allow_no_indices is not None: @@ -123,7 +134,12 @@ def clear_cache( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="searchable_snapshots.clear_cache", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -178,7 +194,13 @@ def mount( raise ValueError("Empty value passed for parameter 'snapshot'") if index is None and body is None: raise ValueError("Empty value passed for parameter 'index'") - __path = f"/_snapshot/{_quote(repository)}/{_quote(snapshot)}/_mount" + __path_parts: t.Dict[str, str] = { + "repository": _quote(repository), + "snapshot": _quote(snapshot), + } + __path = ( + f'/_snapshot/{__path_parts["repository"]}/{__path_parts["snapshot"]}/_mount' + ) __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: @@ -206,7 +228,13 @@ def mount( __body["renamed_index"] = renamed_index __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="searchable_snapshots.mount", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -230,9 +258,12 @@ def stats( :param index: A comma-separated list of index names :param level: Return stats aggregated at cluster, index or shard level """ + __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: - __path = f"/{_quote(index)}/_searchable_snapshots/stats" + __path_parts = {"index": _quote(index)} + __path = f'/{__path_parts["index"]}/_searchable_snapshots/stats' else: + __path_parts = {} __path = "/_searchable_snapshots/stats" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -247,5 +278,10 @@ def stats( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="searchable_snapshots.stats", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/security.py b/elasticsearch/_sync/client/security.py index 5e0181153..74eedf4c0 100644 --- a/elasticsearch/_sync/client/security.py +++ b/elasticsearch/_sync/client/security.py @@ -55,6 +55,7 @@ def activate_user_profile( """ if grant_type is None and body is None: raise ValueError("Empty value passed for parameter 'grant_type'") + __path_parts: t.Dict[str, str] = {} __path = "/_security/profile/_activate" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -77,7 +78,13 @@ def activate_user_profile( __body["username"] = username __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.activate_user_profile", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -95,6 +102,7 @@ def authenticate( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_security/_authenticate" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -107,7 +115,12 @@ def authenticate( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="security.authenticate", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -145,9 +158,12 @@ def change_password( this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. """ + __path_parts: t.Dict[str, str] if username not in SKIP_IN_PATH: - __path = f"/_security/user/{_quote(username)}/_password" + __path_parts = {"username": _quote(username)} + __path = f'/_security/user/{__path_parts["username"]}/_password' else: + __path_parts = {} __path = "/_security/user/_password" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -168,7 +184,13 @@ def change_password( __body["password_hash"] = password_hash __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.change_password", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -191,7 +213,8 @@ def clear_api_key_cache( """ if ids in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'ids'") - __path = f"/_security/api_key/{_quote(ids)}/_clear_cache" + __path_parts: t.Dict[str, str] = {"ids": _quote(ids)} + __path = f'/_security/api_key/{__path_parts["ids"]}/_clear_cache' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -203,7 +226,12 @@ def clear_api_key_cache( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="security.clear_api_key_cache", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -225,7 +253,8 @@ def clear_cached_privileges( """ if application in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'application'") - __path = f"/_security/privilege/{_quote(application)}/_clear_cache" + __path_parts: t.Dict[str, str] = {"application": _quote(application)} + __path = f'/_security/privilege/{__path_parts["application"]}/_clear_cache' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -237,7 +266,12 @@ def clear_cached_privileges( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="security.clear_cached_privileges", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -262,7 +296,8 @@ def clear_cached_realms( """ if realms in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'realms'") - __path = f"/_security/realm/{_quote(realms)}/_clear_cache" + __path_parts: t.Dict[str, str] = {"realms": _quote(realms)} + __path = f'/_security/realm/{__path_parts["realms"]}/_clear_cache' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -276,7 +311,12 @@ def clear_cached_realms( __query["usernames"] = usernames __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="security.clear_cached_realms", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -298,7 +338,8 @@ def clear_cached_roles( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_security/role/{_quote(name)}/_clear_cache" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_security/role/{__path_parts["name"]}/_clear_cache' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -310,7 +351,12 @@ def clear_cached_roles( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="security.clear_cached_roles", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -340,7 +386,12 @@ def clear_cached_service_tokens( raise ValueError("Empty value passed for parameter 'service'") if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_security/service/{_quote(namespace)}/{_quote(service)}/credential/token/{_quote(name)}/_clear_cache" + __path_parts: t.Dict[str, str] = { + "namespace": _quote(namespace), + "service": _quote(service), + "name": _quote(name), + } + __path = f'/_security/service/{__path_parts["namespace"]}/{__path_parts["service"]}/credential/token/{__path_parts["name"]}/_clear_cache' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -352,7 +403,12 @@ def clear_cached_service_tokens( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="security.clear_cached_service_tokens", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -397,6 +453,7 @@ def create_api_key( is the same as the request for create role API. For more details, see create or update roles API. """ + __path_parts: t.Dict[str, str] = {} __path = "/_security/api_key" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -421,7 +478,13 @@ def create_api_key( __body["role_descriptors"] = role_descriptors __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.create_api_key", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -455,15 +518,22 @@ def create_service_token( raise ValueError("Empty value passed for parameter 'namespace'") if service in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'service'") + __path_parts: t.Dict[str, str] if ( namespace not in SKIP_IN_PATH and service not in SKIP_IN_PATH and name not in SKIP_IN_PATH ): - __path = f"/_security/service/{_quote(namespace)}/{_quote(service)}/credential/token/{_quote(name)}" + __path_parts = { + "namespace": _quote(namespace), + "service": _quote(service), + "name": _quote(name), + } + __path = f'/_security/service/{__path_parts["namespace"]}/{__path_parts["service"]}/credential/token/{__path_parts["name"]}' __method = "PUT" elif namespace not in SKIP_IN_PATH and service not in SKIP_IN_PATH: - __path = f"/_security/service/{_quote(namespace)}/{_quote(service)}/credential/token" + __path_parts = {"namespace": _quote(namespace), "service": _quote(service)} + __path = f'/_security/service/{__path_parts["namespace"]}/{__path_parts["service"]}/credential/token' __method = "POST" else: raise ValueError("Couldn't find a path for the given parameters") @@ -480,7 +550,12 @@ def create_service_token( __query["refresh"] = refresh __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - __method, __path, params=__query, headers=__headers + __method, + __path, + params=__query, + headers=__headers, + endpoint_id="security.create_service_token", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -512,7 +587,13 @@ def delete_privileges( raise ValueError("Empty value passed for parameter 'application'") if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_security/privilege/{_quote(application)}/{_quote(name)}" + __path_parts: t.Dict[str, str] = { + "application": _quote(application), + "name": _quote(name), + } + __path = ( + f'/_security/privilege/{__path_parts["application"]}/{__path_parts["name"]}' + ) __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -526,7 +607,12 @@ def delete_privileges( __query["refresh"] = refresh __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="security.delete_privileges", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -554,7 +640,8 @@ def delete_role( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_security/role/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_security/role/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -568,7 +655,12 @@ def delete_role( __query["refresh"] = refresh __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="security.delete_role", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -596,7 +688,8 @@ def delete_role_mapping( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_security/role_mapping/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_security/role_mapping/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -610,7 +703,12 @@ def delete_role_mapping( __query["refresh"] = refresh __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="security.delete_role_mapping", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -646,7 +744,12 @@ def delete_service_token( raise ValueError("Empty value passed for parameter 'service'") if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_security/service/{_quote(namespace)}/{_quote(service)}/credential/token/{_quote(name)}" + __path_parts: t.Dict[str, str] = { + "namespace": _quote(namespace), + "service": _quote(service), + "name": _quote(name), + } + __path = f'/_security/service/{__path_parts["namespace"]}/{__path_parts["service"]}/credential/token/{__path_parts["name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -660,7 +763,12 @@ def delete_service_token( __query["refresh"] = refresh __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="security.delete_service_token", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -688,7 +796,8 @@ def delete_user( """ if username in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'username'") - __path = f"/_security/user/{_quote(username)}" + __path_parts: t.Dict[str, str] = {"username": _quote(username)} + __path = f'/_security/user/{__path_parts["username"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -702,7 +811,12 @@ def delete_user( __query["refresh"] = refresh __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="security.delete_user", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -730,7 +844,8 @@ def disable_user( """ if username in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'username'") - __path = f"/_security/user/{_quote(username)}/_disable" + __path_parts: t.Dict[str, str] = {"username": _quote(username)} + __path = f'/_security/user/{__path_parts["username"]}/_disable' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -744,7 +859,12 @@ def disable_user( __query["refresh"] = refresh __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers + "PUT", + __path, + params=__query, + headers=__headers, + endpoint_id="security.disable_user", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -772,7 +892,8 @@ def disable_user_profile( """ if uid in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'uid'") - __path = f"/_security/profile/{_quote(uid)}/_disable" + __path_parts: t.Dict[str, str] = {"uid": _quote(uid)} + __path = f'/_security/profile/{__path_parts["uid"]}/_disable' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -786,7 +907,12 @@ def disable_user_profile( __query["refresh"] = refresh __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers + "PUT", + __path, + params=__query, + headers=__headers, + endpoint_id="security.disable_user_profile", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -814,7 +940,8 @@ def enable_user( """ if username in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'username'") - __path = f"/_security/user/{_quote(username)}/_enable" + __path_parts: t.Dict[str, str] = {"username": _quote(username)} + __path = f'/_security/user/{__path_parts["username"]}/_enable' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -828,7 +955,12 @@ def enable_user( __query["refresh"] = refresh __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers + "PUT", + __path, + params=__query, + headers=__headers, + endpoint_id="security.enable_user", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -856,7 +988,8 @@ def enable_user_profile( """ if uid in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'uid'") - __path = f"/_security/profile/{_quote(uid)}/_enable" + __path_parts: t.Dict[str, str] = {"uid": _quote(uid)} + __path = f'/_security/profile/{__path_parts["uid"]}/_enable' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -870,7 +1003,12 @@ def enable_user_profile( __query["refresh"] = refresh __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers + "PUT", + __path, + params=__query, + headers=__headers, + endpoint_id="security.enable_user_profile", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -888,6 +1026,7 @@ def enroll_kibana( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_security/enroll/kibana" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -900,7 +1039,12 @@ def enroll_kibana( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="security.enroll_kibana", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -917,6 +1061,7 @@ def enroll_node( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_security/enroll/node" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -929,7 +1074,12 @@ def enroll_node( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="security.enroll_node", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -974,6 +1124,7 @@ def get_api_key( associated with the API key. An API key's actual permission is the intersection of its assigned role descriptors and the owner user's role descriptors. """ + __path_parts: t.Dict[str, str] = {} __path = "/_security/api_key" __query: t.Dict[str, t.Any] = {} if active_only is not None: @@ -1000,7 +1151,12 @@ def get_api_key( __query["with_limited_by"] = with_limited_by __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="security.get_api_key", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1018,6 +1174,7 @@ def get_builtin_privileges( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_security/privilege/_builtin" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1030,7 +1187,12 @@ def get_builtin_privileges( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="security.get_builtin_privileges", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1052,11 +1214,15 @@ def get_privileges( :param application: Application name :param name: Privilege name """ + __path_parts: t.Dict[str, str] if application not in SKIP_IN_PATH and name not in SKIP_IN_PATH: - __path = f"/_security/privilege/{_quote(application)}/{_quote(name)}" + __path_parts = {"application": _quote(application), "name": _quote(name)} + __path = f'/_security/privilege/{__path_parts["application"]}/{__path_parts["name"]}' elif application not in SKIP_IN_PATH: - __path = f"/_security/privilege/{_quote(application)}" + __path_parts = {"application": _quote(application)} + __path = f'/_security/privilege/{__path_parts["application"]}' else: + __path_parts = {} __path = "/_security/privilege" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1069,7 +1235,12 @@ def get_privileges( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="security.get_privileges", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1091,9 +1262,12 @@ def get_role( list. If you do not specify this parameter, the API returns information about all roles. """ + __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: - __path = f"/_security/role/{_quote(name)}" + __path_parts = {"name": _quote(name)} + __path = f'/_security/role/{__path_parts["name"]}' else: + __path_parts = {} __path = "/_security/role" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1106,7 +1280,12 @@ def get_role( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="security.get_role", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1130,9 +1309,12 @@ def get_role_mapping( mapping names as a comma-separated list. If you do not specify this parameter, the API returns information about all role mappings. """ + __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: - __path = f"/_security/role_mapping/{_quote(name)}" + __path_parts = {"name": _quote(name)} + __path = f'/_security/role_mapping/{__path_parts["name"]}' else: + __path_parts = {} __path = "/_security/role_mapping" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1145,7 +1327,12 @@ def get_role_mapping( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="security.get_role_mapping", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1170,11 +1357,15 @@ def get_service_accounts( :param service: Name of the service name. Omit this parameter to retrieve information about all service accounts that belong to the specified `namespace`. """ + __path_parts: t.Dict[str, str] if namespace not in SKIP_IN_PATH and service not in SKIP_IN_PATH: - __path = f"/_security/service/{_quote(namespace)}/{_quote(service)}" + __path_parts = {"namespace": _quote(namespace), "service": _quote(service)} + __path = f'/_security/service/{__path_parts["namespace"]}/{__path_parts["service"]}' elif namespace not in SKIP_IN_PATH: - __path = f"/_security/service/{_quote(namespace)}" + __path_parts = {"namespace": _quote(namespace)} + __path = f'/_security/service/{__path_parts["namespace"]}' else: + __path_parts = {} __path = "/_security/service" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1187,7 +1378,12 @@ def get_service_accounts( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="security.get_service_accounts", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1213,7 +1409,11 @@ def get_service_credentials( raise ValueError("Empty value passed for parameter 'namespace'") if service in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'service'") - __path = f"/_security/service/{_quote(namespace)}/{_quote(service)}/credential" + __path_parts: t.Dict[str, str] = { + "namespace": _quote(namespace), + "service": _quote(service), + } + __path = f'/_security/service/{__path_parts["namespace"]}/{__path_parts["service"]}/credential' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -1225,7 +1425,12 @@ def get_service_credentials( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="security.get_service_credentials", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1270,6 +1475,7 @@ def get_token( :param scope: :param username: """ + __path_parts: t.Dict[str, str] = {} __path = "/_security/oauth2/token" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -1296,7 +1502,13 @@ def get_token( __body["username"] = username __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.get_token", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1321,9 +1533,12 @@ def get_user( :param with_profile_uid: If true will return the User Profile ID for a user, if any. """ + __path_parts: t.Dict[str, str] if username not in SKIP_IN_PATH: - __path = f"/_security/user/{_quote(username)}" + __path_parts = {"username": _quote(username)} + __path = f'/_security/user/{__path_parts["username"]}' else: + __path_parts = {} __path = "/_security/user" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1338,7 +1553,12 @@ def get_user( __query["with_profile_uid"] = with_profile_uid __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="security.get_user", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1365,6 +1585,7 @@ def get_user_privileges( the API returns information about all privileges for the requested application. :param username: """ + __path_parts: t.Dict[str, str] = {} __path = "/_security/user/_privileges" __query: t.Dict[str, t.Any] = {} if application is not None: @@ -1383,7 +1604,12 @@ def get_user_privileges( __query["username"] = username __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="security.get_user_privileges", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -1410,7 +1636,8 @@ def get_user_profile( """ if uid in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'uid'") - __path = f"/_security/profile/{_quote(uid)}" + __path_parts: t.Dict[str, str] = {"uid": _quote(uid)} + __path = f'/_security/profile/{__path_parts["uid"]}' __query: t.Dict[str, t.Any] = {} if data is not None: __query["data"] = data @@ -1424,7 +1651,12 @@ def get_user_profile( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="security.get_user_profile", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1477,6 +1709,7 @@ def grant_api_key( raise ValueError("Empty value passed for parameter 'api_key'") if grant_type is None and body is None: raise ValueError("Empty value passed for parameter 'grant_type'") + __path_parts: t.Dict[str, str] = {} __path = "/_security/api_key/grant" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -1503,7 +1736,13 @@ def grant_api_key( __body["username"] = username __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.grant_api_key", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1539,9 +1778,12 @@ def has_privileges( :param cluster: A list of the cluster privileges that you want to check. :param index: """ + __path_parts: t.Dict[str, str] if user not in SKIP_IN_PATH: - __path = f"/_security/user/{_quote(user)}/_has_privileges" + __path_parts = {"user": _quote(user)} + __path = f'/_security/user/{__path_parts["user"]}/_has_privileges' else: + __path_parts = {} __path = "/_security/user/_has_privileges" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -1562,7 +1804,13 @@ def has_privileges( __body["index"] = index __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.has_privileges", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1593,6 +1841,7 @@ def has_privileges_user_profile( raise ValueError("Empty value passed for parameter 'privileges'") if uids is None and body is None: raise ValueError("Empty value passed for parameter 'uids'") + __path_parts: t.Dict[str, str] = {} __path = "/_security/profile/_has_privileges" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -1611,7 +1860,13 @@ def has_privileges_user_profile( __body["uids"] = uids __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.has_privileges_user_profile", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1651,6 +1906,7 @@ def invalidate_api_key( :param username: The username of a user. This parameter cannot be used with either `ids` or `name`, or when `owner` flag is set to `true`. """ + __path_parts: t.Dict[str, str] = {} __path = "/_security/api_key" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -1677,7 +1933,13 @@ def invalidate_api_key( __body["username"] = username __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers, body=__body + "DELETE", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.invalidate_api_key", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1706,6 +1968,7 @@ def invalidate_token( :param token: :param username: """ + __path_parts: t.Dict[str, str] = {} __path = "/_security/oauth2/token" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -1728,7 +1991,13 @@ def invalidate_token( __body["username"] = username __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers, body=__body + "DELETE", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.invalidate_token", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1765,6 +2034,7 @@ def put_privileges( ) elif privileges is not None and body is not None: raise ValueError("Cannot set both 'privileges' and 'body'") + __path_parts: t.Dict[str, str] = {} __path = "/_security/privilege" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -1780,7 +2050,13 @@ def put_privileges( __body = privileges if privileges is not None else body __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.put_privileges", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1850,7 +2126,8 @@ def put_role( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_security/role/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_security/role/{__path_parts["name"]}' __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: @@ -1880,7 +2157,13 @@ def put_role( __body["transient_metadata"] = transient_metadata __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.put_role", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -1930,7 +2213,8 @@ def put_role_mapping( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_security/role_mapping/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = f'/_security/role_mapping/{__path_parts["name"]}' __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: @@ -1958,7 +2242,13 @@ def put_role_mapping( __body["run_as"] = run_as __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.put_role_mapping", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2012,7 +2302,8 @@ def put_user( """ if username in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'username'") - __path = f"/_security/user/{_quote(username)}" + __path_parts: t.Dict[str, str] = {"username": _quote(username)} + __path = f'/_security/user/{__path_parts["username"]}' __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: @@ -2042,7 +2333,13 @@ def put_user( __body["roles"] = roles __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.put_user", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2094,6 +2391,7 @@ def query_api_keys( associated with the API key. An API key's actual permission is the intersection of its assigned role descriptors and the owner user's role descriptors. """ + __path_parts: t.Dict[str, str] = {} __path = "/_security/_query/api_key" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -2135,7 +2433,13 @@ def query_api_keys( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.query_api_keys", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2170,6 +2474,7 @@ def saml_authenticate( raise ValueError("Empty value passed for parameter 'content'") if ids is None and body is None: raise ValueError("Empty value passed for parameter 'ids'") + __path_parts: t.Dict[str, str] = {} __path = "/_security/saml/authenticate" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -2190,7 +2495,13 @@ def saml_authenticate( __body["realm"] = realm __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.saml_authenticate", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2228,6 +2539,7 @@ def saml_complete_logout( raise ValueError("Empty value passed for parameter 'ids'") if realm is None and body is None: raise ValueError("Empty value passed for parameter 'realm'") + __path_parts: t.Dict[str, str] = {} __path = "/_security/saml/complete_logout" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -2250,7 +2562,13 @@ def saml_complete_logout( __body["query_string"] = query_string __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.saml_complete_logout", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2291,6 +2609,7 @@ def saml_invalidate( """ if query_string is None and body is None: raise ValueError("Empty value passed for parameter 'query_string'") + __path_parts: t.Dict[str, str] = {} __path = "/_security/saml/invalidate" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -2311,7 +2630,13 @@ def saml_invalidate( __body["realm"] = realm __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.saml_invalidate", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2343,6 +2668,7 @@ def saml_logout( """ if token is None and body is None: raise ValueError("Empty value passed for parameter 'token'") + __path_parts: t.Dict[str, str] = {} __path = "/_security/saml/logout" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -2361,7 +2687,13 @@ def saml_logout( __body["refresh_token"] = refresh_token __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.saml_logout", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2394,6 +2726,7 @@ def saml_prepare_authentication( API returns as the RelayState query parameter. If the Authentication Request is signed, this value is used as part of the signature computation. """ + __path_parts: t.Dict[str, str] = {} __path = "/_security/saml/prepare" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -2414,7 +2747,13 @@ def saml_prepare_authentication( __body["relay_state"] = relay_state __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.saml_prepare_authentication", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -2436,7 +2775,8 @@ def saml_service_provider_metadata( """ if realm_name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'realm_name'") - __path = f"/_security/saml/metadata/{_quote(realm_name)}" + __path_parts: t.Dict[str, str] = {"realm_name": _quote(realm_name)} + __path = f'/_security/saml/metadata/{__path_parts["realm_name"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -2448,7 +2788,12 @@ def saml_service_provider_metadata( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="security.saml_service_provider_metadata", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2484,6 +2829,7 @@ def suggest_user_profiles( Name-related fields are the user's `username`, `full_name`, and `email`. :param size: Number of profiles to return. """ + __path_parts: t.Dict[str, str] = {} __path = "/_security/profile/_suggest" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -2510,7 +2856,13 @@ def suggest_user_profiles( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.suggest_user_profiles", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2550,7 +2902,8 @@ def update_api_key( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_security/api_key/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_security/api_key/{__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: @@ -2574,7 +2927,13 @@ def update_api_key( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.update_api_key", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -2617,7 +2976,8 @@ def update_user_profile_data( """ if uid in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'uid'") - __path = f"/_security/profile/{_quote(uid)}/_data" + __path_parts: t.Dict[str, str] = {"uid": _quote(uid)} + __path = f'/_security/profile/{__path_parts["uid"]}/_data' __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: @@ -2641,5 +3001,11 @@ def update_user_profile_data( __body["labels"] = labels __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.update_user_profile_data", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/shutdown.py b/elasticsearch/_sync/client/shutdown.py index b3e2caf90..0ab0d20bb 100644 --- a/elasticsearch/_sync/client/shutdown.py +++ b/elasticsearch/_sync/client/shutdown.py @@ -56,7 +56,8 @@ def delete_node( """ if node_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'node_id'") - __path = f"/_nodes/{_quote(node_id)}/shutdown" + __path_parts: t.Dict[str, str] = {"node_id": _quote(node_id)} + __path = f'/_nodes/{__path_parts["node_id"]}/shutdown' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -72,7 +73,12 @@ def delete_node( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="shutdown.delete_node", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -104,9 +110,12 @@ def get_node( :param timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] if node_id not in SKIP_IN_PATH: - __path = f"/_nodes/{_quote(node_id)}/shutdown" + __path_parts = {"node_id": _quote(node_id)} + __path = f'/_nodes/{__path_parts["node_id"]}/shutdown' else: + __path_parts = {} __path = "/_nodes/shutdown" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -123,7 +132,12 @@ def get_node( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="shutdown.get_node", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -196,7 +210,8 @@ def put_node( raise ValueError("Empty value passed for parameter 'reason'") if type is None and body is None: raise ValueError("Empty value passed for parameter 'type'") - __path = f"/_nodes/{_quote(node_id)}/shutdown" + __path_parts: t.Dict[str, str] = {"node_id": _quote(node_id)} + __path = f'/_nodes/{__path_parts["node_id"]}/shutdown' __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: @@ -222,5 +237,11 @@ def put_node( __body["target_node_name"] = target_node_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 + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="shutdown.put_node", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/slm.py b/elasticsearch/_sync/client/slm.py index 55ac7619d..3e88d86f8 100644 --- a/elasticsearch/_sync/client/slm.py +++ b/elasticsearch/_sync/client/slm.py @@ -44,7 +44,8 @@ def delete_lifecycle( """ if policy_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'policy_id'") - __path = f"/_slm/policy/{_quote(policy_id)}" + __path_parts: t.Dict[str, str] = {"policy_id": _quote(policy_id)} + __path = f'/_slm/policy/{__path_parts["policy_id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -56,7 +57,12 @@ def delete_lifecycle( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="slm.delete_lifecycle", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -79,7 +85,8 @@ def execute_lifecycle( """ if policy_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'policy_id'") - __path = f"/_slm/policy/{_quote(policy_id)}/_execute" + __path_parts: t.Dict[str, str] = {"policy_id": _quote(policy_id)} + __path = f'/_slm/policy/{__path_parts["policy_id"]}/_execute' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -91,7 +98,12 @@ def execute_lifecycle( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers + "PUT", + __path, + params=__query, + headers=__headers, + endpoint_id="slm.execute_lifecycle", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -108,6 +120,7 @@ def execute_retention( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_slm/_execute_retention" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -120,7 +133,12 @@ def execute_retention( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="slm.execute_retention", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -141,9 +159,12 @@ def get_lifecycle( :param policy_id: Comma-separated list of snapshot lifecycle policies to retrieve """ + __path_parts: t.Dict[str, str] if policy_id not in SKIP_IN_PATH: - __path = f"/_slm/policy/{_quote(policy_id)}" + __path_parts = {"policy_id": _quote(policy_id)} + __path = f'/_slm/policy/{__path_parts["policy_id"]}' else: + __path_parts = {} __path = "/_slm/policy" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -156,7 +177,12 @@ def get_lifecycle( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="slm.get_lifecycle", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -174,6 +200,7 @@ def get_stats( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_slm/stats" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -186,7 +213,12 @@ def get_stats( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="slm.get_stats", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -203,6 +235,7 @@ def get_status( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_slm/status" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -215,7 +248,12 @@ def get_status( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="slm.get_status", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -266,7 +304,8 @@ def put_lifecycle( """ if policy_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'policy_id'") - __path = f"/_slm/policy/{_quote(policy_id)}" + __path_parts: t.Dict[str, str] = {"policy_id": _quote(policy_id)} + __path = f'/_slm/policy/{__path_parts["policy_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: @@ -298,7 +337,13 @@ def put_lifecycle( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="slm.put_lifecycle", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -315,6 +360,7 @@ def start( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_slm/start" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -327,7 +373,12 @@ def start( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="slm.start", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -344,6 +395,7 @@ def stop( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_slm/stop" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -356,5 +408,10 @@ def stop( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="slm.stop", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/snapshot.py b/elasticsearch/_sync/client/snapshot.py index 3cedec280..d42161d59 100644 --- a/elasticsearch/_sync/client/snapshot.py +++ b/elasticsearch/_sync/client/snapshot.py @@ -50,7 +50,8 @@ def cleanup_repository( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_snapshot/{_quote(name)}/_cleanup" + __path_parts: t.Dict[str, str] = {"repository": _quote(name)} + __path = f'/_snapshot/{__path_parts["repository"]}/_cleanup' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -66,7 +67,12 @@ def cleanup_repository( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="snapshot.cleanup_repository", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -109,7 +115,12 @@ def clone( raise ValueError("Empty value passed for parameter 'target_snapshot'") if indices is None and body is None: raise ValueError("Empty value passed for parameter 'indices'") - __path = f"/_snapshot/{_quote(repository)}/{_quote(snapshot)}/_clone/{_quote(target_snapshot)}" + __path_parts: t.Dict[str, str] = { + "repository": _quote(repository), + "snapshot": _quote(snapshot), + "target_snapshot": _quote(target_snapshot), + } + __path = f'/_snapshot/{__path_parts["repository"]}/{__path_parts["snapshot"]}/_clone/{__path_parts["target_snapshot"]}' __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: @@ -129,7 +140,13 @@ def clone( __body["indices"] = indices __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="snapshot.clone", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -203,7 +220,11 @@ def create( raise ValueError("Empty value passed for parameter 'repository'") if snapshot in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'snapshot'") - __path = f"/_snapshot/{_quote(repository)}/{_quote(snapshot)}" + __path_parts: t.Dict[str, str] = { + "repository": _quote(repository), + "snapshot": _quote(snapshot), + } + __path = f'/_snapshot/{__path_parts["repository"]}/{__path_parts["snapshot"]}' __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: @@ -237,7 +258,13 @@ def create( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="snapshot.create", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -278,7 +305,8 @@ def create_repository( ) elif repository is not None and body is not None: raise ValueError("Cannot set both 'repository' and 'body'") - __path = f"/_snapshot/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"repository": _quote(name)} + __path = f'/_snapshot/{__path_parts["repository"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -297,7 +325,13 @@ def create_repository( __body = repository if repository is not None else body __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="snapshot.create_repository", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -327,7 +361,11 @@ def delete( raise ValueError("Empty value passed for parameter 'repository'") if snapshot in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'snapshot'") - __path = f"/_snapshot/{_quote(repository)}/{_quote(snapshot)}" + __path_parts: t.Dict[str, str] = { + "repository": _quote(repository), + "snapshot": _quote(snapshot), + } + __path = f'/_snapshot/{__path_parts["repository"]}/{__path_parts["snapshot"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -341,7 +379,12 @@ def delete( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="snapshot.delete", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -370,7 +413,8 @@ def delete_repository( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_snapshot/{_quote(name)}" + __path_parts: t.Dict[str, str] = {"repository": _quote(name)} + __path = f'/_snapshot/{__path_parts["repository"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -386,7 +430,12 @@ def delete_repository( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="snapshot.delete_repository", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -470,7 +519,11 @@ def get( raise ValueError("Empty value passed for parameter 'repository'") if snapshot in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'snapshot'") - __path = f"/_snapshot/{_quote(repository)}/{_quote(snapshot)}" + __path_parts: t.Dict[str, str] = { + "repository": _quote(repository), + "snapshot": _quote(snapshot), + } + __path = f'/_snapshot/{__path_parts["repository"]}/{__path_parts["snapshot"]}' __query: t.Dict[str, t.Any] = {} if after is not None: __query["after"] = after @@ -508,7 +561,12 @@ def get( __query["verbose"] = verbose __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="snapshot.get", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -535,9 +593,12 @@ def get_repository( node (default: false) :param master_timeout: Explicit operation timeout for connection to master node """ + __path_parts: t.Dict[str, str] if name not in SKIP_IN_PATH: - __path = f"/_snapshot/{_quote(name)}" + __path_parts = {"repository": _quote(name)} + __path = f'/_snapshot/{__path_parts["repository"]}' else: + __path_parts = {} __path = "/_snapshot" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -554,7 +615,12 @@ def get_repository( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="snapshot.get_repository", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -621,7 +687,11 @@ def restore( raise ValueError("Empty value passed for parameter 'repository'") if snapshot in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'snapshot'") - __path = f"/_snapshot/{_quote(repository)}/{_quote(snapshot)}/_restore" + __path_parts: t.Dict[str, str] = { + "repository": _quote(repository), + "snapshot": _quote(snapshot), + } + __path = f'/_snapshot/{__path_parts["repository"]}/{__path_parts["snapshot"]}/_restore' __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: @@ -663,7 +733,13 @@ def restore( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="snapshot.restore", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -692,11 +768,18 @@ def status( to false which means a SnapshotMissingException is thrown :param master_timeout: Explicit operation timeout for connection to master node """ + __path_parts: t.Dict[str, str] if repository not in SKIP_IN_PATH and snapshot not in SKIP_IN_PATH: - __path = f"/_snapshot/{_quote(repository)}/{_quote(snapshot)}/_status" + __path_parts = { + "repository": _quote(repository), + "snapshot": _quote(snapshot), + } + __path = f'/_snapshot/{__path_parts["repository"]}/{__path_parts["snapshot"]}/_status' elif repository not in SKIP_IN_PATH: - __path = f"/_snapshot/{_quote(repository)}/_status" + __path_parts = {"repository": _quote(repository)} + __path = f'/_snapshot/{__path_parts["repository"]}/_status' else: + __path_parts = {} __path = "/_snapshot/_status" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -713,7 +796,12 @@ def status( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="snapshot.status", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -741,7 +829,8 @@ def verify_repository( """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") - __path = f"/_snapshot/{_quote(name)}/_verify" + __path_parts: t.Dict[str, str] = {"repository": _quote(name)} + __path = f'/_snapshot/{__path_parts["repository"]}/_verify' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -757,5 +846,10 @@ def verify_repository( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="snapshot.verify_repository", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/sql.py b/elasticsearch/_sync/client/sql.py index 6df2c49bf..7a6e681af 100644 --- a/elasticsearch/_sync/client/sql.py +++ b/elasticsearch/_sync/client/sql.py @@ -47,6 +47,7 @@ def clear_cursor( """ if cursor is None and body is None: raise ValueError("Empty value passed for parameter 'cursor'") + __path_parts: t.Dict[str, str] = {} __path = "/_sql/close" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -63,7 +64,13 @@ def clear_cursor( __body["cursor"] = cursor __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="sql.clear_cursor", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -86,7 +93,8 @@ def delete_async( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_sql/async/delete/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_sql/async/delete/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -98,7 +106,12 @@ def delete_async( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="sql.delete_async", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -136,7 +149,8 @@ def get_async( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_sql/async/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_sql/async/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if delimiter is not None: __query["delimiter"] = delimiter @@ -156,7 +170,12 @@ def get_async( __query["wait_for_completion_timeout"] = wait_for_completion_timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="sql.get_async", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -179,7 +198,8 @@ def get_async_status( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_sql/async/status/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_sql/async/status/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -191,7 +211,12 @@ def get_async_status( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="sql.get_async_status", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -281,6 +306,7 @@ def query( to no timeout, meaning the request waits for complete search results. If the search doesn’t finish within this period, the search becomes async. """ + __path_parts: t.Dict[str, str] = {} __path = "/_sql" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -329,7 +355,13 @@ def query( __body["wait_for_completion_timeout"] = wait_for_completion_timeout __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="sql.query", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -360,6 +392,7 @@ def translate( """ if query is None and body is None: raise ValueError("Empty value passed for parameter 'query'") + __path_parts: t.Dict[str, str] = {} __path = "/_sql/translate" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -382,5 +415,11 @@ def translate( __body["time_zone"] = time_zone __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="sql.translate", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/ssl.py b/elasticsearch/_sync/client/ssl.py index 91a0f4458..63dba0bcb 100644 --- a/elasticsearch/_sync/client/ssl.py +++ b/elasticsearch/_sync/client/ssl.py @@ -40,6 +40,7 @@ def certificates( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_ssl/certificates" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -52,5 +53,10 @@ def certificates( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ssl.certificates", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/synonyms.py b/elasticsearch/_sync/client/synonyms.py index 7f0c8fc3a..5d373bd99 100644 --- a/elasticsearch/_sync/client/synonyms.py +++ b/elasticsearch/_sync/client/synonyms.py @@ -44,7 +44,8 @@ def delete_synonym( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_synonyms/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_synonyms/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -56,7 +57,12 @@ def delete_synonym( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="synonyms.delete_synonym", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -82,7 +88,11 @@ def delete_synonym_rule( raise ValueError("Empty value passed for parameter 'set_id'") if rule_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'rule_id'") - __path = f"/_synonyms/{_quote(set_id)}/{_quote(rule_id)}" + __path_parts: t.Dict[str, str] = { + "set_id": _quote(set_id), + "rule_id": _quote(rule_id), + } + __path = f'/_synonyms/{__path_parts["set_id"]}/{__path_parts["rule_id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -94,7 +104,12 @@ def delete_synonym_rule( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="synonyms.delete_synonym_rule", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -122,7 +137,8 @@ def get_synonym( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_synonyms/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_synonyms/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -138,7 +154,12 @@ def get_synonym( __query["size"] = size __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="synonyms.get_synonym", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -164,7 +185,11 @@ def get_synonym_rule( raise ValueError("Empty value passed for parameter 'set_id'") if rule_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'rule_id'") - __path = f"/_synonyms/{_quote(set_id)}/{_quote(rule_id)}" + __path_parts: t.Dict[str, str] = { + "set_id": _quote(set_id), + "rule_id": _quote(rule_id), + } + __path = f'/_synonyms/{__path_parts["set_id"]}/{__path_parts["rule_id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -176,7 +201,12 @@ def get_synonym_rule( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="synonyms.get_synonym_rule", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -200,6 +230,7 @@ def get_synonyms_sets( :param from_: Starting offset :param size: specifies a max number of results to get """ + __path_parts: t.Dict[str, str] = {} __path = "/_synonyms" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -216,7 +247,12 @@ def get_synonyms_sets( __query["size"] = size __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="synonyms.get_synonyms_sets", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -245,7 +281,8 @@ def put_synonym( raise ValueError("Empty value passed for parameter 'id'") if synonyms_set is None and body is None: raise ValueError("Empty value passed for parameter 'synonyms_set'") - __path = f"/_synonyms/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_synonyms/{__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: @@ -261,7 +298,13 @@ def put_synonym( __body["synonyms_set"] = synonyms_set __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="synonyms.put_synonym", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -294,7 +337,11 @@ def put_synonym_rule( raise ValueError("Empty value passed for parameter 'rule_id'") if synonyms is None and body is None: raise ValueError("Empty value passed for parameter 'synonyms'") - __path = f"/_synonyms/{_quote(set_id)}/{_quote(rule_id)}" + __path_parts: t.Dict[str, str] = { + "set_id": _quote(set_id), + "rule_id": _quote(rule_id), + } + __path = f'/_synonyms/{__path_parts["set_id"]}/{__path_parts["rule_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: @@ -310,5 +357,11 @@ def put_synonym_rule( __body["synonyms"] = synonyms __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="synonyms.put_synonym_rule", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/tasks.py b/elasticsearch/_sync/client/tasks.py index 4e83e2228..e00da5a85 100644 --- a/elasticsearch/_sync/client/tasks.py +++ b/elasticsearch/_sync/client/tasks.py @@ -52,9 +52,12 @@ def cancel( :param wait_for_completion: Should the request block until the cancellation of the task and its descendant tasks is completed. Defaults to false """ + __path_parts: t.Dict[str, str] if task_id not in SKIP_IN_PATH: - __path = f"/_tasks/{_quote(task_id)}/_cancel" + __path_parts = {"task_id": _quote(task_id)} + __path = f'/_tasks/{__path_parts["task_id"]}/_cancel' else: + __path_parts = {} __path = "/_tasks/_cancel" __query: t.Dict[str, t.Any] = {} if actions is not None: @@ -75,7 +78,12 @@ def cancel( __query["wait_for_completion"] = wait_for_completion __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="tasks.cancel", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -103,7 +111,8 @@ def get( """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") - __path = f"/_tasks/{_quote(task_id)}" + __path_parts: t.Dict[str, str] = {"task_id": _quote(task_id)} + __path = f'/_tasks/{__path_parts["task_id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -119,7 +128,12 @@ def get( __query["wait_for_completion"] = wait_for_completion __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="tasks.get", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -165,6 +179,7 @@ def list( :param wait_for_completion: If `true`, the request blocks until the operation is complete. """ + __path_parts: t.Dict[str, str] = {} __path = "/_tasks" __query: t.Dict[str, t.Any] = {} if actions is not None: @@ -193,5 +208,10 @@ def list( __query["wait_for_completion"] = wait_for_completion __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="tasks.list", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/text_structure.py b/elasticsearch/_sync/client/text_structure.py index 9f9019c8f..e3de1b190 100644 --- a/elasticsearch/_sync/client/text_structure.py +++ b/elasticsearch/_sync/client/text_structure.py @@ -127,6 +127,7 @@ def find_structure( ) elif text_files is not None and body is not None: raise ValueError("Cannot set both 'text_files' and 'body'") + __path_parts: t.Dict[str, str] = {} __path = "/_text_structure/find_structure" __query: t.Dict[str, t.Any] = {} if charset is not None: @@ -165,7 +166,13 @@ def find_structure( "content-type": "application/x-ndjson", } return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="text_structure.find_structure", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -197,6 +204,7 @@ def test_grok_pattern( raise ValueError("Empty value passed for parameter 'grok_pattern'") if text is None and body is None: raise ValueError("Empty value passed for parameter 'text'") + __path_parts: t.Dict[str, str] = {} __path = "/_text_structure/test_grok_pattern" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -217,5 +225,11 @@ def test_grok_pattern( __body["text"] = text __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="text_structure.test_grok_pattern", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/transform.py b/elasticsearch/_sync/client/transform.py index 75bf8e2e3..5fb069399 100644 --- a/elasticsearch/_sync/client/transform.py +++ b/elasticsearch/_sync/client/transform.py @@ -55,7 +55,8 @@ def delete_transform( """ if transform_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'transform_id'") - __path = f"/_transform/{_quote(transform_id)}" + __path_parts: t.Dict[str, str] = {"transform_id": _quote(transform_id)} + __path = f'/_transform/{__path_parts["transform_id"]}' __query: t.Dict[str, t.Any] = {} if delete_dest_index is not None: __query["delete_dest_index"] = delete_dest_index @@ -73,7 +74,12 @@ def delete_transform( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="transform.delete_transform", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -111,9 +117,12 @@ def get_transform( :param from_: Skips the specified number of transforms. :param size: Specifies the maximum number of transforms to obtain. """ + __path_parts: t.Dict[str, str] if transform_id not in SKIP_IN_PATH: - __path = f"/_transform/{_quote(transform_id)}" + __path_parts = {"transform_id": _quote(transform_id)} + __path = f'/_transform/{__path_parts["transform_id"]}' else: + __path_parts = {} __path = "/_transform" __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: @@ -134,7 +143,12 @@ def get_transform( __query["size"] = size __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="transform.get_transform", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -172,7 +186,8 @@ def get_transform_stats( """ if transform_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'transform_id'") - __path = f"/_transform/{_quote(transform_id)}/_stats" + __path_parts: t.Dict[str, str] = {"transform_id": _quote(transform_id)} + __path = f'/_transform/{__path_parts["transform_id"]}/_stats' __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: __query["allow_no_match"] = allow_no_match @@ -192,7 +207,12 @@ def get_transform_stats( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="transform.get_transform_stats", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -255,9 +275,12 @@ def preview_transform( :param timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] if transform_id not in SKIP_IN_PATH: - __path = f"/_transform/{_quote(transform_id)}/_preview" + __path_parts = {"transform_id": _quote(transform_id)} + __path = f'/_transform/{__path_parts["transform_id"]}/_preview' else: + __path_parts = {} __path = "/_transform/_preview" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -296,7 +319,13 @@ def preview_transform( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="transform.preview_transform", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -377,7 +406,8 @@ def put_transform( raise ValueError("Empty value passed for parameter 'dest'") if source is None and body is None: raise ValueError("Empty value passed for parameter 'source'") - __path = f"/_transform/{_quote(transform_id)}" + __path_parts: t.Dict[str, str] = {"transform_id": _quote(transform_id)} + __path = f'/_transform/{__path_parts["transform_id"]}' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} if defer_validation is not None: @@ -415,7 +445,13 @@ def put_transform( __body["sync"] = sync __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="transform.put_transform", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -443,7 +479,8 @@ def reset_transform( """ if transform_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'transform_id'") - __path = f"/_transform/{_quote(transform_id)}/_reset" + __path_parts: t.Dict[str, str] = {"transform_id": _quote(transform_id)} + __path = f'/_transform/{__path_parts["transform_id"]}/_reset' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -457,7 +494,12 @@ def reset_transform( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="transform.reset_transform", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -481,7 +523,8 @@ def schedule_now_transform( """ if transform_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'transform_id'") - __path = f"/_transform/{_quote(transform_id)}/_schedule_now" + __path_parts: t.Dict[str, str] = {"transform_id": _quote(transform_id)} + __path = f'/_transform/{__path_parts["transform_id"]}/_schedule_now' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -495,7 +538,12 @@ def schedule_now_transform( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="transform.schedule_now_transform", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -526,7 +574,8 @@ def start_transform( """ if transform_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'transform_id'") - __path = f"/_transform/{_quote(transform_id)}/_start" + __path_parts: t.Dict[str, str] = {"transform_id": _quote(transform_id)} + __path = f'/_transform/{__path_parts["transform_id"]}/_start' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -542,7 +591,12 @@ def start_transform( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="transform.start_transform", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -589,7 +643,8 @@ def stop_transform( """ if transform_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'transform_id'") - __path = f"/_transform/{_quote(transform_id)}/_stop" + __path_parts: t.Dict[str, str] = {"transform_id": _quote(transform_id)} + __path = f'/_transform/{__path_parts["transform_id"]}/_stop' __query: t.Dict[str, t.Any] = {} if allow_no_match is not None: __query["allow_no_match"] = allow_no_match @@ -611,7 +666,12 @@ def stop_transform( __query["wait_for_completion"] = wait_for_completion __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="transform.stop_transform", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -673,7 +733,8 @@ def update_transform( """ if transform_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'transform_id'") - __path = f"/_transform/{_quote(transform_id)}/_update" + __path_parts: t.Dict[str, str] = {"transform_id": _quote(transform_id)} + __path = f'/_transform/{__path_parts["transform_id"]}/_update' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} if defer_validation is not None: @@ -707,7 +768,13 @@ def update_transform( __body["sync"] = sync __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="transform.update_transform", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -730,6 +797,7 @@ def upgrade_transforms( :param timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] = {} __path = "/_transform/_upgrade" __query: t.Dict[str, t.Any] = {} if dry_run is not None: @@ -746,5 +814,10 @@ def upgrade_transforms( __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="transform.upgrade_transforms", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/watcher.py b/elasticsearch/_sync/client/watcher.py index 346128b18..272a334b7 100644 --- a/elasticsearch/_sync/client/watcher.py +++ b/elasticsearch/_sync/client/watcher.py @@ -46,10 +46,16 @@ def ack_watch( """ if watch_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'watch_id'") + __path_parts: t.Dict[str, str] if watch_id not in SKIP_IN_PATH and action_id not in SKIP_IN_PATH: - __path = f"/_watcher/watch/{_quote(watch_id)}/_ack/{_quote(action_id)}" + __path_parts = { + "watch_id": _quote(watch_id), + "action_id": _quote(action_id), + } + __path = f'/_watcher/watch/{__path_parts["watch_id"]}/_ack/{__path_parts["action_id"]}' elif watch_id not in SKIP_IN_PATH: - __path = f"/_watcher/watch/{_quote(watch_id)}/_ack" + __path_parts = {"watch_id": _quote(watch_id)} + __path = f'/_watcher/watch/{__path_parts["watch_id"]}/_ack' else: raise ValueError("Couldn't find a path for the given parameters") __query: t.Dict[str, t.Any] = {} @@ -63,7 +69,12 @@ def ack_watch( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers + "PUT", + __path, + params=__query, + headers=__headers, + endpoint_id="watcher.ack_watch", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -85,7 +96,8 @@ def activate_watch( """ if watch_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'watch_id'") - __path = f"/_watcher/watch/{_quote(watch_id)}/_activate" + __path_parts: t.Dict[str, str] = {"watch_id": _quote(watch_id)} + __path = f'/_watcher/watch/{__path_parts["watch_id"]}/_activate' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -97,7 +109,12 @@ def activate_watch( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers + "PUT", + __path, + params=__query, + headers=__headers, + endpoint_id="watcher.activate_watch", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -119,7 +136,8 @@ def deactivate_watch( """ if watch_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'watch_id'") - __path = f"/_watcher/watch/{_quote(watch_id)}/_deactivate" + __path_parts: t.Dict[str, str] = {"watch_id": _quote(watch_id)} + __path = f'/_watcher/watch/{__path_parts["watch_id"]}/_deactivate' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -131,7 +149,12 @@ def deactivate_watch( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers + "PUT", + __path, + params=__query, + headers=__headers, + endpoint_id="watcher.deactivate_watch", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -153,7 +176,8 @@ def delete_watch( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_watcher/watch/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_watcher/watch/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -165,7 +189,12 @@ def delete_watch( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "DELETE", __path, params=__query, headers=__headers + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="watcher.delete_watch", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -229,9 +258,12 @@ def execute_watch( the request. This watch is not persisted to the index and record_execution cannot be set. """ + __path_parts: t.Dict[str, str] if id not in SKIP_IN_PATH: - __path = f"/_watcher/watch/{_quote(id)}/_execute" + __path_parts = {"id": _quote(id)} + __path = f'/_watcher/watch/{__path_parts["id"]}/_execute' else: + __path_parts = {} __path = "/_watcher/watch/_execute" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -266,7 +298,13 @@ def execute_watch( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="watcher.execute_watch", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -288,7 +326,8 @@ def get_watch( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_watcher/watch/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_watcher/watch/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} if error_trace is not None: __query["error_trace"] = error_trace @@ -300,7 +339,12 @@ def get_watch( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="watcher.get_watch", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -357,7 +401,8 @@ def put_watch( """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") - __path = f"/_watcher/watch/{_quote(id)}" + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_watcher/watch/{__path_parts["id"]}' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} if active is not None: @@ -397,7 +442,13 @@ def put_watch( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "PUT", __path, params=__query, headers=__headers, body=__body + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="watcher.put_watch", + path_parts=__path_parts, ) @_rewrite_parameters( @@ -437,6 +488,7 @@ def query_watches( :param size: The number of hits to return. Needs to be non-negative. :param sort: Optional sort definition. """ + __path_parts: t.Dict[str, str] = {} __path = "/_watcher/_query/watches" __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} @@ -476,7 +528,13 @@ def query_watches( if __body is not None: __headers["content-type"] = "application/json" return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers, body=__body + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="watcher.query_watches", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -493,6 +551,7 @@ def start( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_watcher/_start" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -505,7 +564,12 @@ def start( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="watcher.start", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -541,9 +605,12 @@ def stats( :param emit_stacktraces: Defines whether stack traces are generated for each watch that is running. """ + __path_parts: t.Dict[str, str] if metric not in SKIP_IN_PATH: - __path = f"/_watcher/stats/{_quote(metric)}" + __path_parts = {"metric": _quote(metric)} + __path = f'/_watcher/stats/{__path_parts["metric"]}' else: + __path_parts = {} __path = "/_watcher/stats" __query: t.Dict[str, t.Any] = {} if emit_stacktraces is not None: @@ -558,7 +625,12 @@ def stats( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="watcher.stats", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -575,6 +647,7 @@ def stop( ``_ """ + __path_parts: t.Dict[str, str] = {} __path = "/_watcher/_stop" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -587,5 +660,10 @@ def stop( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "POST", __path, params=__query, headers=__headers + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="watcher.stop", + path_parts=__path_parts, ) diff --git a/elasticsearch/_sync/client/xpack.py b/elasticsearch/_sync/client/xpack.py index 35e2e0e21..0555ba1ae 100644 --- a/elasticsearch/_sync/client/xpack.py +++ b/elasticsearch/_sync/client/xpack.py @@ -49,6 +49,7 @@ def info( :param categories: A comma-separated list of the information categories to include in the response. For example, `build,license,features`. """ + __path_parts: t.Dict[str, str] = {} __path = "/_xpack" __query: t.Dict[str, t.Any] = {} if accept_enterprise is not None: @@ -65,7 +66,12 @@ def info( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="xpack.info", + path_parts=__path_parts, ) @_rewrite_parameters() @@ -89,6 +95,7 @@ def usage( no response is received before the timeout expires, the request fails and returns an error. """ + __path_parts: t.Dict[str, str] = {} __path = "/_xpack/usage" __query: t.Dict[str, t.Any] = {} if error_trace is not None: @@ -103,5 +110,10 @@ def usage( __query["pretty"] = pretty __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] - "GET", __path, params=__query, headers=__headers + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="xpack.usage", + path_parts=__path_parts, ) diff --git a/setup.py b/setup.py index f34d78730..7a146da9b 100644 --- a/setup.py +++ b/setup.py @@ -51,7 +51,10 @@ if package == package_name or package.startswith(package_name + ".") ] -install_requires = ["elastic-transport>=8,<9"] +# TODO switch back to elastic-transport>=8,<9 between elastic-transport release and elasticsearch-py release +install_requires = [ + "elastic-transport @ git+https://github.com/elastic/elastic-transport-python" +] async_requires = ["aiohttp>=3,<4"] setup( diff --git a/test_elasticsearch/test_client/test_options.py b/test_elasticsearch/test_client/test_options.py index 72d5edf4c..b8a9affbb 100644 --- a/test_elasticsearch/test_client/test_options.py +++ b/test_elasticsearch/test_client/test_options.py @@ -142,6 +142,8 @@ def test_options_passed_to_perform_request(self): "accept": "application/vnd.elasticsearch+json; compatible-with=8", }, "body": None, + "endpoint_id": "indices.get", + "path_parts": {"index": "test"}, } # Can be overwritten with .options() @@ -160,6 +162,8 @@ def test_options_passed_to_perform_request(self): "accept": "application/vnd.elasticsearch+json; compatible-with=8", }, "body": None, + "endpoint_id": "indices.get", + "path_parts": {"index": "test"}, "request_timeout": 1, "max_retries": 2, "retry_on_status": (404,), @@ -185,6 +189,8 @@ def test_options_passed_to_perform_request(self): "accept": "application/vnd.elasticsearch+json; compatible-with=8", }, "body": None, + "endpoint_id": "indices.get", + "path_parts": {"index": "test"}, "request_timeout": 1, "max_retries": 2, "retry_on_status": (404,), @@ -212,6 +218,8 @@ async def test_options_passed_to_async_perform_request(self): "accept": "application/vnd.elasticsearch+json; compatible-with=8", }, "body": None, + "endpoint_id": "indices.get", + "path_parts": {"index": "test"}, } # Can be overwritten with .options() @@ -230,6 +238,8 @@ async def test_options_passed_to_async_perform_request(self): "accept": "application/vnd.elasticsearch+json; compatible-with=8", }, "body": None, + "endpoint_id": "indices.get", + "path_parts": {"index": "test"}, "request_timeout": 1, "max_retries": 2, "retry_on_status": (404,), @@ -255,6 +265,8 @@ async def test_options_passed_to_async_perform_request(self): "accept": "application/vnd.elasticsearch+json; compatible-with=8", }, "body": None, + "endpoint_id": "indices.get", + "path_parts": {"index": "test"}, "request_timeout": 1, "max_retries": 2, "retry_on_status": (404,), @@ -390,6 +402,8 @@ def test_options_timeout_parameters(self): "accept": "application/vnd.elasticsearch+json; compatible-with=8", }, "body": None, + "endpoint_id": "indices.get", + "path_parts": {"index": "test"}, "request_timeout": 1, "max_retries": 2, "retry_on_status": (404,), @@ -419,6 +433,8 @@ def test_options_timeout_parameters(self): "accept": "application/vnd.elasticsearch+json; compatible-with=8", }, "body": None, + "endpoint_id": "indices.get", + "path_parts": {"index": "test"}, "request_timeout": 2, "max_retries": 3, "retry_on_status": (400,), @@ -443,6 +459,8 @@ def test_options_timeout_parameters(self): "accept": "application/vnd.elasticsearch+json; compatible-with=8", }, "body": None, + "endpoint_id": "indices.get", + "path_parts": {"index": "test"}, } client = Elasticsearch( @@ -464,6 +482,8 @@ def test_options_timeout_parameters(self): "accept": "application/vnd.elasticsearch+json; compatible-with=8", }, "body": None, + "endpoint_id": "indices.get", + "path_parts": {"index": "test"}, "request_timeout": 1, "max_retries": 2, "retry_on_status": (404,),