Files
opensearch-pyd/opensearchpy/client/security.py
T

1511 lines
52 KiB
Python
Raw Normal View History

2023-06-27 17:01:40 +02:00
# 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.
2023-11-21 13:04:39 -05:00
# ------------------------------------------------------------------------------------------
# THIS CODE IS AUTOMATICALLY GENERATED AND MANUAL EDITS WILL BE LOST
#
2023-11-21 13:04:39 -05:00
# 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.
# -----------------------------------------------------------------------------------------+
2023-11-06 13:08:19 -05:00
from typing import Any
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
2023-06-27 17:01:40 +02:00
class SecurityClient(NamespacedClient):
2023-11-06 13:08:19 -05:00
from ._patch import health_check, update_audit_config # type: ignore
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def get_account_details(
self,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Returns account details for the current user.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
return self.transport.perform_request(
"GET", "/_plugins/_security/api/account", params=params, headers=headers
2023-06-27 17:01:40 +02:00
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def change_password(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Changes the password for the current user.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
2023-07-26 15:38:49 -07:00
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")
2023-06-27 17:01:40 +02:00
return self.transport.perform_request(
"PUT",
"/_plugins/_security/api/account",
2023-06-27 17:01:40 +02:00
params=params,
headers=headers,
2023-07-26 15:38:49 -07:00
body=body,
2023-06-27 17:01:40 +02:00
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def get_action_group(
self,
action_group: Any,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Retrieves one action group.
:arg action_group: Action group to retrieve.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
if action_group in SKIP_IN_PATH:
raise ValueError(
"Empty value passed for a required argument 'action_group'."
2023-06-27 17:01:40 +02:00
)
return self.transport.perform_request(
"GET",
_make_path("_plugins", "_security", "api", "actiongroups", action_group),
params=params,
headers=headers,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def get_action_groups(
self,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Retrieves all action groups.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
return self.transport.perform_request(
"GET",
"/_plugins/_security/api/actiongroups",
2023-06-27 17:01:40 +02:00
params=params,
headers=headers,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def delete_action_group(
self,
action_group: Any,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Delete a specified action group.
:arg action_group: Action group to delete.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
if action_group in SKIP_IN_PATH:
raise ValueError(
"Empty value passed for a required argument 'action_group'."
2023-06-27 17:01:40 +02:00
)
return self.transport.perform_request(
"DELETE",
_make_path("_plugins", "_security", "api", "actiongroups", action_group),
params=params,
headers=headers,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def create_action_group(
self,
action_group: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
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.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
2023-07-26 15:38:49 -07:00
for param in (action_group, body):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")
2023-06-27 17:01:40 +02:00
return self.transport.perform_request(
"PUT",
_make_path("_plugins", "_security", "api", "actiongroups", action_group),
params=params,
headers=headers,
body=body,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def patch_action_group(
self,
action_group: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Updates individual attributes of an action group.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
2023-07-26 15:38:49 -07:00
for param in (action_group, body):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")
2023-06-27 17:01:40 +02:00
return self.transport.perform_request(
"PATCH",
_make_path("_plugins", "_security", "api", "actiongroups", action_group),
params=params,
headers=headers,
body=body,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def patch_action_groups(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Creates, updates, or deletes multiple action groups in a single call.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
2023-07-26 15:38:49 -07:00
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")
2023-06-27 17:01:40 +02:00
return self.transport.perform_request(
"PATCH",
"/_plugins/_security/api/actiongroups",
2023-06-27 17:01:40 +02:00
params=params,
headers=headers,
body=body,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def get_user(
self,
username: Any,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Retrieve one internal user.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
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,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def get_users(
self,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Retrieve all internal users.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
return self.transport.perform_request(
"GET",
"/_plugins/_security/api/internalusers",
2023-06-27 17:01:40 +02:00
params=params,
headers=headers,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def delete_user(
self,
username: Any,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Delete the specified user.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
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,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def create_user(
self,
username: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Creates or replaces the specified user.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
2023-07-26 15:38:49 -07:00
for param in (username, body):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")
2023-06-27 17:01:40 +02:00
return self.transport.perform_request(
"PUT",
_make_path("_plugins", "_security", "api", "internalusers", username),
params=params,
headers=headers,
body=body,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def patch_user(
self,
username: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Updates individual attributes of an internal user.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
2023-07-26 15:38:49 -07:00
for param in (username, body):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")
2023-06-27 17:01:40 +02:00
return self.transport.perform_request(
"PATCH",
_make_path("_plugins", "_security", "api", "internalusers", username),
params=params,
headers=headers,
body=body,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def patch_users(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Creates, updates, or deletes multiple internal users in a single call.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
2023-07-26 15:38:49 -07:00
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")
2023-06-27 17:01:40 +02:00
return self.transport.perform_request(
"PATCH",
"/_plugins/_security/api/internalusers",
2023-06-27 17:01:40 +02:00
params=params,
headers=headers,
body=body,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def get_role(
self,
role: Any,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Retrieves one role.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
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,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def get_roles(
self,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Retrieves all roles.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
return self.transport.perform_request(
"GET", "/_plugins/_security/api/roles/", params=params, headers=headers
2023-06-27 17:01:40 +02:00
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def delete_role(
self,
role: Any,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Delete the specified role.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
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,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def create_role(
self,
role: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Creates or replaces the specified role.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
2023-07-26 15:38:49 -07:00
for param in (role, body):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")
2023-06-27 17:01:40 +02:00
return self.transport.perform_request(
"PUT",
_make_path("_plugins", "_security", "api", "roles", role),
params=params,
headers=headers,
body=body,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def patch_role(
self,
role: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Updates individual attributes of a role.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
2023-07-26 15:38:49 -07:00
for param in (role, body):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")
2023-06-27 17:01:40 +02:00
return self.transport.perform_request(
"PATCH",
_make_path("_plugins", "_security", "api", "roles", role),
params=params,
headers=headers,
body=body,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def patch_roles(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Creates, updates, or deletes multiple roles in a single call.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
2023-07-26 15:38:49 -07:00
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")
2023-06-27 17:01:40 +02:00
return self.transport.perform_request(
"PATCH",
"/_plugins/_security/api/roles",
2023-06-27 17:01:40 +02:00
params=params,
headers=headers,
body=body,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def get_role_mapping(
self,
role: Any,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Retrieves one role mapping.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
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,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def get_role_mappings(
self,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Retrieves all role mappings.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
return self.transport.perform_request(
"GET",
"/_plugins/_security/api/rolesmapping",
2023-06-27 17:01:40 +02:00
params=params,
headers=headers,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def delete_role_mapping(
self,
role: Any,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Deletes the specified role mapping.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
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,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def create_role_mapping(
self,
role: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Creates or replaces the specified role mapping.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
2023-07-26 15:38:49 -07:00
for param in (role, body):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")
2023-06-27 17:01:40 +02:00
return self.transport.perform_request(
"PUT",
_make_path("_plugins", "_security", "api", "rolesmapping", role),
params=params,
headers=headers,
body=body,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def patch_role_mapping(
self,
role: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Updates individual attributes of a role mapping.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
2023-07-26 15:38:49 -07:00
for param in (role, body):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")
2023-06-27 17:01:40 +02:00
return self.transport.perform_request(
"PATCH",
_make_path("_plugins", "_security", "api", "rolesmapping", role),
params=params,
headers=headers,
body=body,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def patch_role_mappings(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Creates or updates multiple role mappings in a single call.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
2023-07-26 15:38:49 -07:00
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")
2023-06-27 17:01:40 +02:00
return self.transport.perform_request(
"PATCH",
"/_plugins/_security/api/rolesmapping",
2023-06-27 17:01:40 +02:00
params=params,
headers=headers,
body=body,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def get_tenant(
self,
tenant: Any,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Retrieves one tenant.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
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,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def get_tenants(
self,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Retrieves all tenants.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
return self.transport.perform_request(
"GET", "/_plugins/_security/api/tenants/", params=params, headers=headers
2023-06-27 17:01:40 +02:00
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def delete_tenant(
self,
tenant: Any,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Delete the specified tenant.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
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,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def create_tenant(
self,
tenant: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Creates or replaces the specified tenant.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
2023-07-26 15:38:49 -07:00
for param in (tenant, body):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")
2023-06-27 17:01:40 +02:00
return self.transport.perform_request(
"PUT",
_make_path("_plugins", "_security", "api", "tenants", tenant),
params=params,
headers=headers,
body=body,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def patch_tenant(
self,
tenant: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Add, delete, or modify a single tenant.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
2023-07-26 15:38:49 -07:00
for param in (tenant, body):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")
2023-06-27 17:01:40 +02:00
return self.transport.perform_request(
"PATCH",
_make_path("_plugins", "_security", "api", "tenants", tenant),
params=params,
headers=headers,
body=body,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def patch_tenants(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Add, delete, or modify multiple tenants in a single call.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
2023-07-26 15:38:49 -07:00
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")
2023-06-27 17:01:40 +02:00
return self.transport.perform_request(
"PATCH",
"/_plugins/_security/api/tenants/",
2023-06-27 17:01:40 +02:00
params=params,
headers=headers,
body=body,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def get_configuration(
self,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Returns the current Security plugin configuration in JSON format.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
return self.transport.perform_request(
"GET",
"/_plugins/_security/api/securityconfig",
2023-06-27 17:01:40 +02:00
params=params,
headers=headers,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def update_configuration(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Adds or updates the existing configuration using the REST API.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
2023-07-26 15:38:49 -07:00
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")
2023-06-27 17:01:40 +02:00
return self.transport.perform_request(
"PUT",
"/_plugins/_security/api/securityconfig/config",
2023-06-27 17:01:40 +02:00
params=params,
headers=headers,
body=body,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def patch_configuration(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
A PATCH call is used to update the existing configuration using the REST API.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
2023-07-26 15:38:49 -07:00
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")
2023-06-27 17:01:40 +02:00
return self.transport.perform_request(
"PATCH",
"/_plugins/_security/api/securityconfig",
2023-06-27 17:01:40 +02:00
params=params,
headers=headers,
body=body,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def get_distinguished_names(
self,
cluster_name: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Retrieves distinguished names.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
return self.transport.perform_request(
"GET",
_make_path("_plugins", "_security", "api", "nodesdn", cluster_name),
params=params,
headers=headers,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
def update_distinguished_names(
2023-11-06 13:08:19 -05:00
self,
cluster_name: Any,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Adds or updates the specified distinguished names in the clusters or nodes
allow list.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
if cluster_name in SKIP_IN_PATH:
raise ValueError(
"Empty value passed for a required argument 'cluster_name'."
)
2023-06-27 17:01:40 +02:00
return self.transport.perform_request(
"PUT",
_make_path("_plugins", "_security", "api", "nodesdn", cluster_name),
params=params,
headers=headers,
body=body,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def delete_distinguished_names(
self,
cluster_name: Any,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Deletes all distinguished names in the specified clusters or nodes allow
list.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
if cluster_name in SKIP_IN_PATH:
raise ValueError(
"Empty value passed for a required argument 'cluster_name'."
2023-06-27 17:01:40 +02:00
)
return self.transport.perform_request(
"DELETE",
_make_path("_plugins", "_security", "api", "nodesdn", cluster_name),
params=params,
headers=headers,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def get_certificates(
self,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Retrieves the clusters security certificates.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
return self.transport.perform_request(
"GET", "/_plugins/_security/api/ssl/certs", params=params, headers=headers
2023-06-27 17:01:40 +02:00
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def reload_transport_certificates(
self,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Reload transport layer communication certificates.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
return self.transport.perform_request(
"PUT",
"/_plugins/_security/api/ssl/transport/reloadcerts",
2023-06-27 17:01:40 +02:00
params=params,
headers=headers,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def reload_http_certificates(
self,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Reload HTTP layer communication certificates.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
return self.transport.perform_request(
"PUT",
"/_plugins/_security/api/ssl/http/reloadcerts",
2023-06-27 17:01:40 +02:00
params=params,
headers=headers,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def flush_cache(
self,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Flushes the Security plugin user, authentication, and authorization cache.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
return self.transport.perform_request(
"DELETE", "/_plugins/_security/api/cache", params=params, headers=headers
2023-06-27 17:01:40 +02:00
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def health(
self,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Checks to see if the Security plugin is up and running.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
return self.transport.perform_request(
"GET", "/_plugins/_security/health", params=params, headers=headers
2023-06-27 17:01:40 +02:00
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def get_audit_configuration(
self,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Retrieves the audit configuration.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
return self.transport.perform_request(
"GET", "/_plugins/_security/api/audit", params=params, headers=headers
2023-06-27 17:01:40 +02:00
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def update_audit_configuration(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
Updates the audit configuration.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
2023-07-26 15:38:49 -07:00
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")
2023-06-27 17:01:40 +02:00
return self.transport.perform_request(
"PUT",
"/_plugins/_security/api/audit/config",
2023-06-27 17:01:40 +02:00
params=params,
headers=headers,
body=body,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def patch_audit_configuration(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
2023-06-27 17:01:40 +02:00
"""
A PATCH call is used to update specified fields in the audit configuration.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
2023-06-27 17:01:40 +02:00
"""
2023-07-26 15:38:49 -07:00
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")
2023-06-27 17:01:40 +02:00
return self.transport.perform_request(
"PATCH",
"/_plugins/_security/api/audit",
params=params,
headers=headers,
body=body,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
2023-11-06 13:08:19 -05:00
def patch_distinguished_names(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Bulk update of distinguished names.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
: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",
2023-06-27 17:01:40 +02:00
params=params,
headers=headers,
body=body,
)