Skip to content

Commit

Permalink
Auto-generated API code (#38)
Browse files Browse the repository at this point in the history
* Auto-generated API code

* Try older qaf image

* Revert "Try older qaf image"

This reverts commit 30fdabe.
  • Loading branch information
pquentin authored May 24, 2024
1 parent 2b8e964 commit c8c7a34
Show file tree
Hide file tree
Showing 8 changed files with 170 additions and 80 deletions.
20 changes: 11 additions & 9 deletions elasticsearch_serverless/_async/client/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,16 +225,17 @@ async def info(
)

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

@_rewrite_parameters(
body_fields=(
"allow_auto_create",
"composed_of",
"data_stream",
"deprecated",
"ignore_missing_component_templates",
"index_patterns",
"meta",
"priority",
Expand All @@ -1652,13 +1655,20 @@ async def put_index_template(
self,
*,
name: str,
allow_auto_create: t.Optional[bool] = None,
cause: t.Optional[str] = None,
composed_of: t.Optional[t.Sequence[str]] = None,
create: t.Optional[bool] = None,
data_stream: t.Optional[t.Mapping[str, t.Any]] = None,
deprecated: t.Optional[bool] = None,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
human: t.Optional[bool] = None,
ignore_missing_component_templates: t.Optional[t.Sequence[str]] = None,
index_patterns: t.Optional[t.Union[str, t.Sequence[str]]] = None,
master_timeout: t.Optional[
t.Union["t.Literal[-1]", "t.Literal[0]", str]
] = None,
meta: t.Optional[t.Mapping[str, t.Any]] = None,
pretty: t.Optional[bool] = None,
priority: t.Optional[int] = None,
Expand All @@ -1672,6 +1682,13 @@ async def put_index_template(
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-put-template.html>`_
:param name: Index or template name
:param allow_auto_create: This setting overrides the value of the `action.auto_create_index`
cluster setting. If set to `true` in a template, then indices can be automatically
created using that template even if auto-creation of indices is disabled
via `actions.auto_create_index`. If set to `false`, then indices or data
streams matching the template must always be explicitly created, and may
never be automatically created.
:param cause: User defined reason for creating/updating the index template
:param composed_of: An ordered list of component template names. Component templates
are merged in the order specified, meaning that the last component template
specified has the highest precedence.
Expand All @@ -1680,7 +1697,16 @@ async def put_index_template(
:param data_stream: If this object is included, the template is used to create
data streams and their backing indices. Supports an empty object. Data streams
require a matching index template with a `data_stream` object.
:param deprecated: Marks this index template as deprecated. When creating or
updating a non-deprecated index template that uses deprecated components,
Elasticsearch will emit a deprecation warning.
:param ignore_missing_component_templates: The configuration option ignore_missing_component_templates
can be used when an index template references a component template that might
not exist
:param index_patterns: Name of the index template to create.
:param master_timeout: Period to wait for a connection to the master node. If
no response is received before the timeout expires, the request fails and
returns an error.
:param meta: Optional user metadata about the index template. May have any contents.
This map is not automatically generated by Elasticsearch.
:param priority: Priority to determine index template precedence when a new data
Expand All @@ -1698,6 +1724,8 @@ async def put_index_template(
__path = f"/_index_template/{_quote(name)}"
__query: t.Dict[str, t.Any] = {}
__body: t.Dict[str, t.Any] = body if body is not None else {}
if cause is not None:
__query["cause"] = cause
if create is not None:
__query["create"] = create
if error_trace is not None:
Expand All @@ -1706,13 +1734,23 @@ async def put_index_template(
__query["filter_path"] = filter_path
if human is not None:
__query["human"] = human
if master_timeout is not None:
__query["master_timeout"] = master_timeout
if pretty is not None:
__query["pretty"] = pretty
if not __body:
if allow_auto_create is not None:
__body["allow_auto_create"] = allow_auto_create
if composed_of is not None:
__body["composed_of"] = composed_of
if data_stream is not None:
__body["data_stream"] = data_stream
if deprecated is not None:
__body["deprecated"] = deprecated
if ignore_missing_component_templates is not None:
__body["ignore_missing_component_templates"] = (
ignore_missing_component_templates
)
if index_patterns is not None:
__body["index_patterns"] = index_patterns
if meta is not None:
Expand Down Expand Up @@ -1997,10 +2035,10 @@ async def put_template(
*,
name: str,
aliases: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
cause: t.Optional[str] = None,
create: t.Optional[bool] = None,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
flat_settings: t.Optional[bool] = None,
human: t.Optional[bool] = None,
index_patterns: t.Optional[t.Union[str, t.Sequence[str]]] = None,
mappings: t.Optional[t.Mapping[str, t.Any]] = None,
Expand All @@ -2010,7 +2048,6 @@ async def put_template(
order: t.Optional[int] = None,
pretty: t.Optional[bool] = None,
settings: t.Optional[t.Mapping[str, t.Any]] = None,
timeout: t.Optional[t.Union["t.Literal[-1]", "t.Literal[0]", str]] = None,
version: t.Optional[int] = None,
body: t.Optional[t.Dict[str, t.Any]] = None,
) -> ObjectApiResponse[t.Any]:
Expand All @@ -2021,9 +2058,9 @@ async def put_template(
:param name: The name of the template
:param aliases: Aliases for the index.
:param cause:
:param create: If true, this request cannot replace or update existing index
templates.
:param flat_settings: If `true`, returns settings in flat format.
:param index_patterns: Array of wildcard expressions used to match the names
of indices during creation.
:param mappings: Mapping for fields in the index.
Expand All @@ -2035,8 +2072,6 @@ async def put_template(
Templates with higher 'order' values are merged later, overriding templates
with lower values.
:param settings: Configuration options for the index.
:param timeout: Period to wait for a response. If no response is received before
the timeout expires, the request fails and returns an error.
:param version: Version number used to manage index templates externally. This
number is not automatically generated by Elasticsearch.
"""
Expand All @@ -2045,22 +2080,20 @@ async def put_template(
__path = f"/_template/{_quote(name)}"
__query: t.Dict[str, t.Any] = {}
__body: t.Dict[str, t.Any] = body if body is not None else {}
if cause is not None:
__query["cause"] = cause
if create is not None:
__query["create"] = create
if error_trace is not None:
__query["error_trace"] = error_trace
if filter_path is not None:
__query["filter_path"] = filter_path
if flat_settings is not None:
__query["flat_settings"] = flat_settings
if human is not None:
__query["human"] = human
if master_timeout is not None:
__query["master_timeout"] = master_timeout
if pretty is not None:
__query["pretty"] = pretty
if timeout is not None:
__query["timeout"] = timeout
if not __body:
if aliases is not None:
__body["aliases"] = aliases
Expand Down Expand Up @@ -2345,6 +2378,7 @@ async def simulate_index_template(
"allow_auto_create",
"composed_of",
"data_stream",
"deprecated",
"ignore_missing_component_templates",
"index_patterns",
"meta",
Expand All @@ -2362,6 +2396,7 @@ async def simulate_template(
composed_of: t.Optional[t.Sequence[str]] = None,
create: t.Optional[bool] = None,
data_stream: t.Optional[t.Mapping[str, t.Any]] = None,
deprecated: t.Optional[bool] = None,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
human: t.Optional[bool] = None,
Expand Down Expand Up @@ -2402,6 +2437,9 @@ async def simulate_template(
:param data_stream: If this object is included, the template is used to create
data streams and their backing indices. Supports an empty object. Data streams
require a matching index template with a `data_stream` object.
:param deprecated: Marks this index template as deprecated. When creating or
updating a non-deprecated index template that uses deprecated components,
Elasticsearch will emit a deprecation warning.
:param ignore_missing_component_templates: The configuration option ignore_missing_component_templates
can be used when an index template references a component template that might
not exist
Expand Down Expand Up @@ -2451,6 +2489,8 @@ async def simulate_template(
__body["composed_of"] = composed_of
if data_stream is not None:
__body["data_stream"] = data_stream
if deprecated is not None:
__body["deprecated"] = deprecated
if ignore_missing_component_templates is not None:
__body["ignore_missing_component_templates"] = (
ignore_missing_component_templates
Expand Down
Loading

0 comments on commit c8c7a34

Please sign in to comment.