Skip to content

Commit 676ff30

Browse files
Auto-generated code for main (#3394)
* Auto-generated API code * add missing imports --------- Co-authored-by: Miguel Grinberg <miguel.grinberg@gmail.com>
1 parent ee23b68 commit 676ff30

7 files changed

Lines changed: 201 additions & 3 deletions

File tree

elasticsearch/_async/client/security.py

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@
2020
from elastic_transport import ObjectApiResponse
2121

2222
from ._base import NamespacedClient
23-
from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters
23+
from .utils import (
24+
SKIP_IN_PATH,
25+
Stability,
26+
_availability_warning,
27+
_quote,
28+
_rewrite_parameters,
29+
)
2430

2531

2632
class SecurityClient(NamespacedClient):
@@ -682,6 +688,89 @@ async def clear_cached_service_tokens(
682688
path_parts=__path_parts,
683689
)
684690

691+
@_rewrite_parameters(
692+
body_fields=("api_key", "expiration", "metadata", "name"),
693+
ignore_deprecated_options={"api_key"},
694+
)
695+
@_availability_warning(Stability.EXPERIMENTAL)
696+
async def clone_api_key(
697+
self,
698+
*,
699+
api_key: t.Optional[str] = None,
700+
error_trace: t.Optional[bool] = None,
701+
expiration: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
702+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
703+
human: t.Optional[bool] = None,
704+
metadata: t.Optional[t.Mapping[str, t.Any]] = None,
705+
name: t.Optional[str] = None,
706+
pretty: t.Optional[bool] = None,
707+
refresh: t.Optional[
708+
t.Union[bool, str, t.Literal["false", "true", "wait_for"]]
709+
] = None,
710+
body: t.Optional[t.Dict[str, t.Any]] = None,
711+
) -> ObjectApiResponse[t.Any]:
712+
"""
713+
.. raw:: html
714+
715+
<p>Clone an API key.</p>
716+
<p>Create a copy of an existing API key with a new ID.
717+
The cloned key inherits the role descriptors of the source key.
718+
This is intended for applications (such as Kibana) that need to
719+
create API keys on behalf of a user using an existing API key credential,
720+
since derived API keys (API keys created by API keys) are not otherwise supported.</p>
721+
722+
723+
`<https://www.elastic.co/docs/api/doc/elasticsearch#TODO>`_
724+
725+
:param api_key: The credentials of the API key to clone. This is the secret value
726+
returned when the key was originally created.
727+
:param expiration: The expiration time for the cloned API key. By default, API
728+
keys never expire. Set to `null` to explicitly create a key with no expiration.
729+
:param metadata: Arbitrary metadata to associate with the cloned API key. It
730+
supports nested data structure. Within the metadata object, keys beginning
731+
with `_` are reserved for system usage.
732+
:param name: A name for the cloned API key. If not provided, the name of the
733+
source key is used.
734+
:param refresh: If `true` (the default) then refresh the affected shards to make
735+
this operation visible to search, if `wait_for` then wait for a refresh to
736+
make this operation visible to search, if `false` then do nothing with refreshes.
737+
"""
738+
if api_key is None and body is None:
739+
raise ValueError("Empty value passed for parameter 'api_key'")
740+
__path_parts: t.Dict[str, str] = {}
741+
__path = "/_security/api_key/clone"
742+
__query: t.Dict[str, t.Any] = {}
743+
__body: t.Dict[str, t.Any] = body if body is not None else {}
744+
if error_trace is not None:
745+
__query["error_trace"] = error_trace
746+
if filter_path is not None:
747+
__query["filter_path"] = filter_path
748+
if human is not None:
749+
__query["human"] = human
750+
if pretty is not None:
751+
__query["pretty"] = pretty
752+
if refresh is not None:
753+
__query["refresh"] = refresh
754+
if not __body:
755+
if api_key is not None:
756+
__body["api_key"] = api_key
757+
if expiration is not None:
758+
__body["expiration"] = expiration
759+
if metadata is not None:
760+
__body["metadata"] = metadata
761+
if name is not None:
762+
__body["name"] = name
763+
__headers = {"accept": "application/json", "content-type": "application/json"}
764+
return await self.perform_request( # type: ignore[return-value]
765+
"PUT",
766+
__path,
767+
params=__query,
768+
headers=__headers,
769+
body=__body,
770+
endpoint_id="security.clone_api_key",
771+
path_parts=__path_parts,
772+
)
773+
685774
@_rewrite_parameters(
686775
body_fields=("expiration", "metadata", "name", "role_descriptors"),
687776
)

elasticsearch/_async/client/tasks.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ async def get(
113113
task_id: str,
114114
error_trace: t.Optional[bool] = None,
115115
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
116+
follow_relocations: t.Optional[bool] = None,
116117
human: t.Optional[bool] = None,
117118
pretty: t.Optional[bool] = None,
118119
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
@@ -131,6 +132,7 @@ async def get(
131132
`<https://www.elastic.co/docs/api/doc/elasticsearch/group/endpoint-tasks>`_
132133
133134
:param task_id: The task identifier.
135+
:param follow_relocations: Internal use only
134136
:param timeout: The period to wait for a response. If no response is received
135137
before the timeout expires, the request fails and returns an error.
136138
:param wait_for_completion: If `true`, the request blocks until the task has
@@ -145,6 +147,8 @@ async def get(
145147
__query["error_trace"] = error_trace
146148
if filter_path is not None:
147149
__query["filter_path"] = filter_path
150+
if follow_relocations is not None:
151+
__query["follow_relocations"] = follow_relocations
148152
if human is not None:
149153
__query["human"] = human
150154
if pretty is not None:

elasticsearch/_async/client/transform.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,7 @@ async def schedule_now_transform(
592592
self,
593593
*,
594594
transform_id: str,
595+
defer: t.Optional[bool] = None,
595596
error_trace: t.Optional[bool] = None,
596597
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
597598
human: t.Optional[bool] = None,
@@ -612,13 +613,18 @@ async def schedule_now_transform(
612613
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-transform-schedule-now-transform>`_
613614
614615
:param transform_id: Identifier for the transform.
616+
:param defer: When true, defers the scheduling by the transform's configured
617+
sync delay instead of triggering immediately. The transform will process
618+
new data after the delay elapses rather than right away.
615619
:param timeout: Controls the time to wait for the scheduling to take place
616620
"""
617621
if transform_id in SKIP_IN_PATH:
618622
raise ValueError("Empty value passed for parameter 'transform_id'")
619623
__path_parts: t.Dict[str, str] = {"transform_id": _quote(transform_id)}
620624
__path = f'/_transform/{__path_parts["transform_id"]}/_schedule_now'
621625
__query: t.Dict[str, t.Any] = {}
626+
if defer is not None:
627+
__query["defer"] = defer
622628
if error_trace is not None:
623629
__query["error_trace"] = error_trace
624630
if filter_path is not None:

elasticsearch/_sync/client/security.py

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@
2020
from elastic_transport import ObjectApiResponse
2121

2222
from ._base import NamespacedClient
23-
from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters
23+
from .utils import (
24+
SKIP_IN_PATH,
25+
Stability,
26+
_availability_warning,
27+
_quote,
28+
_rewrite_parameters,
29+
)
2430

2531

2632
class SecurityClient(NamespacedClient):
@@ -682,6 +688,89 @@ def clear_cached_service_tokens(
682688
path_parts=__path_parts,
683689
)
684690

691+
@_rewrite_parameters(
692+
body_fields=("api_key", "expiration", "metadata", "name"),
693+
ignore_deprecated_options={"api_key"},
694+
)
695+
@_availability_warning(Stability.EXPERIMENTAL)
696+
def clone_api_key(
697+
self,
698+
*,
699+
api_key: t.Optional[str] = None,
700+
error_trace: t.Optional[bool] = None,
701+
expiration: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
702+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
703+
human: t.Optional[bool] = None,
704+
metadata: t.Optional[t.Mapping[str, t.Any]] = None,
705+
name: t.Optional[str] = None,
706+
pretty: t.Optional[bool] = None,
707+
refresh: t.Optional[
708+
t.Union[bool, str, t.Literal["false", "true", "wait_for"]]
709+
] = None,
710+
body: t.Optional[t.Dict[str, t.Any]] = None,
711+
) -> ObjectApiResponse[t.Any]:
712+
"""
713+
.. raw:: html
714+
715+
<p>Clone an API key.</p>
716+
<p>Create a copy of an existing API key with a new ID.
717+
The cloned key inherits the role descriptors of the source key.
718+
This is intended for applications (such as Kibana) that need to
719+
create API keys on behalf of a user using an existing API key credential,
720+
since derived API keys (API keys created by API keys) are not otherwise supported.</p>
721+
722+
723+
`<https://www.elastic.co/docs/api/doc/elasticsearch#TODO>`_
724+
725+
:param api_key: The credentials of the API key to clone. This is the secret value
726+
returned when the key was originally created.
727+
:param expiration: The expiration time for the cloned API key. By default, API
728+
keys never expire. Set to `null` to explicitly create a key with no expiration.
729+
:param metadata: Arbitrary metadata to associate with the cloned API key. It
730+
supports nested data structure. Within the metadata object, keys beginning
731+
with `_` are reserved for system usage.
732+
:param name: A name for the cloned API key. If not provided, the name of the
733+
source key is used.
734+
:param refresh: If `true` (the default) then refresh the affected shards to make
735+
this operation visible to search, if `wait_for` then wait for a refresh to
736+
make this operation visible to search, if `false` then do nothing with refreshes.
737+
"""
738+
if api_key is None and body is None:
739+
raise ValueError("Empty value passed for parameter 'api_key'")
740+
__path_parts: t.Dict[str, str] = {}
741+
__path = "/_security/api_key/clone"
742+
__query: t.Dict[str, t.Any] = {}
743+
__body: t.Dict[str, t.Any] = body if body is not None else {}
744+
if error_trace is not None:
745+
__query["error_trace"] = error_trace
746+
if filter_path is not None:
747+
__query["filter_path"] = filter_path
748+
if human is not None:
749+
__query["human"] = human
750+
if pretty is not None:
751+
__query["pretty"] = pretty
752+
if refresh is not None:
753+
__query["refresh"] = refresh
754+
if not __body:
755+
if api_key is not None:
756+
__body["api_key"] = api_key
757+
if expiration is not None:
758+
__body["expiration"] = expiration
759+
if metadata is not None:
760+
__body["metadata"] = metadata
761+
if name is not None:
762+
__body["name"] = name
763+
__headers = {"accept": "application/json", "content-type": "application/json"}
764+
return self.perform_request( # type: ignore[return-value]
765+
"PUT",
766+
__path,
767+
params=__query,
768+
headers=__headers,
769+
body=__body,
770+
endpoint_id="security.clone_api_key",
771+
path_parts=__path_parts,
772+
)
773+
685774
@_rewrite_parameters(
686775
body_fields=("expiration", "metadata", "name", "role_descriptors"),
687776
)

elasticsearch/_sync/client/tasks.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ def get(
113113
task_id: str,
114114
error_trace: t.Optional[bool] = None,
115115
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
116+
follow_relocations: t.Optional[bool] = None,
116117
human: t.Optional[bool] = None,
117118
pretty: t.Optional[bool] = None,
118119
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
@@ -131,6 +132,7 @@ def get(
131132
`<https://www.elastic.co/docs/api/doc/elasticsearch/group/endpoint-tasks>`_
132133
133134
:param task_id: The task identifier.
135+
:param follow_relocations: Internal use only
134136
:param timeout: The period to wait for a response. If no response is received
135137
before the timeout expires, the request fails and returns an error.
136138
:param wait_for_completion: If `true`, the request blocks until the task has
@@ -145,6 +147,8 @@ def get(
145147
__query["error_trace"] = error_trace
146148
if filter_path is not None:
147149
__query["filter_path"] = filter_path
150+
if follow_relocations is not None:
151+
__query["follow_relocations"] = follow_relocations
148152
if human is not None:
149153
__query["human"] = human
150154
if pretty is not None:

elasticsearch/_sync/client/transform.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,7 @@ def schedule_now_transform(
592592
self,
593593
*,
594594
transform_id: str,
595+
defer: t.Optional[bool] = None,
595596
error_trace: t.Optional[bool] = None,
596597
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
597598
human: t.Optional[bool] = None,
@@ -612,13 +613,18 @@ def schedule_now_transform(
612613
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-transform-schedule-now-transform>`_
613614
614615
:param transform_id: Identifier for the transform.
616+
:param defer: When true, defers the scheduling by the transform's configured
617+
sync delay instead of triggering immediately. The transform will process
618+
new data after the delay elapses rather than right away.
615619
:param timeout: Controls the time to wait for the scheduling to take place
616620
"""
617621
if transform_id in SKIP_IN_PATH:
618622
raise ValueError("Empty value passed for parameter 'transform_id'")
619623
__path_parts: t.Dict[str, str] = {"transform_id": _quote(transform_id)}
620624
__path = f'/_transform/{__path_parts["transform_id"]}/_schedule_now'
621625
__query: t.Dict[str, t.Any] = {}
626+
if defer is not None:
627+
__query["defer"] = defer
622628
if error_trace is not None:
623629
__query["error_trace"] = error_trace
624630
if filter_path is not None:

elasticsearch/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
# under the License.
1717

1818
__versionstr__ = "9.4.0"
19-
__es_specification_commit__ = "c376fd6d01cd8d60c6ce229ca4822624de4563fd"
19+
__es_specification_commit__ = "fae5541d686e2e66291c999773f4140bdfd936e9"
2020
_SERVERLESS_API_VERSION = "2023-10-31"

0 commit comments

Comments
 (0)