diff --git a/CHANGELOG.md b/CHANGELOG.md index f425e510..d0990725 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,6 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### Fixed - Fixed PHP 8.4 deprecations ### Updated APIs -- Updated opensearch-php APIs to reflect [opensearch-api-specification@07e329e](https://github.com/opensearch-project/opensearch-api-specification/commit/07e329e8d01fd0576de6a0a3c35412fd5a9163db) - Updated opensearch-php APIs to reflect [opensearch-api-specification@1db1840](https://github.com/opensearch-project/opensearch-api-specification/commit/1db184063a463c5180a2cc824b1efc1aeebfd5eb) - Updated opensearch-php APIs to reflect [opensearch-api-specification@cb320b5](https://github.com/opensearch-project/opensearch-api-specification/commit/cb320b5482551c4f28afa26ff0d1653332699722) ### Security diff --git a/src/OpenSearch/Client.php b/src/OpenSearch/Client.php index 549a8e9b..9c074636 100644 --- a/src/OpenSearch/Client.php +++ b/src/OpenSearch/Client.php @@ -55,7 +55,6 @@ use OpenSearch\Namespaces\SslNamespace; use OpenSearch\Namespaces\TasksNamespace; use OpenSearch\Namespaces\TransformsNamespace; -use OpenSearch\Namespaces\WlmNamespace; /** * Class Client @@ -76,7 +75,10 @@ class Client */ protected $params; - protected EndpointFactoryInterface $endpointFactory; + /** + * @var callable + */ + protected $endpoints; /** * @var NamespaceBuilderInterface[] @@ -228,53 +230,47 @@ class Client */ protected $transforms; - /** - * @var WlmNamespace - */ - protected $wlm; - /** * Client constructor * * @param Transport $transport - * @param EndpointFactoryInterface $endpointFactory + * @param callable $endpoint * @param NamespaceBuilderInterface[] $registeredNamespaces */ - public function __construct(Transport $transport, EndpointFactoryInterface $endpointFactory, array $registeredNamespaces) + public function __construct(Transport $transport, callable $endpoint, array $registeredNamespaces) { $this->transport = $transport; - $this->endpointFactory = $endpointFactory; - $this->asyncSearch = new AsyncSearchNamespace($transport, $this->endpointFactory); - $this->asynchronousSearch = new AsynchronousSearchNamespace($transport, $this->endpointFactory); - $this->cat = new CatNamespace($transport, $this->endpointFactory); - $this->cluster = new ClusterNamespace($transport, $this->endpointFactory); - $this->danglingIndices = new DanglingIndicesNamespace($transport, $this->endpointFactory); - $this->dataFrameTransformDeprecated = new DataFrameTransformDeprecatedNamespace($transport, $this->endpointFactory); - $this->flowFramework = new FlowFrameworkNamespace($transport, $this->endpointFactory); - $this->indices = new IndicesNamespace($transport, $this->endpointFactory); - $this->ingest = new IngestNamespace($transport, $this->endpointFactory); - $this->insights = new InsightsNamespace($transport, $this->endpointFactory); - $this->ism = new IsmNamespace($transport, $this->endpointFactory); - $this->knn = new KnnNamespace($transport, $this->endpointFactory); - $this->ml = new MlNamespace($transport, $this->endpointFactory); - $this->monitoring = new MonitoringNamespace($transport, $this->endpointFactory); - $this->nodes = new NodesNamespace($transport, $this->endpointFactory); - $this->notifications = new NotificationsNamespace($transport, $this->endpointFactory); - $this->observability = new ObservabilityNamespace($transport, $this->endpointFactory); - $this->ppl = new PplNamespace($transport, $this->endpointFactory); - $this->query = new QueryNamespace($transport, $this->endpointFactory); - $this->remoteStore = new RemoteStoreNamespace($transport, $this->endpointFactory); - $this->rollups = new RollupsNamespace($transport, $this->endpointFactory); - $this->searchPipeline = new SearchPipelineNamespace($transport, $this->endpointFactory); - $this->searchableSnapshots = new SearchableSnapshotsNamespace($transport, $this->endpointFactory); - $this->security = new SecurityNamespace($transport, $this->endpointFactory); - $this->snapshot = new SnapshotNamespace($transport, $this->endpointFactory); - $this->sql = new SqlNamespace($transport, $this->endpointFactory); - $this->ssl = new SslNamespace($transport, $this->endpointFactory); - $this->tasks = new TasksNamespace($transport, $this->endpointFactory); - $this->transforms = new TransformsNamespace($transport, $this->endpointFactory); - $this->wlm = new WlmNamespace($transport, $this->endpointFactory); + $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); + $this->dataFrameTransformDeprecated = new DataFrameTransformDeprecatedNamespace($transport, $endpoint); + $this->flowFramework = new FlowFrameworkNamespace($transport, $endpoint); + $this->indices = new IndicesNamespace($transport, $endpoint); + $this->ingest = new IngestNamespace($transport, $endpoint); + $this->insights = new InsightsNamespace($transport, $endpoint); + $this->ism = new IsmNamespace($transport, $endpoint); + $this->knn = new KnnNamespace($transport, $endpoint); + $this->ml = new MlNamespace($transport, $endpoint); + $this->monitoring = new MonitoringNamespace($transport, $endpoint); + $this->nodes = new NodesNamespace($transport, $endpoint); + $this->notifications = new NotificationsNamespace($transport, $endpoint); + $this->observability = new ObservabilityNamespace($transport, $endpoint); + $this->ppl = new PplNamespace($transport, $endpoint); + $this->query = new QueryNamespace($transport, $endpoint); + $this->remoteStore = new RemoteStoreNamespace($transport, $endpoint); + $this->rollups = new RollupsNamespace($transport, $endpoint); + $this->searchPipeline = new SearchPipelineNamespace($transport, $endpoint); + $this->searchableSnapshots = new SearchableSnapshotsNamespace($transport, $endpoint); + $this->security = new SecurityNamespace($transport, $endpoint); + $this->snapshot = new SnapshotNamespace($transport, $endpoint); + $this->sql = new SqlNamespace($transport, $endpoint); + $this->ssl = new SslNamespace($transport, $endpoint); + $this->tasks = new TasksNamespace($transport, $endpoint); + $this->transforms = new TransformsNamespace($transport, $endpoint); $this->registeredNamespaces = $registeredNamespaces; } @@ -307,14 +303,14 @@ public function bulk(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Bulk::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Bulk'); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Allows to perform multiple index/update/delete operations using request response streaming. * @@ -345,14 +341,14 @@ public function bulkStream(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\BulkStream::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('BulkStream'); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Explicitly clears the search context for a scroll. * @@ -372,14 +368,14 @@ public function clearScroll(array $params = []) $scroll_id = $this->extractArgument($params, 'scroll_id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\ClearScroll::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('ClearScroll'); $endpoint->setParams($params); $endpoint->setScrollId($scroll_id); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Returns number of documents matching a query. * @@ -413,14 +409,14 @@ public function count(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Count::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Count'); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Creates point in time context. * @@ -443,13 +439,13 @@ public function createPit(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\CreatePit::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('CreatePit'); $endpoint->setParams($params); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Removes a document from the index. * @@ -477,14 +473,14 @@ public function delete(array $params = []) $id = $this->extractArgument($params, 'id'); $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Delete::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Delete'); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Deletes all active point in time searches. * @@ -499,12 +495,12 @@ public function delete(array $params = []) */ public function deleteAllPits(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\DeleteAllPits::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('DeleteAllPits'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Deletes documents matching the provided query. * @@ -557,14 +553,14 @@ public function deleteByQuery(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\DeleteByQuery::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('DeleteByQuery'); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Changes the number of requests per second for a particular Delete By Query operation. * @@ -583,13 +579,13 @@ public function deleteByQueryRethrottle(array $params = []) { $task_id = $this->extractArgument($params, 'task_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\DeleteByQueryRethrottle::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('DeleteByQueryRethrottle'); $endpoint->setParams($params); $endpoint->setTaskId($task_id); return $this->performRequest($endpoint); } - /** * Deletes one or more point in time searches based on the IDs passed. * @@ -607,13 +603,13 @@ public function deletePit(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\DeletePit::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('DeletePit'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Deletes a script. * @@ -634,13 +630,13 @@ public function deleteScript(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\DeleteScript::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('DeleteScript'); $endpoint->setParams($params); $endpoint->setId($id); return $this->performRequest($endpoint); } - /** * Returns information about whether a document exists in an index. * @@ -673,14 +669,14 @@ public function exists(array $params = []): bool // manually make this verbose so we can check status code $params['client']['verbose'] = true; - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Exists::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Exists'); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setIndex($index); return BooleanRequestWrapper::performRequest($endpoint, $this->transport); } - /** * Returns information about whether a document source exists in an index. * @@ -712,14 +708,14 @@ public function existsSource(array $params = []): bool // manually make this verbose so we can check status code $params['client']['verbose'] = true; - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\ExistsSource::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('ExistsSource'); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setIndex($index); return BooleanRequestWrapper::performRequest($endpoint, $this->transport); } - /** * Returns information about why a specific matches (or doesn't match) a query. * @@ -753,7 +749,8 @@ public function explain(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Explain::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Explain'); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setIndex($index); @@ -761,7 +758,6 @@ public function explain(array $params = []) return $this->performRequest($endpoint); } - /** * Returns the information about the capabilities of fields among multiple indices. * @@ -786,14 +782,14 @@ public function fieldCaps(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\FieldCaps::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('FieldCaps'); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Returns a document. * @@ -823,14 +819,14 @@ public function get(array $params = []) $id = $this->extractArgument($params, 'id'); $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Get::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Get'); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Lists all active point in time searches. * @@ -845,12 +841,12 @@ public function get(array $params = []) */ public function getAllPits(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\GetAllPits::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('GetAllPits'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Returns a script. * @@ -870,13 +866,13 @@ public function getScript(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\GetScript::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('GetScript'); $endpoint->setParams($params); $endpoint->setId($id); return $this->performRequest($endpoint); } - /** * Returns all script contexts. * @@ -891,12 +887,12 @@ public function getScript(array $params = []) */ public function getScriptContext(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\GetScriptContext::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('GetScriptContext'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Returns available script types, languages and contexts. * @@ -911,12 +907,12 @@ public function getScriptContext(array $params = []) */ public function getScriptLanguages(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\GetScriptLanguages::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('GetScriptLanguages'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Returns the source of a document. * @@ -945,14 +941,14 @@ public function getSource(array $params = []) $id = $this->extractArgument($params, 'id'); $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\GetSource::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('GetSource'); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Creates or updates a document in an index. * @@ -985,7 +981,8 @@ public function index(array $params = []) $id = $this->extractArgument($params, 'id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Index::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Index'); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setId($id); @@ -993,7 +990,6 @@ public function index(array $params = []) return $this->performRequest($endpoint); } - /** * Returns basic information about the cluster. * @@ -1008,12 +1004,12 @@ public function index(array $params = []) */ public function info(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Info::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Info'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Allows to get multiple documents in one request. * @@ -1041,14 +1037,14 @@ public function mget(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Mget::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Mget'); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Allows to execute several search operations in one request. * @@ -1075,14 +1071,14 @@ public function msearch(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Msearch::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Msearch'); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Allows to execute several search template operations in one request. * @@ -1107,14 +1103,14 @@ public function msearchTemplate(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\MsearchTemplate::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('MsearchTemplate'); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Returns multiple termvectors in one request. * @@ -1146,14 +1142,14 @@ public function mtermvectors(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\MTermVectors::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('MTermVectors'); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Returns whether the cluster is running. * @@ -1171,12 +1167,12 @@ public function ping(array $params = []): bool // manually make this verbose so we can check status code $params['client']['verbose'] = true; - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ping::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ping'); $endpoint->setParams($params); return BooleanRequestWrapper::performRequest($endpoint, $this->transport); } - /** * Creates or updates a script. * @@ -1201,7 +1197,8 @@ public function putScript(array $params = []) $context = $this->extractArgument($params, 'context'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\PutScript::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('PutScript'); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setContext($context); @@ -1209,7 +1206,6 @@ public function putScript(array $params = []) return $this->performRequest($endpoint); } - /** * Allows to evaluate the quality of ranked search results over a set of typical search queries. * @@ -1233,14 +1229,14 @@ public function rankEval(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\RankEval::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('RankEval'); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Allows to copy documents from one index to another, optionally filtering the sourcedocuments by a query, changing the destination index settings, or fetching thedocuments from a remote cluster. * @@ -1266,13 +1262,13 @@ public function reindex(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Reindex::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Reindex'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Changes the number of requests per second for a particular Reindex operation. * @@ -1291,13 +1287,13 @@ public function reindexRethrottle(array $params = []) { $task_id = $this->extractArgument($params, 'task_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\ReindexRethrottle::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('ReindexRethrottle'); $endpoint->setParams($params); $endpoint->setTaskId($task_id); return $this->performRequest($endpoint); } - /** * Allows to use the Mustache language to pre-render a search definition. * @@ -1317,14 +1313,14 @@ public function renderSearchTemplate(array $params = []) $id = $this->extractArgument($params, 'id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\RenderSearchTemplate::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('RenderSearchTemplate'); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Allows an arbitrary script to be executed and a result to be returned. * @@ -1342,13 +1338,13 @@ public function scriptsPainlessExecute(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\ScriptsPainlessExecute::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('ScriptsPainlessExecute'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Allows to retrieve a large numbers of results from a single search request. * @@ -1370,14 +1366,14 @@ public function scroll(array $params = []) $scroll_id = $this->extractArgument($params, 'scroll_id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Scroll::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Scroll'); $endpoint->setParams($params); $endpoint->setScrollId($scroll_id); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Returns results matching a query. * @@ -1443,14 +1439,14 @@ public function search(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Search::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Search'); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Returns information about the indices and shards that a search request would be executed against. * @@ -1474,13 +1470,13 @@ public function searchShards(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\SearchShards::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('SearchShards'); $endpoint->setParams($params); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Allows to use the Mustache language to pre-render a search definition. * @@ -1513,14 +1509,14 @@ public function searchTemplate(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\SearchTemplate::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('SearchTemplate'); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Returns information and statistics about terms in the fields of a particular document. * @@ -1553,7 +1549,8 @@ public function termvectors(array $params = []) $id = $this->extractArgument($params, 'id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\TermVectors::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('TermVectors'); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setId($id); @@ -1561,7 +1558,6 @@ public function termvectors(array $params = []) return $this->performRequest($endpoint); } - /** * Updates a document with a script or partial document. * @@ -1595,7 +1591,8 @@ public function update(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Update::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Update'); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setIndex($index); @@ -1603,7 +1600,6 @@ public function update(array $params = []) return $this->performRequest($endpoint); } - /** * Performs an update on every document in the index without changing the source,for example to pick up a mapping change. * @@ -1657,14 +1653,14 @@ public function updateByQuery(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\UpdateByQuery::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('UpdateByQuery'); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Changes the number of requests per second for a particular Update By Query operation. * @@ -1683,13 +1679,13 @@ public function updateByQueryRethrottle(array $params = []) { $task_id = $this->extractArgument($params, 'task_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\UpdateByQueryRethrottle::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('UpdateByQueryRethrottle'); $endpoint->setParams($params); $endpoint->setTaskId($task_id); return $this->performRequest($endpoint); } - /** * Proxy function to createPointInTime() to prevent BC break. * This API will be removed in a future version. Use 'createPit' API instead. @@ -1726,9 +1722,8 @@ public function create(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $id ? - $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Create::class) - : $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Index::class); + $endpointBuilder = $this->endpoints; + $endpoint = $id ? $endpointBuilder('Create') : $endpointBuilder('Index'); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setIndex($index); @@ -1947,13 +1942,6 @@ public function transforms(): TransformsNamespace { return $this->transforms; } - /** - * Returns the wlm namespace - */ - public function wlm(): WlmNamespace - { - return $this->wlm; - } /** * Catchall for registered namespaces diff --git a/src/OpenSearch/Endpoints/Wlm/CreateQueryGroup.php b/src/OpenSearch/Endpoints/Wlm/CreateQueryGroup.php deleted file mode 100644 index 9dd6bcbe..00000000 --- a/src/OpenSearch/Endpoints/Wlm/CreateQueryGroup.php +++ /dev/null @@ -1,55 +0,0 @@ -body = $body; - - return $this; - } -} diff --git a/src/OpenSearch/Endpoints/Wlm/DeleteQueryGroup.php b/src/OpenSearch/Endpoints/Wlm/DeleteQueryGroup.php deleted file mode 100644 index a5a6bdf9..00000000 --- a/src/OpenSearch/Endpoints/Wlm/DeleteQueryGroup.php +++ /dev/null @@ -1,62 +0,0 @@ -name ?? null; - if (isset($name)) { - return "/_wlm/query_group/$name"; - } - throw new RuntimeException('Missing parameter for the endpoint wlm.delete_query_group'); - } - - public function getParamWhitelist(): array - { - return [ - 'pretty', - 'human', - 'error_trace', - 'source', - 'filter_path' - ]; - } - - public function getMethod(): string - { - return 'DELETE'; - } - - public function setName($name): DeleteQueryGroup - { - if (isset($name) !== true) { - return $this; - } - $this->name = $name; - - return $this; - } -} diff --git a/src/OpenSearch/Endpoints/Wlm/GetQueryGroup.php b/src/OpenSearch/Endpoints/Wlm/GetQueryGroup.php deleted file mode 100644 index 506c83c5..00000000 --- a/src/OpenSearch/Endpoints/Wlm/GetQueryGroup.php +++ /dev/null @@ -1,61 +0,0 @@ -name ?? null; - if (isset($name)) { - return "/_wlm/query_group/$name"; - } - return "/_wlm/query_group"; - } - - public function getParamWhitelist(): array - { - return [ - 'pretty', - 'human', - 'error_trace', - 'source', - 'filter_path' - ]; - } - - public function getMethod(): string - { - return 'GET'; - } - - public function setName($name): GetQueryGroup - { - if (isset($name) !== true) { - return $this; - } - $this->name = $name; - - return $this; - } -} diff --git a/src/OpenSearch/Endpoints/Wlm/UpdateQueryGroup.php b/src/OpenSearch/Endpoints/Wlm/UpdateQueryGroup.php deleted file mode 100644 index beb335f1..00000000 --- a/src/OpenSearch/Endpoints/Wlm/UpdateQueryGroup.php +++ /dev/null @@ -1,72 +0,0 @@ -name ?? null; - if (isset($name)) { - return "/_wlm/query_group/$name"; - } - throw new RuntimeException('Missing parameter for the endpoint wlm.update_query_group'); - } - - public function getParamWhitelist(): array - { - return [ - 'pretty', - 'human', - 'error_trace', - 'source', - 'filter_path' - ]; - } - - public function getMethod(): string - { - return 'PUT'; - } - - public function setBody($body): UpdateQueryGroup - { - if (isset($body) !== true) { - return $this; - } - $this->body = $body; - - return $this; - } - - public function setName($name): UpdateQueryGroup - { - if (isset($name) !== true) { - return $this; - } - $this->name = $name; - - return $this; - } -} diff --git a/src/OpenSearch/Namespaces/AsynchronousSearchNamespace.php b/src/OpenSearch/Namespaces/AsynchronousSearchNamespace.php index f4e8fb48..a22525ea 100644 --- a/src/OpenSearch/Namespaces/AsynchronousSearchNamespace.php +++ b/src/OpenSearch/Namespaces/AsynchronousSearchNamespace.php @@ -41,13 +41,13 @@ public function delete(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\AsynchronousSearch\Delete::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('AsynchronousSearch\Delete'); $endpoint->setParams($params); $endpoint->setId($id); return $this->performRequest($endpoint); } - /** * Get partial responses from asynchronous search. * @@ -65,13 +65,13 @@ public function get(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\AsynchronousSearch\Get::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('AsynchronousSearch\Get'); $endpoint->setParams($params); $endpoint->setId($id); return $this->performRequest($endpoint); } - /** * Perform an asynchronous search. * @@ -92,13 +92,13 @@ public function search(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\AsynchronousSearch\Search::class); + $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. * @@ -113,10 +113,10 @@ public function search(array $params = []) */ public function stats(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\AsynchronousSearch\Stats::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('AsynchronousSearch\Stats'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - } diff --git a/src/OpenSearch/Namespaces/CatNamespace.php b/src/OpenSearch/Namespaces/CatNamespace.php index 7a1e08b6..26202b33 100644 --- a/src/OpenSearch/Namespaces/CatNamespace.php +++ b/src/OpenSearch/Namespaces/CatNamespace.php @@ -54,13 +54,13 @@ public function aliases(array $params = []) { $name = $this->extractArgument($params, 'name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Aliases::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cat\Aliases'); $endpoint->setParams($params); $endpoint->setName($name); return $this->performRequest($endpoint); } - /** * Lists all active point-in-time segments. * @@ -81,12 +81,12 @@ public function aliases(array $params = []) */ public function allPitSegments(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\AllPitSegments::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cat\AllPitSegments'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Provides a snapshot of how many shards are allocated to each data node and how much disk space they are using. * @@ -113,13 +113,13 @@ public function allocation(array $params = []) { $node_id = $this->extractArgument($params, 'node_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Allocation::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cat\Allocation'); $endpoint->setParams($params); $endpoint->setNodeId($node_id); return $this->performRequest($endpoint); } - /** * Returns information about the cluster-manager node. * @@ -142,12 +142,12 @@ public function allocation(array $params = []) */ public function clusterManager(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\ClusterManager::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cat\ClusterManager'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Provides quick access to the document count of the entire cluster, or individual indices. * @@ -170,13 +170,13 @@ public function count(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Count::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cat\Count'); $endpoint->setParams($params); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Shows how much heap memory is currently being used by fielddata on every data node in the cluster. * @@ -200,13 +200,13 @@ public function fielddata(array $params = []) { $fields = $this->extractArgument($params, 'fields'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Fielddata::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cat\Fielddata'); $endpoint->setParams($params); $endpoint->setFields($fields); return $this->performRequest($endpoint); } - /** * Returns a concise representation of the cluster health. * @@ -228,12 +228,12 @@ public function fielddata(array $params = []) */ public function health(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Health::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cat\Health'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Returns help for the Cat APIs. * @@ -248,12 +248,12 @@ public function health(array $params = []) */ public function help(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Help::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cat\Help'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Returns information about indices: number of primaries and replicas, document counts, disk size, ... * @@ -285,13 +285,13 @@ public function indices(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Indices::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cat\Indices'); $endpoint->setParams($params); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Returns information about the cluster-manager node. * @@ -314,12 +314,12 @@ public function indices(array $params = []) */ public function master(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Master::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cat\Master'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Returns information about custom node attributes. * @@ -342,12 +342,12 @@ public function master(array $params = []) */ public function nodeattrs(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\NodeAttrs::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cat\NodeAttrs'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Returns basic statistics about performance of cluster nodes. * @@ -373,12 +373,12 @@ public function nodeattrs(array $params = []) */ public function nodes(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Nodes::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cat\Nodes'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Returns a concise representation of the cluster pending tasks. * @@ -402,12 +402,12 @@ public function nodes(array $params = []) */ public function pendingTasks(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\PendingTasks::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cat\PendingTasks'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * List segments for one or several PITs. * @@ -430,13 +430,13 @@ public function pitSegments(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\PitSegments::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cat\PitSegments'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Returns information about installed plugins across nodes node. * @@ -459,12 +459,12 @@ public function pitSegments(array $params = []) */ public function plugins(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Plugins::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cat\Plugins'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Returns information about index shard recoveries, both on-going completed. * @@ -491,13 +491,13 @@ public function recovery(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Recovery::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cat\Recovery'); $endpoint->setParams($params); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Returns information about snapshot repositories registered in the cluster. * @@ -520,12 +520,12 @@ public function recovery(array $params = []) */ public function repositories(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Repositories::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cat\Repositories'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Returns information about both on-going and latest completed Segment Replication events. * @@ -559,13 +559,13 @@ public function segmentReplication(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\SegmentReplication::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cat\SegmentReplication'); $endpoint->setParams($params); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Provides low-level information about the segments in the shards of an index. * @@ -591,13 +591,13 @@ public function segments(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Segments::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cat\Segments'); $endpoint->setParams($params); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Provides a detailed view of shard allocation on nodes. * @@ -625,13 +625,13 @@ public function shards(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Shards::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cat\Shards'); $endpoint->setParams($params); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Returns all snapshots in a specific repository. * @@ -658,13 +658,13 @@ public function snapshots(array $params = []) { $repository = $this->extractArgument($params, 'repository'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Snapshots::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cat\Snapshots'); $endpoint->setParams($params); $endpoint->setRepository($repository); return $this->performRequest($endpoint); } - /** * Returns information about the tasks currently executing on one or more nodes in the cluster. * @@ -689,12 +689,12 @@ public function snapshots(array $params = []) */ public function tasks(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Tasks::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cat\Tasks'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Returns information about existing templates. * @@ -720,13 +720,13 @@ public function templates(array $params = []) { $name = $this->extractArgument($params, 'name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Templates::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cat\Templates'); $endpoint->setParams($params); $endpoint->setName($name); return $this->performRequest($endpoint); } - /** * Returns cluster-wide thread pool statistics per node.By default the active, queue and rejected statistics are returned for all thread pools. * @@ -753,11 +753,11 @@ public function threadPool(array $params = []) { $thread_pool_patterns = $this->extractArgument($params, 'thread_pool_patterns'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\ThreadPool::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cat\ThreadPool'); $endpoint->setParams($params); $endpoint->setThreadPoolPatterns($thread_pool_patterns); return $this->performRequest($endpoint); } - } diff --git a/src/OpenSearch/Namespaces/ClusterNamespace.php b/src/OpenSearch/Namespaces/ClusterNamespace.php index 31ee2b0f..52ed74ab 100644 --- a/src/OpenSearch/Namespaces/ClusterNamespace.php +++ b/src/OpenSearch/Namespaces/ClusterNamespace.php @@ -49,13 +49,13 @@ public function allocationExplain(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\AllocationExplain::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cluster\AllocationExplain'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Deletes a component template. * @@ -76,13 +76,13 @@ public function deleteComponentTemplate(array $params = []) { $name = $this->extractArgument($params, 'name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\DeleteComponentTemplate::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cluster\DeleteComponentTemplate'); $endpoint->setParams($params); $endpoint->setName($name); return $this->performRequest($endpoint); } - /** * Delete any existing decommission. * @@ -97,12 +97,12 @@ public function deleteComponentTemplate(array $params = []) */ public function deleteDecommissionAwareness(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\DeleteDecommissionAwareness::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cluster\DeleteDecommissionAwareness'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Clears cluster voting config exclusions. * @@ -118,12 +118,12 @@ public function deleteDecommissionAwareness(array $params = []) */ public function deleteVotingConfigExclusions(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\DeleteVotingConfigExclusions::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cluster\DeleteVotingConfigExclusions'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Delete weighted shard routing weights. * @@ -140,13 +140,13 @@ public function deleteWeightedRouting(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\DeleteWeightedRouting::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cluster\DeleteWeightedRouting'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Returns information about whether a particular component template exist. * @@ -170,13 +170,13 @@ public function existsComponentTemplate(array $params = []): bool // manually make this verbose so we can check status code $params['client']['verbose'] = true; - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\ExistsComponentTemplate::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cluster\ExistsComponentTemplate'); $endpoint->setParams($params); $endpoint->setName($name); return BooleanRequestWrapper::performRequest($endpoint, $this->transport); } - /** * Returns one or more component templates. * @@ -197,13 +197,13 @@ public function getComponentTemplate(array $params = []) { $name = $this->extractArgument($params, 'name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\GetComponentTemplate::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cluster\GetComponentTemplate'); $endpoint->setParams($params); $endpoint->setName($name); return $this->performRequest($endpoint); } - /** * Get details and status of decommissioned attribute. * @@ -221,13 +221,13 @@ public function getDecommissionAwareness(array $params = []) { $awareness_attribute_name = $this->extractArgument($params, 'awareness_attribute_name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\GetDecommissionAwareness::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cluster\GetDecommissionAwareness'); $endpoint->setParams($params); $endpoint->setAwarenessAttributeName($awareness_attribute_name); return $this->performRequest($endpoint); } - /** * Returns cluster settings. * @@ -247,12 +247,12 @@ public function getDecommissionAwareness(array $params = []) */ public function getSettings(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\GetSettings::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cluster\GetSettings'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Fetches weighted shard routing weights. * @@ -270,13 +270,13 @@ public function getWeightedRouting(array $params = []) { $attribute = $this->extractArgument($params, 'attribute'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\GetWeightedRouting::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cluster\GetWeightedRouting'); $endpoint->setParams($params); $endpoint->setAttribute($attribute); return $this->performRequest($endpoint); } - /** * Returns basic information about the health of the cluster. * @@ -307,13 +307,13 @@ public function health(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\Health::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cluster\Health'); $endpoint->setParams($params); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Returns a list of any cluster-level changes (e.g. create index, update mapping,allocate or fail shard) which have not yet been executed. * @@ -331,12 +331,12 @@ public function health(array $params = []) */ public function pendingTasks(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\PendingTasks::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cluster\PendingTasks'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Updates the cluster voting config exclusions by node ids or node names. * @@ -354,12 +354,12 @@ public function pendingTasks(array $params = []) */ public function postVotingConfigExclusions(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\PostVotingConfigExclusions::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cluster\PostVotingConfigExclusions'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Creates or updates a component template. * @@ -383,14 +383,14 @@ public function putComponentTemplate(array $params = []) $name = $this->extractArgument($params, 'name'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\PutComponentTemplate::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cluster\PutComponentTemplate'); $endpoint->setParams($params); $endpoint->setName($name); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Decommissions an awareness attribute. * @@ -410,14 +410,14 @@ public function putDecommissionAwareness(array $params = []) $awareness_attribute_name = $this->extractArgument($params, 'awareness_attribute_name'); $awareness_attribute_value = $this->extractArgument($params, 'awareness_attribute_value'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\PutDecommissionAwareness::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cluster\PutDecommissionAwareness'); $endpoint->setParams($params); $endpoint->setAwarenessAttributeName($awareness_attribute_name); $endpoint->setAwarenessAttributeValue($awareness_attribute_value); return $this->performRequest($endpoint); } - /** * Updates the cluster settings. * @@ -439,13 +439,13 @@ public function putSettings(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\PutSettings::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cluster\PutSettings'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Updates weighted shard routing weights. * @@ -464,14 +464,14 @@ public function putWeightedRouting(array $params = []) $attribute = $this->extractArgument($params, 'attribute'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\PutWeightedRouting::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cluster\PutWeightedRouting'); $endpoint->setParams($params); $endpoint->setAttribute($attribute); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Returns the information about configured remote clusters. * @@ -486,12 +486,12 @@ public function putWeightedRouting(array $params = []) */ public function remoteInfo(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\RemoteInfo::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cluster\RemoteInfo'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Allows to manually change the allocation of individual shards in the cluster. * @@ -516,13 +516,13 @@ public function reroute(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\Reroute::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cluster\Reroute'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Returns a comprehensive information about the state of the cluster. * @@ -551,14 +551,14 @@ public function state(array $params = []) $metric = $this->extractArgument($params, 'metric'); $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\State::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cluster\State'); $endpoint->setParams($params); $endpoint->setMetric($metric); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Returns high-level overview of cluster statistics. * @@ -578,11 +578,11 @@ public function stats(array $params = []) { $node_id = $this->extractArgument($params, 'node_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\Stats::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Cluster\Stats'); $endpoint->setParams($params); $endpoint->setNodeId($node_id); return $this->performRequest($endpoint); } - } diff --git a/src/OpenSearch/Namespaces/DanglingIndicesNamespace.php b/src/OpenSearch/Namespaces/DanglingIndicesNamespace.php index 2bc4ed51..034de5b9 100644 --- a/src/OpenSearch/Namespaces/DanglingIndicesNamespace.php +++ b/src/OpenSearch/Namespaces/DanglingIndicesNamespace.php @@ -51,13 +51,13 @@ public function deleteDanglingIndex(array $params = []) { $index_uuid = $this->extractArgument($params, 'index_uuid'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\DanglingIndices\DeleteDanglingIndex::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('DanglingIndices\DeleteDanglingIndex'); $endpoint->setParams($params); $endpoint->setIndexUuid($index_uuid); return $this->performRequest($endpoint); } - /** * Imports the specified dangling index. * @@ -79,13 +79,13 @@ public function importDanglingIndex(array $params = []) { $index_uuid = $this->extractArgument($params, 'index_uuid'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\DanglingIndices\ImportDanglingIndex::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('DanglingIndices\ImportDanglingIndex'); $endpoint->setParams($params); $endpoint->setIndexUuid($index_uuid); return $this->performRequest($endpoint); } - /** * Returns all dangling indices. * @@ -100,10 +100,10 @@ public function importDanglingIndex(array $params = []) */ public function listDanglingIndices(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\DanglingIndices\ListDanglingIndices::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('DanglingIndices\ListDanglingIndices'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - } diff --git a/src/OpenSearch/Namespaces/FlowFrameworkNamespace.php b/src/OpenSearch/Namespaces/FlowFrameworkNamespace.php index 132e3bdc..184daf48 100644 --- a/src/OpenSearch/Namespaces/FlowFrameworkNamespace.php +++ b/src/OpenSearch/Namespaces/FlowFrameworkNamespace.php @@ -45,13 +45,13 @@ public function create(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\FlowFramework\Create::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('FlowFramework\Create'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Delete a workflow. * @@ -70,13 +70,13 @@ public function delete(array $params = []) { $workflow_id = $this->extractArgument($params, 'workflow_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\FlowFramework\Delete::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('FlowFramework\Delete'); $endpoint->setParams($params); $endpoint->setWorkflowId($workflow_id); return $this->performRequest($endpoint); } - /** * Deprovision workflow's resources when you no longer need it. * @@ -95,13 +95,13 @@ public function deprovision(array $params = []) { $workflow_id = $this->extractArgument($params, 'workflow_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\FlowFramework\Deprovision::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('FlowFramework\Deprovision'); $endpoint->setParams($params); $endpoint->setWorkflowId($workflow_id); return $this->performRequest($endpoint); } - /** * Get a workflow. * @@ -119,13 +119,13 @@ public function get(array $params = []) { $workflow_id = $this->extractArgument($params, 'workflow_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\FlowFramework\Get::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('FlowFramework\Get'); $endpoint->setParams($params); $endpoint->setWorkflowId($workflow_id); return $this->performRequest($endpoint); } - /** * Get the provisioning deployment status until it is complete. * @@ -144,13 +144,13 @@ public function getStatus(array $params = []) { $workflow_id = $this->extractArgument($params, 'workflow_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\FlowFramework\GetStatus::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('FlowFramework\GetStatus'); $endpoint->setParams($params); $endpoint->setWorkflowId($workflow_id); return $this->performRequest($endpoint); } - /** * Get a list of workflow steps. * @@ -166,12 +166,12 @@ public function getStatus(array $params = []) */ public function getSteps(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\FlowFramework\GetSteps::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('FlowFramework\GetSteps'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Provisioning a workflow. This API is also executed when the Create or Update Workflow API is called with the provision parameter set to true. * @@ -190,14 +190,14 @@ public function provision(array $params = []) $workflow_id = $this->extractArgument($params, 'workflow_id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\FlowFramework\Provision::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('FlowFramework\Provision'); $endpoint->setParams($params); $endpoint->setWorkflowId($workflow_id); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Search for workflows by using a query matching a field. * @@ -214,13 +214,13 @@ public function search(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\FlowFramework\Search::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('FlowFramework\Search'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Search for workflows by using a query matching a field. * @@ -237,13 +237,13 @@ public function searchState(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\FlowFramework\SearchState::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('FlowFramework\SearchState'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Update a workflow. You can only update a complete workflow if it has not yet been provisioned. * @@ -267,12 +267,12 @@ public function update(array $params = []) $workflow_id = $this->extractArgument($params, 'workflow_id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\FlowFramework\Update::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('FlowFramework\Update'); $endpoint->setParams($params); $endpoint->setWorkflowId($workflow_id); $endpoint->setBody($body); return $this->performRequest($endpoint); } - } diff --git a/src/OpenSearch/Namespaces/IndicesNamespace.php b/src/OpenSearch/Namespaces/IndicesNamespace.php index 0704105d..09d9b2e4 100644 --- a/src/OpenSearch/Namespaces/IndicesNamespace.php +++ b/src/OpenSearch/Namespaces/IndicesNamespace.php @@ -55,14 +55,14 @@ public function addBlock(array $params = []) $block = $this->extractArgument($params, 'block'); $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\AddBlock::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\AddBlock'); $endpoint->setParams($params); $endpoint->setBlock($block); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Performs the analysis process on a text and return the tokens breakdown of the text. * @@ -82,14 +82,14 @@ public function analyze(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\Analyze::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\Analyze'); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Clears all or specific caches for one or more indices. * @@ -115,13 +115,13 @@ public function clearCache(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\ClearCache::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\ClearCache'); $endpoint->setParams($params); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Clones an index. * @@ -149,7 +149,8 @@ public function clone(array $params = []) $target = $this->extractArgument($params, 'target'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\CloneIndices::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\CloneIndices'); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setTarget($target); @@ -157,7 +158,6 @@ public function clone(array $params = []) return $this->performRequest($endpoint); } - /** * Closes an index. * @@ -182,13 +182,13 @@ public function close(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\Close::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\Close'); $endpoint->setParams($params); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Creates an index with optional settings and mappings. * @@ -212,14 +212,14 @@ public function create(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\Create::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\Create'); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Creates or updates a data stream. * @@ -239,14 +239,14 @@ public function createDataStream(array $params = []) $name = $this->extractArgument($params, 'name'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\CreateDataStream::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\CreateDataStream'); $endpoint->setParams($params); $endpoint->setName($name); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Provides statistics on operations happening in a data stream. * @@ -264,13 +264,13 @@ public function dataStreamsStats(array $params = []) { $name = $this->extractArgument($params, 'name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\DataStreamsStats::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\DataStreamsStats'); $endpoint->setParams($params); $endpoint->setName($name); return $this->performRequest($endpoint); } - /** * Deletes an index. * @@ -294,13 +294,13 @@ public function delete(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\Delete::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\Delete'); $endpoint->setParams($params); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Deletes an alias. * @@ -323,14 +323,14 @@ public function deleteAlias(array $params = []) $index = $this->extractArgument($params, 'index'); $name = $this->extractArgument($params, 'name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\DeleteAlias::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\DeleteAlias'); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setName($name); return $this->performRequest($endpoint); } - /** * Deletes a data stream. * @@ -348,13 +348,13 @@ public function deleteDataStream(array $params = []) { $name = $this->extractArgument($params, 'name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\DeleteDataStream::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\DeleteDataStream'); $endpoint->setParams($params); $endpoint->setName($name); return $this->performRequest($endpoint); } - /** * Deletes an index template. * @@ -375,13 +375,13 @@ public function deleteIndexTemplate(array $params = []) { $name = $this->extractArgument($params, 'name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\DeleteIndexTemplate::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\DeleteIndexTemplate'); $endpoint->setParams($params); $endpoint->setName($name); return $this->performRequest($endpoint); } - /** * Deletes an index template. * @@ -402,13 +402,13 @@ public function deleteTemplate(array $params = []) { $name = $this->extractArgument($params, 'name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\DeleteTemplate::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\DeleteTemplate'); $endpoint->setParams($params); $endpoint->setName($name); return $this->performRequest($endpoint); } - /** * Returns information about whether a particular index exists. * @@ -436,13 +436,13 @@ public function exists(array $params = []): bool // manually make this verbose so we can check status code $params['client']['verbose'] = true; - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\Exists::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\Exists'); $endpoint->setParams($params); $endpoint->setIndex($index); return BooleanRequestWrapper::performRequest($endpoint, $this->transport); } - /** * Returns information about whether a particular alias exists. * @@ -469,14 +469,14 @@ public function existsAlias(array $params = []): bool // manually make this verbose so we can check status code $params['client']['verbose'] = true; - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\ExistsAlias::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\ExistsAlias'); $endpoint->setParams($params); $endpoint->setName($name); $endpoint->setIndex($index); return BooleanRequestWrapper::performRequest($endpoint, $this->transport); } - /** * Returns information about whether a particular index template exists. * @@ -501,13 +501,13 @@ public function existsIndexTemplate(array $params = []): bool // manually make this verbose so we can check status code $params['client']['verbose'] = true; - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\ExistsIndexTemplate::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\ExistsIndexTemplate'); $endpoint->setParams($params); $endpoint->setName($name); return BooleanRequestWrapper::performRequest($endpoint, $this->transport); } - /** * Returns information about whether a particular index template exists. * @@ -532,13 +532,13 @@ public function existsTemplate(array $params = []): bool // manually make this verbose so we can check status code $params['client']['verbose'] = true; - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\ExistsTemplate::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\ExistsTemplate'); $endpoint->setParams($params); $endpoint->setName($name); return BooleanRequestWrapper::performRequest($endpoint, $this->transport); } - /** * Performs the flush operation on one or more indices. * @@ -561,13 +561,13 @@ public function flush(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\Flush::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\Flush'); $endpoint->setParams($params); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Performs the force merge operation on one or more indices. * @@ -593,13 +593,13 @@ public function forcemerge(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\ForceMerge::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\ForceMerge'); $endpoint->setParams($params); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Returns information about one or more indices. * @@ -625,13 +625,13 @@ public function get(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\Get::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\Get'); $endpoint->setParams($params); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Returns an alias. * @@ -655,14 +655,14 @@ public function getAlias(array $params = []) $name = $this->extractArgument($params, 'name'); $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\GetAlias::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\GetAlias'); $endpoint->setParams($params); $endpoint->setName($name); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Returns data streams. * @@ -680,13 +680,13 @@ public function getDataStream(array $params = []) { $name = $this->extractArgument($params, 'name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\GetDataStream::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\GetDataStream'); $endpoint->setParams($params); $endpoint->setName($name); return $this->performRequest($endpoint); } - /** * Returns mapping for one or more fields. * @@ -711,14 +711,14 @@ public function getFieldMapping(array $params = []) $fields = $this->extractArgument($params, 'fields'); $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\GetFieldMapping::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\GetFieldMapping'); $endpoint->setParams($params); $endpoint->setFields($fields); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Returns an index template. * @@ -740,13 +740,13 @@ public function getIndexTemplate(array $params = []) { $name = $this->extractArgument($params, 'name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\GetIndexTemplate::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\GetIndexTemplate'); $endpoint->setParams($params); $endpoint->setName($name); return $this->performRequest($endpoint); } - /** * Returns mappings for one or more indices. * @@ -770,13 +770,13 @@ public function getMapping(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\GetMapping::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\GetMapping'); $endpoint->setParams($params); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Returns settings for one or more indices. * @@ -804,14 +804,14 @@ public function getSettings(array $params = []) $name = $this->extractArgument($params, 'name'); $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\GetSettings::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\GetSettings'); $endpoint->setParams($params); $endpoint->setName($name); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Returns an index template. * @@ -833,13 +833,13 @@ public function getTemplate(array $params = []) { $name = $this->extractArgument($params, 'name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\GetTemplate::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\GetTemplate'); $endpoint->setParams($params); $endpoint->setName($name); return $this->performRequest($endpoint); } - /** * The _upgrade API is no longer useful and will be removed. * @@ -860,13 +860,13 @@ public function getUpgrade(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\GetUpgrade::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\GetUpgrade'); $endpoint->setParams($params); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Opens an index. * @@ -893,13 +893,13 @@ public function open(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\Open::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\Open'); $endpoint->setParams($params); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Creates or updates an alias. * @@ -924,7 +924,8 @@ public function putAlias(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\PutAlias::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\PutAlias'); $endpoint->setParams($params); $endpoint->setName($name); $endpoint->setIndex($index); @@ -932,7 +933,6 @@ public function putAlias(array $params = []) return $this->performRequest($endpoint); } - /** * Creates or updates an index template. * @@ -956,14 +956,14 @@ public function putIndexTemplate(array $params = []) $name = $this->extractArgument($params, 'name'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\PutIndexTemplate::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\PutIndexTemplate'); $endpoint->setParams($params); $endpoint->setName($name); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Updates the index mappings. * @@ -990,14 +990,14 @@ public function putMapping(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\PutMapping::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\PutMapping'); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Updates the index settings. * @@ -1024,14 +1024,14 @@ public function putSettings(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\PutSettings::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\PutSettings'); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Creates or updates an index template. * @@ -1055,14 +1055,14 @@ public function putTemplate(array $params = []) $name = $this->extractArgument($params, 'name'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\PutTemplate::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\PutTemplate'); $endpoint->setParams($params); $endpoint->setName($name); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Returns information about ongoing index shard recoveries. * @@ -1082,13 +1082,13 @@ public function recovery(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\Recovery::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\Recovery'); $endpoint->setParams($params); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Performs the refresh operation in one or more indices. * @@ -1109,13 +1109,13 @@ public function refresh(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\Refresh::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\Refresh'); $endpoint->setParams($params); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Returns information about any matching indices, aliases, and data streams. * @@ -1134,13 +1134,13 @@ public function resolveIndex(array $params = []) { $name = $this->extractArgument($params, 'name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\ResolveIndex::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\ResolveIndex'); $endpoint->setParams($params); $endpoint->setName($name); return $this->performRequest($endpoint); } - /** * Updates an alias to point to a new index when the existing indexis considered to be too large or too old. * @@ -1167,7 +1167,8 @@ public function rollover(array $params = []) $new_index = $this->extractArgument($params, 'new_index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\Rollover::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\Rollover'); $endpoint->setParams($params); $endpoint->setAlias($alias); $endpoint->setNewIndex($new_index); @@ -1175,7 +1176,6 @@ public function rollover(array $params = []) return $this->performRequest($endpoint); } - /** * Provides low-level information about segments in a Lucene index. * @@ -1197,13 +1197,13 @@ public function segments(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\Segments::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\Segments'); $endpoint->setParams($params); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Provides store information for shard copies of indices. * @@ -1225,13 +1225,13 @@ public function shardStores(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\ShardStores::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\ShardStores'); $endpoint->setParams($params); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Allow to shrink an existing index into a new index with fewer primary shards. * @@ -1260,7 +1260,8 @@ public function shrink(array $params = []) $target = $this->extractArgument($params, 'target'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\Shrink::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\Shrink'); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setTarget($target); @@ -1268,7 +1269,6 @@ public function shrink(array $params = []) return $this->performRequest($endpoint); } - /** * Simulate matching the given index name against the index templates in the system. * @@ -1292,14 +1292,14 @@ public function simulateIndexTemplate(array $params = []) $name = $this->extractArgument($params, 'name'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\SimulateIndexTemplate::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\SimulateIndexTemplate'); $endpoint->setParams($params); $endpoint->setName($name); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Simulate resolving the given template name or body. * @@ -1322,14 +1322,14 @@ public function simulateTemplate(array $params = []) $name = $this->extractArgument($params, 'name'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\SimulateTemplate::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\SimulateTemplate'); $endpoint->setParams($params); $endpoint->setName($name); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Allows you to split an existing index into a new index with more primary shards. * @@ -1358,7 +1358,8 @@ public function split(array $params = []) $target = $this->extractArgument($params, 'target'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\Split::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\Split'); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setTarget($target); @@ -1366,7 +1367,6 @@ public function split(array $params = []) return $this->performRequest($endpoint); } - /** * Provides statistics on operations happening in an index. * @@ -1395,14 +1395,14 @@ public function stats(array $params = []) $metric = $this->extractArgument($params, 'metric'); $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\Stats::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\Stats'); $endpoint->setParams($params); $endpoint->setMetric($metric); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Updates index aliases. * @@ -1423,13 +1423,13 @@ public function updateAliases(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\UpdateAliases::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\UpdateAliases'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * The _upgrade API is no longer useful and will be removed. * @@ -1452,13 +1452,13 @@ public function upgrade(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\Upgrade::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\Upgrade'); $endpoint->setParams($params); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Allows a user to validate a potentially expensive query without executing it. * @@ -1490,14 +1490,14 @@ public function validateQuery(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\ValidateQuery::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\ValidateQuery'); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Alias function to getAlias() * @@ -1518,7 +1518,8 @@ public function refreshSearchAnalyzers(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\RefreshSearchAnalyzers::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Indices\RefreshSearchAnalyzers'); $endpoint->setParams($params); $endpoint->setIndex($index); diff --git a/src/OpenSearch/Namespaces/IngestNamespace.php b/src/OpenSearch/Namespaces/IngestNamespace.php index 9a31dee5..a0c35fd3 100644 --- a/src/OpenSearch/Namespaces/IngestNamespace.php +++ b/src/OpenSearch/Namespaces/IngestNamespace.php @@ -50,13 +50,13 @@ public function deletePipeline(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ingest\DeletePipeline::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ingest\DeletePipeline'); $endpoint->setParams($params); $endpoint->setId($id); return $this->performRequest($endpoint); } - /** * Returns a pipeline. * @@ -76,13 +76,13 @@ public function getPipeline(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ingest\GetPipeline::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ingest\GetPipeline'); $endpoint->setParams($params); $endpoint->setId($id); return $this->performRequest($endpoint); } - /** * Returns a list of the built-in patterns. * @@ -97,12 +97,12 @@ public function getPipeline(array $params = []) */ public function processorGrok(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ingest\ProcessorGrok::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ingest\ProcessorGrok'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Creates or updates a pipeline. * @@ -125,14 +125,14 @@ public function putPipeline(array $params = []) $id = $this->extractArgument($params, 'id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ingest\PutPipeline::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ingest\PutPipeline'); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Allows to simulate a pipeline with example documents. * @@ -153,12 +153,12 @@ public function simulate(array $params = []) $id = $this->extractArgument($params, 'id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ingest\Simulate::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ingest\Simulate'); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setBody($body); return $this->performRequest($endpoint); } - } diff --git a/src/OpenSearch/Namespaces/InsightsNamespace.php b/src/OpenSearch/Namespaces/InsightsNamespace.php index 9c3cc5ca..ecbfa4a6 100644 --- a/src/OpenSearch/Namespaces/InsightsNamespace.php +++ b/src/OpenSearch/Namespaces/InsightsNamespace.php @@ -38,10 +38,10 @@ class InsightsNamespace extends AbstractNamespace */ public function topQueries(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Insights\TopQueries::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Insights\TopQueries'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - } diff --git a/src/OpenSearch/Namespaces/IsmNamespace.php b/src/OpenSearch/Namespaces/IsmNamespace.php index 4a62b061..ff91cbb0 100644 --- a/src/OpenSearch/Namespaces/IsmNamespace.php +++ b/src/OpenSearch/Namespaces/IsmNamespace.php @@ -42,14 +42,14 @@ public function addPolicy(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ism\AddPolicy::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ism\AddPolicy'); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Updates the managed index policy to a new policy. * @@ -68,14 +68,14 @@ public function changePolicy(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ism\ChangePolicy::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ism\ChangePolicy'); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Deletes a policy. * @@ -93,13 +93,13 @@ public function deletePolicy(array $params = []) { $policy_id = $this->extractArgument($params, 'policy_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ism\DeletePolicy::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ism\DeletePolicy'); $endpoint->setParams($params); $endpoint->setPolicyId($policy_id); return $this->performRequest($endpoint); } - /** * Checks whether the policy exists. * @@ -120,13 +120,13 @@ public function existsPolicy(array $params = []): bool // manually make this verbose so we can check status code $params['client']['verbose'] = true; - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ism\ExistsPolicy::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ism\ExistsPolicy'); $endpoint->setParams($params); $endpoint->setPolicyId($policy_id); return BooleanRequestWrapper::performRequest($endpoint, $this->transport); } - /** * Gets the currently applied policy on indices. * @@ -145,14 +145,14 @@ public function explainPolicy(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ism\ExplainPolicy::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ism\ExplainPolicy'); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Gets the policies. * @@ -167,12 +167,12 @@ public function explainPolicy(array $params = []) */ public function getPolicies(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ism\GetPolicies::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ism\GetPolicies'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Gets a policy. * @@ -190,13 +190,13 @@ public function getPolicy(array $params = []) { $policy_id = $this->extractArgument($params, 'policy_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ism\GetPolicy::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ism\GetPolicy'); $endpoint->setParams($params); $endpoint->setPolicyId($policy_id); return $this->performRequest($endpoint); } - /** * Gets the policies. * @@ -216,13 +216,13 @@ public function putPolicies(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ism\PutPolicies::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ism\PutPolicies'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Creates or updates a policy. * @@ -243,14 +243,14 @@ public function putPolicy(array $params = []) $policy_id = $this->extractArgument($params, 'policy_id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ism\PutPolicy::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ism\PutPolicy'); $endpoint->setParams($params); $endpoint->setPolicyId($policy_id); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Refresh search analyzers in real time. * @@ -268,13 +268,13 @@ public function refreshSearchAnalyzers(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ism\RefreshSearchAnalyzers::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ism\RefreshSearchAnalyzers'); $endpoint->setParams($params); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Removes a policy from an index. * @@ -292,13 +292,13 @@ public function removePolicy(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ism\RemovePolicy::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ism\RemovePolicy'); $endpoint->setParams($params); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - /** * Retry the failed action for an index. * @@ -317,12 +317,12 @@ public function retryIndex(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ism\RetryIndex::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ism\RetryIndex'); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); return $this->performRequest($endpoint); } - } diff --git a/src/OpenSearch/Namespaces/KnnNamespace.php b/src/OpenSearch/Namespaces/KnnNamespace.php index 6b1c8994..5cfb4a82 100644 --- a/src/OpenSearch/Namespaces/KnnNamespace.php +++ b/src/OpenSearch/Namespaces/KnnNamespace.php @@ -41,13 +41,13 @@ public function deleteModel(array $params = []) { $model_id = $this->extractArgument($params, 'model_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Knn\DeleteModel::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Knn\DeleteModel'); $endpoint->setParams($params); $endpoint->setModelId($model_id); return $this->performRequest($endpoint); } - /** * Used to retrieve information about models present in the cluster. * @@ -65,13 +65,13 @@ public function getModel(array $params = []) { $model_id = $this->extractArgument($params, 'model_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Knn\GetModel::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Knn\GetModel'); $endpoint->setParams($params); $endpoint->setModelId($model_id); return $this->performRequest($endpoint); } - /** * Use an OpenSearch query to search for models in the index. * @@ -130,13 +130,13 @@ public function searchModels(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Knn\SearchModels::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Knn\SearchModels'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Provides information about the current status of the k-NN plugin. * @@ -157,14 +157,14 @@ public function stats(array $params = []) $node_id = $this->extractArgument($params, 'node_id'); $stat = $this->extractArgument($params, 'stat'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Knn\Stats::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Knn\Stats'); $endpoint->setParams($params); $endpoint->setNodeId($node_id); $endpoint->setStat($stat); return $this->performRequest($endpoint); } - /** * Create and train a model that can be used for initializing k-NN native library indexes during indexing. * @@ -184,14 +184,14 @@ public function trainModel(array $params = []) $model_id = $this->extractArgument($params, 'model_id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Knn\TrainModel::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Knn\TrainModel'); $endpoint->setParams($params); $endpoint->setModelId($model_id); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Preloads native library files into memory, reducing initial search latency for specified indexes. * @@ -209,11 +209,11 @@ public function warmup(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Knn\Warmup::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Knn\Warmup'); $endpoint->setParams($params); $endpoint->setIndex($index); return $this->performRequest($endpoint); } - } diff --git a/src/OpenSearch/Namespaces/MlNamespace.php b/src/OpenSearch/Namespaces/MlNamespace.php index a2e163fd..4938b67e 100644 --- a/src/OpenSearch/Namespaces/MlNamespace.php +++ b/src/OpenSearch/Namespaces/MlNamespace.php @@ -41,13 +41,13 @@ public function deleteAgent(array $params = []) { $agent_id = $this->extractArgument($params, 'agent_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\DeleteAgent::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ml\DeleteAgent'); $endpoint->setParams($params); $endpoint->setAgentId($agent_id); return $this->performRequest($endpoint); } - /** * Deletes a model. * @@ -65,13 +65,13 @@ public function deleteModel(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\DeleteModel::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ml\DeleteModel'); $endpoint->setParams($params); $endpoint->setId($id); return $this->performRequest($endpoint); } - /** * Deletes a model group. * @@ -89,13 +89,13 @@ public function deleteModelGroup(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\DeleteModelGroup::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ml\DeleteModelGroup'); $endpoint->setParams($params); $endpoint->setId($id); return $this->performRequest($endpoint); } - /** * Deletes a task. * @@ -113,13 +113,13 @@ public function deleteTask(array $params = []) { $task_id = $this->extractArgument($params, 'task_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\DeleteTask::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ml\DeleteTask'); $endpoint->setParams($params); $endpoint->setTaskId($task_id); return $this->performRequest($endpoint); } - /** * Retrieves a model group. * @@ -137,13 +137,13 @@ public function getModelGroup(array $params = []) { $model_group_id = $this->extractArgument($params, 'model_group_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\GetModelGroup::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ml\GetModelGroup'); $endpoint->setParams($params); $endpoint->setModelGroupId($model_group_id); return $this->performRequest($endpoint); } - /** * Retrieves a task. * @@ -161,13 +161,13 @@ public function getTask(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\GetTask::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ml\GetTask'); $endpoint->setParams($params); $endpoint->setId($id); return $this->performRequest($endpoint); } - /** * Register an agent. * @@ -184,13 +184,13 @@ public function registerAgents(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\RegisterAgents::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ml\RegisterAgents'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Registers a model. * @@ -207,13 +207,13 @@ public function registerModel(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\RegisterModel::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ml\RegisterModel'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Registers a model group. * @@ -230,13 +230,13 @@ public function registerModelGroup(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\RegisterModelGroup::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ml\RegisterModelGroup'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Searches for models. * @@ -253,13 +253,13 @@ public function searchModels(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\SearchModels::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ml\SearchModels'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * $params['body'] = (string) The body of the request (Required) * @@ -271,7 +271,8 @@ public function searchModels(array $params = []) public function createConnector(array $params = []): array { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\CreateConnector::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ml\CreateConnector'); $endpoint->setParams($params); $endpoint->setBody($body); @@ -288,7 +289,8 @@ public function createConnector(array $params = []): array public function deleteConnector(array $params = []): array { $connectorId = $this->extractArgument($params, 'connector_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\DeleteConnector::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ml\DeleteConnector'); $endpoint->setParams($params); $endpoint->setConnectorId($connectorId); @@ -307,7 +309,8 @@ public function deployModel(array $params = []): array { $modelId = $this->extractArgument($params, 'model_id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\DeployModel::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ml\DeployModel'); $endpoint->setParams($params); $endpoint->setModelId($modelId); if ($body) { @@ -327,7 +330,8 @@ public function deployModel(array $params = []): array public function getConnector(array $params = []): array { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\GetConnector::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ml\GetConnector'); $endpoint->setParams($params); $endpoint->setId($id); @@ -352,7 +356,8 @@ public function getConnectors(array $params = []): array ]; } $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\GetConnectors::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ml\GetConnectors'); $endpoint->setBody($body); return $this->performRequest($endpoint); @@ -376,7 +381,8 @@ public function getModelGroups(array $params = []): array ]; } $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\GetModelGroups::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ml\GetModelGroups'); $endpoint->setBody($body); return $this->performRequest($endpoint); @@ -392,7 +398,8 @@ public function getModelGroups(array $params = []): array public function getModel(array $params = []): array { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\GetModel::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ml\GetModel'); $endpoint->setParams($params); $endpoint->setId($id); @@ -428,7 +435,8 @@ public function predict(array $params = []): array { $id = $this->extractArgument($params, 'id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\Predict::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ml\Predict'); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setBody($body); @@ -448,7 +456,8 @@ public function undeployModel(array $params = []): array { $modelId = $this->extractArgument($params, 'model_id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\UndeployModel::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ml\UndeployModel'); $endpoint->setParams($params); $endpoint->setModelId($modelId); if ($body) { @@ -470,7 +479,8 @@ public function updateModelGroup(array $params = []): array { $id = $this->extractArgument($params, 'id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\UpdateModelGroup::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ml\UpdateModelGroup'); $endpoint->setParams($params); $endpoint->setBody($body); $endpoint->setId($id); diff --git a/src/OpenSearch/Namespaces/NodesNamespace.php b/src/OpenSearch/Namespaces/NodesNamespace.php index 18cbae78..e04f2408 100644 --- a/src/OpenSearch/Namespaces/NodesNamespace.php +++ b/src/OpenSearch/Namespaces/NodesNamespace.php @@ -53,13 +53,13 @@ public function hotThreads(array $params = []) { $node_id = $this->extractArgument($params, 'node_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Nodes\HotThreads::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Nodes\HotThreads'); $endpoint->setParams($params); $endpoint->setNodeId($node_id); return $this->performRequest($endpoint); } - /** * Returns information about nodes in the cluster. * @@ -83,7 +83,8 @@ public function info(array $params = []) $metric = $this->extractArgument($params, 'metric'); $node_id = $this->extractArgument($params, 'node_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Nodes\Info::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Nodes\Info'); $endpoint->setParams($params); $endpoint->setNodeIdOrMetric($node_id_or_metric); $endpoint->setMetric($metric); @@ -91,7 +92,6 @@ public function info(array $params = []) return $this->performRequest($endpoint); } - /** * Reloads secure settings. * @@ -112,14 +112,14 @@ public function reloadSecureSettings(array $params = []) $node_id = $this->extractArgument($params, 'node_id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Nodes\ReloadSecureSettings::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Nodes\ReloadSecureSettings'); $endpoint->setParams($params); $endpoint->setNodeId($node_id); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Returns statistical information about nodes in the cluster. * @@ -149,7 +149,8 @@ public function stats(array $params = []) $metric = $this->extractArgument($params, 'metric'); $index_metric = $this->extractArgument($params, 'index_metric'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Nodes\Stats::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Nodes\Stats'); $endpoint->setParams($params); $endpoint->setNodeId($node_id); $endpoint->setMetric($metric); @@ -157,7 +158,6 @@ public function stats(array $params = []) return $this->performRequest($endpoint); } - /** * Returns low-level information about REST actions usage on nodes. * @@ -178,12 +178,12 @@ public function usage(array $params = []) $node_id = $this->extractArgument($params, 'node_id'); $metric = $this->extractArgument($params, 'metric'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Nodes\Usage::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Nodes\Usage'); $endpoint->setParams($params); $endpoint->setNodeId($node_id); $endpoint->setMetric($metric); return $this->performRequest($endpoint); } - } diff --git a/src/OpenSearch/Namespaces/NotificationsNamespace.php b/src/OpenSearch/Namespaces/NotificationsNamespace.php index a69759cf..d0b9cd53 100644 --- a/src/OpenSearch/Namespaces/NotificationsNamespace.php +++ b/src/OpenSearch/Namespaces/NotificationsNamespace.php @@ -40,13 +40,13 @@ public function createConfig(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Notifications\CreateConfig::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Notifications\CreateConfig'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Delete a channel configuration. * @@ -64,13 +64,13 @@ public function deleteConfig(array $params = []) { $config_id = $this->extractArgument($params, 'config_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Notifications\DeleteConfig::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Notifications\DeleteConfig'); $endpoint->setParams($params); $endpoint->setConfigId($config_id); return $this->performRequest($endpoint); } - /** * Delete multiple channel configurations. * @@ -87,12 +87,12 @@ public function deleteConfig(array $params = []) */ public function deleteConfigs(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Notifications\DeleteConfigs::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Notifications\DeleteConfigs'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Get a specific channel configuration. * @@ -110,13 +110,13 @@ public function getConfig(array $params = []) { $config_id = $this->extractArgument($params, 'config_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Notifications\GetConfig::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Notifications\GetConfig'); $endpoint->setParams($params); $endpoint->setConfigId($config_id); return $this->performRequest($endpoint); } - /** * Get multiple channel configurations with filtering. * @@ -173,13 +173,13 @@ public function getConfigs(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Notifications\GetConfigs::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Notifications\GetConfigs'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * List created notification channels. * @@ -194,12 +194,12 @@ public function getConfigs(array $params = []) */ public function listChannels(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Notifications\ListChannels::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Notifications\ListChannels'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * List supported channel configurations. * @@ -214,12 +214,12 @@ public function listChannels(array $params = []) */ public function listFeatures(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Notifications\ListFeatures::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Notifications\ListFeatures'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Send a test notification. * @@ -237,13 +237,13 @@ public function sendTest(array $params = []) { $config_id = $this->extractArgument($params, 'config_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Notifications\SendTest::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Notifications\SendTest'); $endpoint->setParams($params); $endpoint->setConfigId($config_id); return $this->performRequest($endpoint); } - /** * Update channel configuration. * @@ -262,12 +262,12 @@ public function updateConfig(array $params = []) $config_id = $this->extractArgument($params, 'config_id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Notifications\UpdateConfig::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Notifications\UpdateConfig'); $endpoint->setParams($params); $endpoint->setConfigId($config_id); $endpoint->setBody($body); return $this->performRequest($endpoint); } - } diff --git a/src/OpenSearch/Namespaces/ObservabilityNamespace.php b/src/OpenSearch/Namespaces/ObservabilityNamespace.php index 480e4c9a..ac9b1299 100644 --- a/src/OpenSearch/Namespaces/ObservabilityNamespace.php +++ b/src/OpenSearch/Namespaces/ObservabilityNamespace.php @@ -40,13 +40,13 @@ public function createObject(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Observability\CreateObject::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Observability\CreateObject'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Deletes specific observability object specified by ID. * @@ -64,13 +64,13 @@ public function deleteObject(array $params = []) { $object_id = $this->extractArgument($params, 'object_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Observability\DeleteObject::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Observability\DeleteObject'); $endpoint->setParams($params); $endpoint->setObjectId($object_id); return $this->performRequest($endpoint); } - /** * Deletes specific observability objects specified by ID or a list of IDs. * @@ -87,12 +87,12 @@ public function deleteObject(array $params = []) */ public function deleteObjects(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Observability\DeleteObjects::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Observability\DeleteObjects'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Retrieves Local Stats of all observability objects. * @@ -107,12 +107,12 @@ public function deleteObjects(array $params = []) */ public function getLocalstats(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Observability\GetLocalstats::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Observability\GetLocalstats'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Retrieves specific observability object specified by ID. * @@ -130,13 +130,13 @@ public function getObject(array $params = []) { $object_id = $this->extractArgument($params, 'object_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Observability\GetObject::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Observability\GetObject'); $endpoint->setParams($params); $endpoint->setObjectId($object_id); return $this->performRequest($endpoint); } - /** * Retrieves list of all observability objects. * @@ -151,12 +151,12 @@ public function getObject(array $params = []) */ public function listObjects(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Observability\ListObjects::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Observability\ListObjects'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Updates an existing observability object. * @@ -175,12 +175,12 @@ public function updateObject(array $params = []) $object_id = $this->extractArgument($params, 'object_id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Observability\UpdateObject::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Observability\UpdateObject'); $endpoint->setParams($params); $endpoint->setObjectId($object_id); $endpoint->setBody($body); return $this->performRequest($endpoint); } - } diff --git a/src/OpenSearch/Namespaces/PplNamespace.php b/src/OpenSearch/Namespaces/PplNamespace.php index 8ed4ccdf..f015828e 100644 --- a/src/OpenSearch/Namespaces/PplNamespace.php +++ b/src/OpenSearch/Namespaces/PplNamespace.php @@ -42,13 +42,13 @@ public function explain(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ppl\Explain::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ppl\Explain'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Collect metrics for the plugin within the interval. * @@ -65,12 +65,12 @@ public function explain(array $params = []) */ public function getStats(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ppl\GetStats::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ppl\GetStats'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * By a stats endpoint, you are able to collect metrics for the plugin within the interval. * @@ -89,13 +89,13 @@ public function postStats(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ppl\PostStats::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ppl\PostStats'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Send a PPL query to the PPL plugin. * @@ -114,11 +114,11 @@ public function query(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ppl\Query::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Ppl\Query'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - } diff --git a/src/OpenSearch/Namespaces/QueryNamespace.php b/src/OpenSearch/Namespaces/QueryNamespace.php index dd92af18..ab5d0ad2 100644 --- a/src/OpenSearch/Namespaces/QueryNamespace.php +++ b/src/OpenSearch/Namespaces/QueryNamespace.php @@ -41,13 +41,13 @@ public function datasourceDelete(array $params = []) { $datasource_name = $this->extractArgument($params, 'datasource_name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Query\DatasourceDelete::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Query\DatasourceDelete'); $endpoint->setParams($params); $endpoint->setDatasourceName($datasource_name); return $this->performRequest($endpoint); } - /** * Retrieves specific datasource specified by name. * @@ -65,13 +65,13 @@ public function datasourceRetrieve(array $params = []) { $datasource_name = $this->extractArgument($params, 'datasource_name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Query\DatasourceRetrieve::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Query\DatasourceRetrieve'); $endpoint->setParams($params); $endpoint->setDatasourceName($datasource_name); return $this->performRequest($endpoint); } - /** * Creates a new query datasource. * @@ -88,13 +88,13 @@ public function datasourcesCreate(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Query\DatasourcesCreate::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Query\DatasourcesCreate'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Retrieves list of all datasources. * @@ -109,12 +109,12 @@ public function datasourcesCreate(array $params = []) */ public function datasourcesList(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Query\DatasourcesList::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Query\DatasourcesList'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Updates an existing query datasource. * @@ -131,11 +131,11 @@ public function datasourcesUpdate(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Query\DatasourcesUpdate::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Query\DatasourcesUpdate'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - } diff --git a/src/OpenSearch/Namespaces/RemoteStoreNamespace.php b/src/OpenSearch/Namespaces/RemoteStoreNamespace.php index bf3987a7..afe11dae 100644 --- a/src/OpenSearch/Namespaces/RemoteStoreNamespace.php +++ b/src/OpenSearch/Namespaces/RemoteStoreNamespace.php @@ -43,11 +43,11 @@ public function restore(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\RemoteStore\Restore::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('RemoteStore\Restore'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - } diff --git a/src/OpenSearch/Namespaces/RollupsNamespace.php b/src/OpenSearch/Namespaces/RollupsNamespace.php index 78589976..c777c01a 100644 --- a/src/OpenSearch/Namespaces/RollupsNamespace.php +++ b/src/OpenSearch/Namespaces/RollupsNamespace.php @@ -41,13 +41,13 @@ public function delete(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Rollups\Delete::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Rollups\Delete'); $endpoint->setParams($params); $endpoint->setId($id); return $this->performRequest($endpoint); } - /** * Get a rollup's current status. * @@ -65,13 +65,13 @@ public function explain(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Rollups\Explain::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Rollups\Explain'); $endpoint->setParams($params); $endpoint->setId($id); return $this->performRequest($endpoint); } - /** * Get an index rollup. * @@ -89,13 +89,13 @@ public function get(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Rollups\Get::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Rollups\Get'); $endpoint->setParams($params); $endpoint->setId($id); return $this->performRequest($endpoint); } - /** * Create or update index rollup. * @@ -116,14 +116,14 @@ public function put(array $params = []) $id = $this->extractArgument($params, 'id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Rollups\Put::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Rollups\Put'); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Start rollup. * @@ -141,13 +141,13 @@ public function start(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Rollups\Start::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Rollups\Start'); $endpoint->setParams($params); $endpoint->setId($id); return $this->performRequest($endpoint); } - /** * Stop rollup. * @@ -165,11 +165,11 @@ public function stop(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Rollups\Stop::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Rollups\Stop'); $endpoint->setParams($params); $endpoint->setId($id); return $this->performRequest($endpoint); } - } diff --git a/src/OpenSearch/Namespaces/SearchPipelineNamespace.php b/src/OpenSearch/Namespaces/SearchPipelineNamespace.php index 6886a2c4..5742a52c 100644 --- a/src/OpenSearch/Namespaces/SearchPipelineNamespace.php +++ b/src/OpenSearch/Namespaces/SearchPipelineNamespace.php @@ -43,13 +43,13 @@ public function delete(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\SearchPipeline\Delete::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('SearchPipeline\Delete'); $endpoint->setParams($params); $endpoint->setId($id); return $this->performRequest($endpoint); } - /** * Retrieves information about a specified search pipeline. * @@ -68,13 +68,13 @@ public function get(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\SearchPipeline\Get::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('SearchPipeline\Get'); $endpoint->setParams($params); $endpoint->setId($id); return $this->performRequest($endpoint); } - /** * Creates or replaces the specified search pipeline. * @@ -95,12 +95,12 @@ public function put(array $params = []) $id = $this->extractArgument($params, 'id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\SearchPipeline\Put::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('SearchPipeline\Put'); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setBody($body); return $this->performRequest($endpoint); } - } diff --git a/src/OpenSearch/Namespaces/SecurityNamespace.php b/src/OpenSearch/Namespaces/SecurityNamespace.php index 8ea06e1c..3eded771 100644 --- a/src/OpenSearch/Namespaces/SecurityNamespace.php +++ b/src/OpenSearch/Namespaces/SecurityNamespace.php @@ -40,12 +40,12 @@ class SecurityNamespace extends AbstractNamespace */ public function authinfo(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\Authinfo::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\Authinfo'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Returns the authorization token. * @@ -60,12 +60,12 @@ public function authinfo(array $params = []) */ public function authtoken(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\Authtoken::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\Authtoken'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Not supported for cache API. * @@ -80,12 +80,12 @@ public function authtoken(array $params = []) */ public function cache(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\Cache::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\Cache'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Check whether or not an upgrade can be performed and what resources can be updated. * @@ -100,12 +100,12 @@ public function cache(array $params = []) */ public function configUpgradeCheck(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\ConfigUpgradeCheck::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\ConfigUpgradeCheck'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Helps cluster operator upgrade missing defaults and stale default definitions. * @@ -122,13 +122,13 @@ public function configUpgradePerform(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\ConfigUpgradePerform::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\ConfigUpgradePerform'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Creates or replaces the allowlisted APIs. Accessible via Super Admin certificate or REST API permission. * @@ -145,13 +145,13 @@ public function createAllowlist(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\CreateAllowlist::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\CreateAllowlist'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Creates or replaces the multi-tenancy configuration. Only accessible to admins and users with REST API permissions. * @@ -168,13 +168,13 @@ public function createUpdateTenancyConfig(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\CreateUpdateTenancyConfig::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\CreateUpdateTenancyConfig'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Creates or replaces the specified user. Legacy API. * @@ -193,14 +193,14 @@ public function createUserLegacy(array $params = []) $username = $this->extractArgument($params, 'username'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\CreateUserLegacy::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\CreateUserLegacy'); $endpoint->setParams($params); $endpoint->setUsername($username); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Delete a specified action group. * @@ -218,13 +218,13 @@ public function deleteActionGroup(array $params = []) { $action_group = $this->extractArgument($params, 'action_group'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\DeleteActionGroup::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\DeleteActionGroup'); $endpoint->setParams($params); $endpoint->setActionGroup($action_group); return $this->performRequest($endpoint); } - /** * Deletes all distinguished names in the specified cluster or node allow list. Only accessible to super-admins and with rest-api permissions when enabled. * @@ -242,13 +242,13 @@ public function deleteDistinguishedName(array $params = []) { $cluster_name = $this->extractArgument($params, 'cluster_name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\DeleteDistinguishedName::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\DeleteDistinguishedName'); $endpoint->setParams($params); $endpoint->setClusterName($cluster_name); return $this->performRequest($endpoint); } - /** * Delete the specified role. * @@ -266,13 +266,13 @@ public function deleteRole(array $params = []) { $role = $this->extractArgument($params, 'role'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\DeleteRole::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\DeleteRole'); $endpoint->setParams($params); $endpoint->setRole($role); return $this->performRequest($endpoint); } - /** * Deletes the specified role mapping. * @@ -290,13 +290,13 @@ public function deleteRoleMapping(array $params = []) { $role = $this->extractArgument($params, 'role'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\DeleteRoleMapping::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\DeleteRoleMapping'); $endpoint->setParams($params); $endpoint->setRole($role); return $this->performRequest($endpoint); } - /** * Delete the specified tenant. * @@ -314,13 +314,13 @@ public function deleteTenant(array $params = []) { $tenant = $this->extractArgument($params, 'tenant'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\DeleteTenant::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\DeleteTenant'); $endpoint->setParams($params); $endpoint->setTenant($tenant); return $this->performRequest($endpoint); } - /** * Delete the specified user. * @@ -338,13 +338,13 @@ public function deleteUser(array $params = []) { $username = $this->extractArgument($params, 'username'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\DeleteUser::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\DeleteUser'); $endpoint->setParams($params); $endpoint->setUsername($username); return $this->performRequest($endpoint); } - /** * Delete the specified user. Legacy API. * @@ -362,13 +362,13 @@ public function deleteUserLegacy(array $params = []) { $username = $this->extractArgument($params, 'username'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\DeleteUserLegacy::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\DeleteUserLegacy'); $endpoint->setParams($params); $endpoint->setUsername($username); return $this->performRequest($endpoint); } - /** * Flushes the Security plugin user, authentication, and authorization cache. * @@ -383,12 +383,12 @@ public function deleteUserLegacy(array $params = []) */ public function flushCache(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\FlushCache::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\FlushCache'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Generates On-Behalf-Of token for the current user. * @@ -405,13 +405,13 @@ public function generateOboToken(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GenerateOboToken::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\GenerateOboToken'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Generates authorization token for the given user. * @@ -429,13 +429,13 @@ public function generateUserToken(array $params = []) { $username = $this->extractArgument($params, 'username'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GenerateUserToken::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\GenerateUserToken'); $endpoint->setParams($params); $endpoint->setUsername($username); return $this->performRequest($endpoint); } - /** * Generates authorization token for the given user. Legacy API. Not Implemented. * @@ -453,13 +453,13 @@ public function generateUserTokenLegacy(array $params = []) { $username = $this->extractArgument($params, 'username'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GenerateUserTokenLegacy::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\GenerateUserTokenLegacy'); $endpoint->setParams($params); $endpoint->setUsername($username); return $this->performRequest($endpoint); } - /** * Returns account details for the current user. * @@ -474,12 +474,12 @@ public function generateUserTokenLegacy(array $params = []) */ public function getAccountDetails(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetAccountDetails::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\GetAccountDetails'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Retrieves one action group. * @@ -497,13 +497,13 @@ public function getActionGroup(array $params = []) { $action_group = $this->extractArgument($params, 'action_group'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetActionGroup::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\GetActionGroup'); $endpoint->setParams($params); $endpoint->setActionGroup($action_group); return $this->performRequest($endpoint); } - /** * Retrieves the cluster security certificates. * @@ -520,12 +520,12 @@ public function getActionGroup(array $params = []) */ public function getAllCertificates(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetAllCertificates::class); + $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. * @@ -540,12 +540,12 @@ public function getAllCertificates(array $params = []) */ public function getAllowlist(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetAllowlist::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\GetAllowlist'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Retrieves the audit configuration. * @@ -560,12 +560,12 @@ public function getAllowlist(array $params = []) */ public function getAuditConfiguration(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetAuditConfiguration::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\GetAuditConfiguration'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Retrieves the cluster security certificates. * @@ -580,12 +580,12 @@ public function getAuditConfiguration(array $params = []) */ public function getCertificates(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetCertificates::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\GetCertificates'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Returns the current Security plugin configuration in JSON format. * @@ -600,12 +600,12 @@ public function getCertificates(array $params = []) */ public function getConfiguration(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetConfiguration::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\GetConfiguration'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Retrieves the current security-dashboards plugin configuration. * @@ -620,12 +620,12 @@ public function getConfiguration(array $params = []) */ public function getDashboardsInfo(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetDashboardsInfo::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\GetDashboardsInfo'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Retrieves distinguished names. Only accessible to super-admins and with rest-api permissions when enabled. * @@ -644,13 +644,13 @@ public function getDistinguishedName(array $params = []) { $cluster_name = $this->extractArgument($params, 'cluster_name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetDistinguishedName::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\GetDistinguishedName'); $endpoint->setParams($params); $endpoint->setClusterName($cluster_name); return $this->performRequest($endpoint); } - /** * Retrieves the given node's security certificates. * @@ -670,13 +670,13 @@ public function getNodeCertificates(array $params = []) { $node_id = $this->extractArgument($params, 'node_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetNodeCertificates::class); + $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. * @@ -691,12 +691,12 @@ public function getNodeCertificates(array $params = []) */ public function getPermissionsInfo(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetPermissionsInfo::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\GetPermissionsInfo'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Retrieves one role. * @@ -714,13 +714,13 @@ public function getRole(array $params = []) { $role = $this->extractArgument($params, 'role'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetRole::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\GetRole'); $endpoint->setParams($params); $endpoint->setRole($role); return $this->performRequest($endpoint); } - /** * Retrieves one role mapping. * @@ -738,13 +738,13 @@ public function getRoleMapping(array $params = []) { $role = $this->extractArgument($params, 'role'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetRoleMapping::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\GetRoleMapping'); $endpoint->setParams($params); $endpoint->setRole($role); return $this->performRequest($endpoint); } - /** * Retrieves the SSL configuration information. * @@ -760,12 +760,12 @@ public function getRoleMapping(array $params = []) */ public function getSslinfo(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetSslinfo::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\GetSslinfo'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Retrieves multi-tenancy configuration. Only accessible to admins and users with REST API permissions. * @@ -780,12 +780,12 @@ public function getSslinfo(array $params = []) */ public function getTenancyConfig(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetTenancyConfig::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\GetTenancyConfig'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Retrieves one tenant. * @@ -803,13 +803,13 @@ public function getTenant(array $params = []) { $tenant = $this->extractArgument($params, 'tenant'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetTenant::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\GetTenant'); $endpoint->setParams($params); $endpoint->setTenant($tenant); return $this->performRequest($endpoint); } - /** * Retrieve one internal user. * @@ -827,13 +827,13 @@ public function getUser(array $params = []) { $username = $this->extractArgument($params, 'username'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetUser::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\GetUser'); $endpoint->setParams($params); $endpoint->setUsername($username); return $this->performRequest($endpoint); } - /** * Retrieve one user. Legacy API. * @@ -851,13 +851,13 @@ public function getUserLegacy(array $params = []) { $username = $this->extractArgument($params, 'username'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetUserLegacy::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\GetUserLegacy'); $endpoint->setParams($params); $endpoint->setUsername($username); return $this->performRequest($endpoint); } - /** * Retrieve all internal users. Legacy API. * @@ -872,12 +872,12 @@ public function getUserLegacy(array $params = []) */ public function getUsersLegacy(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetUsersLegacy::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\GetUsersLegacy'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Checks to see if the Security plugin is up and running. * @@ -893,12 +893,12 @@ public function getUsersLegacy(array $params = []) */ public function health(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\Health::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\Health'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Migrates security configuration from v6 to v7. * @@ -913,12 +913,12 @@ public function health(array $params = []) */ public function migrate(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\Migrate::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\Migrate'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Updates individual attributes of an action group. * @@ -937,14 +937,14 @@ public function patchActionGroup(array $params = []) $action_group = $this->extractArgument($params, 'action_group'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchActionGroup::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\PatchActionGroup'); $endpoint->setParams($params); $endpoint->setActionGroup($action_group); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Updates the current list of allowed API accessible to normal user. * @@ -961,13 +961,13 @@ public function patchAllowlist(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchAllowlist::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\PatchAllowlist'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * A PATCH call is used to update specified fields in the audit configuration. * @@ -984,13 +984,13 @@ public function patchAuditConfiguration(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchAuditConfiguration::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\PatchAuditConfiguration'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * A PATCH call is used to update the existing configuration using the REST API. Only accessible by admins and users with rest api access and only when put or patch is enabled. * @@ -1007,13 +1007,13 @@ public function patchConfiguration(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchConfiguration::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\PatchConfiguration'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Updates a distinguished cluster name for a specific cluster. Only accessible to super-admins and with rest-api permissions when enabled. * @@ -1032,14 +1032,14 @@ public function patchDistinguishedName(array $params = []) $cluster_name = $this->extractArgument($params, 'cluster_name'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchDistinguishedName::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\PatchDistinguishedName'); $endpoint->setParams($params); $endpoint->setClusterName($cluster_name); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Bulk update of distinguished names. Only accessible to super-admins and with rest-api permissions when enabled. * @@ -1056,13 +1056,13 @@ public function patchDistinguishedNames(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchDistinguishedNames::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\PatchDistinguishedNames'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Updates individual attributes of a role. * @@ -1081,14 +1081,14 @@ public function patchRole(array $params = []) $role = $this->extractArgument($params, 'role'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchRole::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\PatchRole'); $endpoint->setParams($params); $endpoint->setRole($role); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Updates individual attributes of a role mapping. * @@ -1107,14 +1107,14 @@ public function patchRoleMapping(array $params = []) $role = $this->extractArgument($params, 'role'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchRoleMapping::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\PatchRoleMapping'); $endpoint->setParams($params); $endpoint->setRole($role); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Add, delete, or modify a single tenant. * @@ -1133,14 +1133,14 @@ public function patchTenant(array $params = []) $tenant = $this->extractArgument($params, 'tenant'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchTenant::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\PatchTenant'); $endpoint->setParams($params); $endpoint->setTenant($tenant); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Updates individual attributes of an internal user. * @@ -1159,14 +1159,14 @@ public function patchUser(array $params = []) $username = $this->extractArgument($params, 'username'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchUser::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\PatchUser'); $endpoint->setParams($params); $endpoint->setUsername($username); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Updates the current security-dashboards plugin configuration. * @@ -1181,12 +1181,12 @@ public function patchUser(array $params = []) */ public function postDashboardsInfo(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PostDashboardsInfo::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\PostDashboardsInfo'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Reload HTTP layer communication certificates. * @@ -1201,12 +1201,12 @@ public function postDashboardsInfo(array $params = []) */ public function reloadHttpCertificates(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\ReloadHttpCertificates::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\ReloadHttpCertificates'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Reload Transport layer communication certificates. * @@ -1221,12 +1221,12 @@ public function reloadHttpCertificates(array $params = []) */ public function reloadTransportCertificates(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\ReloadTransportCertificates::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\ReloadTransportCertificates'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Retrieves the tenant names if any exist. Only accessible to super admins or kibanaserver user. * @@ -1241,12 +1241,12 @@ public function reloadTransportCertificates(array $params = []) */ public function tenantInfo(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\TenantInfo::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\TenantInfo'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Updates the audit configuration. * @@ -1263,13 +1263,13 @@ public function updateAuditConfiguration(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\UpdateAuditConfiguration::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\UpdateAuditConfiguration'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Adds or updates the existing configuration using the REST API. Only accessible by admins and users with rest api access and only when put or patch is enabled. * @@ -1286,13 +1286,13 @@ public function updateConfiguration(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\UpdateConfiguration::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\UpdateConfiguration'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * 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. * @@ -1311,14 +1311,14 @@ public function updateDistinguishedName(array $params = []) $cluster_name = $this->extractArgument($params, 'cluster_name'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\UpdateDistinguishedName::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\UpdateDistinguishedName'); $endpoint->setParams($params); $endpoint->setClusterName($cluster_name); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Checks whether the v6 security configuration is valid and ready to be migrated to v7. * @@ -1334,12 +1334,12 @@ public function updateDistinguishedName(array $params = []) */ public function validate(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\Validate::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\Validate'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Gets the user identity related information for currently logged in user. * @@ -1354,12 +1354,12 @@ public function validate(array $params = []) */ public function whoAmI(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\WhoAmI::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\WhoAmI'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Gets the user identity related information for currently logged in user. User needs to have access to this endpoint when authorization at REST layer is enabled. * @@ -1374,12 +1374,12 @@ public function whoAmI(array $params = []) */ public function whoAmIProtected(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\WhoAmIProtected::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\WhoAmIProtected'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Changes the password for the current user. * @@ -1404,7 +1404,8 @@ public function changePassword(array $params = []) ]; } - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\ChangePassword::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\ChangePassword'); $endpoint->setParams($params); $endpoint->setBody($body); @@ -1434,7 +1435,8 @@ public function createActionGroup(array $params = []) ]; } - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\CreateActionGroup::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\CreateActionGroup'); $endpoint->setParams($params); $endpoint->setActionGroup($action_group); $endpoint->setBody($body); @@ -1469,7 +1471,8 @@ public function createRoleMapping(array $params = []) ]); } - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\CreateRoleMapping::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\CreateRoleMapping'); $endpoint->setParams($params); $endpoint->setRole($role); $endpoint->setBody($body); @@ -1504,7 +1507,8 @@ public function createRole(array $params = []) ]); } - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\CreateRole::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\CreateRole'); $endpoint->setParams($params); $endpoint->setRole($role); $endpoint->setBody($body); @@ -1535,7 +1539,8 @@ public function createTenant(array $params = []) ]; } - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\CreateTenant::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\CreateTenant'); $endpoint->setParams($params); $endpoint->setTenant($tenant); $endpoint->setBody($body); @@ -1572,7 +1577,8 @@ public function createUser(array $params = []) ]); } - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\CreateUser::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\CreateUser'); $endpoint->setParams($params); $endpoint->setUsername($username); $endpoint->setBody($body); @@ -1610,12 +1616,13 @@ public function getAccount(array $params = []) */ public function getActionGroups(array $params = []) { + $endpointBuilder = $this->endpoints; if (isset($params['action_group'])) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetActionGroup::class); + $endpoint = $endpointBuilder('Security\GetActionGroup'); $action_group = $this->extractArgument($params, 'action_group'); $endpoint->setActionGroup($action_group); } else { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetActionGroups::class); + $endpoint = $endpointBuilder('Security\GetActionGroups'); } $endpoint->setParams($params); @@ -1646,12 +1653,13 @@ public function getConfig(array $params = []) */ public function getDistinguishedNames(array $params = []) { + $endpointBuilder = $this->endpoints; if (isset($params['cluster_name'])) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetDistinguishedName::class); + $endpoint = $endpointBuilder('Security\GetDistinguishedName'); $cluster_name = $this->extractArgument($params, 'cluster_name'); $endpoint->setClusterName($cluster_name); } else { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetDistinguishedNames::class); + $endpoint = $endpointBuilder('Security\GetDistinguishedNames'); } $endpoint->setParams($params); @@ -1673,12 +1681,13 @@ public function getDistinguishedNames(array $params = []) */ public function getRoleMappings(array $params = []) { + $endpointBuilder = $this->endpoints; if (isset($params['role'])) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetRoleMapping::class); + $endpoint = $endpointBuilder('Security\GetRoleMapping'); $role = $this->extractArgument($params, 'role'); $endpoint->setRole($role); } else { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetRoleMappings::class); + $endpoint = $endpointBuilder('Security\GetRoleMappings'); } $endpoint->setParams($params); @@ -1700,12 +1709,13 @@ public function getRoleMappings(array $params = []) */ public function getRoles(array $params = []) { + $endpointBuilder = $this->endpoints; if (isset($params['role'])) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetRole::class); + $endpoint = $endpointBuilder('Security\GetRole'); $role = $this->extractArgument($params, 'role'); $endpoint->setRole($role); } else { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetRoles::class); + $endpoint = $endpointBuilder('Security\GetRoles'); } $endpoint->setParams($params); @@ -1727,12 +1737,13 @@ public function getRoles(array $params = []) */ public function getTenants(array $params = []) { + $endpointBuilder = $this->endpoints; if (isset($params['tenant'])) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetTenant::class); + $endpoint = $endpointBuilder('Security\GetTenant'); $tenant = $this->extractArgument($params, 'tenant'); $endpoint->setTenant($tenant); } else { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetTenants::class); + $endpoint = $endpointBuilder('Security\GetTenants'); } $endpoint->setParams($params); @@ -1757,11 +1768,11 @@ public function getUsers(array $params = []): array $endpointBuilder = $this->endpoints; if (isset($params['username'])) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetUser::class); + $endpoint = $endpointBuilder('Security\GetUser'); $username = $this->extractArgument($params, 'username'); $endpoint->setUsername($username); } else { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetUsers::class); + $endpoint = $endpointBuilder('Security\GetUsers'); } $endpoint->setParams($params); @@ -1789,12 +1800,13 @@ public function patchActionGroups(array $params = []) $body = $this->extractArgument($params, 'ops') ?? []; } + $endpointBuilder = $this->endpoints; if (isset($params['action_group'])) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchActionGroup::class); + $endpoint = $endpointBuilder('Security\PatchActionGroup'); $action_group = $this->extractArgument($params, 'action_group'); $endpoint->setActionGroup($action_group); } else { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchActionGroups::class); + $endpoint = $endpointBuilder('Security\PatchActionGroups'); } $endpoint->setParams($params); $endpoint->setBody($body); @@ -1833,12 +1845,13 @@ public function patchRoleMappings(array $params = []) $body = $this->extractArgument($params, 'ops') ?? []; } + $endpointBuilder = $this->endpoints; if (isset($params['role'])) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchRoleMapping::class); + $endpoint = $endpointBuilder('Security\PatchRoleMapping'); $role = $this->extractArgument($params, 'role'); $endpoint->setRole($role); } else { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchRoleMappings::class); + $endpoint = $endpointBuilder('Security\PatchRoleMappings'); } $endpoint->setParams($params); $endpoint->setBody($body); @@ -1865,12 +1878,13 @@ public function patchRoles(array $params = []) $body = $this->extractArgument($params, 'ops') ?? []; } + $endpointBuilder = $this->endpoints; if (isset($params['role'])) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchRole::class); + $endpoint = $endpointBuilder('Security\PatchRole'); $role = $this->extractArgument($params, 'role'); $endpoint->setRole($role); } else { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchRoles::class); + $endpoint = $endpointBuilder('Security\PatchRoles'); } $endpoint->setParams($params); @@ -1898,12 +1912,13 @@ public function patchTenants(array $params = []) $body = $this->extractArgument($params, 'ops') ?? []; } + $endpointBuilder = $this->endpoints; if (isset($params['tenant'])) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchTenant::class); + $endpoint = $endpointBuilder('Security\PatchTenant'); $tenant = $this->extractArgument($params, 'tenant'); $endpoint->setTenant($tenant); } else { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchTenants::class); + $endpoint = $endpointBuilder('Security\PatchTenants'); } $endpoint->setParams($params); @@ -1931,12 +1946,13 @@ public function patchUsers(array $params = []) $body = $this->extractArgument($params, 'ops') ?? []; } + $endpointBuilder = $this->endpoints; if (isset($params['username'])) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchUser::class); + $endpoint = $endpointBuilder('Security\PatchUser'); $username = $this->extractArgument($params, 'username'); $endpoint->setUsername($username); } else { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchUsers::class); + $endpoint = $endpointBuilder('Security\PatchUsers'); } $endpoint->setParams($params); diff --git a/src/OpenSearch/Namespaces/SnapshotNamespace.php b/src/OpenSearch/Namespaces/SnapshotNamespace.php index c93da08a..26f1e365 100644 --- a/src/OpenSearch/Namespaces/SnapshotNamespace.php +++ b/src/OpenSearch/Namespaces/SnapshotNamespace.php @@ -50,13 +50,13 @@ public function cleanupRepository(array $params = []) { $repository = $this->extractArgument($params, 'repository'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Snapshot\CleanupRepository::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Snapshot\CleanupRepository'); $endpoint->setParams($params); $endpoint->setRepository($repository); return $this->performRequest($endpoint); } - /** * Clones indices from one snapshot into another snapshot in the same repository. * @@ -82,7 +82,8 @@ public function clone(array $params = []) $target_snapshot = $this->extractArgument($params, 'target_snapshot'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Snapshot\CloneSnapshot::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Snapshot\CloneSnapshot'); $endpoint->setParams($params); $endpoint->setRepository($repository); $endpoint->setSnapshot($snapshot); @@ -91,7 +92,6 @@ public function clone(array $params = []) return $this->performRequest($endpoint); } - /** * Creates a snapshot in a repository. * @@ -116,7 +116,8 @@ public function create(array $params = []) $snapshot = $this->extractArgument($params, 'snapshot'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Snapshot\Create::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Snapshot\Create'); $endpoint->setParams($params); $endpoint->setRepository($repository); $endpoint->setSnapshot($snapshot); @@ -124,7 +125,6 @@ public function create(array $params = []) return $this->performRequest($endpoint); } - /** * Creates a repository. * @@ -148,14 +148,14 @@ public function createRepository(array $params = []) $repository = $this->extractArgument($params, 'repository'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Snapshot\CreateRepository::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Snapshot\CreateRepository'); $endpoint->setParams($params); $endpoint->setRepository($repository); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Deletes a snapshot. * @@ -177,14 +177,14 @@ public function delete(array $params = []) $repository = $this->extractArgument($params, 'repository'); $snapshot = $this->extractArgument($params, 'snapshot'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Snapshot\Delete::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Snapshot\Delete'); $endpoint->setParams($params); $endpoint->setRepository($repository); $endpoint->setSnapshot($snapshot); return $this->performRequest($endpoint); } - /** * Deletes a repository. * @@ -205,13 +205,13 @@ public function deleteRepository(array $params = []) { $repository = $this->extractArgument($params, 'repository'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Snapshot\DeleteRepository::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Snapshot\DeleteRepository'); $endpoint->setParams($params); $endpoint->setRepository($repository); return $this->performRequest($endpoint); } - /** * Returns information about a snapshot. * @@ -235,14 +235,14 @@ public function get(array $params = []) $repository = $this->extractArgument($params, 'repository'); $snapshot = $this->extractArgument($params, 'snapshot'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Snapshot\Get::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Snapshot\Get'); $endpoint->setParams($params); $endpoint->setRepository($repository); $endpoint->setSnapshot($snapshot); return $this->performRequest($endpoint); } - /** * Returns information about a repository. * @@ -263,13 +263,13 @@ public function getRepository(array $params = []) { $repository = $this->extractArgument($params, 'repository'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Snapshot\GetRepository::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Snapshot\GetRepository'); $endpoint->setParams($params); $endpoint->setRepository($repository); return $this->performRequest($endpoint); } - /** * Restores a snapshot. * @@ -294,7 +294,8 @@ public function restore(array $params = []) $snapshot = $this->extractArgument($params, 'snapshot'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Snapshot\Restore::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Snapshot\Restore'); $endpoint->setParams($params); $endpoint->setRepository($repository); $endpoint->setSnapshot($snapshot); @@ -302,7 +303,6 @@ public function restore(array $params = []) return $this->performRequest($endpoint); } - /** * Returns information about the status of a snapshot. * @@ -325,14 +325,14 @@ public function status(array $params = []) $repository = $this->extractArgument($params, 'repository'); $snapshot = $this->extractArgument($params, 'snapshot'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Snapshot\Status::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Snapshot\Status'); $endpoint->setParams($params); $endpoint->setRepository($repository); $endpoint->setSnapshot($snapshot); return $this->performRequest($endpoint); } - /** * Verifies a repository. * @@ -353,11 +353,11 @@ public function verifyRepository(array $params = []) { $repository = $this->extractArgument($params, 'repository'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Snapshot\VerifyRepository::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Snapshot\VerifyRepository'); $endpoint->setParams($params); $endpoint->setRepository($repository); return $this->performRequest($endpoint); } - } diff --git a/src/OpenSearch/Namespaces/SqlNamespace.php b/src/OpenSearch/Namespaces/SqlNamespace.php index 00b44028..2d7b43b9 100644 --- a/src/OpenSearch/Namespaces/SqlNamespace.php +++ b/src/OpenSearch/Namespaces/SqlNamespace.php @@ -42,13 +42,13 @@ public function close(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Sql\Close::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Sql\Close'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Collect metrics for the plugin within the interval. * @@ -65,12 +65,12 @@ public function close(array $params = []) */ public function getStats(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Sql\GetStats::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Sql\GetStats'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * By a stats endpoint, you are able to collect metrics for the plugin within the interval. * @@ -89,13 +89,13 @@ public function postStats(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Sql\PostStats::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Sql\PostStats'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Adds SQL settings to the standard OpenSearch cluster settings. * @@ -113,13 +113,13 @@ public function settings(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Sql\Settings::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Sql\Settings'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); - } - /** + } /** * This API will be removed in a future version. Use 'close' API instead. * * $params['cursor'] = (string) The cursor given by the server @@ -129,7 +129,9 @@ public function settings(array $params = []) */ public function closeCursor(array $params): array { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Sql\Close::class); + $endpointBuilder = $this->endpoints; + + $endpoint = $endpointBuilder('Sql\Close'); $endpoint->setBody(array_filter([ 'cursor' => $this->extractArgument($params, 'cursor'), ])); @@ -146,10 +148,12 @@ public function closeCursor(array $params): array */ public function explain(array $params): array { + $endpointBuilder = $this->endpoints; + $body = $this->extractArgument($params, 'body') ?? []; $query = $this->extractArgument($params, 'query'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Sql\Explain::class); + $endpoint = $endpointBuilder('Sql\Explain'); $endpoint->setBody(array_merge($body, [ 'query' => $query, ])); @@ -170,7 +174,9 @@ public function explain(array $params): array */ public function query(array $params): array { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Sql\Query::class); + $endpointBuilder = $this->endpoints; + + $endpoint = $endpointBuilder('Sql\Query'); $body = $this->extractArgument($params, 'body') ?? []; $endpoint->setBody(array_merge($body, array_filter([ 'query' => $this->extractArgument($params, 'query'), diff --git a/src/OpenSearch/Namespaces/TasksNamespace.php b/src/OpenSearch/Namespaces/TasksNamespace.php index d57389eb..6ff0943c 100644 --- a/src/OpenSearch/Namespaces/TasksNamespace.php +++ b/src/OpenSearch/Namespaces/TasksNamespace.php @@ -51,13 +51,13 @@ public function cancel(array $params = []) { $task_id = $this->extractArgument($params, 'task_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Tasks\Cancel::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Tasks\Cancel'); $endpoint->setParams($params); $endpoint->setTaskId($task_id); return $this->performRequest($endpoint); } - /** * Returns information about a task. * @@ -77,13 +77,13 @@ public function get(array $params = []) { $task_id = $this->extractArgument($params, 'task_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Tasks\Get::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Tasks\Get'); $endpoint->setParams($params); $endpoint->setTaskId($task_id); return $this->performRequest($endpoint); } - /** * Returns a list of tasks. * @@ -105,12 +105,12 @@ public function get(array $params = []) */ public function list(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Tasks\ListTasks::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Tasks\ListTasks'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Proxy function to list() to prevent BC break since 7.4.0 */ diff --git a/src/OpenSearch/Namespaces/TransformsNamespace.php b/src/OpenSearch/Namespaces/TransformsNamespace.php index 3fae3b7c..96741237 100644 --- a/src/OpenSearch/Namespaces/TransformsNamespace.php +++ b/src/OpenSearch/Namespaces/TransformsNamespace.php @@ -41,13 +41,13 @@ public function delete(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Transforms\Delete::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Transforms\Delete'); $endpoint->setParams($params); $endpoint->setId($id); return $this->performRequest($endpoint); } - /** * Returns the status and metadata of a transform job. * @@ -65,13 +65,13 @@ public function explain(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Transforms\Explain::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Transforms\Explain'); $endpoint->setParams($params); $endpoint->setId($id); return $this->performRequest($endpoint); } - /** * Returns the status and metadata of a transform job. * @@ -89,13 +89,13 @@ public function get(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Transforms\Get::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Transforms\Get'); $endpoint->setParams($params); $endpoint->setId($id); return $this->performRequest($endpoint); } - /** * Returns a preview of what a transformed index would look like. * @@ -112,13 +112,13 @@ public function preview(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Transforms\Preview::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Transforms\Preview'); $endpoint->setParams($params); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Create an index transform, or update a transform if if_seq_no and if_primary_term are provided. * @@ -139,14 +139,14 @@ public function put(array $params = []) $id = $this->extractArgument($params, 'id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Transforms\Put::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Transforms\Put'); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** * Returns the details of all transform jobs. * @@ -166,12 +166,12 @@ public function put(array $params = []) */ public function search(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Transforms\Search::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Transforms\Search'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** * Start transform. * @@ -189,13 +189,13 @@ public function start(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Transforms\Start::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Transforms\Start'); $endpoint->setParams($params); $endpoint->setId($id); return $this->performRequest($endpoint); } - /** * Stop transform. * @@ -213,11 +213,11 @@ public function stop(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Transforms\Stop::class); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Transforms\Stop'); $endpoint->setParams($params); $endpoint->setId($id); return $this->performRequest($endpoint); } - }