From ac5673b0cceb2a347cf5f61db1376e3572e9682d Mon Sep 17 00:00:00 2001 From: saimedhi <117196660+saimedhi@users.noreply.github.com> Date: Tue, 17 Dec 2024 03:42:37 +0000 Subject: [PATCH] Updated opensearch-py to reflect the latest OpenSearch API spec (2024-12-17) Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 1 + opensearchpy/_async/client/__init__.py | 20 +- opensearchpy/_async/client/cat.py | 75 ++-- opensearchpy/_async/client/cluster.py | 2 +- opensearchpy/_async/client/indices.py | 9 +- opensearchpy/_async/client/list.py | 3 +- opensearchpy/_async/client/plugins.py | 4 + opensearchpy/_async/plugins/knn.py | 5 +- opensearchpy/_async/plugins/observability.py | 2 +- opensearchpy/_async/plugins/sm.py | 346 +++++++++++++++++++ opensearchpy/client/__init__.py | 20 +- opensearchpy/client/cat.py | 75 ++-- opensearchpy/client/cluster.py | 2 +- opensearchpy/client/indices.py | 9 +- opensearchpy/client/list.py | 3 +- opensearchpy/client/plugins.py | 4 + opensearchpy/plugins/knn.py | 5 +- opensearchpy/plugins/observability.py | 2 +- opensearchpy/plugins/sm.py | 346 +++++++++++++++++++ 19 files changed, 829 insertions(+), 104 deletions(-) create mode 100644 opensearchpy/_async/plugins/sm.py create mode 100644 opensearchpy/plugins/sm.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 3354d4e1..0f263746 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Added option to pass custom headers to 'AWSV4SignerAsyncAuth' ([863](https://github.com/opensearch-project/opensearch-py/pull/863)) - Added sync and async sample that uses `search_after` parameter ([859](https://github.com/opensearch-project/opensearch-py/pull/859)) ### Updated APIs +- Updated opensearch-py APIs to reflect [opensearch-api-specification@b2c8c46](https://github.com/opensearch-project/opensearch-api-specification/commit/b2c8c4684d97e8b907203f0ce5ae89b5630c9890) ### Changed - Small refactor of AWS Signer classes for both sync and async clients ([866](https://github.com/opensearch-project/opensearch-py/pull/866)) ### Deprecated diff --git a/opensearchpy/_async/client/__init__.py b/opensearchpy/_async/client/__init__.py index 5c1fa04f..2ae52901 100644 --- a/opensearchpy/_async/client/__init__.py +++ b/opensearchpy/_async/client/__init__.py @@ -667,7 +667,7 @@ async def count( specified. :arg default_operator: The default operator for query string query: `AND` or `OR`. This parameter can only be used when the `q` query - string parameter is specified. Valid choices are and, or. + string parameter is specified. Valid choices are and, AND, or, OR. :arg df: Field to use as default where no field prefix is given in the query string. This parameter can only be used when the `q` query string parameter is specified. @@ -855,7 +855,7 @@ async def delete_by_query( :arg conflicts: What to do if delete by query hits version conflicts: `abort` or `proceed`. Valid choices are abort, proceed. :arg default_operator: The default operator for query string - query: `AND` or `OR`. Valid choices are and, or. + query: `AND` or `OR`. Valid choices are and, AND, or, OR. :arg df: Field to use as default where no field prefix is given in the query string. :arg error_trace: Whether to include the stack trace of returned @@ -1225,7 +1225,7 @@ async def explain( parameter can only be used when the `q` query string parameter is specified. :arg default_operator: The default operator for query string - query: `AND` or `OR`. Valid choices are and, or. + query: `AND` or `OR`. Valid choices are and, AND, or, OR. :arg df: Field to use as default where no field prefix is given in the query string. Default is _all. :arg error_trace: Whether to include the stack trace of returned @@ -2281,7 +2281,7 @@ async def search( executing cross-cluster search (CCS) requests. Default is True. :arg default_operator: The default operator for query string query: AND or OR. This parameter can only be used when the `q` query - string parameter is specified. Valid choices are and, or. + string parameter is specified. Valid choices are and, AND, or, OR. :arg df: Field to use as default where no field prefix is given in the query string. This parameter can only be used when the q query string parameter is specified. @@ -2451,6 +2451,7 @@ async def search( ) async def search_shards( self, + body: Any = None, index: Any = None, params: Any = None, headers: Any = None, @@ -2460,6 +2461,9 @@ async def search_shards( executed against. + :arg body: Defines the parameters that can be used in the + `search_shards` endpoint request. See documentation for supported query + syntax. :arg index: Returns the indexes and shards that a search request would be executed against. :arg allow_no_indices: If `false`, the request returns an error @@ -2495,7 +2499,11 @@ async def search_shards( libraries that do not accept a request body for non-POST requests. """ return await self.transport.perform_request( - "GET", _make_path(index, "_search_shards"), params=params, headers=headers + "POST", + _make_path(index, "_search_shards"), + params=params, + headers=headers, + body=body, ) @query_params( @@ -2834,7 +2842,7 @@ async def update_by_query( :arg conflicts: What to do if update by query hits version conflicts: `abort` or `proceed`. Valid choices are abort, proceed. :arg default_operator: The default operator for query string - query: `AND` or `OR`. Valid choices are and, or. + query: `AND` or `OR`. Valid choices are and, AND, or, OR. :arg df: Field to use as default where no field prefix is given in the query string. :arg error_trace: Whether to include the stack trace of returned diff --git a/opensearchpy/_async/client/cat.py b/opensearchpy/_async/client/cat.py index 3b38803d..e1e31714 100644 --- a/opensearchpy/_async/client/cat.py +++ b/opensearchpy/_async/client/cat.py @@ -70,27 +70,29 @@ async def aliases( or use `*` or `_all`. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. - :arg expand_wildcards: Whether to expand wildcard expression to - concrete indexes that are open, closed or both. + :arg expand_wildcards: Expands wildcard expressions to concrete + indexes. Combine multiple values with commas. Supported values are + `all`, `open`, `closed`, `hidden`, and `none`. :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 field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. - :arg help: Return help information. Default is false. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. + :arg help: Returns help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg local: Whether to return information from the local node + only instead of from the cluster manager node. Default is false. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return await self.transport.perform_request( "GET", _make_path("_cat", "aliases", name), params=params, headers=headers @@ -171,36 +173,37 @@ async def allocation( much disk space they are using. - :arg node_id: Comma-separated list of node identifiers or names - used to limit the returned information. - :arg bytes: The unit used to display byte values. Valid choices + :arg node_id: A comma-separated list of node IDs or names used + to limit the returned information. + :arg bytes: The units used to display byte values. Valid choices are b, g, gb, k, kb, m, mb, p, pb, t, tb. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. + :arg cluster_manager_timeout: A timeout for connection to the + cluster manager node. :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 field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. - :arg help: Return help information. Default is false. + :arg format: A short version of the HTTP `Accept` header, such + as `json` or `yaml`. + :arg h: A comma-separated list of column names to display. + :arg help: Returns help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg local: Returns local information but does not retrieve the + state from cluster-manager node. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, - use `cluster_manager_timeout` instead.): Operation timeout for - connection to cluster-manager node. + use `cluster_manager_timeout` instead.): A timeout for connection to the + cluster manager node. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return await self.transport.perform_request( "GET", @@ -233,32 +236,33 @@ async def cluster_manager( Returns information about the cluster-manager node. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. + :arg cluster_manager_timeout: A timeout for connection to the + cluster manager node. :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 field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the HTTP `Accept` header, such + as `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. :arg local: Return local information, do not retrieve the state from cluster-manager node. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, - use `cluster_manager_timeout` instead.): Operation timeout for - connection to cluster-manager node. + use `cluster_manager_timeout` instead.): A timeout for connection to the + cluster manager node. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return await self.transport.perform_request( "GET", "/_cat/cluster_manager", params=params, headers=headers @@ -498,8 +502,7 @@ async def indices( `json`, `yaml`). :arg h: Comma-separated list of column names to display. :arg health: The health status used to limit returned indexes. - By default, the response includes indexes of any health status. Valid - choices are green, red, yellow. + By default, the response includes indexes of any health status. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. diff --git a/opensearchpy/_async/client/cluster.py b/opensearchpy/_async/client/cluster.py index 8a6b881d..bacf5266 100644 --- a/opensearchpy/_async/client/cluster.py +++ b/opensearchpy/_async/client/cluster.py @@ -127,7 +127,7 @@ async def health( :arg wait_for_status: One of green, yellow or red. Will wait (until the timeout 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. Valid choices are green, red, yellow. + not wait for any status. """ return await self.transport.perform_request( "GET", diff --git a/opensearchpy/_async/client/indices.py b/opensearchpy/_async/client/indices.py index 99603830..2a10af57 100644 --- a/opensearchpy/_async/client/indices.py +++ b/opensearchpy/_async/client/indices.py @@ -1638,7 +1638,7 @@ async def validate_query( parameter can only be used when the `q` query string parameter is specified. :arg default_operator: The default operator for query string - query: `AND` or `OR`. Valid choices are and, or. + query: `AND` or `OR`. Valid choices are and, AND, or, OR. :arg df: Field to use as default where no field prefix is given in the query string. This parameter can only be used when the `q` query string parameter is specified. @@ -1797,6 +1797,7 @@ async def recovery( ) async def upgrade( self, + body: Any = None, index: Any = None, params: Any = None, headers: Any = None, @@ -1832,7 +1833,11 @@ async def upgrade( operation has completed before returning. Default is false. """ return await self.transport.perform_request( - "POST", _make_path(index, "_upgrade"), params=params, headers=headers + "POST", + _make_path(index, "_upgrade"), + params=params, + headers=headers, + body=body, ) @query_params( diff --git a/opensearchpy/_async/client/list.py b/opensearchpy/_async/client/list.py index 8a38d00d..8ba4925b 100644 --- a/opensearchpy/_async/client/list.py +++ b/opensearchpy/_async/client/list.py @@ -103,8 +103,7 @@ async def indices( `JSON`, `YAML`. :arg h: Comma-separated list of column names to display. :arg health: The health status used to limit returned indexes. - By default, the response includes indexes of any health status. Valid - choices are green, red, yellow. + By default, the response includes indexes of any health status. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. diff --git a/opensearchpy/_async/client/plugins.py b/opensearchpy/_async/client/plugins.py index d625f838..985839cd 100644 --- a/opensearchpy/_async/client/plugins.py +++ b/opensearchpy/_async/client/plugins.py @@ -22,6 +22,7 @@ from ..plugins.query import QueryClient from ..plugins.replication import ReplicationClient from ..plugins.rollups import RollupsClient +from ..plugins.sm import SmClient from ..plugins.sql import SqlClient from ..plugins.transforms import TransformsClient from .client import Client @@ -29,6 +30,7 @@ class PluginsClient(NamespacedClient): + sm: Any asynchronous_search: Any alerting: Any index_management: Any @@ -45,6 +47,7 @@ class PluginsClient(NamespacedClient): def __init__(self, client: Client) -> None: super().__init__(client) + self.sm = SmClient(client) self.replication = ReplicationClient(client) self.flow_framework = FlowFrameworkClient(client) self.asynchronous_search = AsynchronousSearchClient(client) @@ -66,6 +69,7 @@ def _dynamic_lookup(self, client: Any) -> None: # Issue : https://github.com/opensearch-project/opensearch-py/issues/90#issuecomment-1003396742 plugins = [ + "sm", "replication", "flow_framework", "asynchronous_search", diff --git a/opensearchpy/_async/plugins/knn.py b/opensearchpy/_async/plugins/knn.py index 8cf7fa42..fd5e2e31 100644 --- a/opensearchpy/_async/plugins/knn.py +++ b/opensearchpy/_async/plugins/knn.py @@ -310,7 +310,7 @@ async def stats( ) async def train_model( self, - body: Any, + body: Any = None, model_id: Any = None, params: Any = None, headers: Any = None, @@ -335,9 +335,6 @@ async def train_model( :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 await self.transport.perform_request( "POST", _make_path("_plugins", "_knn", "models", model_id, "_train"), diff --git a/opensearchpy/_async/plugins/observability.py b/opensearchpy/_async/plugins/observability.py index 1242171d..3894a611 100644 --- a/opensearchpy/_async/plugins/observability.py +++ b/opensearchpy/_async/plugins/observability.py @@ -135,7 +135,7 @@ async def get_localstats( headers: Any = None, ) -> Any: """ - Retrieves Local Stats of all observability objects. + Retrieves local stats of all observability objects. :arg error_trace: Whether to include the stack trace of returned diff --git a/opensearchpy/_async/plugins/sm.py b/opensearchpy/_async/plugins/sm.py new file mode 100644 index 00000000..4ea3a1d9 --- /dev/null +++ b/opensearchpy/_async/plugins/sm.py @@ -0,0 +1,346 @@ +# 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 ..client.utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params + + +class SmClient(NamespacedClient): + @query_params("error_trace", "filter_path", "human", "pretty", "source") + async def create_policy( + self, + policy_name: Any, + body: Any = None, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Creates a snapshot management policy. + + + :arg policy_name: The name of the snapshot management policy. + :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 field’s 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 policy_name in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for a required argument 'policy_name'." + ) + + return await self.transport.perform_request( + "POST", + _make_path("_plugins", "_sm", "policies", policy_name), + params=params, + headers=headers, + body=body, + ) + + @query_params("error_trace", "filter_path", "human", "pretty", "source") + async def delete_policy( + self, + policy_name: Any, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Deletes a snapshot management policy. + + + :arg policy_name: The name of the snapshot management policy. + :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 field’s 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 policy_name in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for a required argument 'policy_name'." + ) + + return await self.transport.perform_request( + "DELETE", + _make_path("_plugins", "_sm", "policies", policy_name), + params=params, + headers=headers, + ) + + @query_params("error_trace", "filter_path", "human", "pretty", "source") + async def explain_policy( + self, + policy_name: Any, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Explains the state of the snapshot management policy. + + + :arg policy_name: The name of the snapshot management policy. + :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 field’s 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 policy_name in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for a required argument 'policy_name'." + ) + + return await self.transport.perform_request( + "GET", + _make_path("_plugins", "_sm", "policies", policy_name, "_explain"), + params=params, + headers=headers, + ) + + @query_params( + "error_trace", + "filter_path", + "from_", + "human", + "pretty", + "queryString", + "size", + "sortField", + "sortOrder", + "source", + ) + async def get_policies( + self, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Retrieves all snapshot management policies with optional pagination and + filtering. + + + :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 field’s name. You can also exclude fields + with "-". + :arg from_: The starting index (default: 0) + :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 queryString: A query string to filter policies. + :arg size: The number of policies to return. + :arg sortField: The field to sort on. + :arg sortOrder: The order of sorting. Valid choices are asc, + desc.Default is asc. + :arg source: The URL-encoded request definition. Useful for + libraries that do not accept a request body for non-POST requests. + """ + # from is a reserved word so it cannot be used, use from_ instead + if "from_" in params: + params["from"] = params.pop("from_") + + return await self.transport.perform_request( + "GET", "/_plugins/_sm/policies", params=params, headers=headers + ) + + @query_params("error_trace", "filter_path", "human", "pretty", "source") + async def get_policy( + self, + policy_name: Any, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Retrieves a specific snapshot management policy by name. + + + :arg policy_name: The name of the snapshot management policy. + :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 field’s 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 policy_name in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for a required argument 'policy_name'." + ) + + return await self.transport.perform_request( + "GET", + _make_path("_plugins", "_sm", "policies", policy_name), + params=params, + headers=headers, + ) + + @query_params("error_trace", "filter_path", "human", "pretty", "source") + async def start_policy( + self, + policy_name: Any, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Starts a snapshot management policy. + + + :arg policy_name: The name of the snapshot management policy. + :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 field’s 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 policy_name in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for a required argument 'policy_name'." + ) + + return await self.transport.perform_request( + "POST", + _make_path("_plugins", "_sm", "policies", policy_name, "_start"), + params=params, + headers=headers, + ) + + @query_params("error_trace", "filter_path", "human", "pretty", "source") + async def stop_policy( + self, + policy_name: Any, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Stops a snapshot management policy. + + + :arg policy_name: The name of the snapshot management policy. + :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 field’s 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 policy_name in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for a required argument 'policy_name'." + ) + + return await self.transport.perform_request( + "POST", + _make_path("_plugins", "_sm", "policies", policy_name, "_stop"), + params=params, + headers=headers, + ) + + @query_params( + "error_trace", + "filter_path", + "human", + "if_primary_term", + "if_seq_no", + "pretty", + "source", + ) + async def update_policy( + self, + policy_name: Any, + body: Any = None, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Updates an existing snapshot management policy. Requires `if_seq_no` and + `if_primary_term`. + + + :arg policy_name: The name of the snapshot management policy. + :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 field’s name. You can also exclude fields + with "-". + :arg human: Whether to return human readable values for + statistics. Default is True. + :arg if_primary_term: The primary term of the policy to update. + :arg if_seq_no: The sequence number of the policy to update. + :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 policy_name in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for a required argument 'policy_name'." + ) + + return await self.transport.perform_request( + "PUT", + _make_path("_plugins", "_sm", "policies", policy_name), + params=params, + headers=headers, + body=body, + ) diff --git a/opensearchpy/client/__init__.py b/opensearchpy/client/__init__.py index 118cfa7a..680ede25 100644 --- a/opensearchpy/client/__init__.py +++ b/opensearchpy/client/__init__.py @@ -667,7 +667,7 @@ def count( specified. :arg default_operator: The default operator for query string query: `AND` or `OR`. This parameter can only be used when the `q` query - string parameter is specified. Valid choices are and, or. + string parameter is specified. Valid choices are and, AND, or, OR. :arg df: Field to use as default where no field prefix is given in the query string. This parameter can only be used when the `q` query string parameter is specified. @@ -855,7 +855,7 @@ def delete_by_query( :arg conflicts: What to do if delete by query hits version conflicts: `abort` or `proceed`. Valid choices are abort, proceed. :arg default_operator: The default operator for query string - query: `AND` or `OR`. Valid choices are and, or. + query: `AND` or `OR`. Valid choices are and, AND, or, OR. :arg df: Field to use as default where no field prefix is given in the query string. :arg error_trace: Whether to include the stack trace of returned @@ -1225,7 +1225,7 @@ def explain( parameter can only be used when the `q` query string parameter is specified. :arg default_operator: The default operator for query string - query: `AND` or `OR`. Valid choices are and, or. + query: `AND` or `OR`. Valid choices are and, AND, or, OR. :arg df: Field to use as default where no field prefix is given in the query string. Default is _all. :arg error_trace: Whether to include the stack trace of returned @@ -2281,7 +2281,7 @@ def search( executing cross-cluster search (CCS) requests. Default is True. :arg default_operator: The default operator for query string query: AND or OR. This parameter can only be used when the `q` query - string parameter is specified. Valid choices are and, or. + string parameter is specified. Valid choices are and, AND, or, OR. :arg df: Field to use as default where no field prefix is given in the query string. This parameter can only be used when the q query string parameter is specified. @@ -2451,6 +2451,7 @@ def search( ) def search_shards( self, + body: Any = None, index: Any = None, params: Any = None, headers: Any = None, @@ -2460,6 +2461,9 @@ def search_shards( executed against. + :arg body: Defines the parameters that can be used in the + `search_shards` endpoint request. See documentation for supported query + syntax. :arg index: Returns the indexes and shards that a search request would be executed against. :arg allow_no_indices: If `false`, the request returns an error @@ -2495,7 +2499,11 @@ def search_shards( libraries that do not accept a request body for non-POST requests. """ return self.transport.perform_request( - "GET", _make_path(index, "_search_shards"), params=params, headers=headers + "POST", + _make_path(index, "_search_shards"), + params=params, + headers=headers, + body=body, ) @query_params( @@ -2834,7 +2842,7 @@ def update_by_query( :arg conflicts: What to do if update by query hits version conflicts: `abort` or `proceed`. Valid choices are abort, proceed. :arg default_operator: The default operator for query string - query: `AND` or `OR`. Valid choices are and, or. + query: `AND` or `OR`. Valid choices are and, AND, or, OR. :arg df: Field to use as default where no field prefix is given in the query string. :arg error_trace: Whether to include the stack trace of returned diff --git a/opensearchpy/client/cat.py b/opensearchpy/client/cat.py index ce668e7f..907ef960 100644 --- a/opensearchpy/client/cat.py +++ b/opensearchpy/client/cat.py @@ -70,27 +70,29 @@ def aliases( or use `*` or `_all`. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. - :arg expand_wildcards: Whether to expand wildcard expression to - concrete indexes that are open, closed or both. + :arg expand_wildcards: Expands wildcard expressions to concrete + indexes. Combine multiple values with commas. Supported values are + `all`, `open`, `closed`, `hidden`, and `none`. :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 field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. - :arg help: Return help information. Default is false. + :arg format: A short version of the `Accept` header, such as + `json` or `yaml`. + :arg h: A comma-separated list of column names to display. + :arg help: Returns help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg local: Whether to return information from the local node + only instead of from the cluster manager node. Default is false. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return self.transport.perform_request( "GET", _make_path("_cat", "aliases", name), params=params, headers=headers @@ -171,36 +173,37 @@ def allocation( much disk space they are using. - :arg node_id: Comma-separated list of node identifiers or names - used to limit the returned information. - :arg bytes: The unit used to display byte values. Valid choices + :arg node_id: A comma-separated list of node IDs or names used + to limit the returned information. + :arg bytes: The units used to display byte values. Valid choices are b, g, gb, k, kb, m, mb, p, pb, t, tb. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. + :arg cluster_manager_timeout: A timeout for connection to the + cluster manager node. :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 field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. - :arg help: Return help information. Default is false. + :arg format: A short version of the HTTP `Accept` header, such + as `json` or `yaml`. + :arg h: A comma-separated list of column names to display. + :arg help: Returns help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. - :arg local: Return local information, do not retrieve the state - from cluster-manager node. Default is false. + :arg local: Returns local information but does not retrieve the + state from cluster-manager node. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, - use `cluster_manager_timeout` instead.): Operation timeout for - connection to cluster-manager node. + use `cluster_manager_timeout` instead.): A timeout for connection to the + cluster manager node. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return self.transport.perform_request( "GET", @@ -233,32 +236,33 @@ def cluster_manager( Returns information about the cluster-manager node. - :arg cluster_manager_timeout: Operation timeout for connection - to cluster-manager node. + :arg cluster_manager_timeout: A timeout for connection to the + cluster manager node. :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 field’s name. You can also exclude fields with "-". - :arg format: A short version of the Accept header (for example, - `json`, `yaml`). - :arg h: Comma-separated list of column names to display. + :arg format: A short version of the HTTP `Accept` header, such + as `json` or `yaml`. + :arg h: A comma-separated list of column names to display. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. :arg local: Return local information, do not retrieve the state from cluster-manager node. Default is false. :arg master_timeout (Deprecated: To promote inclusive language, - use `cluster_manager_timeout` instead.): Operation timeout for - connection to cluster-manager node. + use `cluster_manager_timeout` instead.): A timeout for connection to the + cluster manager node. :arg pretty: Whether to pretty format the returned JSON response. Default is false. - :arg s: Comma-separated list of column names or column aliases + :arg s: A comma-separated list of column names or column aliases to sort by. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - :arg v: Verbose mode. Display column headers. Default is false. + :arg v: Enables verbose mode, which displays column headers. + Default is false. """ return self.transport.perform_request( "GET", "/_cat/cluster_manager", params=params, headers=headers @@ -498,8 +502,7 @@ def indices( `json`, `yaml`). :arg h: Comma-separated list of column names to display. :arg health: The health status used to limit returned indexes. - By default, the response includes indexes of any health status. Valid - choices are green, red, yellow. + By default, the response includes indexes of any health status. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. diff --git a/opensearchpy/client/cluster.py b/opensearchpy/client/cluster.py index 7dc19976..c46bbc37 100644 --- a/opensearchpy/client/cluster.py +++ b/opensearchpy/client/cluster.py @@ -127,7 +127,7 @@ def health( :arg wait_for_status: One of green, yellow or red. Will wait (until the timeout 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. Valid choices are green, red, yellow. + not wait for any status. """ return self.transport.perform_request( "GET", diff --git a/opensearchpy/client/indices.py b/opensearchpy/client/indices.py index c4b2405c..61523e1b 100644 --- a/opensearchpy/client/indices.py +++ b/opensearchpy/client/indices.py @@ -1638,7 +1638,7 @@ def validate_query( parameter can only be used when the `q` query string parameter is specified. :arg default_operator: The default operator for query string - query: `AND` or `OR`. Valid choices are and, or. + query: `AND` or `OR`. Valid choices are and, AND, or, OR. :arg df: Field to use as default where no field prefix is given in the query string. This parameter can only be used when the `q` query string parameter is specified. @@ -1797,6 +1797,7 @@ def recovery( ) def upgrade( self, + body: Any = None, index: Any = None, params: Any = None, headers: Any = None, @@ -1832,7 +1833,11 @@ def upgrade( operation has completed before returning. Default is false. """ return self.transport.perform_request( - "POST", _make_path(index, "_upgrade"), params=params, headers=headers + "POST", + _make_path(index, "_upgrade"), + params=params, + headers=headers, + body=body, ) @query_params( diff --git a/opensearchpy/client/list.py b/opensearchpy/client/list.py index cbf6d5d9..e171754c 100644 --- a/opensearchpy/client/list.py +++ b/opensearchpy/client/list.py @@ -103,8 +103,7 @@ def indices( `JSON`, `YAML`. :arg h: Comma-separated list of column names to display. :arg health: The health status used to limit returned indexes. - By default, the response includes indexes of any health status. Valid - choices are green, red, yellow. + By default, the response includes indexes of any health status. :arg help: Return help information. Default is false. :arg human: Whether to return human readable values for statistics. Default is True. diff --git a/opensearchpy/client/plugins.py b/opensearchpy/client/plugins.py index d625f838..985839cd 100644 --- a/opensearchpy/client/plugins.py +++ b/opensearchpy/client/plugins.py @@ -22,6 +22,7 @@ from ..plugins.query import QueryClient from ..plugins.replication import ReplicationClient from ..plugins.rollups import RollupsClient +from ..plugins.sm import SmClient from ..plugins.sql import SqlClient from ..plugins.transforms import TransformsClient from .client import Client @@ -29,6 +30,7 @@ class PluginsClient(NamespacedClient): + sm: Any asynchronous_search: Any alerting: Any index_management: Any @@ -45,6 +47,7 @@ class PluginsClient(NamespacedClient): def __init__(self, client: Client) -> None: super().__init__(client) + self.sm = SmClient(client) self.replication = ReplicationClient(client) self.flow_framework = FlowFrameworkClient(client) self.asynchronous_search = AsynchronousSearchClient(client) @@ -66,6 +69,7 @@ def _dynamic_lookup(self, client: Any) -> None: # Issue : https://github.com/opensearch-project/opensearch-py/issues/90#issuecomment-1003396742 plugins = [ + "sm", "replication", "flow_framework", "asynchronous_search", diff --git a/opensearchpy/plugins/knn.py b/opensearchpy/plugins/knn.py index 191bfb5f..c5b2e065 100644 --- a/opensearchpy/plugins/knn.py +++ b/opensearchpy/plugins/knn.py @@ -310,7 +310,7 @@ def stats( ) def train_model( self, - body: Any, + body: Any = None, model_id: Any = None, params: Any = None, headers: Any = None, @@ -335,9 +335,6 @@ def train_model( :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( "POST", _make_path("_plugins", "_knn", "models", model_id, "_train"), diff --git a/opensearchpy/plugins/observability.py b/opensearchpy/plugins/observability.py index 2bf9e03f..af1d68ba 100644 --- a/opensearchpy/plugins/observability.py +++ b/opensearchpy/plugins/observability.py @@ -135,7 +135,7 @@ def get_localstats( headers: Any = None, ) -> Any: """ - Retrieves Local Stats of all observability objects. + Retrieves local stats of all observability objects. :arg error_trace: Whether to include the stack trace of returned diff --git a/opensearchpy/plugins/sm.py b/opensearchpy/plugins/sm.py new file mode 100644 index 00000000..7c5cb208 --- /dev/null +++ b/opensearchpy/plugins/sm.py @@ -0,0 +1,346 @@ +# 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 ..client.utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params + + +class SmClient(NamespacedClient): + @query_params("error_trace", "filter_path", "human", "pretty", "source") + def create_policy( + self, + policy_name: Any, + body: Any = None, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Creates a snapshot management policy. + + + :arg policy_name: The name of the snapshot management policy. + :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 field’s 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 policy_name in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for a required argument 'policy_name'." + ) + + return self.transport.perform_request( + "POST", + _make_path("_plugins", "_sm", "policies", policy_name), + params=params, + headers=headers, + body=body, + ) + + @query_params("error_trace", "filter_path", "human", "pretty", "source") + def delete_policy( + self, + policy_name: Any, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Deletes a snapshot management policy. + + + :arg policy_name: The name of the snapshot management policy. + :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 field’s 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 policy_name in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for a required argument 'policy_name'." + ) + + return self.transport.perform_request( + "DELETE", + _make_path("_plugins", "_sm", "policies", policy_name), + params=params, + headers=headers, + ) + + @query_params("error_trace", "filter_path", "human", "pretty", "source") + def explain_policy( + self, + policy_name: Any, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Explains the state of the snapshot management policy. + + + :arg policy_name: The name of the snapshot management policy. + :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 field’s 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 policy_name in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for a required argument 'policy_name'." + ) + + return self.transport.perform_request( + "GET", + _make_path("_plugins", "_sm", "policies", policy_name, "_explain"), + params=params, + headers=headers, + ) + + @query_params( + "error_trace", + "filter_path", + "from_", + "human", + "pretty", + "queryString", + "size", + "sortField", + "sortOrder", + "source", + ) + def get_policies( + self, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Retrieves all snapshot management policies with optional pagination and + filtering. + + + :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 field’s name. You can also exclude fields + with "-". + :arg from_: The starting index (default: 0) + :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 queryString: A query string to filter policies. + :arg size: The number of policies to return. + :arg sortField: The field to sort on. + :arg sortOrder: The order of sorting. Valid choices are asc, + desc.Default is asc. + :arg source: The URL-encoded request definition. Useful for + libraries that do not accept a request body for non-POST requests. + """ + # from is a reserved word so it cannot be used, use from_ instead + if "from_" in params: + params["from"] = params.pop("from_") + + return self.transport.perform_request( + "GET", "/_plugins/_sm/policies", params=params, headers=headers + ) + + @query_params("error_trace", "filter_path", "human", "pretty", "source") + def get_policy( + self, + policy_name: Any, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Retrieves a specific snapshot management policy by name. + + + :arg policy_name: The name of the snapshot management policy. + :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 field’s 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 policy_name in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for a required argument 'policy_name'." + ) + + return self.transport.perform_request( + "GET", + _make_path("_plugins", "_sm", "policies", policy_name), + params=params, + headers=headers, + ) + + @query_params("error_trace", "filter_path", "human", "pretty", "source") + def start_policy( + self, + policy_name: Any, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Starts a snapshot management policy. + + + :arg policy_name: The name of the snapshot management policy. + :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 field’s 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 policy_name in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for a required argument 'policy_name'." + ) + + return self.transport.perform_request( + "POST", + _make_path("_plugins", "_sm", "policies", policy_name, "_start"), + params=params, + headers=headers, + ) + + @query_params("error_trace", "filter_path", "human", "pretty", "source") + def stop_policy( + self, + policy_name: Any, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Stops a snapshot management policy. + + + :arg policy_name: The name of the snapshot management policy. + :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 field’s 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 policy_name in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for a required argument 'policy_name'." + ) + + return self.transport.perform_request( + "POST", + _make_path("_plugins", "_sm", "policies", policy_name, "_stop"), + params=params, + headers=headers, + ) + + @query_params( + "error_trace", + "filter_path", + "human", + "if_primary_term", + "if_seq_no", + "pretty", + "source", + ) + def update_policy( + self, + policy_name: Any, + body: Any = None, + params: Any = None, + headers: Any = None, + ) -> Any: + """ + Updates an existing snapshot management policy. Requires `if_seq_no` and + `if_primary_term`. + + + :arg policy_name: The name of the snapshot management policy. + :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 field’s name. You can also exclude fields + with "-". + :arg human: Whether to return human readable values for + statistics. Default is True. + :arg if_primary_term: The primary term of the policy to update. + :arg if_seq_no: The sequence number of the policy to update. + :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 policy_name in SKIP_IN_PATH: + raise ValueError( + "Empty value passed for a required argument 'policy_name'." + ) + + return self.transport.perform_request( + "PUT", + _make_path("_plugins", "_sm", "policies", policy_name), + params=params, + headers=headers, + body=body, + )