From 64f70939b106abf101de482031696118fccade13 Mon Sep 17 00:00:00 2001 From: dblock Date: Fri, 6 Sep 2024 03:35:37 +0000 Subject: [PATCH] Updated opensearch-php to reflect the latest OpenSearch API spec (2024-09-06) Signed-off-by: GitHub --- CHANGELOG.md | 1 + src/OpenSearch/Client.php | 14 ++ .../Endpoints/AsynchronousSearch/Delete.php | 52 ++++++++ .../Endpoints/AsynchronousSearch/Get.php | 52 ++++++++ .../Endpoints/AsynchronousSearch/Search.php | 59 +++++++++ .../Endpoints/AsynchronousSearch/Stats.php | 45 +++++++ .../Cluster/DeleteWeightedRouting.php | 10 ++ .../Endpoints/Cluster/PutWeightedRouting.php | 10 ++ src/OpenSearch/Endpoints/Ml/DeleteTask.php | 62 +++++++++ src/OpenSearch/Endpoints/Ml/DeployModel.php | 47 ++++--- src/OpenSearch/Endpoints/Ml/UndeployModel.php | 47 ++++--- .../Endpoints/Security/ConfigUpgradeCheck.php | 2 +- .../Security/ConfigUpgradePerform.php | 2 +- .../Endpoints/Security/GetAllCertificates.php | 47 +++++++ .../Security/GetNodeCertificates.php | 64 +++++++++ .../Endpoints/Security/PostDashboardsInfo.php | 10 -- .../AsynchronousSearchNamespace.php | 122 ++++++++++++++++++ .../Namespaces/ClusterNamespace.php | 5 + src/OpenSearch/Namespaces/MlNamespace.php | 24 ++++ .../Namespaces/SecurityNamespace.php | 105 ++++++++++----- 20 files changed, 700 insertions(+), 80 deletions(-) create mode 100644 src/OpenSearch/Endpoints/AsynchronousSearch/Delete.php create mode 100644 src/OpenSearch/Endpoints/AsynchronousSearch/Get.php create mode 100644 src/OpenSearch/Endpoints/AsynchronousSearch/Search.php create mode 100644 src/OpenSearch/Endpoints/AsynchronousSearch/Stats.php create mode 100644 src/OpenSearch/Endpoints/Ml/DeleteTask.php create mode 100644 src/OpenSearch/Endpoints/Security/GetAllCertificates.php create mode 100644 src/OpenSearch/Endpoints/Security/GetNodeCertificates.php create mode 100644 src/OpenSearch/Namespaces/AsynchronousSearchNamespace.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c7f9851..d8d55cb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### Fixed - Fixed upcomming PHP 8.4 deprecations ### Updated APIs +- Updated opensearch-php APIs to reflect [opensearch-api-specification@f150005](https://github.com/opensearch-project/opensearch-api-specification/commit/f150005df24029b196234b857849e6c256193f71) - Updated opensearch-php APIs to reflect [opensearch-api-specification@cb320b5](https://github.com/opensearch-project/opensearch-api-specification/commit/cb320b5482551c4f28afa26ff0d1653332699722) ### Security ### Dependencies diff --git a/src/OpenSearch/Client.php b/src/OpenSearch/Client.php index e679a65e..373d2db2 100644 --- a/src/OpenSearch/Client.php +++ b/src/OpenSearch/Client.php @@ -27,6 +27,7 @@ use OpenSearch\Namespaces\NamespaceBuilderInterface; use OpenSearch\Namespaces\BooleanRequestWrapper; use OpenSearch\Namespaces\AsyncSearchNamespace; +use OpenSearch\Namespaces\AsynchronousSearchNamespace; use OpenSearch\Namespaces\CatNamespace; use OpenSearch\Namespaces\ClusterNamespace; use OpenSearch\Namespaces\DanglingIndicesNamespace; @@ -86,6 +87,11 @@ class Client */ protected $asyncSearch; + /** + * @var AsynchronousSearchNamespace + */ + protected $asynchronousSearch; + /** * @var CatNamespace */ @@ -219,6 +225,7 @@ public function __construct(Transport $transport, callable $endpoint, array $reg $this->transport = $transport; $this->endpoints = $endpoint; $this->asyncSearch = new AsyncSearchNamespace($transport, $endpoint); + $this->asynchronousSearch = new AsynchronousSearchNamespace($transport, $endpoint); $this->cat = new CatNamespace($transport, $endpoint); $this->cluster = new ClusterNamespace($transport, $endpoint); $this->danglingIndices = new DanglingIndicesNamespace($transport, $endpoint); @@ -1680,6 +1687,13 @@ public function asyncSearch(): AsyncSearchNamespace { return $this->asyncSearch; } + /** + * Returns the asynchronousSearch namespace + */ + public function asynchronousSearch(): AsynchronousSearchNamespace + { + return $this->asynchronousSearch; + } /** * Returns the cat namespace */ diff --git a/src/OpenSearch/Endpoints/AsynchronousSearch/Delete.php b/src/OpenSearch/Endpoints/AsynchronousSearch/Delete.php new file mode 100644 index 00000000..fe63dc31 --- /dev/null +++ b/src/OpenSearch/Endpoints/AsynchronousSearch/Delete.php @@ -0,0 +1,52 @@ +id) !== true) { + throw new RuntimeException( + 'id is required for delete' + ); + } + $id = $this->id; + return "/_plugins/_asynchronous_search/$id"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } +} diff --git a/src/OpenSearch/Endpoints/AsynchronousSearch/Get.php b/src/OpenSearch/Endpoints/AsynchronousSearch/Get.php new file mode 100644 index 00000000..6caa77b1 --- /dev/null +++ b/src/OpenSearch/Endpoints/AsynchronousSearch/Get.php @@ -0,0 +1,52 @@ +id) !== true) { + throw new RuntimeException( + 'id is required for get' + ); + } + $id = $this->id; + return "/_plugins/_asynchronous_search/$id"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } +} diff --git a/src/OpenSearch/Endpoints/AsynchronousSearch/Search.php b/src/OpenSearch/Endpoints/AsynchronousSearch/Search.php new file mode 100644 index 00000000..1bdd1757 --- /dev/null +++ b/src/OpenSearch/Endpoints/AsynchronousSearch/Search.php @@ -0,0 +1,59 @@ +body = $body; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/AsynchronousSearch/Stats.php b/src/OpenSearch/Endpoints/AsynchronousSearch/Stats.php new file mode 100644 index 00000000..8b68cb39 --- /dev/null +++ b/src/OpenSearch/Endpoints/AsynchronousSearch/Stats.php @@ -0,0 +1,45 @@ +body = $body; + + return $this; + } } diff --git a/src/OpenSearch/Endpoints/Cluster/PutWeightedRouting.php b/src/OpenSearch/Endpoints/Cluster/PutWeightedRouting.php index 3a35b555..2cb8eb3c 100644 --- a/src/OpenSearch/Endpoints/Cluster/PutWeightedRouting.php +++ b/src/OpenSearch/Endpoints/Cluster/PutWeightedRouting.php @@ -50,6 +50,16 @@ public function getMethod(): string return 'PUT'; } + public function setBody($body): PutWeightedRouting + { + if (isset($body) !== true) { + return $this; + } + $this->body = $body; + + return $this; + } + public function setAttribute($attribute): PutWeightedRouting { if (isset($attribute) !== true) { diff --git a/src/OpenSearch/Endpoints/Ml/DeleteTask.php b/src/OpenSearch/Endpoints/Ml/DeleteTask.php new file mode 100644 index 00000000..6a2a3036 --- /dev/null +++ b/src/OpenSearch/Endpoints/Ml/DeleteTask.php @@ -0,0 +1,62 @@ +task_id ?? null; + if (isset($task_id)) { + return "/_plugins/_ml/tasks/$task_id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.delete_task'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setTaskId($task_id): DeleteTask + { + if (isset($task_id) !== true) { + return $this; + } + $this->task_id = $task_id; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Ml/DeployModel.php b/src/OpenSearch/Endpoints/Ml/DeployModel.php index ba181822..0d9cf4cb 100644 --- a/src/OpenSearch/Endpoints/Ml/DeployModel.php +++ b/src/OpenSearch/Endpoints/Ml/DeployModel.php @@ -16,36 +16,45 @@ use OpenSearch\Common\Exceptions\RuntimeException; use OpenSearch\Endpoints\AbstractEndpoint; +/** + * NOTE: This file is autogenerated using util/GenerateEndpoints.php + */ class DeployModel extends AbstractEndpoint { - /** - * @return string[] - */ - public function getParamWhitelist(): array - { - return []; - } + protected $model_id; - /** - * @return string - */ public function getURI(): string { - if ($this->id) { - return "/_plugins/_ml/models/$this->id/_deploy"; + $model_id = $this->model_id ?? null; + if (isset($model_id)) { + return "/_plugins/_ml/models/$model_id/_deploy"; } + throw new RuntimeException('Missing parameter for the endpoint ml.deploy_model'); + } - throw new RuntimeException( - 'id is required for deploy' - ); - + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; } - /** - * @return string - */ public function getMethod(): string { return 'POST'; } + + public function setModelId($model_id): DeployModel + { + if (isset($model_id) !== true) { + return $this; + } + $this->model_id = $model_id; + + return $this; + } } diff --git a/src/OpenSearch/Endpoints/Ml/UndeployModel.php b/src/OpenSearch/Endpoints/Ml/UndeployModel.php index 1b9dd7fd..2dd63058 100644 --- a/src/OpenSearch/Endpoints/Ml/UndeployModel.php +++ b/src/OpenSearch/Endpoints/Ml/UndeployModel.php @@ -16,36 +16,45 @@ use OpenSearch\Common\Exceptions\RuntimeException; use OpenSearch\Endpoints\AbstractEndpoint; +/** + * NOTE: This file is autogenerated using util/GenerateEndpoints.php + */ class UndeployModel extends AbstractEndpoint { - /** - * @return string[] - */ - public function getParamWhitelist(): array - { - return []; - } + protected $model_id; - /** - * @return string - */ public function getURI(): string { - if ($this->id) { - return "/_plugins/_ml/models/$this->id/_undeploy"; + $model_id = $this->model_id ?? null; + if (isset($model_id)) { + return "/_plugins/_ml/models/$model_id/_undeploy"; } + throw new RuntimeException('Missing parameter for the endpoint ml.undeploy_model'); + } - throw new RuntimeException( - 'id is required for undeploy' - ); - + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; } - /** - * @return string - */ public function getMethod(): string { return 'POST'; } + + public function setModelId($model_id): UndeployModel + { + if (isset($model_id) !== true) { + return $this; + } + $this->model_id = $model_id; + + return $this; + } } diff --git a/src/OpenSearch/Endpoints/Security/ConfigUpgradeCheck.php b/src/OpenSearch/Endpoints/Security/ConfigUpgradeCheck.php index 7f105c3d..217d9978 100644 --- a/src/OpenSearch/Endpoints/Security/ConfigUpgradeCheck.php +++ b/src/OpenSearch/Endpoints/Security/ConfigUpgradeCheck.php @@ -24,7 +24,7 @@ class ConfigUpgradeCheck extends AbstractEndpoint { public function getURI(): string { - return "/_plugins/_security/_upgrade_check"; + return "/_plugins/_security/api/_upgrade_check"; } public function getParamWhitelist(): array diff --git a/src/OpenSearch/Endpoints/Security/ConfigUpgradePerform.php b/src/OpenSearch/Endpoints/Security/ConfigUpgradePerform.php index 25425359..ad049f47 100644 --- a/src/OpenSearch/Endpoints/Security/ConfigUpgradePerform.php +++ b/src/OpenSearch/Endpoints/Security/ConfigUpgradePerform.php @@ -24,7 +24,7 @@ class ConfigUpgradePerform extends AbstractEndpoint { public function getURI(): string { - return "/_plugins/_security/_upgrade_perform"; + return "/_plugins/_security/api/_upgrade_perform"; } public function getParamWhitelist(): array diff --git a/src/OpenSearch/Endpoints/Security/GetAllCertificates.php b/src/OpenSearch/Endpoints/Security/GetAllCertificates.php new file mode 100644 index 00000000..06b5fd43 --- /dev/null +++ b/src/OpenSearch/Endpoints/Security/GetAllCertificates.php @@ -0,0 +1,47 @@ +node_id ?? null; + if (isset($node_id)) { + return "/_plugins/_security/api/certificates/$node_id"; + } + throw new RuntimeException('Missing parameter for the endpoint security.get_node_certificates'); + } + + public function getParamWhitelist(): array + { + return [ + 'cert_type', + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setNodeId($node_id): GetNodeCertificates + { + if (isset($node_id) !== true) { + return $this; + } + $this->node_id = $node_id; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Security/PostDashboardsInfo.php b/src/OpenSearch/Endpoints/Security/PostDashboardsInfo.php index 75bff211..87fff406 100644 --- a/src/OpenSearch/Endpoints/Security/PostDashboardsInfo.php +++ b/src/OpenSearch/Endpoints/Security/PostDashboardsInfo.php @@ -42,14 +42,4 @@ public function getMethod(): string { return 'POST'; } - - public function setBody($body): PostDashboardsInfo - { - if (isset($body) !== true) { - return $this; - } - $this->body = $body; - - return $this; - } } diff --git a/src/OpenSearch/Namespaces/AsynchronousSearchNamespace.php b/src/OpenSearch/Namespaces/AsynchronousSearchNamespace.php new file mode 100644 index 00000000..b485fccd --- /dev/null +++ b/src/OpenSearch/Namespaces/AsynchronousSearchNamespace.php @@ -0,0 +1,122 @@ +extractArgument($params, 'id'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('AsynchronousSearch\Delete'); + $endpoint->setParams($params); + $endpoint->setId($id); + + return $this->performRequest($endpoint); + } + /** + * Get partial responses from asynchronous search. + * + * $params['id'] = (string) (Required) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function get(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('AsynchronousSearch\Get'); + $endpoint->setParams($params); + $endpoint->setId($id); + + return $this->performRequest($endpoint); + } + /** + * Perform an asynchronous search. + * + * $params['index'] = (string) The name of the index to be searched. + * $params['keep_alive'] = (string) The amount of time that the result is saved in the cluster. + * $params['keep_on_completion'] = (boolean) Whether you want to save the results in the cluster after the search is complete. + * $params['wait_for_completion_timeout'] = (string) The amount of time that you plan to wait for the results. + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function search(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('AsynchronousSearch\Search'); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Monitoring of asynchronous searches that are running, completed, and/or persisted. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function stats(array $params = []) + { + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('AsynchronousSearch\Stats'); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } +} diff --git a/src/OpenSearch/Namespaces/ClusterNamespace.php b/src/OpenSearch/Namespaces/ClusterNamespace.php index dbe85126..0efea982 100644 --- a/src/OpenSearch/Namespaces/ClusterNamespace.php +++ b/src/OpenSearch/Namespaces/ClusterNamespace.php @@ -138,9 +138,12 @@ public function deleteVotingConfigExclusions(array $params = []) */ public function deleteWeightedRouting(array $params = []) { + $body = $this->extractArgument($params, 'body'); + $endpointBuilder = $this->endpoints; $endpoint = $endpointBuilder('Cluster\DeleteWeightedRouting'); $endpoint->setParams($params); + $endpoint->setBody($body); return $this->performRequest($endpoint); } @@ -459,11 +462,13 @@ public function putSettings(array $params = []) public function putWeightedRouting(array $params = []) { $attribute = $this->extractArgument($params, 'attribute'); + $body = $this->extractArgument($params, 'body'); $endpointBuilder = $this->endpoints; $endpoint = $endpointBuilder('Cluster\PutWeightedRouting'); $endpoint->setParams($params); $endpoint->setAttribute($attribute); + $endpoint->setBody($body); return $this->performRequest($endpoint); } diff --git a/src/OpenSearch/Namespaces/MlNamespace.php b/src/OpenSearch/Namespaces/MlNamespace.php index c89c35e8..1a566b98 100644 --- a/src/OpenSearch/Namespaces/MlNamespace.php +++ b/src/OpenSearch/Namespaces/MlNamespace.php @@ -72,6 +72,30 @@ public function deleteModelGroup(array $params = []) return $this->performRequest($endpoint); } + /** + * Deletes a task. + * + * $params['task_id'] = (string) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function deleteTask(array $params = []) + { + $task_id = $this->extractArgument($params, 'task_id'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ml\DeleteTask'); + $endpoint->setParams($params); + $endpoint->setTaskId($task_id); + + return $this->performRequest($endpoint); + } /** * Retrieves a model group. * diff --git a/src/OpenSearch/Namespaces/SecurityNamespace.php b/src/OpenSearch/Namespaces/SecurityNamespace.php index bf7a5937..a804ce9b 100644 --- a/src/OpenSearch/Namespaces/SecurityNamespace.php +++ b/src/OpenSearch/Namespaces/SecurityNamespace.php @@ -178,7 +178,7 @@ public function createUpdateTenancyConfig(array $params = []) /** * Creates or replaces the specified user. Legacy API. * - * $params['username'] = (string) (Required) + * $params['username'] = (string) The name of the user to be created. (Required) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. @@ -204,7 +204,7 @@ public function createUserLegacy(array $params = []) /** * Delete a specified action group. * - * $params['action_group'] = (string) Action group to delete. (Required) + * $params['action_group'] = (string) The name of the action group to delete. (Required) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. @@ -228,7 +228,7 @@ public function deleteActionGroup(array $params = []) /** * Deletes all distinguished names in the specified cluster or node allow list. Only accessible to super-admins and with rest-api permissions when enabled. * - * $params['cluster_name'] = (string) (Required) + * $params['cluster_name'] = (string) The cluster-name to delete from list of distinguished names. (Required) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. @@ -252,7 +252,7 @@ public function deleteDistinguishedName(array $params = []) /** * Delete the specified role. * - * $params['role'] = (string) (Required) + * $params['role'] = (string) The name of the role to delete. (Required) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. @@ -276,7 +276,7 @@ public function deleteRole(array $params = []) /** * Deletes the specified role mapping. * - * $params['role'] = (string) (Required) + * $params['role'] = (string) The name of the role whose mapping needs to delete. (Required) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. @@ -300,7 +300,7 @@ public function deleteRoleMapping(array $params = []) /** * Delete the specified tenant. * - * $params['tenant'] = (string) (Required) + * $params['tenant'] = (string) The name of the tenant to delete. (Required) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. @@ -324,7 +324,7 @@ public function deleteTenant(array $params = []) /** * Delete the specified user. * - * $params['username'] = (string) (Required) + * $params['username'] = (string) The name of the user to delete. (Required) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. @@ -348,7 +348,7 @@ public function deleteUser(array $params = []) /** * Delete the specified user. Legacy API. * - * $params['username'] = (string) (Required) + * $params['username'] = (string) The name of the user to delete. (Required) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. @@ -415,7 +415,7 @@ public function generateOboToken(array $params = []) /** * Generates authorization token for the given user. * - * $params['username'] = (string) (Required) + * $params['username'] = (string) The name of the user for whom an auth token is to be vended. (Required) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. @@ -437,9 +437,9 @@ public function generateUserToken(array $params = []) return $this->performRequest($endpoint); } /** - * Generates authorization token for the given user. Legacy API. + * Generates authorization token for the given user. Legacy API. Not Implemented. * - * $params['username'] = (string) (Required) + * $params['username'] = (string) The name of the user for whom an auth token is to be vended. (Required) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. @@ -483,7 +483,7 @@ public function getAccountDetails(array $params = []) /** * Retrieves one action group. * - * $params['action_group'] = (string) Action group to retrieve. (Required) + * $params['action_group'] = (string) The name of the action group to retrieve. (Required) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. @@ -504,6 +504,28 @@ public function getActionGroup(array $params = []) return $this->performRequest($endpoint); } + /** + * Retrieves the cluster security certificates. + * + * $params['cert_type'] = (string) The type of certificates (HTTP, TRANSPORT, ALL) to retrieve from all nodes. + * $params['timeout'] = (string) The maximum duration, in seconds, to be spent to retrieve certificates from all nodes. + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function getAllCertificates(array $params = []) + { + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\GetAllCertificates'); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } /** * Retrieves the current list of allowed API accessible to normal user. * @@ -607,8 +629,8 @@ public function getDashboardsInfo(array $params = []) /** * Retrieves distinguished names. Only accessible to super-admins and with rest-api permissions when enabled. * - * $params['cluster_name'] = (string) (Required) - * $params['show_all'] = (boolean) + * $params['cluster_name'] = (string) The cluster-name to retrieve nodes DN setting for. (Required) + * $params['show_all'] = (boolean) A boolean flag to include/exclude static nodes DN from final result. * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. @@ -629,6 +651,32 @@ public function getDistinguishedName(array $params = []) return $this->performRequest($endpoint); } + /** + * Retrieves the given node's security certificates. + * + * $params['node_id'] = (string) The full-id of the node to retrieve certificates. + * $params['cert_type'] = (string) The type of certificates (HTTP, TRANSPORT, ALL) to retrieve for a node. + * $params['timeout'] = (string) The maximum duration, in seconds, to be spent to retrieve a node's certificates. + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function getNodeCertificates(array $params = []) + { + $node_id = $this->extractArgument($params, 'node_id'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\GetNodeCertificates'); + $endpoint->setParams($params); + $endpoint->setNodeId($node_id); + + return $this->performRequest($endpoint); + } /** * Gets the evaluated REST API permissions for the currently logged in user. * @@ -700,7 +748,7 @@ public function getRoleMapping(array $params = []) /** * Retrieves the SSL configuration information. * - * $params['show_dn'] = (string) The domain names from all certificates. + * $params['show_dn'] = (Array) A boolean flag to indicate whether all domain names should be returned. * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. @@ -741,7 +789,7 @@ public function getTenancyConfig(array $params = []) /** * Retrieves one tenant. * - * $params['tenant'] = (string) (Required) + * $params['tenant'] = (string) The name of the tenant to retrieve. (Required) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. @@ -765,7 +813,7 @@ public function getTenant(array $params = []) /** * Retrieve one internal user. * - * $params['username'] = (string) (Required) + * $params['username'] = (string) The name of the user to retrieve. (Required) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. @@ -789,7 +837,7 @@ public function getUser(array $params = []) /** * Retrieve one user. Legacy API. * - * $params['username'] = (string) (Required) + * $params['username'] = (string) The name of the user to retrieve. (Required) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. @@ -833,7 +881,7 @@ public function getUsersLegacy(array $params = []) /** * Checks to see if the Security plugin is up and running. * - * $params['mode'] = (string) + * $params['mode'] = (string) A flag to indicate whether service should consider security-plugin's status before returning health response. `strict` mode indicates service should check security plugin status. * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. @@ -874,7 +922,7 @@ public function migrate(array $params = []) /** * Updates individual attributes of an action group. * - * $params['action_group'] = (string) (Required) + * $params['action_group'] = (string) The name of the action group to update. (Required) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. @@ -969,7 +1017,7 @@ public function patchConfiguration(array $params = []) /** * Updates a distinguished cluster name for a specific cluster. Only accessible to super-admins and with rest-api permissions when enabled. * - * $params['cluster_name'] = (string) (Required) + * $params['cluster_name'] = (string) The cluster-name to update nodesDn value. (Required) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. @@ -1018,7 +1066,7 @@ public function patchDistinguishedNames(array $params = []) /** * Updates individual attributes of a role. * - * $params['role'] = (string) (Required) + * $params['role'] = (string) The name of the role to update. (Required) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. @@ -1044,7 +1092,7 @@ public function patchRole(array $params = []) /** * Updates individual attributes of a role mapping. * - * $params['role'] = (string) (Required) + * $params['role'] = (string) The name of the role to update role-mapping for. (Required) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. @@ -1070,7 +1118,7 @@ public function patchRoleMapping(array $params = []) /** * Add, delete, or modify a single tenant. * - * $params['tenant'] = (string) (Required) + * $params['tenant'] = (string) The name of the tenant to update. (Required) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. @@ -1096,7 +1144,7 @@ public function patchTenant(array $params = []) /** * Updates individual attributes of an internal user. * - * $params['username'] = (string) (Required) + * $params['username'] = (string) The name of the user to update. (Required) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. @@ -1133,12 +1181,9 @@ public function patchUser(array $params = []) */ public function postDashboardsInfo(array $params = []) { - $body = $this->extractArgument($params, 'body'); - $endpointBuilder = $this->endpoints; $endpoint = $endpointBuilder('Security\PostDashboardsInfo'); $endpoint->setParams($params); - $endpoint->setBody($body); return $this->performRequest($endpoint); } @@ -1251,7 +1296,7 @@ public function updateConfiguration(array $params = []) /** * Adds or updates the specified distinguished names in the cluster or node allow list. Only accessible to super-admins and with rest-api permissions when enabled. * - * $params['cluster_name'] = (string) (Required) + * $params['cluster_name'] = (string) The cluster-name to create/update nodesDn value for. (Required) * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. @@ -1277,7 +1322,7 @@ public function updateDistinguishedName(array $params = []) /** * Checks whether the v6 security configuration is valid and ready to be migrated to v7. * - * $params['accept_invalid'] = (boolean) + * $params['accept_invalid'] = (boolean) A boolean flag to indicate whether invalid v6 configuration should be allowed. * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. * $params['human'] = (boolean) Whether to return human readable values for statistics. * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors.