Files
opensearch-pyd/opensearchpy/client/wlm.py
T
Daniel (dB.) Doubrovkine bf9add4eed Fix /cluster/stats in a backwards compatible way (#851)
* Ran nox -s generate.

Signed-off-by: dblock <dblock@amazon.com>

* Fix: backwards compatible parameter order in cluster stats.

Signed-off-by: dblock <dblock@amazon.com>

* Moved Updated APIs section to the correct set.

Signed-off-by: dblock <dblock@amazon.com>

---------

Signed-off-by: dblock <dblock@amazon.com>
2024-11-25 14:54:03 -08:00

161 lines
6.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
# ------------------------------------------------------------------------------------------
# THIS CODE IS AUTOMATICALLY GENERATED AND MANUAL EDITS WILL BE LOST
#
# To contribute, kindly make modifications in the opensearch-py client generator
# or in the OpenSearch API specification, and run `nox -rs generate`. See DEVELOPER_GUIDE.md
# and https://github.com/opensearch-project/opensearch-api-specification for details.
# -----------------------------------------------------------------------------------------+
from typing import Any
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class WlmClient(NamespacedClient):
@query_params("error_trace", "filter_path", "human", "pretty", "source")
def create_query_group(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Creates a new query group and sets the resource limits for the new query group.
:arg error_trace: Whether to include the stack trace of returned
errors. Default is false.
:arg filter_path: Used to reduce the response. This parameter
takes a comma-separated list of filters. It supports using wildcards to
match any field or part of a fields name. You can also exclude fields
with "-".
:arg human: Whether to return human readable values for
statistics. Default is True.
:arg pretty: Whether to pretty format the returned JSON
response. Default is false.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
"""
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")
return self.transport.perform_request(
"PUT", "/_wlm/query_group", params=params, headers=headers, body=body
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
def delete_query_group(
self,
name: Any,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Deletes the specified query group.
:arg name: The name of the query group.
:arg error_trace: Whether to include the stack trace of returned
errors. Default is false.
:arg filter_path: Used to reduce the response. This parameter
takes a comma-separated list of filters. It supports using wildcards to
match any field or part of a fields name. You can also exclude fields
with "-".
:arg human: Whether to return human readable values for
statistics. Default is True.
:arg pretty: Whether to pretty format the returned JSON
response. Default is false.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
"""
if name in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'name'.")
return self.transport.perform_request(
"DELETE",
_make_path("_wlm", "query_group", name),
params=params,
headers=headers,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
def get_query_group(
self,
name: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Retrieves the specified query group. If no query group is specified, all query
groups in the cluster are retrieved.
:arg name: The name of the query group.
:arg error_trace: Whether to include the stack trace of returned
errors. Default is false.
:arg filter_path: Used to reduce the response. This parameter
takes a comma-separated list of filters. It supports using wildcards to
match any field or part of a fields name. You can also exclude fields
with "-".
:arg human: Whether to return human readable values for
statistics. Default is True.
:arg pretty: Whether to pretty format the returned JSON
response. Default is false.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
"""
return self.transport.perform_request(
"GET",
_make_path("_wlm", "query_group", name),
params=params,
headers=headers,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
def update_query_group(
self,
name: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Updates the specified query group.
:arg name: The name of the query group.
:arg error_trace: Whether to include the stack trace of returned
errors. Default is false.
:arg filter_path: Used to reduce the response. This parameter
takes a comma-separated list of filters. It supports using wildcards to
match any field or part of a fields name. You can also exclude fields
with "-".
:arg human: Whether to return human readable values for
statistics. Default is True.
:arg pretty: Whether to pretty format the returned JSON
response. Default is false.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
"""
for param in (name, body):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")
return self.transport.perform_request(
"PUT",
_make_path("_wlm", "query_group", name),
params=params,
headers=headers,
body=body,
)