Source code for opensearchpy.client.security

# 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


[docs]class SecurityClient(NamespacedClient):
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_account_details( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Returns account information for the current user. :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. """ return self.transport.perform_request( "GET", "/_plugins/_security/api/account", params=params, headers=headers )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def change_password( self, *, body: Any, params: Any = None, headers: Any = None, ) -> Any: """ Changes the password for the current user. :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 body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") return self.transport.perform_request( "PUT", "/_plugins/_security/api/account", params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_action_group( self, *, action_group: Any, params: Any = None, headers: Any = None, ) -> Any: """ Retrieves one action group. :arg action_group: The name of the action group to retrieve. :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 action_group in SKIP_IN_PATH: raise ValueError( "Empty value passed for a required argument 'action_group'." ) return self.transport.perform_request( "GET", _make_path("_plugins", "_security", "api", "actiongroups", action_group), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_action_groups( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Retrieves all action groups. :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. """ return self.transport.perform_request( "GET", "/_plugins/_security/api/actiongroups", params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def delete_action_group( self, *, action_group: Any, params: Any = None, headers: Any = None, ) -> Any: """ Deletes the specified action group. :arg action_group: The name of the action group to delete. :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 action_group in SKIP_IN_PATH: raise ValueError( "Empty value passed for a required argument 'action_group'." ) return self.transport.perform_request( "DELETE", _make_path("_plugins", "_security", "api", "actiongroups", action_group), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def create_action_group( self, *, action_group: Any, body: Any, params: Any = None, headers: Any = None, ) -> Any: """ Creates or replaces the specified action group. :arg action_group: The name of the action group to create or replace. :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. """ for param in (action_group, body): if param in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument.") return self.transport.perform_request( "PUT", _make_path("_plugins", "_security", "api", "actiongroups", action_group), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def patch_action_group( self, *, action_group: Any, body: Any, params: Any = None, headers: Any = None, ) -> Any: """ Updates the individual attributes of an action group. :arg action_group: The name of the action group to update. :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. """ for param in (action_group, body): if param in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument.") return self.transport.perform_request( "PATCH", _make_path("_plugins", "_security", "api", "actiongroups", action_group), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def patch_action_groups( self, *, body: Any, params: Any = None, headers: Any = None, ) -> Any: """ Creates, updates, or deletes multiple action groups in a single request. :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 body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") return self.transport.perform_request( "PATCH", "/_plugins/_security/api/actiongroups", params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_user( self, *, username: Any, params: Any = None, headers: Any = None, ) -> Any: """ Retrieve information about the specified internal user. :arg username: The name of the user to retrieve. :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 username in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'username'.") return self.transport.perform_request( "GET", _make_path("_plugins", "_security", "api", "internalusers", username), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_users( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Retrieve all internal users. :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. """ return self.transport.perform_request( "GET", "/_plugins/_security/api/internalusers", params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def delete_user( self, *, username: Any, params: Any = None, headers: Any = None, ) -> Any: """ Deletes the specified internal user. :arg username: The name of the user to delete. :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 username in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'username'.") return self.transport.perform_request( "DELETE", _make_path("_plugins", "_security", "api", "internalusers", username), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def create_user( self, *, username: Any, body: Any, params: Any = None, headers: Any = None, ) -> Any: """ Creates or replaces the specified user. :arg username: The name of the user to create. :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. """ for param in (username, body): if param in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument.") return self.transport.perform_request( "PUT", _make_path("_plugins", "_security", "api", "internalusers", username), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def patch_user( self, *, username: Any, body: Any, params: Any = None, headers: Any = None, ) -> Any: """ Updates individual attributes for an internal user. :arg username: The name of the user to update. :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. """ for param in (username, body): if param in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument.") return self.transport.perform_request( "PATCH", _make_path("_plugins", "_security", "api", "internalusers", username), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def patch_users( self, *, body: Any, params: Any = None, headers: Any = None, ) -> Any: """ Creates, updates, or deletes multiple internal users in a single request. :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 body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") return self.transport.perform_request( "PATCH", "/_plugins/_security/api/internalusers", params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_role( self, *, role: Any, params: Any = None, headers: Any = None, ) -> Any: """ Retrieves one role. :arg role: The name of the role to retrieve. :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 role in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'role'.") return self.transport.perform_request( "GET", _make_path("_plugins", "_security", "api", "roles", role), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_roles( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Retrieves all roles. :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. """ return self.transport.perform_request( "GET", "/_plugins/_security/api/roles", params=params, headers=headers )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def delete_role( self, *, role: Any, params: Any = None, headers: Any = None, ) -> Any: """ Deletes the specified role. :arg role: The name of the role to delete. :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 role in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'role'.") return self.transport.perform_request( "DELETE", _make_path("_plugins", "_security", "api", "roles", role), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def create_role( self, *, role: Any, body: Any, params: Any = None, headers: Any = None, ) -> Any: """ Creates or replaces the specified role. :arg role: The name of the role to create. :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. """ for param in (role, body): if param in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument.") return self.transport.perform_request( "PUT", _make_path("_plugins", "_security", "api", "roles", role), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def patch_role( self, *, role: Any, body: Any, params: Any = None, headers: Any = None, ) -> Any: """ Updates the individual attributes of a role. :arg role: The name of the role to update. :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. """ for param in (role, body): if param in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument.") return self.transport.perform_request( "PATCH", _make_path("_plugins", "_security", "api", "roles", role), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def patch_roles( self, *, body: Any, params: Any = None, headers: Any = None, ) -> Any: """ Creates, updates, or deletes multiple roles in a single call. :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 body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") return self.transport.perform_request( "PATCH", "/_plugins/_security/api/roles", params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_role_mapping( self, *, role: Any, params: Any = None, headers: Any = None, ) -> Any: """ Retrieves the specified role mapping. :arg role: The name of the role mapping to retrieve. :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 role in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'role'.") return self.transport.perform_request( "GET", _make_path("_plugins", "_security", "api", "rolesmapping", role), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_role_mappings( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Retrieves all role mappings. :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. """ return self.transport.perform_request( "GET", "/_plugins/_security/api/rolesmapping", params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def delete_role_mapping( self, *, role: Any, params: Any = None, headers: Any = None, ) -> Any: """ Deletes the specified role mapping. :arg role: The name of the role for which to delete the role's mappings. :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 role in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'role'.") return self.transport.perform_request( "DELETE", _make_path("_plugins", "_security", "api", "rolesmapping", role), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def create_role_mapping( self, *, role: Any, body: Any, params: Any = None, headers: Any = None, ) -> Any: """ Creates or replaces the specified role mapping. :arg role: The name of the role for which to create a role mapping. :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. """ for param in (role, body): if param in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument.") return self.transport.perform_request( "PUT", _make_path("_plugins", "_security", "api", "rolesmapping", role), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def patch_role_mapping( self, *, role: Any, body: Any, params: Any = None, headers: Any = None, ) -> Any: """ Updates the individual attributes of a role mapping. :arg role: The name of the role to update a role mapping for :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. """ for param in (role, body): if param in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument.") return self.transport.perform_request( "PATCH", _make_path("_plugins", "_security", "api", "rolesmapping", role), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def patch_role_mappings( self, *, body: Any, params: Any = None, headers: Any = None, ) -> Any: """ Creates or updates multiple role mappings in a single request. :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 body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") return self.transport.perform_request( "PATCH", "/_plugins/_security/api/rolesmapping", params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_tenant( self, *, tenant: Any, params: Any = None, headers: Any = None, ) -> Any: """ Retrieves the specified tenant. :arg tenant: The name of the tenant to retrieve. :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 tenant in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'tenant'.") return self.transport.perform_request( "GET", _make_path("_plugins", "_security", "api", "tenants", tenant), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_tenants( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Retrieves all tenants. :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. """ return self.transport.perform_request( "GET", "/_plugins/_security/api/tenants", params=params, headers=headers )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def delete_tenant( self, *, tenant: Any, params: Any = None, headers: Any = None, ) -> Any: """ Deletes the specified tenant. :arg tenant: The name of the tenant to delete. :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 tenant in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'tenant'.") return self.transport.perform_request( "DELETE", _make_path("_plugins", "_security", "api", "tenants", tenant), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def create_tenant( self, *, tenant: Any, body: Any, params: Any = None, headers: Any = None, ) -> Any: """ Creates or replaces the specified tenant. :arg tenant: The name of the tenant to create. :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. """ for param in (tenant, body): if param in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument.") return self.transport.perform_request( "PUT", _make_path("_plugins", "_security", "api", "tenants", tenant), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def patch_tenant( self, *, tenant: Any, body: Any, params: Any = None, headers: Any = None, ) -> Any: """ Adds, deletes, or modifies a single tenant. :arg tenant: The name of the tenant to update. :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. """ for param in (tenant, body): if param in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument.") return self.transport.perform_request( "PATCH", _make_path("_plugins", "_security", "api", "tenants", tenant), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def patch_tenants( self, *, body: Any, params: Any = None, headers: Any = None, ) -> Any: """ Adds, deletes, or modifies multiple tenants in a single request. :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 body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") return self.transport.perform_request( "PATCH", "/_plugins/_security/api/tenants", params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_configuration( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Returns the current Security plugin configuration in a JSON format. :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. """ return self.transport.perform_request( "GET", "/_plugins/_security/api/securityconfig", params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def update_configuration( self, *, body: Any, params: Any = None, headers: Any = None, ) -> Any: """ Updates the settings for an existing security configuration. Requires super admin or REST API permissions. :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 body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") return self.transport.perform_request( "PUT", "/_plugins/_security/api/securityconfig/config", params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def patch_configuration( self, *, body: Any, params: Any = None, headers: Any = None, ) -> Any: """ Updates the existing security configuration using the REST API. Requires super admin or REST API permissions. :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 body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") return self.transport.perform_request( "PATCH", "/_plugins/_security/api/securityconfig", params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "show_all", "source") def get_distinguished_names( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Retrieves all node distinguished names. Requires super admin or REST API permissions. :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 show_all: Whether to include or exclude any static node's DN settings from the final result. :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", "/_plugins/_security/api/nodesdn", params=params, headers=headers )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_certificates( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Retrieves the cluster security certificates. :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. """ return self.transport.perform_request( "GET", "/_plugins/_security/api/ssl/certs", params=params, headers=headers )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def reload_transport_certificates( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Reloads the transport communication certificates. :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. """ return self.transport.perform_request( "PUT", "/_plugins/_security/api/ssl/transport/reloadcerts", params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def reload_http_certificates( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Reloads the HTTP communication certificates. :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. """ return self.transport.perform_request( "PUT", "/_plugins/_security/api/ssl/http/reloadcerts", params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def flush_cache( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Flushes the Security plugin's user, authentication, and authorization cache. :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. """ return self.transport.perform_request( "DELETE", "/_plugins/_security/api/cache", params=params, headers=headers )
[docs] @query_params("error_trace", "filter_path", "human", "mode", "pretty", "source") def health( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Checks to see if the Security plugin is running. :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 mode: A flag that determines whether to consider the security status before returning a response for a health query response. For example, `strict` mode indicates service should check the Security plugin status. :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", "/_plugins/_security/health", params=params, headers=headers )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_audit_configuration( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Retrieves the audit configuration. :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. """ return self.transport.perform_request( "GET", "/_plugins/_security/api/audit", params=params, headers=headers )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def update_audit_configuration( self, *, body: Any, params: Any = None, headers: Any = None, ) -> Any: """ Updates the audit configuration. :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 body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") return self.transport.perform_request( "PUT", "/_plugins/_security/api/audit/config", params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def patch_audit_configuration( self, *, body: Any, params: Any = None, headers: Any = None, ) -> Any: """ Updates the specified fields in the audit configuration. :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 body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") return self.transport.perform_request( "PATCH", "/_plugins/_security/api/audit", params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def patch_distinguished_names( self, *, body: Any, params: Any = None, headers: Any = None, ) -> Any: """ Bulk updates specified node distinguished names. Requires super admin or REST API permissions. :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 body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") return self.transport.perform_request( "PATCH", "/_plugins/_security/api/nodesdn", params=params, headers=headers, body=body, )
[docs] @query_params( "auth_type", "error_trace", "filter_path", "human", "pretty", "source", "verbose", ) def authinfo( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Returns or updates authentication information for the currently authenticated user. :arg auth_type: The type of the current authentication request. :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. :arg verbose: Whether to return a verbose response. """ return self.transport.perform_request( "GET", "/_plugins/_security/authinfo", params=params, headers=headers )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def authtoken( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Returns the authorization token for the current user. :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. """ return self.transport.perform_request( "POST", "/_plugins/_security/api/authtoken", params=params, headers=headers )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def cache( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Not supported for the Cache API. :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. """ return self.transport.perform_request( "PUT", "/_plugins/_security/api/cache", params=params, headers=headers )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def config_upgrade_check( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Checks whether or not an upgrade can be performed and which security resources can be updated. :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. """ return self.transport.perform_request( "GET", "/_plugins/_security/api/_upgrade_check", params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def config_upgrade_perform( self, *, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Assists the cluster operator with upgrading missing default values and stale default definitions. :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. """ return self.transport.perform_request( "POST", "/_plugins/_security/api/_upgrade_perform", params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def create_allowlist( self, *, body: Any, params: Any = None, headers: Any = None, ) -> Any: """ Creates or replaces APIs permitted for users on the allow list. Requires a super admin certificate or REST API permissions. :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 body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") return self.transport.perform_request( "PUT", "/_plugins/_security/api/allowlist", params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def create_update_tenancy_config( self, *, body: Any, params: Any = None, headers: Any = None, ) -> Any: """ Creates or replaces the multi-tenancy configuration. Requires super admin or REST API permissions. :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 body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") return self.transport.perform_request( "PUT", "/_plugins/_security/api/tenancy/config", params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def create_user_legacy( self, *, username: Any, body: Any, params: Any = None, headers: Any = None, ) -> Any: """ Creates or replaces the specified user. Legacy API. :arg username: The name of the user to create. :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. """ for param in (username, body): if param in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument.") return self.transport.perform_request( "PUT", _make_path("_plugins", "_security", "api", "user", username), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def delete_distinguished_name( self, *, cluster_name: Any, params: Any = None, headers: Any = None, ) -> Any: """ Deletes all distinguished names in the specified cluster or node allowlist. Requires super admin or REST API permissions. :arg cluster_name: The cluster name to delete from list of distinguished names. :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 cluster_name in SKIP_IN_PATH: raise ValueError( "Empty value passed for a required argument 'cluster_name'." ) return self.transport.perform_request( "DELETE", _make_path("_plugins", "_security", "api", "nodesdn", cluster_name), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def delete_user_legacy( self, *, username: Any, params: Any = None, headers: Any = None, ) -> Any: """ Delete the specified user. Legacy API. :arg username: The name of the user to delete. :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 username in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'username'.") return self.transport.perform_request( "DELETE", _make_path("_plugins", "_security", "api", "user", username), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def generate_obo_token( self, *, body: Any, params: Any = None, headers: Any = None, ) -> Any: """ Generates a `On-Behalf-Of` token for the current user. :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 body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") return self.transport.perform_request( "POST", "/_plugins/_security/api/generateonbehalfoftoken", params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def generate_user_token( self, *, username: Any, params: Any = None, headers: Any = None, ) -> Any: """ Generates an authorization token for the specified user. :arg username: The name of the user for whom to issue an authorization token. :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 username in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'username'.") return self.transport.perform_request( "POST", _make_path( "_plugins", "_security", "api", "internalusers", username, "authtoken" ), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def generate_user_token_legacy( self, *, username: Any, params: Any = None, headers: Any = None, ) -> Any: """ Generates authorization token for the given user. Legacy API. Not Implemented. :arg username: The name of the user for whom to issue an authorization token. :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 username in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'username'.") return self.transport.perform_request( "POST", _make_path("_plugins", "_security", "api", "user", username, "authtoken"), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_allowlist( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Retrieves the current list of allowed APIs accessible to a normal user. :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. """ return self.transport.perform_request( "GET", "/_plugins/_security/api/allowlist", params=params, headers=headers )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_dashboards_info( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Retrieves the current values for dynamic security settings for OpenSearch Dashboards. :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. """ return self.transport.perform_request( "GET", "/_plugins/_security/dashboardsinfo", params=params, headers=headers )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "show_all", "source") def get_distinguished_name( self, *, cluster_name: Any, params: Any = None, headers: Any = None, ) -> Any: """ Retrieves all node distinguished names. Requires super admin or REST API permissions. :arg cluster_name: The name of the cluster to retrieve that cluster's nodes DN settings. :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 show_all: Whether to include or exclude any static node's DN settings from the final result. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if cluster_name in SKIP_IN_PATH: raise ValueError( "Empty value passed for a required argument 'cluster_name'." ) return self.transport.perform_request( "GET", _make_path("_plugins", "_security", "api", "nodesdn", cluster_name), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_permissions_info( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Retrieves the evaluated REST API permissions for the currently logged in user. :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. """ return self.transport.perform_request( "GET", "/_plugins/_security/api/permissionsinfo", params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "show_dn", "source") def get_sslinfo( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Retrieves information about the SSL configuration. :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 show_dn: Whether to include all domain names in the response. :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", "/_opendistro/_security/sslinfo", params=params, headers=headers )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_tenancy_config( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Retrieves the multi-tenancy configuration. Requires super admin or REST API permissions. :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. """ return self.transport.perform_request( "GET", "/_plugins/_security/api/tenancy/config", params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_user_legacy( self, *, username: Any, params: Any = None, headers: Any = None, ) -> Any: """ Retrieve one user. Legacy API. :arg username: The name of the user to retrieve. :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 username in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'username'.") return self.transport.perform_request( "GET", _make_path("_plugins", "_security", "api", "user", username), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_users_legacy( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Retrieve all internal users. Legacy API. :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. """ return self.transport.perform_request( "GET", "/_plugins/_security/api/user", params=params, headers=headers )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def migrate( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Migrates the security configuration from v6 to v7. :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. """ return self.transport.perform_request( "POST", "/_plugins/_security/api/migrate", params=params, headers=headers )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def patch_allowlist( self, *, body: Any, params: Any = None, headers: Any = None, ) -> Any: """ Updates the current list of APIs accessible for users on the allow list. :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 body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") return self.transport.perform_request( "PATCH", "/_plugins/_security/api/allowlist", params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def patch_distinguished_name( self, *, cluster_name: Any, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Updates the distinguished cluster name for the specified cluster. Requires super admin or REST API permissions. :arg cluster_name: The cluster name to update the `nodesDn` value. :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 cluster_name in SKIP_IN_PATH: raise ValueError( "Empty value passed for a required argument 'cluster_name'." ) return self.transport.perform_request( "PATCH", _make_path("_plugins", "_security", "api", "nodesdn", cluster_name), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def post_dashboards_info( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Retrieves the current values for dynamic security settings for OpenSearch Dashboards. :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. """ return self.transport.perform_request( "POST", "/_plugins/_security/dashboardsinfo", params=params, headers=headers )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def tenant_info( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Retrieves the names of current tenants. Requires super admin or `kibanaserver` permissions. :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. """ return self.transport.perform_request( "GET", "/_plugins/_security/tenantinfo", params=params, headers=headers )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def update_distinguished_name( self, *, cluster_name: Any, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Adds or updates the specified distinguished names in the cluster or node allowlist. Requires super admin or REST API permissions. :arg cluster_name: The name of the cluster containing the `nodesDn` value to create or update. :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 cluster_name in SKIP_IN_PATH: raise ValueError( "Empty value passed for a required argument 'cluster_name'." ) return self.transport.perform_request( "PUT", _make_path("_plugins", "_security", "api", "nodesdn", cluster_name), params=params, headers=headers, body=body, )
[docs] @query_params( "accept_invalid", "error_trace", "filter_path", "human", "pretty", "source" ) def validate( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Checks whether the v6 security configuration is valid and ready to be migrated to v7. :arg accept_invalid: Whether an invalid v6 configuration should be allowed. :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. """ return self.transport.perform_request( "GET", "/_plugins/_security/api/validate", params=params, headers=headers )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def who_am_i( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Gets the identity information for the user currently logged in. :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. """ return self.transport.perform_request( "GET", "/_plugins/_security/whoami", params=params, headers=headers )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def who_am_i_protected( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Gets the identity information for the user currently logged in. To use this operation, you must have access to this endpoint when authorization at REST layer is enabled. :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. """ return self.transport.perform_request( "GET", "/_plugins/_security/whoamiprotected", params=params, headers=headers )
[docs] @query_params( "cert_type", "error_trace", "filter_path", "human", "pretty", "source", "timeout", ) def get_all_certificates( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Retrieves the cluster security certificates. :arg cert_type: The type of certificates (`HTTP`, `TRANSPORT`, or `ALL`) to retrieve from all nodes. :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. :arg timeout: The maximum duration, in seconds, to spend retrieving certificates from all nodes before a timeout. """ return self.transport.perform_request( "GET", "/_plugins/_security/api/certificates", params=params, headers=headers, )
[docs] @query_params( "cert_type", "error_trace", "filter_path", "human", "pretty", "source", "timeout", ) def get_node_certificates( self, *, node_id: Any, params: Any = None, headers: Any = None, ) -> Any: """ Retrieves the specified node's security certificates. :arg node_id: The node ID to retrieve certificates for. :arg cert_type: The type of certificates (`HTTP`, `TRANSPORT`, or `ALL`) to retrieve from a 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 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. :arg timeout: The maximum duration, in seconds, to spend retrieving certificates from all nodes before a timeout. """ if node_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'node_id'.") return self.transport.perform_request( "GET", _make_path("_plugins", "_security", "api", "certificates", node_id), params=params, headers=headers, )