diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index bdc263c1b..70e914c4c 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -1,19 +1,28 @@ setRiskyAllowed(true) ->setRules([ '@PSR12' => true, 'no_unused_imports' => true, + 'fully_qualified_strict_types' => [ + 'import_symbols' => true, + 'leading_backslash_in_global_namespace' => true, + 'phpdoc_tags' => ['property-read', 'property-write'], + ], + 'no_extra_blank_lines' => ['tokens' => ['extra']], ]) ->setFinder( - PhpCsFixer\Finder::create() + Finder::create() ->exclude('vendor') ->exclude('util/cache') ->in(__DIR__) diff --git a/samples/index.php b/samples/index.php index 266be954a..0cb2ebcee 100644 --- a/samples/index.php +++ b/samples/index.php @@ -1,5 +1,13 @@ create(); -$endpointFactory = new \OpenSearch\EndpointFactory(); -$client = new \OpenSearch\Client($transport, $endpointFactory, []); +$transport = (new TransportFactory())->create(); +$endpointFactory = new EndpointFactory(); +$client = new Client($transport, $endpointFactory, []); // Send a request to the 'info' endpoint. $info = $client->info(); @@ -26,35 +34,35 @@ 'headers' => [ 'Accept' => 'application/json', 'Content-Type' => 'application/json', - 'User-Agent' => sprintf('opensearch-php/%s (%s; PHP %s)', \OpenSearch\Client::VERSION, PHP_OS, PHP_VERSION), + 'User-Agent' => sprintf('opensearch-php/%s (%s; PHP %s)', Client::VERSION, PHP_OS, PHP_VERSION), ] ]); -$guzzleHttpFactory = new \GuzzleHttp\Psr7\HttpFactory(); +$guzzleHttpFactory = new HttpFactory(); -$serializer = new \OpenSearch\Serializers\SmartSerializer(); +$serializer = new SmartSerializer(); -$requestFactory = new \OpenSearch\RequestFactory( +$requestFactory = new RequestFactory( $guzzleHttpFactory, $guzzleHttpFactory, $guzzleHttpFactory, $serializer, ); -$transport = (new OpenSearch\TransportFactory()) +$transport = (new TransportFactory()) ->setHttpClient($guzzleClient) ->setRequestFactory($requestFactory) ->create(); -$endpointFactory = new \OpenSearch\EndpointFactory(); -$client = new \OpenSearch\Client($transport, $endpointFactory, []); +$endpointFactory = new EndpointFactory(); +$client = new Client($transport, $endpointFactory, []); // Send a request to the 'info' endpoint. $info = $client->info(); // Symfony example -$symfonyPsr18Client = (new \Symfony\Component\HttpClient\Psr18Client())->withOptions([ +$symfonyPsr18Client = (new Psr18Client())->withOptions([ 'base_uri' => 'https://localhost:9200', 'auth_basic' => ['admin', getenv('OPENSEARCH_PASSWORD')], 'verify_peer' => false, @@ -65,21 +73,21 @@ ], ]); -$serializer = new \OpenSearch\Serializers\SmartSerializer(); +$serializer = new SmartSerializer(); -$requestFactory = new \OpenSearch\RequestFactory( +$requestFactory = new RequestFactory( $symfonyPsr18Client, $symfonyPsr18Client, $symfonyPsr18Client, $serializer, ); -$transport = (new \OpenSearch\TransportFactory()) +$transport = (new TransportFactory()) ->setHttpClient($symfonyPsr18Client) ->setRequestFactory($requestFactory) ->create(); -$client = new \OpenSearch\Client($transport, $endpointFactory, []); +$client = new Client($transport, $endpointFactory, []); // Send a request to the 'info' endpoint. $info = $client->info(); diff --git a/src/OpenSearch/Client.php b/src/OpenSearch/Client.php index 020cbffed..260bc6b15 100644 --- a/src/OpenSearch/Client.php +++ b/src/OpenSearch/Client.php @@ -57,6 +57,49 @@ use OpenSearch\Namespaces\TasksNamespace; use OpenSearch\Namespaces\TransformsNamespace; use OpenSearch\Namespaces\WlmNamespace; +use OpenSearch\Endpoints\Bulk; +use OpenSearch\Endpoints\BulkStream; +use OpenSearch\Endpoints\ClearScroll; +use OpenSearch\Endpoints\Count; +use OpenSearch\Endpoints\Create; +use OpenSearch\Endpoints\CreatePit; +use OpenSearch\Endpoints\Delete; +use OpenSearch\Endpoints\DeleteAllPits; +use OpenSearch\Endpoints\DeleteByQuery; +use OpenSearch\Endpoints\DeleteByQueryRethrottle; +use OpenSearch\Endpoints\DeletePit; +use OpenSearch\Endpoints\DeleteScript; +use OpenSearch\Endpoints\Exists; +use OpenSearch\Endpoints\ExistsSource; +use OpenSearch\Endpoints\Explain; +use OpenSearch\Endpoints\FieldCaps; +use OpenSearch\Endpoints\Get; +use OpenSearch\Endpoints\GetAllPits; +use OpenSearch\Endpoints\GetScript; +use OpenSearch\Endpoints\GetScriptContext; +use OpenSearch\Endpoints\GetScriptLanguages; +use OpenSearch\Endpoints\GetSource; +use OpenSearch\Endpoints\Index; +use OpenSearch\Endpoints\Info; +use OpenSearch\Endpoints\MTermVectors; +use OpenSearch\Endpoints\Mget; +use OpenSearch\Endpoints\Msearch; +use OpenSearch\Endpoints\MsearchTemplate; +use OpenSearch\Endpoints\Ping; +use OpenSearch\Endpoints\PutScript; +use OpenSearch\Endpoints\RankEval; +use OpenSearch\Endpoints\Reindex; +use OpenSearch\Endpoints\ReindexRethrottle; +use OpenSearch\Endpoints\RenderSearchTemplate; +use OpenSearch\Endpoints\ScriptsPainlessExecute; +use OpenSearch\Endpoints\Scroll; +use OpenSearch\Endpoints\Search; +use OpenSearch\Endpoints\SearchShards; +use OpenSearch\Endpoints\SearchTemplate; +use OpenSearch\Endpoints\TermVectors; +use OpenSearch\Endpoints\Update; +use OpenSearch\Endpoints\UpdateByQuery; +use OpenSearch\Endpoints\UpdateByQueryRethrottle; /** * Class Client @@ -260,8 +303,6 @@ class Client */ protected $wlm; - - /** * Client constructor * @@ -364,7 +405,7 @@ public function bulk(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Bulk::class); + $endpoint = $this->endpointFactory->getEndpoint(Bulk::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); @@ -402,7 +443,7 @@ public function bulkStream(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\BulkStream::class); + $endpoint = $this->endpointFactory->getEndpoint(BulkStream::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); @@ -429,7 +470,7 @@ 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); + $endpoint = $this->endpointFactory->getEndpoint(ClearScroll::class); $endpoint->setParams($params); $endpoint->setScrollId($scroll_id); $endpoint->setBody($body); @@ -470,7 +511,7 @@ public function count(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Count::class); + $endpoint = $this->endpointFactory->getEndpoint(Count::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); @@ -500,7 +541,7 @@ public function createPit(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\CreatePit::class); + $endpoint = $this->endpointFactory->getEndpoint(CreatePit::class); $endpoint->setParams($params); $endpoint->setIndex($index); @@ -534,7 +575,7 @@ public function delete(array $params = []) $id = $this->extractArgument($params, 'id'); $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Delete::class); + $endpoint = $this->endpointFactory->getEndpoint(Delete::class); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setIndex($index); @@ -556,7 +597,7 @@ public function delete(array $params = []) */ public function deleteAllPits(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\DeleteAllPits::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteAllPits::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -614,7 +655,7 @@ public function deleteByQuery(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\DeleteByQuery::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteByQuery::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); @@ -640,7 +681,7 @@ public function deleteByQueryRethrottle(array $params = []) { $task_id = $this->extractArgument($params, 'task_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\DeleteByQueryRethrottle::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteByQueryRethrottle::class); $endpoint->setParams($params); $endpoint->setTaskId($task_id); @@ -664,7 +705,7 @@ public function deletePit(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\DeletePit::class); + $endpoint = $this->endpointFactory->getEndpoint(DeletePit::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -691,7 +732,7 @@ public function deleteScript(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\DeleteScript::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteScript::class); $endpoint->setParams($params); $endpoint->setId($id); @@ -730,7 +771,7 @@ 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); + $endpoint = $this->endpointFactory->getEndpoint(Exists::class); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setIndex($index); @@ -769,7 +810,7 @@ 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); + $endpoint = $this->endpointFactory->getEndpoint(ExistsSource::class); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setIndex($index); @@ -810,7 +851,7 @@ public function explain(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Explain::class); + $endpoint = $this->endpointFactory->getEndpoint(Explain::class); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setIndex($index); @@ -843,7 +884,7 @@ public function fieldCaps(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\FieldCaps::class); + $endpoint = $this->endpointFactory->getEndpoint(FieldCaps::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); @@ -880,7 +921,7 @@ public function get(array $params = []) $id = $this->extractArgument($params, 'id'); $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Get::class); + $endpoint = $this->endpointFactory->getEndpoint(Get::class); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setIndex($index); @@ -902,7 +943,7 @@ public function get(array $params = []) */ public function getAllPits(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\GetAllPits::class); + $endpoint = $this->endpointFactory->getEndpoint(GetAllPits::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -927,7 +968,7 @@ public function getScript(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\GetScript::class); + $endpoint = $this->endpointFactory->getEndpoint(GetScript::class); $endpoint->setParams($params); $endpoint->setId($id); @@ -948,7 +989,7 @@ public function getScript(array $params = []) */ public function getScriptContext(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\GetScriptContext::class); + $endpoint = $this->endpointFactory->getEndpoint(GetScriptContext::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -968,7 +1009,7 @@ public function getScriptContext(array $params = []) */ public function getScriptLanguages(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\GetScriptLanguages::class); + $endpoint = $this->endpointFactory->getEndpoint(GetScriptLanguages::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -1002,7 +1043,7 @@ public function getSource(array $params = []) $id = $this->extractArgument($params, 'id'); $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\GetSource::class); + $endpoint = $this->endpointFactory->getEndpoint(GetSource::class); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setIndex($index); @@ -1042,7 +1083,7 @@ public function index(array $params = []) $id = $this->extractArgument($params, 'id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Index::class); + $endpoint = $this->endpointFactory->getEndpoint(Index::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setId($id); @@ -1065,7 +1106,7 @@ public function index(array $params = []) */ public function info(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Info::class); + $endpoint = $this->endpointFactory->getEndpoint(Info::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -1098,7 +1139,7 @@ public function mget(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Mget::class); + $endpoint = $this->endpointFactory->getEndpoint(Mget::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); @@ -1132,7 +1173,7 @@ public function msearch(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Msearch::class); + $endpoint = $this->endpointFactory->getEndpoint(Msearch::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); @@ -1164,7 +1205,7 @@ public function msearchTemplate(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\MsearchTemplate::class); + $endpoint = $this->endpointFactory->getEndpoint(MsearchTemplate::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); @@ -1203,7 +1244,7 @@ public function mtermvectors(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\MTermVectors::class); + $endpoint = $this->endpointFactory->getEndpoint(MTermVectors::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); @@ -1228,7 +1269,7 @@ 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); + $endpoint = $this->endpointFactory->getEndpoint(Ping::class); $endpoint->setParams($params); return BooleanRequestWrapper::sendRequest($endpoint, $this->httpTransport); @@ -1258,7 +1299,7 @@ public function putScript(array $params = []) $context = $this->extractArgument($params, 'context'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\PutScript::class); + $endpoint = $this->endpointFactory->getEndpoint(PutScript::class); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setContext($context); @@ -1290,7 +1331,7 @@ public function rankEval(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\RankEval::class); + $endpoint = $this->endpointFactory->getEndpoint(RankEval::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); @@ -1324,7 +1365,7 @@ public function reindex(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Reindex::class); + $endpoint = $this->endpointFactory->getEndpoint(Reindex::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -1349,7 +1390,7 @@ public function reindexRethrottle(array $params = []) { $task_id = $this->extractArgument($params, 'task_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\ReindexRethrottle::class); + $endpoint = $this->endpointFactory->getEndpoint(ReindexRethrottle::class); $endpoint->setParams($params); $endpoint->setTaskId($task_id); @@ -1375,7 +1416,7 @@ public function renderSearchTemplate(array $params = []) $id = $this->extractArgument($params, 'id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\RenderSearchTemplate::class); + $endpoint = $this->endpointFactory->getEndpoint(RenderSearchTemplate::class); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setBody($body); @@ -1400,7 +1441,7 @@ public function scriptsPainlessExecute(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\ScriptsPainlessExecute::class); + $endpoint = $this->endpointFactory->getEndpoint(ScriptsPainlessExecute::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -1427,7 +1468,7 @@ 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); + $endpoint = $this->endpointFactory->getEndpoint(Scroll::class); $endpoint->setParams($params); $endpoint->setScrollId($scroll_id); $endpoint->setBody($body); @@ -1500,7 +1541,7 @@ public function search(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Search::class); + $endpoint = $this->endpointFactory->getEndpoint(Search::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); @@ -1531,7 +1572,7 @@ public function searchShards(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\SearchShards::class); + $endpoint = $this->endpointFactory->getEndpoint(SearchShards::class); $endpoint->setParams($params); $endpoint->setIndex($index); @@ -1570,7 +1611,7 @@ public function searchTemplate(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\SearchTemplate::class); + $endpoint = $this->endpointFactory->getEndpoint(SearchTemplate::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); @@ -1610,7 +1651,7 @@ public function termvectors(array $params = []) $id = $this->extractArgument($params, 'id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\TermVectors::class); + $endpoint = $this->endpointFactory->getEndpoint(TermVectors::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setId($id); @@ -1652,7 +1693,7 @@ public function update(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Update::class); + $endpoint = $this->endpointFactory->getEndpoint(Update::class); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setIndex($index); @@ -1714,7 +1755,7 @@ public function updateByQuery(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\UpdateByQuery::class); + $endpoint = $this->endpointFactory->getEndpoint(UpdateByQuery::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); @@ -1740,7 +1781,7 @@ public function updateByQueryRethrottle(array $params = []) { $task_id = $this->extractArgument($params, 'task_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\UpdateByQueryRethrottle::class); + $endpoint = $this->endpointFactory->getEndpoint(UpdateByQueryRethrottle::class); $endpoint->setParams($params); $endpoint->setTaskId($task_id); @@ -1784,8 +1825,8 @@ public function create(array $params = []) $body = $this->extractArgument($params, 'body'); $endpoint = $id ? - $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Create::class) - : $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Index::class); + $this->endpointFactory->getEndpoint(Create::class) + : $this->endpointFactory->getEndpoint(Index::class); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setIndex($index); @@ -2033,7 +2074,6 @@ public function wlm(): WlmNamespace return $this->wlm; } - /** * Gets the endpoint factory. */ diff --git a/src/OpenSearch/Common/Exceptions/AuthenticationConfigException.php b/src/OpenSearch/Common/Exceptions/AuthenticationConfigException.php index 69c5a5dba..302807ac6 100644 --- a/src/OpenSearch/Common/Exceptions/AuthenticationConfigException.php +++ b/src/OpenSearch/Common/Exceptions/AuthenticationConfigException.php @@ -1,6 +1,5 @@ extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\AsynchronousSearch\Delete::class); + $endpoint = $this->endpointFactory->getEndpoint(Delete::class); $endpoint->setParams($params); $endpoint->setId($id); @@ -63,7 +68,7 @@ public function get(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\AsynchronousSearch\Get::class); + $endpoint = $this->endpointFactory->getEndpoint(Get::class); $endpoint->setParams($params); $endpoint->setId($id); @@ -90,7 +95,7 @@ public function search(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\AsynchronousSearch\Search::class); + $endpoint = $this->endpointFactory->getEndpoint(Search::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -111,7 +116,7 @@ public function search(array $params = []) */ public function stats(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\AsynchronousSearch\Stats::class); + $endpoint = $this->endpointFactory->getEndpoint(Stats::class); $endpoint->setParams($params); return $this->performRequest($endpoint); diff --git a/src/OpenSearch/Namespaces/CatNamespace.php b/src/OpenSearch/Namespaces/CatNamespace.php index a7445537d..92f1ff795 100644 --- a/src/OpenSearch/Namespaces/CatNamespace.php +++ b/src/OpenSearch/Namespaces/CatNamespace.php @@ -21,6 +21,31 @@ namespace OpenSearch\Namespaces; +use OpenSearch\Endpoints\Cat\Aliases; +use OpenSearch\Endpoints\Cat\AllPitSegments; +use OpenSearch\Endpoints\Cat\Allocation; +use OpenSearch\Endpoints\Cat\ClusterManager; +use OpenSearch\Endpoints\Cat\Count; +use OpenSearch\Endpoints\Cat\Fielddata; +use OpenSearch\Endpoints\Cat\Health; +use OpenSearch\Endpoints\Cat\Help; +use OpenSearch\Endpoints\Cat\Indices; +use OpenSearch\Endpoints\Cat\Master; +use OpenSearch\Endpoints\Cat\NodeAttrs; +use OpenSearch\Endpoints\Cat\Nodes; +use OpenSearch\Endpoints\Cat\PendingTasks; +use OpenSearch\Endpoints\Cat\PitSegments; +use OpenSearch\Endpoints\Cat\Plugins; +use OpenSearch\Endpoints\Cat\Recovery; +use OpenSearch\Endpoints\Cat\Repositories; +use OpenSearch\Endpoints\Cat\SegmentReplication; +use OpenSearch\Endpoints\Cat\Segments; +use OpenSearch\Endpoints\Cat\Shards; +use OpenSearch\Endpoints\Cat\Snapshots; +use OpenSearch\Endpoints\Cat\Tasks; +use OpenSearch\Endpoints\Cat\Templates; +use OpenSearch\Endpoints\Cat\ThreadPool; + /** * Class CatNamespace * @@ -52,7 +77,7 @@ public function aliases(array $params = []) { $name = $this->extractArgument($params, 'name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Aliases::class); + $endpoint = $this->endpointFactory->getEndpoint(Aliases::class); $endpoint->setParams($params); $endpoint->setName($name); @@ -79,7 +104,7 @@ public function aliases(array $params = []) */ public function allPitSegments(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\AllPitSegments::class); + $endpoint = $this->endpointFactory->getEndpoint(AllPitSegments::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -111,7 +136,7 @@ public function allocation(array $params = []) { $node_id = $this->extractArgument($params, 'node_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Allocation::class); + $endpoint = $this->endpointFactory->getEndpoint(Allocation::class); $endpoint->setParams($params); $endpoint->setNodeId($node_id); @@ -140,7 +165,7 @@ public function allocation(array $params = []) */ public function clusterManager(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\ClusterManager::class); + $endpoint = $this->endpointFactory->getEndpoint(ClusterManager::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -168,7 +193,7 @@ public function count(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Count::class); + $endpoint = $this->endpointFactory->getEndpoint(Count::class); $endpoint->setParams($params); $endpoint->setIndex($index); @@ -198,7 +223,7 @@ public function fielddata(array $params = []) { $fields = $this->extractArgument($params, 'fields'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Fielddata::class); + $endpoint = $this->endpointFactory->getEndpoint(Fielddata::class); $endpoint->setParams($params); $endpoint->setFields($fields); @@ -226,7 +251,7 @@ public function fielddata(array $params = []) */ public function health(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Health::class); + $endpoint = $this->endpointFactory->getEndpoint(Health::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -246,7 +271,7 @@ public function health(array $params = []) */ public function help(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Help::class); + $endpoint = $this->endpointFactory->getEndpoint(Help::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -283,7 +308,7 @@ public function indices(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Indices::class); + $endpoint = $this->endpointFactory->getEndpoint(Indices::class); $endpoint->setParams($params); $endpoint->setIndex($index); @@ -312,7 +337,7 @@ public function indices(array $params = []) */ public function master(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Master::class); + $endpoint = $this->endpointFactory->getEndpoint(Master::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -340,7 +365,7 @@ public function master(array $params = []) */ public function nodeattrs(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\NodeAttrs::class); + $endpoint = $this->endpointFactory->getEndpoint(NodeAttrs::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -371,7 +396,7 @@ public function nodeattrs(array $params = []) */ public function nodes(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Nodes::class); + $endpoint = $this->endpointFactory->getEndpoint(Nodes::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -400,7 +425,7 @@ public function nodes(array $params = []) */ public function pendingTasks(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\PendingTasks::class); + $endpoint = $this->endpointFactory->getEndpoint(PendingTasks::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -428,7 +453,7 @@ public function pitSegments(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\PitSegments::class); + $endpoint = $this->endpointFactory->getEndpoint(PitSegments::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -457,7 +482,7 @@ public function pitSegments(array $params = []) */ public function plugins(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Plugins::class); + $endpoint = $this->endpointFactory->getEndpoint(Plugins::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -489,7 +514,7 @@ public function recovery(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Recovery::class); + $endpoint = $this->endpointFactory->getEndpoint(Recovery::class); $endpoint->setParams($params); $endpoint->setIndex($index); @@ -518,7 +543,7 @@ public function recovery(array $params = []) */ public function repositories(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Repositories::class); + $endpoint = $this->endpointFactory->getEndpoint(Repositories::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -557,7 +582,7 @@ public function segmentReplication(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\SegmentReplication::class); + $endpoint = $this->endpointFactory->getEndpoint(SegmentReplication::class); $endpoint->setParams($params); $endpoint->setIndex($index); @@ -589,7 +614,7 @@ public function segments(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Segments::class); + $endpoint = $this->endpointFactory->getEndpoint(Segments::class); $endpoint->setParams($params); $endpoint->setIndex($index); @@ -623,7 +648,7 @@ public function shards(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Shards::class); + $endpoint = $this->endpointFactory->getEndpoint(Shards::class); $endpoint->setParams($params); $endpoint->setIndex($index); @@ -656,7 +681,7 @@ public function snapshots(array $params = []) { $repository = $this->extractArgument($params, 'repository'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Snapshots::class); + $endpoint = $this->endpointFactory->getEndpoint(Snapshots::class); $endpoint->setParams($params); $endpoint->setRepository($repository); @@ -687,7 +712,7 @@ public function snapshots(array $params = []) */ public function tasks(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Tasks::class); + $endpoint = $this->endpointFactory->getEndpoint(Tasks::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -718,7 +743,7 @@ public function templates(array $params = []) { $name = $this->extractArgument($params, 'name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\Templates::class); + $endpoint = $this->endpointFactory->getEndpoint(Templates::class); $endpoint->setParams($params); $endpoint->setName($name); @@ -751,7 +776,7 @@ public function threadPool(array $params = []) { $thread_pool_patterns = $this->extractArgument($params, 'thread_pool_patterns'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cat\ThreadPool::class); + $endpoint = $this->endpointFactory->getEndpoint(ThreadPool::class); $endpoint->setParams($params); $endpoint->setThreadPoolPatterns($thread_pool_patterns); diff --git a/src/OpenSearch/Namespaces/ClusterNamespace.php b/src/OpenSearch/Namespaces/ClusterNamespace.php index 094ee196e..b80059c5f 100644 --- a/src/OpenSearch/Namespaces/ClusterNamespace.php +++ b/src/OpenSearch/Namespaces/ClusterNamespace.php @@ -21,6 +21,28 @@ namespace OpenSearch\Namespaces; +use OpenSearch\Endpoints\Cluster\AllocationExplain; +use OpenSearch\Endpoints\Cluster\DeleteComponentTemplate; +use OpenSearch\Endpoints\Cluster\DeleteDecommissionAwareness; +use OpenSearch\Endpoints\Cluster\DeleteVotingConfigExclusions; +use OpenSearch\Endpoints\Cluster\DeleteWeightedRouting; +use OpenSearch\Endpoints\Cluster\ExistsComponentTemplate; +use OpenSearch\Endpoints\Cluster\GetComponentTemplate; +use OpenSearch\Endpoints\Cluster\GetDecommissionAwareness; +use OpenSearch\Endpoints\Cluster\GetSettings; +use OpenSearch\Endpoints\Cluster\GetWeightedRouting; +use OpenSearch\Endpoints\Cluster\Health; +use OpenSearch\Endpoints\Cluster\PendingTasks; +use OpenSearch\Endpoints\Cluster\PostVotingConfigExclusions; +use OpenSearch\Endpoints\Cluster\PutComponentTemplate; +use OpenSearch\Endpoints\Cluster\PutDecommissionAwareness; +use OpenSearch\Endpoints\Cluster\PutSettings; +use OpenSearch\Endpoints\Cluster\PutWeightedRouting; +use OpenSearch\Endpoints\Cluster\RemoteInfo; +use OpenSearch\Endpoints\Cluster\Reroute; +use OpenSearch\Endpoints\Cluster\State; +use OpenSearch\Endpoints\Cluster\Stats; + /** * Class ClusterNamespace * @@ -47,7 +69,7 @@ public function allocationExplain(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\AllocationExplain::class); + $endpoint = $this->endpointFactory->getEndpoint(AllocationExplain::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -74,7 +96,7 @@ public function deleteComponentTemplate(array $params = []) { $name = $this->extractArgument($params, 'name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\DeleteComponentTemplate::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteComponentTemplate::class); $endpoint->setParams($params); $endpoint->setName($name); @@ -95,7 +117,7 @@ public function deleteComponentTemplate(array $params = []) */ public function deleteDecommissionAwareness(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\DeleteDecommissionAwareness::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteDecommissionAwareness::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -116,7 +138,7 @@ public function deleteDecommissionAwareness(array $params = []) */ public function deleteVotingConfigExclusions(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\DeleteVotingConfigExclusions::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteVotingConfigExclusions::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -138,7 +160,7 @@ public function deleteWeightedRouting(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\DeleteWeightedRouting::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteWeightedRouting::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -168,7 +190,7 @@ 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); + $endpoint = $this->endpointFactory->getEndpoint(ExistsComponentTemplate::class); $endpoint->setParams($params); $endpoint->setName($name); @@ -196,7 +218,7 @@ public function getComponentTemplate(array $params = []) { $name = $this->extractArgument($params, 'name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\GetComponentTemplate::class); + $endpoint = $this->endpointFactory->getEndpoint(GetComponentTemplate::class); $endpoint->setParams($params); $endpoint->setName($name); @@ -220,7 +242,7 @@ public function getDecommissionAwareness(array $params = []) { $awareness_attribute_name = $this->extractArgument($params, 'awareness_attribute_name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\GetDecommissionAwareness::class); + $endpoint = $this->endpointFactory->getEndpoint(GetDecommissionAwareness::class); $endpoint->setParams($params); $endpoint->setAwarenessAttributeName($awareness_attribute_name); @@ -246,7 +268,7 @@ public function getDecommissionAwareness(array $params = []) */ public function getSettings(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\GetSettings::class); + $endpoint = $this->endpointFactory->getEndpoint(GetSettings::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -269,7 +291,7 @@ public function getWeightedRouting(array $params = []) { $attribute = $this->extractArgument($params, 'attribute'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\GetWeightedRouting::class); + $endpoint = $this->endpointFactory->getEndpoint(GetWeightedRouting::class); $endpoint->setParams($params); $endpoint->setAttribute($attribute); @@ -306,7 +328,7 @@ public function health(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\Health::class); + $endpoint = $this->endpointFactory->getEndpoint(Health::class); $endpoint->setParams($params); $endpoint->setIndex($index); @@ -330,7 +352,7 @@ public function health(array $params = []) */ public function pendingTasks(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\PendingTasks::class); + $endpoint = $this->endpointFactory->getEndpoint(PendingTasks::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -353,7 +375,7 @@ public function pendingTasks(array $params = []) */ public function postVotingConfigExclusions(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\PostVotingConfigExclusions::class); + $endpoint = $this->endpointFactory->getEndpoint(PostVotingConfigExclusions::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -382,7 +404,7 @@ public function putComponentTemplate(array $params = []) $name = $this->extractArgument($params, 'name'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\PutComponentTemplate::class); + $endpoint = $this->endpointFactory->getEndpoint(PutComponentTemplate::class); $endpoint->setParams($params); $endpoint->setName($name); $endpoint->setBody($body); @@ -409,7 +431,7 @@ 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); + $endpoint = $this->endpointFactory->getEndpoint(PutDecommissionAwareness::class); $endpoint->setParams($params); $endpoint->setAwarenessAttributeName($awareness_attribute_name); $endpoint->setAwarenessAttributeValue($awareness_attribute_value); @@ -438,7 +460,7 @@ public function putSettings(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\PutSettings::class); + $endpoint = $this->endpointFactory->getEndpoint(PutSettings::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -463,7 +485,7 @@ public function putWeightedRouting(array $params = []) $attribute = $this->extractArgument($params, 'attribute'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\PutWeightedRouting::class); + $endpoint = $this->endpointFactory->getEndpoint(PutWeightedRouting::class); $endpoint->setParams($params); $endpoint->setAttribute($attribute); $endpoint->setBody($body); @@ -485,7 +507,7 @@ public function putWeightedRouting(array $params = []) */ public function remoteInfo(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\RemoteInfo::class); + $endpoint = $this->endpointFactory->getEndpoint(RemoteInfo::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -515,7 +537,7 @@ public function reroute(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\Reroute::class); + $endpoint = $this->endpointFactory->getEndpoint(Reroute::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -550,7 +572,7 @@ public function state(array $params = []) $metric = $this->extractArgument($params, 'metric'); $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\State::class); + $endpoint = $this->endpointFactory->getEndpoint(State::class); $endpoint->setParams($params); $endpoint->setMetric($metric); $endpoint->setIndex($index); @@ -581,7 +603,7 @@ public function stats(array $params = []) $metric = $this->extractArgument($params, 'metric'); $node_id = $this->extractArgument($params, 'node_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Cluster\Stats::class); + $endpoint = $this->endpointFactory->getEndpoint(Stats::class); $endpoint->setParams($params); $endpoint->setIndexMetric($index_metric); $endpoint->setMetric($metric); diff --git a/src/OpenSearch/Namespaces/DanglingIndicesNamespace.php b/src/OpenSearch/Namespaces/DanglingIndicesNamespace.php index fcc9c0f6b..1eb320f90 100644 --- a/src/OpenSearch/Namespaces/DanglingIndicesNamespace.php +++ b/src/OpenSearch/Namespaces/DanglingIndicesNamespace.php @@ -21,6 +21,10 @@ namespace OpenSearch\Namespaces; +use OpenSearch\Endpoints\DanglingIndices\DeleteDanglingIndex; +use OpenSearch\Endpoints\DanglingIndices\ImportDanglingIndex; +use OpenSearch\Endpoints\DanglingIndices\ListDanglingIndices; + /** * Class DanglingIndicesNamespace * @@ -49,7 +53,7 @@ public function deleteDanglingIndex(array $params = []) { $index_uuid = $this->extractArgument($params, 'index_uuid'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\DanglingIndices\DeleteDanglingIndex::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteDanglingIndex::class); $endpoint->setParams($params); $endpoint->setIndexUuid($index_uuid); @@ -77,7 +81,7 @@ public function importDanglingIndex(array $params = []) { $index_uuid = $this->extractArgument($params, 'index_uuid'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\DanglingIndices\ImportDanglingIndex::class); + $endpoint = $this->endpointFactory->getEndpoint(ImportDanglingIndex::class); $endpoint->setParams($params); $endpoint->setIndexUuid($index_uuid); @@ -98,7 +102,7 @@ public function importDanglingIndex(array $params = []) */ public function listDanglingIndices(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\DanglingIndices\ListDanglingIndices::class); + $endpoint = $this->endpointFactory->getEndpoint(ListDanglingIndices::class); $endpoint->setParams($params); return $this->performRequest($endpoint); diff --git a/src/OpenSearch/Namespaces/FlowFrameworkNamespace.php b/src/OpenSearch/Namespaces/FlowFrameworkNamespace.php index 1a926267a..230494a84 100644 --- a/src/OpenSearch/Namespaces/FlowFrameworkNamespace.php +++ b/src/OpenSearch/Namespaces/FlowFrameworkNamespace.php @@ -15,6 +15,17 @@ namespace OpenSearch\Namespaces; +use OpenSearch\Endpoints\FlowFramework\Create; +use OpenSearch\Endpoints\FlowFramework\Delete; +use OpenSearch\Endpoints\FlowFramework\Deprovision; +use OpenSearch\Endpoints\FlowFramework\Get; +use OpenSearch\Endpoints\FlowFramework\GetStatus; +use OpenSearch\Endpoints\FlowFramework\GetSteps; +use OpenSearch\Endpoints\FlowFramework\Provision; +use OpenSearch\Endpoints\FlowFramework\Search; +use OpenSearch\Endpoints\FlowFramework\SearchState; +use OpenSearch\Endpoints\FlowFramework\Update; + /** * Class FlowFrameworkNamespace * @@ -43,7 +54,7 @@ public function create(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\FlowFramework\Create::class); + $endpoint = $this->endpointFactory->getEndpoint(Create::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -68,7 +79,7 @@ public function delete(array $params = []) { $workflow_id = $this->extractArgument($params, 'workflow_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\FlowFramework\Delete::class); + $endpoint = $this->endpointFactory->getEndpoint(Delete::class); $endpoint->setParams($params); $endpoint->setWorkflowId($workflow_id); @@ -93,7 +104,7 @@ public function deprovision(array $params = []) { $workflow_id = $this->extractArgument($params, 'workflow_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\FlowFramework\Deprovision::class); + $endpoint = $this->endpointFactory->getEndpoint(Deprovision::class); $endpoint->setParams($params); $endpoint->setWorkflowId($workflow_id); @@ -117,7 +128,7 @@ public function get(array $params = []) { $workflow_id = $this->extractArgument($params, 'workflow_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\FlowFramework\Get::class); + $endpoint = $this->endpointFactory->getEndpoint(Get::class); $endpoint->setParams($params); $endpoint->setWorkflowId($workflow_id); @@ -142,7 +153,7 @@ public function getStatus(array $params = []) { $workflow_id = $this->extractArgument($params, 'workflow_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\FlowFramework\GetStatus::class); + $endpoint = $this->endpointFactory->getEndpoint(GetStatus::class); $endpoint->setParams($params); $endpoint->setWorkflowId($workflow_id); @@ -164,7 +175,7 @@ public function getStatus(array $params = []) */ public function getSteps(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\FlowFramework\GetSteps::class); + $endpoint = $this->endpointFactory->getEndpoint(GetSteps::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -188,7 +199,7 @@ 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); + $endpoint = $this->endpointFactory->getEndpoint(Provision::class); $endpoint->setParams($params); $endpoint->setWorkflowId($workflow_id); $endpoint->setBody($body); @@ -212,7 +223,7 @@ public function search(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\FlowFramework\Search::class); + $endpoint = $this->endpointFactory->getEndpoint(Search::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -235,7 +246,7 @@ public function searchState(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\FlowFramework\SearchState::class); + $endpoint = $this->endpointFactory->getEndpoint(SearchState::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -265,7 +276,7 @@ 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); + $endpoint = $this->endpointFactory->getEndpoint(Update::class); $endpoint->setParams($params); $endpoint->setWorkflowId($workflow_id); $endpoint->setBody($body); diff --git a/src/OpenSearch/Namespaces/IndicesNamespace.php b/src/OpenSearch/Namespaces/IndicesNamespace.php index ffa64981f..f76602ac2 100644 --- a/src/OpenSearch/Namespaces/IndicesNamespace.php +++ b/src/OpenSearch/Namespaces/IndicesNamespace.php @@ -21,6 +21,56 @@ namespace OpenSearch\Namespaces; +use OpenSearch\Endpoints\Indices\AddBlock; +use OpenSearch\Endpoints\Indices\Analyze; +use OpenSearch\Endpoints\Indices\ClearCache; +use OpenSearch\Endpoints\Indices\CloneIndices; +use OpenSearch\Endpoints\Indices\Close; +use OpenSearch\Endpoints\Indices\Create; +use OpenSearch\Endpoints\Indices\CreateDataStream; +use OpenSearch\Endpoints\Indices\DataStreamsStats; +use OpenSearch\Endpoints\Indices\Delete; +use OpenSearch\Endpoints\Indices\DeleteAlias; +use OpenSearch\Endpoints\Indices\DeleteDataStream; +use OpenSearch\Endpoints\Indices\DeleteIndexTemplate; +use OpenSearch\Endpoints\Indices\DeleteTemplate; +use OpenSearch\Endpoints\Indices\Exists; +use OpenSearch\Endpoints\Indices\ExistsAlias; +use OpenSearch\Endpoints\Indices\ExistsIndexTemplate; +use OpenSearch\Endpoints\Indices\ExistsTemplate; +use OpenSearch\Endpoints\Indices\Flush; +use OpenSearch\Endpoints\Indices\ForceMerge; +use OpenSearch\Endpoints\Indices\Get; +use OpenSearch\Endpoints\Indices\GetAlias; +use OpenSearch\Endpoints\Indices\GetDataStream; +use OpenSearch\Endpoints\Indices\GetFieldMapping; +use OpenSearch\Endpoints\Indices\GetIndexTemplate; +use OpenSearch\Endpoints\Indices\GetMapping; +use OpenSearch\Endpoints\Indices\GetSettings; +use OpenSearch\Endpoints\Indices\GetTemplate; +use OpenSearch\Endpoints\Indices\GetUpgrade; +use OpenSearch\Endpoints\Indices\Open; +use OpenSearch\Endpoints\Indices\PutAlias; +use OpenSearch\Endpoints\Indices\PutIndexTemplate; +use OpenSearch\Endpoints\Indices\PutMapping; +use OpenSearch\Endpoints\Indices\PutSettings; +use OpenSearch\Endpoints\Indices\PutTemplate; +use OpenSearch\Endpoints\Indices\Recovery; +use OpenSearch\Endpoints\Indices\Refresh; +use OpenSearch\Endpoints\Indices\RefreshSearchAnalyzers; +use OpenSearch\Endpoints\Indices\ResolveIndex; +use OpenSearch\Endpoints\Indices\Rollover; +use OpenSearch\Endpoints\Indices\Segments; +use OpenSearch\Endpoints\Indices\ShardStores; +use OpenSearch\Endpoints\Indices\Shrink; +use OpenSearch\Endpoints\Indices\SimulateIndexTemplate; +use OpenSearch\Endpoints\Indices\SimulateTemplate; +use OpenSearch\Endpoints\Indices\Split; +use OpenSearch\Endpoints\Indices\Stats; +use OpenSearch\Endpoints\Indices\UpdateAliases; +use OpenSearch\Endpoints\Indices\Upgrade; +use OpenSearch\Endpoints\Indices\ValidateQuery; + /** * Class IndicesNamespace * @@ -53,7 +103,7 @@ public function addBlock(array $params = []) $block = $this->extractArgument($params, 'block'); $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\AddBlock::class); + $endpoint = $this->endpointFactory->getEndpoint(AddBlock::class); $endpoint->setParams($params); $endpoint->setBlock($block); $endpoint->setIndex($index); @@ -80,7 +130,7 @@ public function analyze(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\Analyze::class); + $endpoint = $this->endpointFactory->getEndpoint(Analyze::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); @@ -113,7 +163,7 @@ public function clearCache(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\ClearCache::class); + $endpoint = $this->endpointFactory->getEndpoint(ClearCache::class); $endpoint->setParams($params); $endpoint->setIndex($index); @@ -147,7 +197,7 @@ public function clone(array $params = []) $target = $this->extractArgument($params, 'target'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\CloneIndices::class); + $endpoint = $this->endpointFactory->getEndpoint(CloneIndices::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setTarget($target); @@ -180,7 +230,7 @@ public function close(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\Close::class); + $endpoint = $this->endpointFactory->getEndpoint(Close::class); $endpoint->setParams($params); $endpoint->setIndex($index); @@ -210,7 +260,7 @@ public function create(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\Create::class); + $endpoint = $this->endpointFactory->getEndpoint(Create::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); @@ -237,7 +287,7 @@ public function createDataStream(array $params = []) $name = $this->extractArgument($params, 'name'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\CreateDataStream::class); + $endpoint = $this->endpointFactory->getEndpoint(CreateDataStream::class); $endpoint->setParams($params); $endpoint->setName($name); $endpoint->setBody($body); @@ -262,7 +312,7 @@ public function dataStreamsStats(array $params = []) { $name = $this->extractArgument($params, 'name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\DataStreamsStats::class); + $endpoint = $this->endpointFactory->getEndpoint(DataStreamsStats::class); $endpoint->setParams($params); $endpoint->setName($name); @@ -292,7 +342,7 @@ public function delete(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\Delete::class); + $endpoint = $this->endpointFactory->getEndpoint(Delete::class); $endpoint->setParams($params); $endpoint->setIndex($index); @@ -321,7 +371,7 @@ public function deleteAlias(array $params = []) $index = $this->extractArgument($params, 'index'); $name = $this->extractArgument($params, 'name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\DeleteAlias::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteAlias::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setName($name); @@ -346,7 +396,7 @@ public function deleteDataStream(array $params = []) { $name = $this->extractArgument($params, 'name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\DeleteDataStream::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteDataStream::class); $endpoint->setParams($params); $endpoint->setName($name); @@ -373,7 +423,7 @@ public function deleteIndexTemplate(array $params = []) { $name = $this->extractArgument($params, 'name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\DeleteIndexTemplate::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteIndexTemplate::class); $endpoint->setParams($params); $endpoint->setName($name); @@ -400,7 +450,7 @@ public function deleteTemplate(array $params = []) { $name = $this->extractArgument($params, 'name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\DeleteTemplate::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteTemplate::class); $endpoint->setParams($params); $endpoint->setName($name); @@ -434,7 +484,7 @@ 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); + $endpoint = $this->endpointFactory->getEndpoint(Exists::class); $endpoint->setParams($params); $endpoint->setIndex($index); @@ -467,7 +517,7 @@ 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); + $endpoint = $this->endpointFactory->getEndpoint(ExistsAlias::class); $endpoint->setParams($params); $endpoint->setName($name); $endpoint->setIndex($index); @@ -499,7 +549,7 @@ 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); + $endpoint = $this->endpointFactory->getEndpoint(ExistsIndexTemplate::class); $endpoint->setParams($params); $endpoint->setName($name); @@ -530,7 +580,7 @@ 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); + $endpoint = $this->endpointFactory->getEndpoint(ExistsTemplate::class); $endpoint->setParams($params); $endpoint->setName($name); @@ -559,7 +609,7 @@ public function flush(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\Flush::class); + $endpoint = $this->endpointFactory->getEndpoint(Flush::class); $endpoint->setParams($params); $endpoint->setIndex($index); @@ -591,7 +641,7 @@ public function forcemerge(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\ForceMerge::class); + $endpoint = $this->endpointFactory->getEndpoint(ForceMerge::class); $endpoint->setParams($params); $endpoint->setIndex($index); @@ -623,7 +673,7 @@ public function get(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\Get::class); + $endpoint = $this->endpointFactory->getEndpoint(Get::class); $endpoint->setParams($params); $endpoint->setIndex($index); @@ -653,7 +703,7 @@ public function getAlias(array $params = []) $name = $this->extractArgument($params, 'name'); $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\GetAlias::class); + $endpoint = $this->endpointFactory->getEndpoint(GetAlias::class); $endpoint->setParams($params); $endpoint->setName($name); $endpoint->setIndex($index); @@ -678,7 +728,7 @@ public function getDataStream(array $params = []) { $name = $this->extractArgument($params, 'name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\GetDataStream::class); + $endpoint = $this->endpointFactory->getEndpoint(GetDataStream::class); $endpoint->setParams($params); $endpoint->setName($name); @@ -709,7 +759,7 @@ public function getFieldMapping(array $params = []) $fields = $this->extractArgument($params, 'fields'); $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\GetFieldMapping::class); + $endpoint = $this->endpointFactory->getEndpoint(GetFieldMapping::class); $endpoint->setParams($params); $endpoint->setFields($fields); $endpoint->setIndex($index); @@ -738,7 +788,7 @@ public function getIndexTemplate(array $params = []) { $name = $this->extractArgument($params, 'name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\GetIndexTemplate::class); + $endpoint = $this->endpointFactory->getEndpoint(GetIndexTemplate::class); $endpoint->setParams($params); $endpoint->setName($name); @@ -768,7 +818,7 @@ public function getMapping(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\GetMapping::class); + $endpoint = $this->endpointFactory->getEndpoint(GetMapping::class); $endpoint->setParams($params); $endpoint->setIndex($index); @@ -802,7 +852,7 @@ public function getSettings(array $params = []) $name = $this->extractArgument($params, 'name'); $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\GetSettings::class); + $endpoint = $this->endpointFactory->getEndpoint(GetSettings::class); $endpoint->setParams($params); $endpoint->setName($name); $endpoint->setIndex($index); @@ -831,7 +881,7 @@ public function getTemplate(array $params = []) { $name = $this->extractArgument($params, 'name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\GetTemplate::class); + $endpoint = $this->endpointFactory->getEndpoint(GetTemplate::class); $endpoint->setParams($params); $endpoint->setName($name); @@ -858,7 +908,7 @@ public function getUpgrade(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\GetUpgrade::class); + $endpoint = $this->endpointFactory->getEndpoint(GetUpgrade::class); $endpoint->setParams($params); $endpoint->setIndex($index); @@ -891,7 +941,7 @@ public function open(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\Open::class); + $endpoint = $this->endpointFactory->getEndpoint(Open::class); $endpoint->setParams($params); $endpoint->setIndex($index); @@ -922,7 +972,7 @@ public function putAlias(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\PutAlias::class); + $endpoint = $this->endpointFactory->getEndpoint(PutAlias::class); $endpoint->setParams($params); $endpoint->setName($name); $endpoint->setIndex($index); @@ -954,7 +1004,7 @@ public function putIndexTemplate(array $params = []) $name = $this->extractArgument($params, 'name'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\PutIndexTemplate::class); + $endpoint = $this->endpointFactory->getEndpoint(PutIndexTemplate::class); $endpoint->setParams($params); $endpoint->setName($name); $endpoint->setBody($body); @@ -988,7 +1038,7 @@ public function putMapping(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\PutMapping::class); + $endpoint = $this->endpointFactory->getEndpoint(PutMapping::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); @@ -1022,7 +1072,7 @@ public function putSettings(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\PutSettings::class); + $endpoint = $this->endpointFactory->getEndpoint(PutSettings::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); @@ -1053,7 +1103,7 @@ public function putTemplate(array $params = []) $name = $this->extractArgument($params, 'name'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\PutTemplate::class); + $endpoint = $this->endpointFactory->getEndpoint(PutTemplate::class); $endpoint->setParams($params); $endpoint->setName($name); $endpoint->setBody($body); @@ -1080,7 +1130,7 @@ public function recovery(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\Recovery::class); + $endpoint = $this->endpointFactory->getEndpoint(Recovery::class); $endpoint->setParams($params); $endpoint->setIndex($index); @@ -1107,7 +1157,7 @@ public function refresh(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\Refresh::class); + $endpoint = $this->endpointFactory->getEndpoint(Refresh::class); $endpoint->setParams($params); $endpoint->setIndex($index); @@ -1132,7 +1182,7 @@ public function resolveIndex(array $params = []) { $name = $this->extractArgument($params, 'name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\ResolveIndex::class); + $endpoint = $this->endpointFactory->getEndpoint(ResolveIndex::class); $endpoint->setParams($params); $endpoint->setName($name); @@ -1165,7 +1215,7 @@ 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); + $endpoint = $this->endpointFactory->getEndpoint(Rollover::class); $endpoint->setParams($params); $endpoint->setAlias($alias); $endpoint->setNewIndex($new_index); @@ -1195,7 +1245,7 @@ public function segments(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\Segments::class); + $endpoint = $this->endpointFactory->getEndpoint(Segments::class); $endpoint->setParams($params); $endpoint->setIndex($index); @@ -1223,7 +1273,7 @@ public function shardStores(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\ShardStores::class); + $endpoint = $this->endpointFactory->getEndpoint(ShardStores::class); $endpoint->setParams($params); $endpoint->setIndex($index); @@ -1258,7 +1308,7 @@ public function shrink(array $params = []) $target = $this->extractArgument($params, 'target'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\Shrink::class); + $endpoint = $this->endpointFactory->getEndpoint(Shrink::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setTarget($target); @@ -1288,7 +1338,7 @@ public function simulateIndexTemplate(array $params = []) $name = $this->extractArgument($params, 'name'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\SimulateIndexTemplate::class); + $endpoint = $this->endpointFactory->getEndpoint(SimulateIndexTemplate::class); $endpoint->setParams($params); $endpoint->setName($name); $endpoint->setBody($body); @@ -1318,7 +1368,7 @@ public function simulateTemplate(array $params = []) $name = $this->extractArgument($params, 'name'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\SimulateTemplate::class); + $endpoint = $this->endpointFactory->getEndpoint(SimulateTemplate::class); $endpoint->setParams($params); $endpoint->setName($name); $endpoint->setBody($body); @@ -1354,7 +1404,7 @@ public function split(array $params = []) $target = $this->extractArgument($params, 'target'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\Split::class); + $endpoint = $this->endpointFactory->getEndpoint(Split::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setTarget($target); @@ -1391,7 +1441,7 @@ public function stats(array $params = []) $metric = $this->extractArgument($params, 'metric'); $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\Stats::class); + $endpoint = $this->endpointFactory->getEndpoint(Stats::class); $endpoint->setParams($params); $endpoint->setMetric($metric); $endpoint->setIndex($index); @@ -1419,7 +1469,7 @@ public function updateAliases(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\UpdateAliases::class); + $endpoint = $this->endpointFactory->getEndpoint(UpdateAliases::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -1448,7 +1498,7 @@ public function upgrade(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\Upgrade::class); + $endpoint = $this->endpointFactory->getEndpoint(Upgrade::class); $endpoint->setParams($params); $endpoint->setIndex($index); @@ -1486,7 +1536,7 @@ public function validateQuery(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\ValidateQuery::class); + $endpoint = $this->endpointFactory->getEndpoint(ValidateQuery::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); @@ -1514,7 +1564,7 @@ public function refreshSearchAnalyzers(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Indices\RefreshSearchAnalyzers::class); + $endpoint = $this->endpointFactory->getEndpoint(RefreshSearchAnalyzers::class); $endpoint->setParams($params); $endpoint->setIndex($index); diff --git a/src/OpenSearch/Namespaces/IngestNamespace.php b/src/OpenSearch/Namespaces/IngestNamespace.php index 23e184826..1e72f7c37 100644 --- a/src/OpenSearch/Namespaces/IngestNamespace.php +++ b/src/OpenSearch/Namespaces/IngestNamespace.php @@ -21,6 +21,12 @@ namespace OpenSearch\Namespaces; +use OpenSearch\Endpoints\Ingest\DeletePipeline; +use OpenSearch\Endpoints\Ingest\GetPipeline; +use OpenSearch\Endpoints\Ingest\ProcessorGrok; +use OpenSearch\Endpoints\Ingest\PutPipeline; +use OpenSearch\Endpoints\Ingest\Simulate; + /** * Class IngestNamespace * @@ -48,7 +54,7 @@ public function deletePipeline(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ingest\DeletePipeline::class); + $endpoint = $this->endpointFactory->getEndpoint(DeletePipeline::class); $endpoint->setParams($params); $endpoint->setId($id); @@ -74,7 +80,7 @@ public function getPipeline(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ingest\GetPipeline::class); + $endpoint = $this->endpointFactory->getEndpoint(GetPipeline::class); $endpoint->setParams($params); $endpoint->setId($id); @@ -96,7 +102,7 @@ public function getPipeline(array $params = []) */ public function processorGrok(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ingest\ProcessorGrok::class); + $endpoint = $this->endpointFactory->getEndpoint(ProcessorGrok::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -124,7 +130,7 @@ public function putPipeline(array $params = []) $id = $this->extractArgument($params, 'id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ingest\PutPipeline::class); + $endpoint = $this->endpointFactory->getEndpoint(PutPipeline::class); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setBody($body); @@ -152,7 +158,7 @@ public function simulate(array $params = []) $id = $this->extractArgument($params, 'id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ingest\Simulate::class); + $endpoint = $this->endpointFactory->getEndpoint(Simulate::class); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setBody($body); diff --git a/src/OpenSearch/Namespaces/InsightsNamespace.php b/src/OpenSearch/Namespaces/InsightsNamespace.php index 7edb4fdcb..eba0f44ef 100644 --- a/src/OpenSearch/Namespaces/InsightsNamespace.php +++ b/src/OpenSearch/Namespaces/InsightsNamespace.php @@ -15,6 +15,8 @@ namespace OpenSearch\Namespaces; +use OpenSearch\Endpoints\Insights\TopQueries; + /** * Class InsightsNamespace * @@ -36,7 +38,7 @@ class InsightsNamespace extends AbstractNamespace */ public function topQueries(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Insights\TopQueries::class); + $endpoint = $this->endpointFactory->getEndpoint(TopQueries::class); $endpoint->setParams($params); return $this->performRequest($endpoint); diff --git a/src/OpenSearch/Namespaces/IsmNamespace.php b/src/OpenSearch/Namespaces/IsmNamespace.php index 9aca519f3..968b37785 100644 --- a/src/OpenSearch/Namespaces/IsmNamespace.php +++ b/src/OpenSearch/Namespaces/IsmNamespace.php @@ -15,6 +15,19 @@ namespace OpenSearch\Namespaces; +use OpenSearch\Endpoints\Ism\AddPolicy; +use OpenSearch\Endpoints\Ism\ChangePolicy; +use OpenSearch\Endpoints\Ism\DeletePolicy; +use OpenSearch\Endpoints\Ism\ExistsPolicy; +use OpenSearch\Endpoints\Ism\ExplainPolicy; +use OpenSearch\Endpoints\Ism\GetPolicies; +use OpenSearch\Endpoints\Ism\GetPolicy; +use OpenSearch\Endpoints\Ism\PutPolicies; +use OpenSearch\Endpoints\Ism\PutPolicy; +use OpenSearch\Endpoints\Ism\RefreshSearchAnalyzers; +use OpenSearch\Endpoints\Ism\RemovePolicy; +use OpenSearch\Endpoints\Ism\RetryIndex; + /** * Class IsmNamespace * @@ -40,7 +53,7 @@ public function addPolicy(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ism\AddPolicy::class); + $endpoint = $this->endpointFactory->getEndpoint(AddPolicy::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); @@ -66,7 +79,7 @@ public function changePolicy(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ism\ChangePolicy::class); + $endpoint = $this->endpointFactory->getEndpoint(ChangePolicy::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); @@ -91,7 +104,7 @@ public function deletePolicy(array $params = []) { $policy_id = $this->extractArgument($params, 'policy_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ism\DeletePolicy::class); + $endpoint = $this->endpointFactory->getEndpoint(DeletePolicy::class); $endpoint->setParams($params); $endpoint->setPolicyId($policy_id); @@ -118,7 +131,7 @@ 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); + $endpoint = $this->endpointFactory->getEndpoint(ExistsPolicy::class); $endpoint->setParams($params); $endpoint->setPolicyId($policy_id); @@ -143,7 +156,7 @@ public function explainPolicy(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ism\ExplainPolicy::class); + $endpoint = $this->endpointFactory->getEndpoint(ExplainPolicy::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); @@ -165,7 +178,7 @@ public function explainPolicy(array $params = []) */ public function getPolicies(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ism\GetPolicies::class); + $endpoint = $this->endpointFactory->getEndpoint(GetPolicies::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -188,7 +201,7 @@ public function getPolicy(array $params = []) { $policy_id = $this->extractArgument($params, 'policy_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ism\GetPolicy::class); + $endpoint = $this->endpointFactory->getEndpoint(GetPolicy::class); $endpoint->setParams($params); $endpoint->setPolicyId($policy_id); @@ -214,7 +227,7 @@ public function putPolicies(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ism\PutPolicies::class); + $endpoint = $this->endpointFactory->getEndpoint(PutPolicies::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -241,7 +254,7 @@ 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); + $endpoint = $this->endpointFactory->getEndpoint(PutPolicy::class); $endpoint->setParams($params); $endpoint->setPolicyId($policy_id); $endpoint->setBody($body); @@ -266,7 +279,7 @@ public function refreshSearchAnalyzers(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ism\RefreshSearchAnalyzers::class); + $endpoint = $this->endpointFactory->getEndpoint(RefreshSearchAnalyzers::class); $endpoint->setParams($params); $endpoint->setIndex($index); @@ -290,7 +303,7 @@ public function removePolicy(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ism\RemovePolicy::class); + $endpoint = $this->endpointFactory->getEndpoint(RemovePolicy::class); $endpoint->setParams($params); $endpoint->setIndex($index); @@ -315,7 +328,7 @@ public function retryIndex(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ism\RetryIndex::class); + $endpoint = $this->endpointFactory->getEndpoint(RetryIndex::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); diff --git a/src/OpenSearch/Namespaces/KnnNamespace.php b/src/OpenSearch/Namespaces/KnnNamespace.php index d33805db9..a07adf3b0 100644 --- a/src/OpenSearch/Namespaces/KnnNamespace.php +++ b/src/OpenSearch/Namespaces/KnnNamespace.php @@ -15,6 +15,13 @@ namespace OpenSearch\Namespaces; +use OpenSearch\Endpoints\Knn\DeleteModel; +use OpenSearch\Endpoints\Knn\GetModel; +use OpenSearch\Endpoints\Knn\SearchModels; +use OpenSearch\Endpoints\Knn\Stats; +use OpenSearch\Endpoints\Knn\TrainModel; +use OpenSearch\Endpoints\Knn\Warmup; + /** * Class KnnNamespace * @@ -39,7 +46,7 @@ public function deleteModel(array $params = []) { $model_id = $this->extractArgument($params, 'model_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Knn\DeleteModel::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteModel::class); $endpoint->setParams($params); $endpoint->setModelId($model_id); @@ -63,7 +70,7 @@ public function getModel(array $params = []) { $model_id = $this->extractArgument($params, 'model_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Knn\GetModel::class); + $endpoint = $this->endpointFactory->getEndpoint(GetModel::class); $endpoint->setParams($params); $endpoint->setModelId($model_id); @@ -128,7 +135,7 @@ public function searchModels(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Knn\SearchModels::class); + $endpoint = $this->endpointFactory->getEndpoint(SearchModels::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -155,7 +162,7 @@ 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); + $endpoint = $this->endpointFactory->getEndpoint(Stats::class); $endpoint->setParams($params); $endpoint->setNodeId($node_id); $endpoint->setStat($stat); @@ -182,7 +189,7 @@ 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); + $endpoint = $this->endpointFactory->getEndpoint(TrainModel::class); $endpoint->setParams($params); $endpoint->setModelId($model_id); $endpoint->setBody($body); @@ -207,7 +214,7 @@ public function warmup(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Knn\Warmup::class); + $endpoint = $this->endpointFactory->getEndpoint(Warmup::class); $endpoint->setParams($params); $endpoint->setIndex($index); diff --git a/src/OpenSearch/Namespaces/ListNamespace.php b/src/OpenSearch/Namespaces/ListNamespace.php index de0aac1fb..0c6cf9b50 100644 --- a/src/OpenSearch/Namespaces/ListNamespace.php +++ b/src/OpenSearch/Namespaces/ListNamespace.php @@ -15,6 +15,10 @@ namespace OpenSearch\Namespaces; +use OpenSearch\Endpoints\List\Help; +use OpenSearch\Endpoints\List\Indices; +use OpenSearch\Endpoints\List\Shards; + /** * Class ListNamespace * @@ -36,7 +40,7 @@ class ListNamespace extends AbstractNamespace */ public function help(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\List\Help::class); + $endpoint = $this->endpointFactory->getEndpoint(Help::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -76,7 +80,7 @@ public function indices(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\List\Indices::class); + $endpoint = $this->endpointFactory->getEndpoint(Indices::class); $endpoint->setParams($params); $endpoint->setIndex($index); @@ -113,7 +117,7 @@ public function shards(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\List\Shards::class); + $endpoint = $this->endpointFactory->getEndpoint(Shards::class); $endpoint->setParams($params); $endpoint->setIndex($index); diff --git a/src/OpenSearch/Namespaces/MlNamespace.php b/src/OpenSearch/Namespaces/MlNamespace.php index c578de47e..8a334d949 100644 --- a/src/OpenSearch/Namespaces/MlNamespace.php +++ b/src/OpenSearch/Namespaces/MlNamespace.php @@ -15,6 +15,67 @@ namespace OpenSearch\Namespaces; +use OpenSearch\Endpoints\Ml\ChunkModel; +use OpenSearch\Endpoints\Ml\CreateConnector; +use OpenSearch\Endpoints\Ml\CreateController; +use OpenSearch\Endpoints\Ml\CreateMemory; +use OpenSearch\Endpoints\Ml\CreateMessage; +use OpenSearch\Endpoints\Ml\CreateModelMeta; +use OpenSearch\Endpoints\Ml\DeleteAgent; +use OpenSearch\Endpoints\Ml\DeleteConnector; +use OpenSearch\Endpoints\Ml\DeleteController; +use OpenSearch\Endpoints\Ml\DeleteMemory; +use OpenSearch\Endpoints\Ml\DeleteModel; +use OpenSearch\Endpoints\Ml\DeleteModelGroup; +use OpenSearch\Endpoints\Ml\DeleteTask; +use OpenSearch\Endpoints\Ml\DeployModel; +use OpenSearch\Endpoints\Ml\ExecuteAgent; +use OpenSearch\Endpoints\Ml\GetAgent; +use OpenSearch\Endpoints\Ml\GetAllMemories; +use OpenSearch\Endpoints\Ml\GetAllMessages; +use OpenSearch\Endpoints\Ml\GetAllTools; +use OpenSearch\Endpoints\Ml\GetConnector; +use OpenSearch\Endpoints\Ml\GetConnectors; +use OpenSearch\Endpoints\Ml\GetController; +use OpenSearch\Endpoints\Ml\GetMemory; +use OpenSearch\Endpoints\Ml\GetMessage; +use OpenSearch\Endpoints\Ml\GetMessageTraces; +use OpenSearch\Endpoints\Ml\GetModel; +use OpenSearch\Endpoints\Ml\GetModelGroup; +use OpenSearch\Endpoints\Ml\GetModelGroups; +use OpenSearch\Endpoints\Ml\GetProfile; +use OpenSearch\Endpoints\Ml\GetProfileModels; +use OpenSearch\Endpoints\Ml\GetProfileTasks; +use OpenSearch\Endpoints\Ml\GetStats; +use OpenSearch\Endpoints\Ml\GetTask; +use OpenSearch\Endpoints\Ml\GetTool; +use OpenSearch\Endpoints\Ml\LoadModel; +use OpenSearch\Endpoints\Ml\Predict; +use OpenSearch\Endpoints\Ml\PredictModel; +use OpenSearch\Endpoints\Ml\RegisterAgents; +use OpenSearch\Endpoints\Ml\RegisterModel; +use OpenSearch\Endpoints\Ml\RegisterModelGroup; +use OpenSearch\Endpoints\Ml\RegisterModelMeta; +use OpenSearch\Endpoints\Ml\SearchAgents; +use OpenSearch\Endpoints\Ml\SearchConnectors; +use OpenSearch\Endpoints\Ml\SearchMemory; +use OpenSearch\Endpoints\Ml\SearchMessage; +use OpenSearch\Endpoints\Ml\SearchModelGroup; +use OpenSearch\Endpoints\Ml\SearchModels; +use OpenSearch\Endpoints\Ml\SearchTasks; +use OpenSearch\Endpoints\Ml\Train; +use OpenSearch\Endpoints\Ml\TrainPredict; +use OpenSearch\Endpoints\Ml\UndeployModel; +use OpenSearch\Endpoints\Ml\UnloadModel; +use OpenSearch\Endpoints\Ml\UpdateConnector; +use OpenSearch\Endpoints\Ml\UpdateController; +use OpenSearch\Endpoints\Ml\UpdateMemory; +use OpenSearch\Endpoints\Ml\UpdateMessage; +use OpenSearch\Endpoints\Ml\UpdateModel; +use OpenSearch\Endpoints\Ml\UpdateModelGroup; +use OpenSearch\Endpoints\Ml\UploadChunk; +use OpenSearch\Endpoints\Ml\UploadModel; + /** * Class MlNamespace * @@ -42,7 +103,7 @@ public function chunkModel(array $params = []) $model_id = $this->extractArgument($params, 'model_id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\ChunkModel::class); + $endpoint = $this->endpointFactory->getEndpoint(ChunkModel::class); $endpoint->setParams($params); $endpoint->setChunkNumber($chunk_number); $endpoint->setModelId($model_id); @@ -69,7 +130,7 @@ public function createController(array $params = []) $model_id = $this->extractArgument($params, 'model_id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\CreateController::class); + $endpoint = $this->endpointFactory->getEndpoint(CreateController::class); $endpoint->setParams($params); $endpoint->setModelId($model_id); $endpoint->setBody($body); @@ -93,7 +154,7 @@ public function createMemory(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\CreateMemory::class); + $endpoint = $this->endpointFactory->getEndpoint(CreateMemory::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -118,7 +179,7 @@ public function createMessage(array $params = []) $memory_id = $this->extractArgument($params, 'memory_id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\CreateMessage::class); + $endpoint = $this->endpointFactory->getEndpoint(CreateMessage::class); $endpoint->setParams($params); $endpoint->setMemoryId($memory_id); $endpoint->setBody($body); @@ -142,7 +203,7 @@ public function createModelMeta(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\CreateModelMeta::class); + $endpoint = $this->endpointFactory->getEndpoint(CreateModelMeta::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -166,7 +227,7 @@ public function deleteAgent(array $params = []) { $agent_id = $this->extractArgument($params, 'agent_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\DeleteAgent::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteAgent::class); $endpoint->setParams($params); $endpoint->setAgentId($agent_id); @@ -190,7 +251,7 @@ public function deleteController(array $params = []) { $model_id = $this->extractArgument($params, 'model_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\DeleteController::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteController::class); $endpoint->setParams($params); $endpoint->setModelId($model_id); @@ -214,7 +275,7 @@ public function deleteMemory(array $params = []) { $memory_id = $this->extractArgument($params, 'memory_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\DeleteMemory::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteMemory::class); $endpoint->setParams($params); $endpoint->setMemoryId($memory_id); @@ -238,7 +299,7 @@ public function deleteModel(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\DeleteModel::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteModel::class); $endpoint->setParams($params); $endpoint->setId($id); @@ -262,7 +323,7 @@ public function deleteModelGroup(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\DeleteModelGroup::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteModelGroup::class); $endpoint->setParams($params); $endpoint->setId($id); @@ -286,7 +347,7 @@ public function deleteTask(array $params = []) { $task_id = $this->extractArgument($params, 'task_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\DeleteTask::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteTask::class); $endpoint->setParams($params); $endpoint->setTaskId($task_id); @@ -311,7 +372,7 @@ public function executeAgent(array $params = []) $agent_id = $this->extractArgument($params, 'agent_id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\ExecuteAgent::class); + $endpoint = $this->endpointFactory->getEndpoint(ExecuteAgent::class); $endpoint->setParams($params); $endpoint->setAgentId($agent_id); $endpoint->setBody($body); @@ -336,7 +397,7 @@ public function getAgent(array $params = []) { $agent_id = $this->extractArgument($params, 'agent_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\GetAgent::class); + $endpoint = $this->endpointFactory->getEndpoint(GetAgent::class); $endpoint->setParams($params); $endpoint->setAgentId($agent_id); @@ -359,7 +420,7 @@ public function getAgent(array $params = []) */ public function getAllMemories(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\GetAllMemories::class); + $endpoint = $this->endpointFactory->getEndpoint(GetAllMemories::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -384,7 +445,7 @@ public function getAllMessages(array $params = []) { $memory_id = $this->extractArgument($params, 'memory_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\GetAllMessages::class); + $endpoint = $this->endpointFactory->getEndpoint(GetAllMessages::class); $endpoint->setParams($params); $endpoint->setMemoryId($memory_id); @@ -405,7 +466,7 @@ public function getAllMessages(array $params = []) */ public function getAllTools(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\GetAllTools::class); + $endpoint = $this->endpointFactory->getEndpoint(GetAllTools::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -428,7 +489,7 @@ public function getController(array $params = []) { $model_id = $this->extractArgument($params, 'model_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\GetController::class); + $endpoint = $this->endpointFactory->getEndpoint(GetController::class); $endpoint->setParams($params); $endpoint->setModelId($model_id); @@ -452,7 +513,7 @@ public function getMemory(array $params = []) { $memory_id = $this->extractArgument($params, 'memory_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\GetMemory::class); + $endpoint = $this->endpointFactory->getEndpoint(GetMemory::class); $endpoint->setParams($params); $endpoint->setMemoryId($memory_id); @@ -476,7 +537,7 @@ public function getMessage(array $params = []) { $message_id = $this->extractArgument($params, 'message_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\GetMessage::class); + $endpoint = $this->endpointFactory->getEndpoint(GetMessage::class); $endpoint->setParams($params); $endpoint->setMessageId($message_id); @@ -502,7 +563,7 @@ public function getMessageTraces(array $params = []) { $message_id = $this->extractArgument($params, 'message_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\GetMessageTraces::class); + $endpoint = $this->endpointFactory->getEndpoint(GetMessageTraces::class); $endpoint->setParams($params); $endpoint->setMessageId($message_id); @@ -526,7 +587,7 @@ public function getModelGroup(array $params = []) { $model_group_id = $this->extractArgument($params, 'model_group_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\GetModelGroup::class); + $endpoint = $this->endpointFactory->getEndpoint(GetModelGroup::class); $endpoint->setParams($params); $endpoint->setModelGroupId($model_group_id); @@ -549,7 +610,7 @@ public function getProfile(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\GetProfile::class); + $endpoint = $this->endpointFactory->getEndpoint(GetProfile::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -574,7 +635,7 @@ public function getProfileModels(array $params = []) $model_id = $this->extractArgument($params, 'model_id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\GetProfileModels::class); + $endpoint = $this->endpointFactory->getEndpoint(GetProfileModels::class); $endpoint->setParams($params); $endpoint->setModelId($model_id); $endpoint->setBody($body); @@ -600,7 +661,7 @@ public function getProfileTasks(array $params = []) $task_id = $this->extractArgument($params, 'task_id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\GetProfileTasks::class); + $endpoint = $this->endpointFactory->getEndpoint(GetProfileTasks::class); $endpoint->setParams($params); $endpoint->setTaskId($task_id); $endpoint->setBody($body); @@ -627,7 +688,7 @@ public function getStats(array $params = []) $node_id = $this->extractArgument($params, 'node_id'); $stat = $this->extractArgument($params, 'stat'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\GetStats::class); + $endpoint = $this->endpointFactory->getEndpoint(GetStats::class); $endpoint->setParams($params); $endpoint->setNodeId($node_id); $endpoint->setStat($stat); @@ -652,7 +713,7 @@ public function getTask(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\GetTask::class); + $endpoint = $this->endpointFactory->getEndpoint(GetTask::class); $endpoint->setParams($params); $endpoint->setId($id); @@ -676,7 +737,7 @@ public function getTool(array $params = []) { $tool_name = $this->extractArgument($params, 'tool_name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\GetTool::class); + $endpoint = $this->endpointFactory->getEndpoint(GetTool::class); $endpoint->setParams($params); $endpoint->setToolName($tool_name); @@ -700,7 +761,7 @@ public function loadModel(array $params = []) { $model_id = $this->extractArgument($params, 'model_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\LoadModel::class); + $endpoint = $this->endpointFactory->getEndpoint(LoadModel::class); $endpoint->setParams($params); $endpoint->setModelId($model_id); @@ -725,7 +786,7 @@ public function predictModel(array $params = []) $model_id = $this->extractArgument($params, 'model_id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\PredictModel::class); + $endpoint = $this->endpointFactory->getEndpoint(PredictModel::class); $endpoint->setParams($params); $endpoint->setModelId($model_id); $endpoint->setBody($body); @@ -749,7 +810,7 @@ public function registerAgents(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\RegisterAgents::class); + $endpoint = $this->endpointFactory->getEndpoint(RegisterAgents::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -772,7 +833,7 @@ public function registerModel(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\RegisterModel::class); + $endpoint = $this->endpointFactory->getEndpoint(RegisterModel::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -795,7 +856,7 @@ public function registerModelGroup(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\RegisterModelGroup::class); + $endpoint = $this->endpointFactory->getEndpoint(RegisterModelGroup::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -818,7 +879,7 @@ public function registerModelMeta(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\RegisterModelMeta::class); + $endpoint = $this->endpointFactory->getEndpoint(RegisterModelMeta::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -841,7 +902,7 @@ public function searchAgents(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\SearchAgents::class); + $endpoint = $this->endpointFactory->getEndpoint(SearchAgents::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -864,7 +925,7 @@ public function searchConnectors(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\SearchConnectors::class); + $endpoint = $this->endpointFactory->getEndpoint(SearchConnectors::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -887,7 +948,7 @@ public function searchMemory(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\SearchMemory::class); + $endpoint = $this->endpointFactory->getEndpoint(SearchMemory::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -912,7 +973,7 @@ public function searchMessage(array $params = []) $memory_id = $this->extractArgument($params, 'memory_id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\SearchMessage::class); + $endpoint = $this->endpointFactory->getEndpoint(SearchMessage::class); $endpoint->setParams($params); $endpoint->setMemoryId($memory_id); $endpoint->setBody($body); @@ -936,7 +997,7 @@ public function searchModelGroup(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\SearchModelGroup::class); + $endpoint = $this->endpointFactory->getEndpoint(SearchModelGroup::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -959,7 +1020,7 @@ public function searchModels(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\SearchModels::class); + $endpoint = $this->endpointFactory->getEndpoint(SearchModels::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -982,7 +1043,7 @@ public function searchTasks(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\SearchTasks::class); + $endpoint = $this->endpointFactory->getEndpoint(SearchTasks::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -1007,7 +1068,7 @@ public function train(array $params = []) $algorithm_name = $this->extractArgument($params, 'algorithm_name'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\Train::class); + $endpoint = $this->endpointFactory->getEndpoint(Train::class); $endpoint->setParams($params); $endpoint->setAlgorithmName($algorithm_name); $endpoint->setBody($body); @@ -1033,7 +1094,7 @@ public function trainPredict(array $params = []) $algorithm_name = $this->extractArgument($params, 'algorithm_name'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\TrainPredict::class); + $endpoint = $this->endpointFactory->getEndpoint(TrainPredict::class); $endpoint->setParams($params); $endpoint->setAlgorithmName($algorithm_name); $endpoint->setBody($body); @@ -1059,7 +1120,7 @@ public function unloadModel(array $params = []) $model_id = $this->extractArgument($params, 'model_id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\UnloadModel::class); + $endpoint = $this->endpointFactory->getEndpoint(UnloadModel::class); $endpoint->setParams($params); $endpoint->setModelId($model_id); $endpoint->setBody($body); @@ -1085,7 +1146,7 @@ public function updateConnector(array $params = []) $connector_id = $this->extractArgument($params, 'connector_id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\UpdateConnector::class); + $endpoint = $this->endpointFactory->getEndpoint(UpdateConnector::class); $endpoint->setParams($params); $endpoint->setConnectorId($connector_id); $endpoint->setBody($body); @@ -1111,7 +1172,7 @@ public function updateController(array $params = []) $model_id = $this->extractArgument($params, 'model_id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\UpdateController::class); + $endpoint = $this->endpointFactory->getEndpoint(UpdateController::class); $endpoint->setParams($params); $endpoint->setModelId($model_id); $endpoint->setBody($body); @@ -1137,7 +1198,7 @@ public function updateMemory(array $params = []) $memory_id = $this->extractArgument($params, 'memory_id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\UpdateMemory::class); + $endpoint = $this->endpointFactory->getEndpoint(UpdateMemory::class); $endpoint->setParams($params); $endpoint->setMemoryId($memory_id); $endpoint->setBody($body); @@ -1163,7 +1224,7 @@ public function updateMessage(array $params = []) $message_id = $this->extractArgument($params, 'message_id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\UpdateMessage::class); + $endpoint = $this->endpointFactory->getEndpoint(UpdateMessage::class); $endpoint->setParams($params); $endpoint->setMessageId($message_id); $endpoint->setBody($body); @@ -1189,7 +1250,7 @@ public function updateModel(array $params = []) $model_id = $this->extractArgument($params, 'model_id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\UpdateModel::class); + $endpoint = $this->endpointFactory->getEndpoint(UpdateModel::class); $endpoint->setParams($params); $endpoint->setModelId($model_id); $endpoint->setBody($body); @@ -1217,7 +1278,7 @@ public function uploadChunk(array $params = []) $model_id = $this->extractArgument($params, 'model_id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\UploadChunk::class); + $endpoint = $this->endpointFactory->getEndpoint(UploadChunk::class); $endpoint->setParams($params); $endpoint->setChunkNumber($chunk_number); $endpoint->setModelId($model_id); @@ -1242,7 +1303,7 @@ public function uploadModel(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\UploadModel::class); + $endpoint = $this->endpointFactory->getEndpoint(UploadModel::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -1260,7 +1321,7 @@ public function uploadModel(array $params = []) public function createConnector(array $params = []): array { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\CreateConnector::class); + $endpoint = $this->endpointFactory->getEndpoint(CreateConnector::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -1277,7 +1338,7 @@ 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); + $endpoint = $this->endpointFactory->getEndpoint(DeleteConnector::class); $endpoint->setParams($params); $endpoint->setConnectorId($connectorId); @@ -1296,7 +1357,7 @@ 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); + $endpoint = $this->endpointFactory->getEndpoint(DeployModel::class); $endpoint->setParams($params); $endpoint->setModelId($modelId); if ($body) { @@ -1317,7 +1378,7 @@ public function getConnector(array $params = []): array { $id = $this->extractArgument($params, 'id'); $connector_id = $this->extractArgument($params, 'connector_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\GetConnector::class); + $endpoint = $this->endpointFactory->getEndpoint(GetConnector::class); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setConnectorId($connector_id); @@ -1343,7 +1404,7 @@ public function getConnectors(array $params = []): array ]; } $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\GetConnectors::class); + $endpoint = $this->endpointFactory->getEndpoint(GetConnectors::class); $endpoint->setBody($body); return $this->performRequest($endpoint); @@ -1367,7 +1428,7 @@ public function getModelGroups(array $params = []): array ]; } $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\GetModelGroups::class); + $endpoint = $this->endpointFactory->getEndpoint(GetModelGroups::class); $endpoint->setBody($body); return $this->performRequest($endpoint); @@ -1384,7 +1445,7 @@ public function getModel(array $params = []): array { $id = $this->extractArgument($params, 'id'); $model_id = $this->extractArgument($params, 'model_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\GetModel::class); + $endpoint = $this->endpointFactory->getEndpoint(GetModel::class); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setModelId($model_id); @@ -1424,7 +1485,7 @@ public function predict(array $params = []): array $algorithm_name = $this->extractArgument($params, 'algorithm_name'); $model_id = $this->extractArgument($params, 'model_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\Predict::class); + $endpoint = $this->endpointFactory->getEndpoint(Predict::class); $endpoint->setParams($params) ->setId($id) ->setBody($body) @@ -1446,7 +1507,7 @@ 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); + $endpoint = $this->endpointFactory->getEndpoint(UndeployModel::class); $endpoint->setParams($params); $endpoint->setModelId($modelId); if ($body) { @@ -1469,7 +1530,7 @@ public function updateModelGroup(array $params = []): array $id = $this->extractArgument($params, 'id'); $model_group_id = $this->extractArgument($params, 'model_group_id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ml\UpdateModelGroup::class); + $endpoint = $this->endpointFactory->getEndpoint(UpdateModelGroup::class); $endpoint->setParams($params); $endpoint->setBody($body); $endpoint->setId($id); diff --git a/src/OpenSearch/Namespaces/MonitoringNamespace.php b/src/OpenSearch/Namespaces/MonitoringNamespace.php index 76c6e6f85..ea732c2e6 100644 --- a/src/OpenSearch/Namespaces/MonitoringNamespace.php +++ b/src/OpenSearch/Namespaces/MonitoringNamespace.php @@ -21,8 +21,6 @@ namespace OpenSearch\Namespaces; -use OpenSearch\Namespaces\AbstractNamespace; - // @phpstan-ignore classConstant.deprecatedClass @trigger_error(MonitoringNamespace::class . ' is deprecated in 2.4.0 and will be removed in 3.0.0.', E_USER_DEPRECATED); diff --git a/src/OpenSearch/Namespaces/NodesNamespace.php b/src/OpenSearch/Namespaces/NodesNamespace.php index 32dfc08e3..2440d325e 100644 --- a/src/OpenSearch/Namespaces/NodesNamespace.php +++ b/src/OpenSearch/Namespaces/NodesNamespace.php @@ -21,6 +21,12 @@ namespace OpenSearch\Namespaces; +use OpenSearch\Endpoints\Nodes\HotThreads; +use OpenSearch\Endpoints\Nodes\Info; +use OpenSearch\Endpoints\Nodes\ReloadSecureSettings; +use OpenSearch\Endpoints\Nodes\Stats; +use OpenSearch\Endpoints\Nodes\Usage; + /** * Class NodesNamespace * @@ -51,7 +57,7 @@ public function hotThreads(array $params = []) { $node_id = $this->extractArgument($params, 'node_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Nodes\HotThreads::class); + $endpoint = $this->endpointFactory->getEndpoint(HotThreads::class); $endpoint->setParams($params); $endpoint->setNodeId($node_id); @@ -81,7 +87,7 @@ 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); + $endpoint = $this->endpointFactory->getEndpoint(Info::class); $endpoint->setParams($params); $endpoint->setNodeIdOrMetric($node_id_or_metric); $endpoint->setMetric($metric); @@ -110,7 +116,7 @@ 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); + $endpoint = $this->endpointFactory->getEndpoint(ReloadSecureSettings::class); $endpoint->setParams($params); $endpoint->setNodeId($node_id); $endpoint->setBody($body); @@ -147,7 +153,7 @@ 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); + $endpoint = $this->endpointFactory->getEndpoint(Stats::class); $endpoint->setParams($params); $endpoint->setNodeId($node_id); $endpoint->setMetric($metric); @@ -176,7 +182,7 @@ 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); + $endpoint = $this->endpointFactory->getEndpoint(Usage::class); $endpoint->setParams($params); $endpoint->setNodeId($node_id); $endpoint->setMetric($metric); diff --git a/src/OpenSearch/Namespaces/NotificationsNamespace.php b/src/OpenSearch/Namespaces/NotificationsNamespace.php index 997e5bac0..0b2087f92 100644 --- a/src/OpenSearch/Namespaces/NotificationsNamespace.php +++ b/src/OpenSearch/Namespaces/NotificationsNamespace.php @@ -15,6 +15,16 @@ namespace OpenSearch\Namespaces; +use OpenSearch\Endpoints\Notifications\CreateConfig; +use OpenSearch\Endpoints\Notifications\DeleteConfig; +use OpenSearch\Endpoints\Notifications\DeleteConfigs; +use OpenSearch\Endpoints\Notifications\GetConfig; +use OpenSearch\Endpoints\Notifications\GetConfigs; +use OpenSearch\Endpoints\Notifications\ListChannels; +use OpenSearch\Endpoints\Notifications\ListFeatures; +use OpenSearch\Endpoints\Notifications\SendTest; +use OpenSearch\Endpoints\Notifications\UpdateConfig; + /** * Class NotificationsNamespace * @@ -38,7 +48,7 @@ public function createConfig(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Notifications\CreateConfig::class); + $endpoint = $this->endpointFactory->getEndpoint(CreateConfig::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -62,7 +72,7 @@ public function deleteConfig(array $params = []) { $config_id = $this->extractArgument($params, 'config_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Notifications\DeleteConfig::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteConfig::class); $endpoint->setParams($params); $endpoint->setConfigId($config_id); @@ -85,7 +95,7 @@ public function deleteConfig(array $params = []) */ public function deleteConfigs(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Notifications\DeleteConfigs::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteConfigs::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -108,7 +118,7 @@ public function getConfig(array $params = []) { $config_id = $this->extractArgument($params, 'config_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Notifications\GetConfig::class); + $endpoint = $this->endpointFactory->getEndpoint(GetConfig::class); $endpoint->setParams($params); $endpoint->setConfigId($config_id); @@ -171,7 +181,7 @@ public function getConfigs(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Notifications\GetConfigs::class); + $endpoint = $this->endpointFactory->getEndpoint(GetConfigs::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -192,7 +202,7 @@ public function getConfigs(array $params = []) */ public function listChannels(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Notifications\ListChannels::class); + $endpoint = $this->endpointFactory->getEndpoint(ListChannels::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -212,7 +222,7 @@ public function listChannels(array $params = []) */ public function listFeatures(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Notifications\ListFeatures::class); + $endpoint = $this->endpointFactory->getEndpoint(ListFeatures::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -235,7 +245,7 @@ public function sendTest(array $params = []) { $config_id = $this->extractArgument($params, 'config_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Notifications\SendTest::class); + $endpoint = $this->endpointFactory->getEndpoint(SendTest::class); $endpoint->setParams($params); $endpoint->setConfigId($config_id); @@ -260,7 +270,7 @@ 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); + $endpoint = $this->endpointFactory->getEndpoint(UpdateConfig::class); $endpoint->setParams($params); $endpoint->setConfigId($config_id); $endpoint->setBody($body); diff --git a/src/OpenSearch/Namespaces/ObservabilityNamespace.php b/src/OpenSearch/Namespaces/ObservabilityNamespace.php index 3bc1486e7..bc9c750f3 100644 --- a/src/OpenSearch/Namespaces/ObservabilityNamespace.php +++ b/src/OpenSearch/Namespaces/ObservabilityNamespace.php @@ -15,6 +15,14 @@ namespace OpenSearch\Namespaces; +use OpenSearch\Endpoints\Observability\CreateObject; +use OpenSearch\Endpoints\Observability\DeleteObject; +use OpenSearch\Endpoints\Observability\DeleteObjects; +use OpenSearch\Endpoints\Observability\GetLocalstats; +use OpenSearch\Endpoints\Observability\GetObject; +use OpenSearch\Endpoints\Observability\ListObjects; +use OpenSearch\Endpoints\Observability\UpdateObject; + /** * Class ObservabilityNamespace * @@ -38,7 +46,7 @@ public function createObject(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Observability\CreateObject::class); + $endpoint = $this->endpointFactory->getEndpoint(CreateObject::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -62,7 +70,7 @@ public function deleteObject(array $params = []) { $object_id = $this->extractArgument($params, 'object_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Observability\DeleteObject::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteObject::class); $endpoint->setParams($params); $endpoint->setObjectId($object_id); @@ -85,7 +93,7 @@ public function deleteObject(array $params = []) */ public function deleteObjects(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Observability\DeleteObjects::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteObjects::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -105,7 +113,7 @@ public function deleteObjects(array $params = []) */ public function getLocalstats(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Observability\GetLocalstats::class); + $endpoint = $this->endpointFactory->getEndpoint(GetLocalstats::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -128,7 +136,7 @@ public function getObject(array $params = []) { $object_id = $this->extractArgument($params, 'object_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Observability\GetObject::class); + $endpoint = $this->endpointFactory->getEndpoint(GetObject::class); $endpoint->setParams($params); $endpoint->setObjectId($object_id); @@ -149,7 +157,7 @@ public function getObject(array $params = []) */ public function listObjects(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Observability\ListObjects::class); + $endpoint = $this->endpointFactory->getEndpoint(ListObjects::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -173,7 +181,7 @@ 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); + $endpoint = $this->endpointFactory->getEndpoint(UpdateObject::class); $endpoint->setParams($params); $endpoint->setObjectId($object_id); $endpoint->setBody($body); diff --git a/src/OpenSearch/Namespaces/PplNamespace.php b/src/OpenSearch/Namespaces/PplNamespace.php index fa2149c18..5701692f3 100644 --- a/src/OpenSearch/Namespaces/PplNamespace.php +++ b/src/OpenSearch/Namespaces/PplNamespace.php @@ -15,6 +15,11 @@ namespace OpenSearch\Namespaces; +use OpenSearch\Endpoints\Ppl\Explain; +use OpenSearch\Endpoints\Ppl\GetStats; +use OpenSearch\Endpoints\Ppl\PostStats; +use OpenSearch\Endpoints\Ppl\Query; + /** * Class PplNamespace * @@ -40,7 +45,7 @@ public function explain(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ppl\Explain::class); + $endpoint = $this->endpointFactory->getEndpoint(Explain::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -63,7 +68,7 @@ public function explain(array $params = []) */ public function getStats(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ppl\GetStats::class); + $endpoint = $this->endpointFactory->getEndpoint(GetStats::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -87,7 +92,7 @@ public function postStats(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ppl\PostStats::class); + $endpoint = $this->endpointFactory->getEndpoint(PostStats::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -112,7 +117,7 @@ public function query(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Ppl\Query::class); + $endpoint = $this->endpointFactory->getEndpoint(Query::class); $endpoint->setParams($params); $endpoint->setBody($body); diff --git a/src/OpenSearch/Namespaces/QueryNamespace.php b/src/OpenSearch/Namespaces/QueryNamespace.php index a9f3893e9..3db5ade92 100644 --- a/src/OpenSearch/Namespaces/QueryNamespace.php +++ b/src/OpenSearch/Namespaces/QueryNamespace.php @@ -15,6 +15,12 @@ namespace OpenSearch\Namespaces; +use OpenSearch\Endpoints\Query\DatasourceDelete; +use OpenSearch\Endpoints\Query\DatasourceRetrieve; +use OpenSearch\Endpoints\Query\DatasourcesCreate; +use OpenSearch\Endpoints\Query\DatasourcesList; +use OpenSearch\Endpoints\Query\DatasourcesUpdate; + /** * Class QueryNamespace * @@ -39,7 +45,7 @@ public function datasourceDelete(array $params = []) { $datasource_name = $this->extractArgument($params, 'datasource_name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Query\DatasourceDelete::class); + $endpoint = $this->endpointFactory->getEndpoint(DatasourceDelete::class); $endpoint->setParams($params); $endpoint->setDatasourceName($datasource_name); @@ -63,7 +69,7 @@ public function datasourceRetrieve(array $params = []) { $datasource_name = $this->extractArgument($params, 'datasource_name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Query\DatasourceRetrieve::class); + $endpoint = $this->endpointFactory->getEndpoint(DatasourceRetrieve::class); $endpoint->setParams($params); $endpoint->setDatasourceName($datasource_name); @@ -86,7 +92,7 @@ public function datasourcesCreate(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Query\DatasourcesCreate::class); + $endpoint = $this->endpointFactory->getEndpoint(DatasourcesCreate::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -107,7 +113,7 @@ public function datasourcesCreate(array $params = []) */ public function datasourcesList(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Query\DatasourcesList::class); + $endpoint = $this->endpointFactory->getEndpoint(DatasourcesList::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -129,7 +135,7 @@ public function datasourcesUpdate(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Query\DatasourcesUpdate::class); + $endpoint = $this->endpointFactory->getEndpoint(DatasourcesUpdate::class); $endpoint->setParams($params); $endpoint->setBody($body); diff --git a/src/OpenSearch/Namespaces/RemoteStoreNamespace.php b/src/OpenSearch/Namespaces/RemoteStoreNamespace.php index 1884900d1..4815debed 100644 --- a/src/OpenSearch/Namespaces/RemoteStoreNamespace.php +++ b/src/OpenSearch/Namespaces/RemoteStoreNamespace.php @@ -15,6 +15,8 @@ namespace OpenSearch\Namespaces; +use OpenSearch\Endpoints\RemoteStore\Restore; + /** * Class RemoteStoreNamespace * @@ -41,7 +43,7 @@ public function restore(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\RemoteStore\Restore::class); + $endpoint = $this->endpointFactory->getEndpoint(Restore::class); $endpoint->setParams($params); $endpoint->setBody($body); diff --git a/src/OpenSearch/Namespaces/ReplicationNamespace.php b/src/OpenSearch/Namespaces/ReplicationNamespace.php index bc9f709ad..be7e13c16 100644 --- a/src/OpenSearch/Namespaces/ReplicationNamespace.php +++ b/src/OpenSearch/Namespaces/ReplicationNamespace.php @@ -15,6 +15,18 @@ namespace OpenSearch\Namespaces; +use OpenSearch\Endpoints\Replication\AutofollowStats; +use OpenSearch\Endpoints\Replication\CreateReplicationRule; +use OpenSearch\Endpoints\Replication\DeleteReplicationRule; +use OpenSearch\Endpoints\Replication\FollowerStats; +use OpenSearch\Endpoints\Replication\LeaderStats; +use OpenSearch\Endpoints\Replication\Pause; +use OpenSearch\Endpoints\Replication\Resume; +use OpenSearch\Endpoints\Replication\Start; +use OpenSearch\Endpoints\Replication\Status; +use OpenSearch\Endpoints\Replication\Stop; +use OpenSearch\Endpoints\Replication\UpdateSettings; + /** * Class ReplicationNamespace * @@ -36,7 +48,7 @@ class ReplicationNamespace extends AbstractNamespace */ public function autofollowStats(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Replication\AutofollowStats::class); + $endpoint = $this->endpointFactory->getEndpoint(AutofollowStats::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -58,7 +70,7 @@ public function createReplicationRule(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Replication\CreateReplicationRule::class); + $endpoint = $this->endpointFactory->getEndpoint(CreateReplicationRule::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -81,7 +93,7 @@ public function deleteReplicationRule(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Replication\DeleteReplicationRule::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteReplicationRule::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -102,7 +114,7 @@ public function deleteReplicationRule(array $params = []) */ public function followerStats(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Replication\FollowerStats::class); + $endpoint = $this->endpointFactory->getEndpoint(FollowerStats::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -122,7 +134,7 @@ public function followerStats(array $params = []) */ public function leaderStats(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Replication\LeaderStats::class); + $endpoint = $this->endpointFactory->getEndpoint(LeaderStats::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -146,7 +158,7 @@ public function pause(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Replication\Pause::class); + $endpoint = $this->endpointFactory->getEndpoint(Pause::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); @@ -172,7 +184,7 @@ public function resume(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Replication\Resume::class); + $endpoint = $this->endpointFactory->getEndpoint(Resume::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); @@ -198,7 +210,7 @@ public function start(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Replication\Start::class); + $endpoint = $this->endpointFactory->getEndpoint(Start::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); @@ -223,7 +235,7 @@ public function status(array $params = []) { $index = $this->extractArgument($params, 'index'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Replication\Status::class); + $endpoint = $this->endpointFactory->getEndpoint(Status::class); $endpoint->setParams($params); $endpoint->setIndex($index); @@ -248,7 +260,7 @@ public function stop(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Replication\Stop::class); + $endpoint = $this->endpointFactory->getEndpoint(Stop::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); @@ -274,7 +286,7 @@ public function updateSettings(array $params = []) $index = $this->extractArgument($params, 'index'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Replication\UpdateSettings::class); + $endpoint = $this->endpointFactory->getEndpoint(UpdateSettings::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); diff --git a/src/OpenSearch/Namespaces/RollupsNamespace.php b/src/OpenSearch/Namespaces/RollupsNamespace.php index 57adaea21..945abf3db 100644 --- a/src/OpenSearch/Namespaces/RollupsNamespace.php +++ b/src/OpenSearch/Namespaces/RollupsNamespace.php @@ -15,6 +15,13 @@ namespace OpenSearch\Namespaces; +use OpenSearch\Endpoints\Rollups\Delete; +use OpenSearch\Endpoints\Rollups\Explain; +use OpenSearch\Endpoints\Rollups\Get; +use OpenSearch\Endpoints\Rollups\Put; +use OpenSearch\Endpoints\Rollups\Start; +use OpenSearch\Endpoints\Rollups\Stop; + /** * Class RollupsNamespace * @@ -39,7 +46,7 @@ public function delete(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Rollups\Delete::class); + $endpoint = $this->endpointFactory->getEndpoint(Delete::class); $endpoint->setParams($params); $endpoint->setId($id); @@ -63,7 +70,7 @@ public function explain(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Rollups\Explain::class); + $endpoint = $this->endpointFactory->getEndpoint(Explain::class); $endpoint->setParams($params); $endpoint->setId($id); @@ -87,7 +94,7 @@ public function get(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Rollups\Get::class); + $endpoint = $this->endpointFactory->getEndpoint(Get::class); $endpoint->setParams($params); $endpoint->setId($id); @@ -114,7 +121,7 @@ public function put(array $params = []) $id = $this->extractArgument($params, 'id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Rollups\Put::class); + $endpoint = $this->endpointFactory->getEndpoint(Put::class); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setBody($body); @@ -139,7 +146,7 @@ public function start(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Rollups\Start::class); + $endpoint = $this->endpointFactory->getEndpoint(Start::class); $endpoint->setParams($params); $endpoint->setId($id); @@ -163,7 +170,7 @@ public function stop(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Rollups\Stop::class); + $endpoint = $this->endpointFactory->getEndpoint(Stop::class); $endpoint->setParams($params); $endpoint->setId($id); diff --git a/src/OpenSearch/Namespaces/SearchPipelineNamespace.php b/src/OpenSearch/Namespaces/SearchPipelineNamespace.php index fea10cfb0..c5635daf5 100644 --- a/src/OpenSearch/Namespaces/SearchPipelineNamespace.php +++ b/src/OpenSearch/Namespaces/SearchPipelineNamespace.php @@ -15,6 +15,10 @@ namespace OpenSearch\Namespaces; +use OpenSearch\Endpoints\SearchPipeline\Delete; +use OpenSearch\Endpoints\SearchPipeline\Get; +use OpenSearch\Endpoints\SearchPipeline\Put; + /** * Class SearchPipelineNamespace * @@ -41,7 +45,7 @@ public function delete(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\SearchPipeline\Delete::class); + $endpoint = $this->endpointFactory->getEndpoint(Delete::class); $endpoint->setParams($params); $endpoint->setId($id); @@ -66,7 +70,7 @@ public function get(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\SearchPipeline\Get::class); + $endpoint = $this->endpointFactory->getEndpoint(Get::class); $endpoint->setParams($params); $endpoint->setId($id); @@ -93,7 +97,7 @@ public function put(array $params = []) $id = $this->extractArgument($params, 'id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\SearchPipeline\Put::class); + $endpoint = $this->endpointFactory->getEndpoint(Put::class); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setBody($body); diff --git a/src/OpenSearch/Namespaces/SecurityNamespace.php b/src/OpenSearch/Namespaces/SecurityNamespace.php index 17dd7fefe..eac9f73da 100644 --- a/src/OpenSearch/Namespaces/SecurityNamespace.php +++ b/src/OpenSearch/Namespaces/SecurityNamespace.php @@ -15,6 +15,84 @@ namespace OpenSearch\Namespaces; +use OpenSearch\Endpoints\Security\Authinfo; +use OpenSearch\Endpoints\Security\Authtoken; +use OpenSearch\Endpoints\Security\Cache; +use OpenSearch\Endpoints\Security\ChangePassword; +use OpenSearch\Endpoints\Security\ConfigUpgradeCheck; +use OpenSearch\Endpoints\Security\ConfigUpgradePerform; +use OpenSearch\Endpoints\Security\CreateActionGroup; +use OpenSearch\Endpoints\Security\CreateAllowlist; +use OpenSearch\Endpoints\Security\CreateRole; +use OpenSearch\Endpoints\Security\CreateRoleMapping; +use OpenSearch\Endpoints\Security\CreateTenant; +use OpenSearch\Endpoints\Security\CreateUpdateTenancyConfig; +use OpenSearch\Endpoints\Security\CreateUser; +use OpenSearch\Endpoints\Security\CreateUserLegacy; +use OpenSearch\Endpoints\Security\DeleteActionGroup; +use OpenSearch\Endpoints\Security\DeleteDistinguishedName; +use OpenSearch\Endpoints\Security\DeleteRole; +use OpenSearch\Endpoints\Security\DeleteRoleMapping; +use OpenSearch\Endpoints\Security\DeleteTenant; +use OpenSearch\Endpoints\Security\DeleteUser; +use OpenSearch\Endpoints\Security\DeleteUserLegacy; +use OpenSearch\Endpoints\Security\FlushCache; +use OpenSearch\Endpoints\Security\GenerateOboToken; +use OpenSearch\Endpoints\Security\GenerateUserToken; +use OpenSearch\Endpoints\Security\GenerateUserTokenLegacy; +use OpenSearch\Endpoints\Security\GetAccountDetails; +use OpenSearch\Endpoints\Security\GetActionGroup; +use OpenSearch\Endpoints\Security\GetActionGroups; +use OpenSearch\Endpoints\Security\GetAllCertificates; +use OpenSearch\Endpoints\Security\GetAllowlist; +use OpenSearch\Endpoints\Security\GetAuditConfiguration; +use OpenSearch\Endpoints\Security\GetCertificates; +use OpenSearch\Endpoints\Security\GetConfiguration; +use OpenSearch\Endpoints\Security\GetDashboardsInfo; +use OpenSearch\Endpoints\Security\GetDistinguishedName; +use OpenSearch\Endpoints\Security\GetDistinguishedNames; +use OpenSearch\Endpoints\Security\GetNodeCertificates; +use OpenSearch\Endpoints\Security\GetPermissionsInfo; +use OpenSearch\Endpoints\Security\GetRole; +use OpenSearch\Endpoints\Security\GetRoleMapping; +use OpenSearch\Endpoints\Security\GetRoleMappings; +use OpenSearch\Endpoints\Security\GetRoles; +use OpenSearch\Endpoints\Security\GetSslinfo; +use OpenSearch\Endpoints\Security\GetTenancyConfig; +use OpenSearch\Endpoints\Security\GetTenant; +use OpenSearch\Endpoints\Security\GetTenants; +use OpenSearch\Endpoints\Security\GetUser; +use OpenSearch\Endpoints\Security\GetUserLegacy; +use OpenSearch\Endpoints\Security\GetUsers; +use OpenSearch\Endpoints\Security\GetUsersLegacy; +use OpenSearch\Endpoints\Security\Health; +use OpenSearch\Endpoints\Security\Migrate; +use OpenSearch\Endpoints\Security\PatchActionGroup; +use OpenSearch\Endpoints\Security\PatchActionGroups; +use OpenSearch\Endpoints\Security\PatchAllowlist; +use OpenSearch\Endpoints\Security\PatchAuditConfiguration; +use OpenSearch\Endpoints\Security\PatchConfiguration; +use OpenSearch\Endpoints\Security\PatchDistinguishedName; +use OpenSearch\Endpoints\Security\PatchDistinguishedNames; +use OpenSearch\Endpoints\Security\PatchRole; +use OpenSearch\Endpoints\Security\PatchRoleMapping; +use OpenSearch\Endpoints\Security\PatchRoleMappings; +use OpenSearch\Endpoints\Security\PatchRoles; +use OpenSearch\Endpoints\Security\PatchTenant; +use OpenSearch\Endpoints\Security\PatchTenants; +use OpenSearch\Endpoints\Security\PatchUser; +use OpenSearch\Endpoints\Security\PatchUsers; +use OpenSearch\Endpoints\Security\PostDashboardsInfo; +use OpenSearch\Endpoints\Security\ReloadHttpCertificates; +use OpenSearch\Endpoints\Security\ReloadTransportCertificates; +use OpenSearch\Endpoints\Security\TenantInfo; +use OpenSearch\Endpoints\Security\UpdateAuditConfiguration; +use OpenSearch\Endpoints\Security\UpdateConfiguration; +use OpenSearch\Endpoints\Security\UpdateDistinguishedName; +use OpenSearch\Endpoints\Security\Validate; +use OpenSearch\Endpoints\Security\WhoAmI; +use OpenSearch\Endpoints\Security\WhoAmIProtected; + /** * Class SecurityNamespace * @@ -38,7 +116,7 @@ class SecurityNamespace extends AbstractNamespace */ public function authinfo(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\Authinfo::class); + $endpoint = $this->endpointFactory->getEndpoint(Authinfo::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -58,7 +136,7 @@ public function authinfo(array $params = []) */ public function authtoken(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\Authtoken::class); + $endpoint = $this->endpointFactory->getEndpoint(Authtoken::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -78,7 +156,7 @@ public function authtoken(array $params = []) */ public function cache(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\Cache::class); + $endpoint = $this->endpointFactory->getEndpoint(Cache::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -98,7 +176,7 @@ public function cache(array $params = []) */ public function configUpgradeCheck(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\ConfigUpgradeCheck::class); + $endpoint = $this->endpointFactory->getEndpoint(ConfigUpgradeCheck::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -120,7 +198,7 @@ public function configUpgradePerform(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\ConfigUpgradePerform::class); + $endpoint = $this->endpointFactory->getEndpoint(ConfigUpgradePerform::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -143,7 +221,7 @@ public function createAllowlist(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\CreateAllowlist::class); + $endpoint = $this->endpointFactory->getEndpoint(CreateAllowlist::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -166,7 +244,7 @@ public function createUpdateTenancyConfig(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\CreateUpdateTenancyConfig::class); + $endpoint = $this->endpointFactory->getEndpoint(CreateUpdateTenancyConfig::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -191,7 +269,7 @@ public function createUserLegacy(array $params = []) $username = $this->extractArgument($params, 'username'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\CreateUserLegacy::class); + $endpoint = $this->endpointFactory->getEndpoint(CreateUserLegacy::class); $endpoint->setParams($params); $endpoint->setUsername($username); $endpoint->setBody($body); @@ -216,7 +294,7 @@ public function deleteActionGroup(array $params = []) { $action_group = $this->extractArgument($params, 'action_group'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\DeleteActionGroup::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteActionGroup::class); $endpoint->setParams($params); $endpoint->setActionGroup($action_group); @@ -240,7 +318,7 @@ public function deleteDistinguishedName(array $params = []) { $cluster_name = $this->extractArgument($params, 'cluster_name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\DeleteDistinguishedName::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteDistinguishedName::class); $endpoint->setParams($params); $endpoint->setClusterName($cluster_name); @@ -264,7 +342,7 @@ public function deleteRole(array $params = []) { $role = $this->extractArgument($params, 'role'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\DeleteRole::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteRole::class); $endpoint->setParams($params); $endpoint->setRole($role); @@ -288,7 +366,7 @@ public function deleteRoleMapping(array $params = []) { $role = $this->extractArgument($params, 'role'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\DeleteRoleMapping::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteRoleMapping::class); $endpoint->setParams($params); $endpoint->setRole($role); @@ -312,7 +390,7 @@ public function deleteTenant(array $params = []) { $tenant = $this->extractArgument($params, 'tenant'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\DeleteTenant::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteTenant::class); $endpoint->setParams($params); $endpoint->setTenant($tenant); @@ -336,7 +414,7 @@ public function deleteUser(array $params = []) { $username = $this->extractArgument($params, 'username'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\DeleteUser::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteUser::class); $endpoint->setParams($params); $endpoint->setUsername($username); @@ -360,7 +438,7 @@ public function deleteUserLegacy(array $params = []) { $username = $this->extractArgument($params, 'username'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\DeleteUserLegacy::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteUserLegacy::class); $endpoint->setParams($params); $endpoint->setUsername($username); @@ -381,7 +459,7 @@ public function deleteUserLegacy(array $params = []) */ public function flushCache(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\FlushCache::class); + $endpoint = $this->endpointFactory->getEndpoint(FlushCache::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -403,7 +481,7 @@ public function generateOboToken(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GenerateOboToken::class); + $endpoint = $this->endpointFactory->getEndpoint(GenerateOboToken::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -427,7 +505,7 @@ public function generateUserToken(array $params = []) { $username = $this->extractArgument($params, 'username'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GenerateUserToken::class); + $endpoint = $this->endpointFactory->getEndpoint(GenerateUserToken::class); $endpoint->setParams($params); $endpoint->setUsername($username); @@ -451,7 +529,7 @@ public function generateUserTokenLegacy(array $params = []) { $username = $this->extractArgument($params, 'username'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GenerateUserTokenLegacy::class); + $endpoint = $this->endpointFactory->getEndpoint(GenerateUserTokenLegacy::class); $endpoint->setParams($params); $endpoint->setUsername($username); @@ -472,7 +550,7 @@ public function generateUserTokenLegacy(array $params = []) */ public function getAccountDetails(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetAccountDetails::class); + $endpoint = $this->endpointFactory->getEndpoint(GetAccountDetails::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -495,7 +573,7 @@ public function getActionGroup(array $params = []) { $action_group = $this->extractArgument($params, 'action_group'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetActionGroup::class); + $endpoint = $this->endpointFactory->getEndpoint(GetActionGroup::class); $endpoint->setParams($params); $endpoint->setActionGroup($action_group); @@ -518,7 +596,7 @@ public function getActionGroup(array $params = []) */ public function getAllCertificates(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetAllCertificates::class); + $endpoint = $this->endpointFactory->getEndpoint(GetAllCertificates::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -538,7 +616,7 @@ public function getAllCertificates(array $params = []) */ public function getAllowlist(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetAllowlist::class); + $endpoint = $this->endpointFactory->getEndpoint(GetAllowlist::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -558,7 +636,7 @@ public function getAllowlist(array $params = []) */ public function getAuditConfiguration(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetAuditConfiguration::class); + $endpoint = $this->endpointFactory->getEndpoint(GetAuditConfiguration::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -578,7 +656,7 @@ public function getAuditConfiguration(array $params = []) */ public function getCertificates(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetCertificates::class); + $endpoint = $this->endpointFactory->getEndpoint(GetCertificates::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -598,7 +676,7 @@ public function getCertificates(array $params = []) */ public function getConfiguration(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetConfiguration::class); + $endpoint = $this->endpointFactory->getEndpoint(GetConfiguration::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -618,7 +696,7 @@ public function getConfiguration(array $params = []) */ public function getDashboardsInfo(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetDashboardsInfo::class); + $endpoint = $this->endpointFactory->getEndpoint(GetDashboardsInfo::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -642,7 +720,7 @@ public function getDistinguishedName(array $params = []) { $cluster_name = $this->extractArgument($params, 'cluster_name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetDistinguishedName::class); + $endpoint = $this->endpointFactory->getEndpoint(GetDistinguishedName::class); $endpoint->setParams($params); $endpoint->setClusterName($cluster_name); @@ -668,7 +746,7 @@ public function getNodeCertificates(array $params = []) { $node_id = $this->extractArgument($params, 'node_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetNodeCertificates::class); + $endpoint = $this->endpointFactory->getEndpoint(GetNodeCertificates::class); $endpoint->setParams($params); $endpoint->setNodeId($node_id); @@ -689,7 +767,7 @@ public function getNodeCertificates(array $params = []) */ public function getPermissionsInfo(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetPermissionsInfo::class); + $endpoint = $this->endpointFactory->getEndpoint(GetPermissionsInfo::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -712,7 +790,7 @@ public function getRole(array $params = []) { $role = $this->extractArgument($params, 'role'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetRole::class); + $endpoint = $this->endpointFactory->getEndpoint(GetRole::class); $endpoint->setParams($params); $endpoint->setRole($role); @@ -736,7 +814,7 @@ public function getRoleMapping(array $params = []) { $role = $this->extractArgument($params, 'role'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetRoleMapping::class); + $endpoint = $this->endpointFactory->getEndpoint(GetRoleMapping::class); $endpoint->setParams($params); $endpoint->setRole($role); @@ -758,7 +836,7 @@ public function getRoleMapping(array $params = []) */ public function getSslinfo(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetSslinfo::class); + $endpoint = $this->endpointFactory->getEndpoint(GetSslinfo::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -778,7 +856,7 @@ public function getSslinfo(array $params = []) */ public function getTenancyConfig(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetTenancyConfig::class); + $endpoint = $this->endpointFactory->getEndpoint(GetTenancyConfig::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -801,7 +879,7 @@ public function getTenant(array $params = []) { $tenant = $this->extractArgument($params, 'tenant'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetTenant::class); + $endpoint = $this->endpointFactory->getEndpoint(GetTenant::class); $endpoint->setParams($params); $endpoint->setTenant($tenant); @@ -825,7 +903,7 @@ public function getUser(array $params = []) { $username = $this->extractArgument($params, 'username'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetUser::class); + $endpoint = $this->endpointFactory->getEndpoint(GetUser::class); $endpoint->setParams($params); $endpoint->setUsername($username); @@ -849,7 +927,7 @@ public function getUserLegacy(array $params = []) { $username = $this->extractArgument($params, 'username'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetUserLegacy::class); + $endpoint = $this->endpointFactory->getEndpoint(GetUserLegacy::class); $endpoint->setParams($params); $endpoint->setUsername($username); @@ -870,7 +948,7 @@ public function getUserLegacy(array $params = []) */ public function getUsersLegacy(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetUsersLegacy::class); + $endpoint = $this->endpointFactory->getEndpoint(GetUsersLegacy::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -891,7 +969,7 @@ public function getUsersLegacy(array $params = []) */ public function health(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\Health::class); + $endpoint = $this->endpointFactory->getEndpoint(Health::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -911,7 +989,7 @@ public function health(array $params = []) */ public function migrate(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\Migrate::class); + $endpoint = $this->endpointFactory->getEndpoint(Migrate::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -935,7 +1013,7 @@ 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); + $endpoint = $this->endpointFactory->getEndpoint(PatchActionGroup::class); $endpoint->setParams($params); $endpoint->setActionGroup($action_group); $endpoint->setBody($body); @@ -959,7 +1037,7 @@ public function patchAllowlist(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchAllowlist::class); + $endpoint = $this->endpointFactory->getEndpoint(PatchAllowlist::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -982,7 +1060,7 @@ public function patchAuditConfiguration(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchAuditConfiguration::class); + $endpoint = $this->endpointFactory->getEndpoint(PatchAuditConfiguration::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -1005,7 +1083,7 @@ public function patchConfiguration(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchConfiguration::class); + $endpoint = $this->endpointFactory->getEndpoint(PatchConfiguration::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -1030,7 +1108,7 @@ 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); + $endpoint = $this->endpointFactory->getEndpoint(PatchDistinguishedName::class); $endpoint->setParams($params); $endpoint->setClusterName($cluster_name); $endpoint->setBody($body); @@ -1054,7 +1132,7 @@ public function patchDistinguishedNames(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchDistinguishedNames::class); + $endpoint = $this->endpointFactory->getEndpoint(PatchDistinguishedNames::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -1079,7 +1157,7 @@ public function patchRole(array $params = []) $role = $this->extractArgument($params, 'role'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchRole::class); + $endpoint = $this->endpointFactory->getEndpoint(PatchRole::class); $endpoint->setParams($params); $endpoint->setRole($role); $endpoint->setBody($body); @@ -1105,7 +1183,7 @@ public function patchRoleMapping(array $params = []) $role = $this->extractArgument($params, 'role'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchRoleMapping::class); + $endpoint = $this->endpointFactory->getEndpoint(PatchRoleMapping::class); $endpoint->setParams($params); $endpoint->setRole($role); $endpoint->setBody($body); @@ -1131,7 +1209,7 @@ public function patchTenant(array $params = []) $tenant = $this->extractArgument($params, 'tenant'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchTenant::class); + $endpoint = $this->endpointFactory->getEndpoint(PatchTenant::class); $endpoint->setParams($params); $endpoint->setTenant($tenant); $endpoint->setBody($body); @@ -1157,7 +1235,7 @@ public function patchUser(array $params = []) $username = $this->extractArgument($params, 'username'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchUser::class); + $endpoint = $this->endpointFactory->getEndpoint(PatchUser::class); $endpoint->setParams($params); $endpoint->setUsername($username); $endpoint->setBody($body); @@ -1179,7 +1257,7 @@ public function patchUser(array $params = []) */ public function postDashboardsInfo(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PostDashboardsInfo::class); + $endpoint = $this->endpointFactory->getEndpoint(PostDashboardsInfo::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -1199,7 +1277,7 @@ public function postDashboardsInfo(array $params = []) */ public function reloadHttpCertificates(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\ReloadHttpCertificates::class); + $endpoint = $this->endpointFactory->getEndpoint(ReloadHttpCertificates::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -1219,7 +1297,7 @@ public function reloadHttpCertificates(array $params = []) */ public function reloadTransportCertificates(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\ReloadTransportCertificates::class); + $endpoint = $this->endpointFactory->getEndpoint(ReloadTransportCertificates::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -1239,7 +1317,7 @@ public function reloadTransportCertificates(array $params = []) */ public function tenantInfo(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\TenantInfo::class); + $endpoint = $this->endpointFactory->getEndpoint(TenantInfo::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -1261,7 +1339,7 @@ public function updateAuditConfiguration(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\UpdateAuditConfiguration::class); + $endpoint = $this->endpointFactory->getEndpoint(UpdateAuditConfiguration::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -1284,7 +1362,7 @@ public function updateConfiguration(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\UpdateConfiguration::class); + $endpoint = $this->endpointFactory->getEndpoint(UpdateConfiguration::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -1309,7 +1387,7 @@ 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); + $endpoint = $this->endpointFactory->getEndpoint(UpdateDistinguishedName::class); $endpoint->setParams($params); $endpoint->setClusterName($cluster_name); $endpoint->setBody($body); @@ -1332,7 +1410,7 @@ public function updateDistinguishedName(array $params = []) */ public function validate(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\Validate::class); + $endpoint = $this->endpointFactory->getEndpoint(Validate::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -1352,7 +1430,7 @@ public function validate(array $params = []) */ public function whoAmI(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\WhoAmI::class); + $endpoint = $this->endpointFactory->getEndpoint(WhoAmI::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -1372,7 +1450,7 @@ public function whoAmI(array $params = []) */ public function whoAmIProtected(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\WhoAmIProtected::class); + $endpoint = $this->endpointFactory->getEndpoint(WhoAmIProtected::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -1402,7 +1480,7 @@ public function changePassword(array $params = []) ]; } - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\ChangePassword::class); + $endpoint = $this->endpointFactory->getEndpoint(ChangePassword::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -1432,7 +1510,7 @@ public function createActionGroup(array $params = []) ]; } - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\CreateActionGroup::class); + $endpoint = $this->endpointFactory->getEndpoint(CreateActionGroup::class); $endpoint->setParams($params); $endpoint->setActionGroup($action_group); $endpoint->setBody($body); @@ -1467,7 +1545,7 @@ public function createRoleMapping(array $params = []) ]); } - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\CreateRoleMapping::class); + $endpoint = $this->endpointFactory->getEndpoint(CreateRoleMapping::class); $endpoint->setParams($params); $endpoint->setRole($role); $endpoint->setBody($body); @@ -1502,7 +1580,7 @@ public function createRole(array $params = []) ]); } - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\CreateRole::class); + $endpoint = $this->endpointFactory->getEndpoint(CreateRole::class); $endpoint->setParams($params); $endpoint->setRole($role); $endpoint->setBody($body); @@ -1533,7 +1611,7 @@ public function createTenant(array $params = []) ]; } - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\CreateTenant::class); + $endpoint = $this->endpointFactory->getEndpoint(CreateTenant::class); $endpoint->setParams($params); $endpoint->setTenant($tenant); $endpoint->setBody($body); @@ -1570,7 +1648,7 @@ public function createUser(array $params = []) ]); } - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\CreateUser::class); + $endpoint = $this->endpointFactory->getEndpoint(CreateUser::class); $endpoint->setParams($params); $endpoint->setUsername($username); $endpoint->setBody($body); @@ -1609,11 +1687,11 @@ public function getAccount(array $params = []) public function getActionGroups(array $params = []) { if (isset($params['action_group'])) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetActionGroup::class); + $endpoint = $this->endpointFactory->getEndpoint(GetActionGroup::class); $action_group = $this->extractArgument($params, 'action_group'); $endpoint->setActionGroup($action_group); } else { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetActionGroups::class); + $endpoint = $this->endpointFactory->getEndpoint(GetActionGroups::class); } $endpoint->setParams($params); @@ -1645,11 +1723,11 @@ public function getConfig(array $params = []) public function getDistinguishedNames(array $params = []) { if (isset($params['cluster_name'])) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetDistinguishedName::class); + $endpoint = $this->endpointFactory->getEndpoint(GetDistinguishedName::class); $cluster_name = $this->extractArgument($params, 'cluster_name'); $endpoint->setClusterName($cluster_name); } else { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetDistinguishedNames::class); + $endpoint = $this->endpointFactory->getEndpoint(GetDistinguishedNames::class); } $endpoint->setParams($params); @@ -1672,11 +1750,11 @@ public function getDistinguishedNames(array $params = []) public function getRoleMappings(array $params = []) { if (isset($params['role'])) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetRoleMapping::class); + $endpoint = $this->endpointFactory->getEndpoint(GetRoleMapping::class); $role = $this->extractArgument($params, 'role'); $endpoint->setRole($role); } else { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetRoleMappings::class); + $endpoint = $this->endpointFactory->getEndpoint(GetRoleMappings::class); } $endpoint->setParams($params); @@ -1699,11 +1777,11 @@ public function getRoleMappings(array $params = []) public function getRoles(array $params = []) { if (isset($params['role'])) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetRole::class); + $endpoint = $this->endpointFactory->getEndpoint(GetRole::class); $role = $this->extractArgument($params, 'role'); $endpoint->setRole($role); } else { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetRoles::class); + $endpoint = $this->endpointFactory->getEndpoint(GetRoles::class); } $endpoint->setParams($params); @@ -1726,11 +1804,11 @@ public function getRoles(array $params = []) public function getTenants(array $params = []) { if (isset($params['tenant'])) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetTenant::class); + $endpoint = $this->endpointFactory->getEndpoint(GetTenant::class); $tenant = $this->extractArgument($params, 'tenant'); $endpoint->setTenant($tenant); } else { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetTenants::class); + $endpoint = $this->endpointFactory->getEndpoint(GetTenants::class); } $endpoint->setParams($params); @@ -1755,11 +1833,11 @@ public function getUsers(array $params = []): array $endpointBuilder = $this->endpoints; if (isset($params['username'])) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetUser::class); + $endpoint = $this->endpointFactory->getEndpoint(GetUser::class); $username = $this->extractArgument($params, 'username'); $endpoint->setUsername($username); } else { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\GetUsers::class); + $endpoint = $this->endpointFactory->getEndpoint(GetUsers::class); } $endpoint->setParams($params); @@ -1788,11 +1866,11 @@ public function patchActionGroups(array $params = []) } if (isset($params['action_group'])) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchActionGroup::class); + $endpoint = $this->endpointFactory->getEndpoint(PatchActionGroup::class); $action_group = $this->extractArgument($params, 'action_group'); $endpoint->setActionGroup($action_group); } else { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchActionGroups::class); + $endpoint = $this->endpointFactory->getEndpoint(PatchActionGroups::class); } $endpoint->setParams($params); $endpoint->setBody($body); @@ -1832,11 +1910,11 @@ public function patchRoleMappings(array $params = []) } if (isset($params['role'])) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchRoleMapping::class); + $endpoint = $this->endpointFactory->getEndpoint(PatchRoleMapping::class); $role = $this->extractArgument($params, 'role'); $endpoint->setRole($role); } else { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchRoleMappings::class); + $endpoint = $this->endpointFactory->getEndpoint(PatchRoleMappings::class); } $endpoint->setParams($params); $endpoint->setBody($body); @@ -1864,11 +1942,11 @@ public function patchRoles(array $params = []) } if (isset($params['role'])) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchRole::class); + $endpoint = $this->endpointFactory->getEndpoint(PatchRole::class); $role = $this->extractArgument($params, 'role'); $endpoint->setRole($role); } else { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchRoles::class); + $endpoint = $this->endpointFactory->getEndpoint(PatchRoles::class); } $endpoint->setParams($params); @@ -1897,11 +1975,11 @@ public function patchTenants(array $params = []) } if (isset($params['tenant'])) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchTenant::class); + $endpoint = $this->endpointFactory->getEndpoint(PatchTenant::class); $tenant = $this->extractArgument($params, 'tenant'); $endpoint->setTenant($tenant); } else { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchTenants::class); + $endpoint = $this->endpointFactory->getEndpoint(PatchTenants::class); } $endpoint->setParams($params); @@ -1930,11 +2008,11 @@ public function patchUsers(array $params = []) } if (isset($params['username'])) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchUser::class); + $endpoint = $this->endpointFactory->getEndpoint(PatchUser::class); $username = $this->extractArgument($params, 'username'); $endpoint->setUsername($username); } else { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Security\PatchUsers::class); + $endpoint = $this->endpointFactory->getEndpoint(PatchUsers::class); } $endpoint->setParams($params); diff --git a/src/OpenSearch/Namespaces/SmNamespace.php b/src/OpenSearch/Namespaces/SmNamespace.php index 3837edbe1..e6ecc3790 100644 --- a/src/OpenSearch/Namespaces/SmNamespace.php +++ b/src/OpenSearch/Namespaces/SmNamespace.php @@ -15,6 +15,15 @@ namespace OpenSearch\Namespaces; +use OpenSearch\Endpoints\Sm\CreatePolicy; +use OpenSearch\Endpoints\Sm\DeletePolicy; +use OpenSearch\Endpoints\Sm\ExplainPolicy; +use OpenSearch\Endpoints\Sm\GetPolicies; +use OpenSearch\Endpoints\Sm\GetPolicy; +use OpenSearch\Endpoints\Sm\StartPolicy; +use OpenSearch\Endpoints\Sm\StopPolicy; +use OpenSearch\Endpoints\Sm\UpdatePolicy; + /** * Class SmNamespace * @@ -40,7 +49,7 @@ public function createPolicy(array $params = []) $policy_name = $this->extractArgument($params, 'policy_name'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Sm\CreatePolicy::class); + $endpoint = $this->endpointFactory->getEndpoint(CreatePolicy::class); $endpoint->setParams($params); $endpoint->setPolicyName($policy_name); $endpoint->setBody($body); @@ -65,7 +74,7 @@ public function deletePolicy(array $params = []) { $policy_name = $this->extractArgument($params, 'policy_name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Sm\DeletePolicy::class); + $endpoint = $this->endpointFactory->getEndpoint(DeletePolicy::class); $endpoint->setParams($params); $endpoint->setPolicyName($policy_name); @@ -89,7 +98,7 @@ public function explainPolicy(array $params = []) { $policy_name = $this->extractArgument($params, 'policy_name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Sm\ExplainPolicy::class); + $endpoint = $this->endpointFactory->getEndpoint(ExplainPolicy::class); $endpoint->setParams($params); $endpoint->setPolicyName($policy_name); @@ -115,7 +124,7 @@ public function explainPolicy(array $params = []) */ public function getPolicies(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Sm\GetPolicies::class); + $endpoint = $this->endpointFactory->getEndpoint(GetPolicies::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -138,7 +147,7 @@ public function getPolicy(array $params = []) { $policy_name = $this->extractArgument($params, 'policy_name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Sm\GetPolicy::class); + $endpoint = $this->endpointFactory->getEndpoint(GetPolicy::class); $endpoint->setParams($params); $endpoint->setPolicyName($policy_name); @@ -162,7 +171,7 @@ public function startPolicy(array $params = []) { $policy_name = $this->extractArgument($params, 'policy_name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Sm\StartPolicy::class); + $endpoint = $this->endpointFactory->getEndpoint(StartPolicy::class); $endpoint->setParams($params); $endpoint->setPolicyName($policy_name); @@ -186,7 +195,7 @@ public function stopPolicy(array $params = []) { $policy_name = $this->extractArgument($params, 'policy_name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Sm\StopPolicy::class); + $endpoint = $this->endpointFactory->getEndpoint(StopPolicy::class); $endpoint->setParams($params); $endpoint->setPolicyName($policy_name); @@ -213,7 +222,7 @@ public function updatePolicy(array $params = []) $policy_name = $this->extractArgument($params, 'policy_name'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Sm\UpdatePolicy::class); + $endpoint = $this->endpointFactory->getEndpoint(UpdatePolicy::class); $endpoint->setParams($params); $endpoint->setPolicyName($policy_name); $endpoint->setBody($body); diff --git a/src/OpenSearch/Namespaces/SnapshotNamespace.php b/src/OpenSearch/Namespaces/SnapshotNamespace.php index 8f00b42c4..f3f0ecd92 100644 --- a/src/OpenSearch/Namespaces/SnapshotNamespace.php +++ b/src/OpenSearch/Namespaces/SnapshotNamespace.php @@ -21,6 +21,18 @@ namespace OpenSearch\Namespaces; +use OpenSearch\Endpoints\Snapshot\CleanupRepository; +use OpenSearch\Endpoints\Snapshot\CloneSnapshot; +use OpenSearch\Endpoints\Snapshot\Create; +use OpenSearch\Endpoints\Snapshot\CreateRepository; +use OpenSearch\Endpoints\Snapshot\Delete; +use OpenSearch\Endpoints\Snapshot\DeleteRepository; +use OpenSearch\Endpoints\Snapshot\Get; +use OpenSearch\Endpoints\Snapshot\GetRepository; +use OpenSearch\Endpoints\Snapshot\Restore; +use OpenSearch\Endpoints\Snapshot\Status; +use OpenSearch\Endpoints\Snapshot\VerifyRepository; + /** * Class SnapshotNamespace * @@ -48,7 +60,7 @@ public function cleanupRepository(array $params = []) { $repository = $this->extractArgument($params, 'repository'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Snapshot\CleanupRepository::class); + $endpoint = $this->endpointFactory->getEndpoint(CleanupRepository::class); $endpoint->setParams($params); $endpoint->setRepository($repository); @@ -80,7 +92,7 @@ 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); + $endpoint = $this->endpointFactory->getEndpoint(CloneSnapshot::class); $endpoint->setParams($params); $endpoint->setRepository($repository); $endpoint->setSnapshot($snapshot); @@ -114,7 +126,7 @@ public function create(array $params = []) $snapshot = $this->extractArgument($params, 'snapshot'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Snapshot\Create::class); + $endpoint = $this->endpointFactory->getEndpoint(Create::class); $endpoint->setParams($params); $endpoint->setRepository($repository); $endpoint->setSnapshot($snapshot); @@ -146,7 +158,7 @@ public function createRepository(array $params = []) $repository = $this->extractArgument($params, 'repository'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Snapshot\CreateRepository::class); + $endpoint = $this->endpointFactory->getEndpoint(CreateRepository::class); $endpoint->setParams($params); $endpoint->setRepository($repository); $endpoint->setBody($body); @@ -175,7 +187,7 @@ public function delete(array $params = []) $repository = $this->extractArgument($params, 'repository'); $snapshot = $this->extractArgument($params, 'snapshot'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Snapshot\Delete::class); + $endpoint = $this->endpointFactory->getEndpoint(Delete::class); $endpoint->setParams($params); $endpoint->setRepository($repository); $endpoint->setSnapshot($snapshot); @@ -203,7 +215,7 @@ public function deleteRepository(array $params = []) { $repository = $this->extractArgument($params, 'repository'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Snapshot\DeleteRepository::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteRepository::class); $endpoint->setParams($params); $endpoint->setRepository($repository); @@ -233,7 +245,7 @@ public function get(array $params = []) $repository = $this->extractArgument($params, 'repository'); $snapshot = $this->extractArgument($params, 'snapshot'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Snapshot\Get::class); + $endpoint = $this->endpointFactory->getEndpoint(Get::class); $endpoint->setParams($params); $endpoint->setRepository($repository); $endpoint->setSnapshot($snapshot); @@ -261,7 +273,7 @@ public function getRepository(array $params = []) { $repository = $this->extractArgument($params, 'repository'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Snapshot\GetRepository::class); + $endpoint = $this->endpointFactory->getEndpoint(GetRepository::class); $endpoint->setParams($params); $endpoint->setRepository($repository); @@ -292,7 +304,7 @@ public function restore(array $params = []) $snapshot = $this->extractArgument($params, 'snapshot'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Snapshot\Restore::class); + $endpoint = $this->endpointFactory->getEndpoint(Restore::class); $endpoint->setParams($params); $endpoint->setRepository($repository); $endpoint->setSnapshot($snapshot); @@ -323,7 +335,7 @@ public function status(array $params = []) $repository = $this->extractArgument($params, 'repository'); $snapshot = $this->extractArgument($params, 'snapshot'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Snapshot\Status::class); + $endpoint = $this->endpointFactory->getEndpoint(Status::class); $endpoint->setParams($params); $endpoint->setRepository($repository); $endpoint->setSnapshot($snapshot); @@ -351,7 +363,7 @@ public function verifyRepository(array $params = []) { $repository = $this->extractArgument($params, 'repository'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Snapshot\VerifyRepository::class); + $endpoint = $this->endpointFactory->getEndpoint(VerifyRepository::class); $endpoint->setParams($params); $endpoint->setRepository($repository); diff --git a/src/OpenSearch/Namespaces/SqlNamespace.php b/src/OpenSearch/Namespaces/SqlNamespace.php index 5a9fe9cf7..8a32ec7d0 100644 --- a/src/OpenSearch/Namespaces/SqlNamespace.php +++ b/src/OpenSearch/Namespaces/SqlNamespace.php @@ -15,6 +15,13 @@ namespace OpenSearch\Namespaces; +use OpenSearch\Endpoints\Sql\Close; +use OpenSearch\Endpoints\Sql\Explain; +use OpenSearch\Endpoints\Sql\GetStats; +use OpenSearch\Endpoints\Sql\PostStats; +use OpenSearch\Endpoints\Sql\Query; +use OpenSearch\Endpoints\Sql\Settings; + /** * Class SqlNamespace * @@ -40,7 +47,7 @@ public function close(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Sql\Close::class); + $endpoint = $this->endpointFactory->getEndpoint(Close::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -63,7 +70,7 @@ public function close(array $params = []) */ public function getStats(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Sql\GetStats::class); + $endpoint = $this->endpointFactory->getEndpoint(GetStats::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -87,7 +94,7 @@ public function postStats(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Sql\PostStats::class); + $endpoint = $this->endpointFactory->getEndpoint(PostStats::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -111,7 +118,7 @@ public function settings(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Sql\Settings::class); + $endpoint = $this->endpointFactory->getEndpoint(Settings::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -127,7 +134,7 @@ public function settings(array $params = []) */ public function closeCursor(array $params): array { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Sql\Close::class); + $endpoint = $this->endpointFactory->getEndpoint(Close::class); $endpoint->setBody(array_filter([ 'cursor' => $this->extractArgument($params, 'cursor'), ])); @@ -147,7 +154,7 @@ public function explain(array $params): array $body = $this->extractArgument($params, 'body') ?? []; $query = $this->extractArgument($params, 'query'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Sql\Explain::class); + $endpoint = $this->endpointFactory->getEndpoint(Explain::class); $endpoint->setBody(array_merge($body, [ 'query' => $query, ])); @@ -168,7 +175,7 @@ public function explain(array $params): array */ public function query(array $params): array { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Sql\Query::class); + $endpoint = $this->endpointFactory->getEndpoint(Query::class); $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 99fdf5373..1cad9c804 100644 --- a/src/OpenSearch/Namespaces/TasksNamespace.php +++ b/src/OpenSearch/Namespaces/TasksNamespace.php @@ -21,6 +21,10 @@ namespace OpenSearch\Namespaces; +use OpenSearch\Endpoints\Tasks\Cancel; +use OpenSearch\Endpoints\Tasks\Get; +use OpenSearch\Endpoints\Tasks\ListTasks; + /** * Class TasksNamespace * @@ -49,7 +53,7 @@ public function cancel(array $params = []) { $task_id = $this->extractArgument($params, 'task_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Tasks\Cancel::class); + $endpoint = $this->endpointFactory->getEndpoint(Cancel::class); $endpoint->setParams($params); $endpoint->setTaskId($task_id); @@ -75,7 +79,7 @@ public function get(array $params = []) { $task_id = $this->extractArgument($params, 'task_id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Tasks\Get::class); + $endpoint = $this->endpointFactory->getEndpoint(Get::class); $endpoint->setParams($params); $endpoint->setTaskId($task_id); @@ -103,7 +107,7 @@ public function get(array $params = []) */ public function list(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Tasks\ListTasks::class); + $endpoint = $this->endpointFactory->getEndpoint(ListTasks::class); $endpoint->setParams($params); return $this->performRequest($endpoint); diff --git a/src/OpenSearch/Namespaces/TransformsNamespace.php b/src/OpenSearch/Namespaces/TransformsNamespace.php index 794c48f3a..71e96fe0b 100644 --- a/src/OpenSearch/Namespaces/TransformsNamespace.php +++ b/src/OpenSearch/Namespaces/TransformsNamespace.php @@ -15,6 +15,15 @@ namespace OpenSearch\Namespaces; +use OpenSearch\Endpoints\Transforms\Delete; +use OpenSearch\Endpoints\Transforms\Explain; +use OpenSearch\Endpoints\Transforms\Get; +use OpenSearch\Endpoints\Transforms\Preview; +use OpenSearch\Endpoints\Transforms\Put; +use OpenSearch\Endpoints\Transforms\Search; +use OpenSearch\Endpoints\Transforms\Start; +use OpenSearch\Endpoints\Transforms\Stop; + /** * Class TransformsNamespace * @@ -39,7 +48,7 @@ public function delete(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Transforms\Delete::class); + $endpoint = $this->endpointFactory->getEndpoint(Delete::class); $endpoint->setParams($params); $endpoint->setId($id); @@ -63,7 +72,7 @@ public function explain(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Transforms\Explain::class); + $endpoint = $this->endpointFactory->getEndpoint(Explain::class); $endpoint->setParams($params); $endpoint->setId($id); @@ -87,7 +96,7 @@ public function get(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Transforms\Get::class); + $endpoint = $this->endpointFactory->getEndpoint(Get::class); $endpoint->setParams($params); $endpoint->setId($id); @@ -110,7 +119,7 @@ public function preview(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Transforms\Preview::class); + $endpoint = $this->endpointFactory->getEndpoint(Preview::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -137,7 +146,7 @@ public function put(array $params = []) $id = $this->extractArgument($params, 'id'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Transforms\Put::class); + $endpoint = $this->endpointFactory->getEndpoint(Put::class); $endpoint->setParams($params); $endpoint->setId($id); $endpoint->setBody($body); @@ -164,7 +173,7 @@ public function put(array $params = []) */ public function search(array $params = []) { - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Transforms\Search::class); + $endpoint = $this->endpointFactory->getEndpoint(Search::class); $endpoint->setParams($params); return $this->performRequest($endpoint); @@ -187,7 +196,7 @@ public function start(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Transforms\Start::class); + $endpoint = $this->endpointFactory->getEndpoint(Start::class); $endpoint->setParams($params); $endpoint->setId($id); @@ -211,7 +220,7 @@ public function stop(array $params = []) { $id = $this->extractArgument($params, 'id'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Transforms\Stop::class); + $endpoint = $this->endpointFactory->getEndpoint(Stop::class); $endpoint->setParams($params); $endpoint->setId($id); diff --git a/src/OpenSearch/Namespaces/WlmNamespace.php b/src/OpenSearch/Namespaces/WlmNamespace.php index c520e8ea8..208004c2c 100644 --- a/src/OpenSearch/Namespaces/WlmNamespace.php +++ b/src/OpenSearch/Namespaces/WlmNamespace.php @@ -15,6 +15,11 @@ namespace OpenSearch\Namespaces; +use OpenSearch\Endpoints\Wlm\CreateQueryGroup; +use OpenSearch\Endpoints\Wlm\DeleteQueryGroup; +use OpenSearch\Endpoints\Wlm\GetQueryGroup; +use OpenSearch\Endpoints\Wlm\UpdateQueryGroup; + /** * Class WlmNamespace * @@ -38,7 +43,7 @@ public function createQueryGroup(array $params = []) { $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Wlm\CreateQueryGroup::class); + $endpoint = $this->endpointFactory->getEndpoint(CreateQueryGroup::class); $endpoint->setParams($params); $endpoint->setBody($body); @@ -62,7 +67,7 @@ public function deleteQueryGroup(array $params = []) { $name = $this->extractArgument($params, 'name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Wlm\DeleteQueryGroup::class); + $endpoint = $this->endpointFactory->getEndpoint(DeleteQueryGroup::class); $endpoint->setParams($params); $endpoint->setName($name); @@ -86,7 +91,7 @@ public function getQueryGroup(array $params = []) { $name = $this->extractArgument($params, 'name'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Wlm\GetQueryGroup::class); + $endpoint = $this->endpointFactory->getEndpoint(GetQueryGroup::class); $endpoint->setParams($params); $endpoint->setName($name); @@ -111,7 +116,7 @@ public function updateQueryGroup(array $params = []) $name = $this->extractArgument($params, 'name'); $body = $this->extractArgument($params, 'body'); - $endpoint = $this->endpointFactory->getEndpoint(\OpenSearch\Endpoints\Wlm\UpdateQueryGroup::class); + $endpoint = $this->endpointFactory->getEndpoint(UpdateQueryGroup::class); $endpoint->setParams($params); $endpoint->setName($name); $endpoint->setBody($body); diff --git a/src/OpenSearch/TransportFactory.php b/src/OpenSearch/TransportFactory.php index c137a867c..47b1d3322 100644 --- a/src/OpenSearch/TransportFactory.php +++ b/src/OpenSearch/TransportFactory.php @@ -92,7 +92,7 @@ public function setUriFactory(UriFactoryInterface $uriFactory): static return $this; } - protected function getSerializer(): Serializers\SerializerInterface + protected function getSerializer(): SerializerInterface { if ($this->serializer === null) { $this->serializer = new SmartSerializer(); @@ -100,7 +100,7 @@ protected function getSerializer(): Serializers\SerializerInterface return $this->serializer; } - public function setSerializer(Serializers\SerializerInterface $serializer): static + public function setSerializer(SerializerInterface $serializer): static { $this->serializer = $serializer; return $this; diff --git a/tests/ClientBuilder/ArrayLogger.php b/tests/ClientBuilder/ArrayLogger.php index 04edb9875..bd0b7f611 100644 --- a/tests/ClientBuilder/ArrayLogger.php +++ b/tests/ClientBuilder/ArrayLogger.php @@ -1,6 +1,5 @@ client->foo(); } - public function testIndexCannotBeNullForDelete() { $this->endpointFactory->expects($this->once()) diff --git a/tests/ConnectionPool/Selectors/RoundRobinSelectorTest.php b/tests/ConnectionPool/Selectors/RoundRobinSelectorTest.php index 8fa291911..5193837af 100644 --- a/tests/ConnectionPool/Selectors/RoundRobinSelectorTest.php +++ b/tests/ConnectionPool/Selectors/RoundRobinSelectorTest.php @@ -23,6 +23,7 @@ use OpenSearch; use OpenSearch\Connections\ConnectionInterface; +use PHPUnit\Framework\TestCase; // @phpstan-ignore classConstant.deprecatedClass @trigger_error(RoundRobinSelectorTest::class . ' is deprecated in 2.4.0 and will be removed in 3.0.0.', E_USER_DEPRECATED); @@ -34,7 +35,7 @@ * * @deprecated in 2.4.0 and will be removed in 3.0.0. */ -class RoundRobinSelectorTest extends \PHPUnit\Framework\TestCase +class RoundRobinSelectorTest extends TestCase { /** * Add Ten connections, select 15 to verify round robin diff --git a/tests/ConnectionPool/Selectors/StickyRoundRobinSelectorTest.php b/tests/ConnectionPool/Selectors/StickyRoundRobinSelectorTest.php index 0fc6c1fe1..84ac62c44 100644 --- a/tests/ConnectionPool/Selectors/StickyRoundRobinSelectorTest.php +++ b/tests/ConnectionPool/Selectors/StickyRoundRobinSelectorTest.php @@ -18,6 +18,7 @@ use OpenSearch; use OpenSearch\Connections\ConnectionInterface; use Mockery as m; +use PHPUnit\Framework\TestCase; // @phpstan-ignore classConstant.deprecatedClass @trigger_error(StickyRoundRobinSelectorTest::class . ' is deprecated in 2.4.0 and will be removed in 3.0.0.', E_USER_DEPRECATED); @@ -29,7 +30,7 @@ * * @deprecated in 2.4.0 and will be removed in 3.0.0. */ -class StickyRoundRobinSelectorTest extends \PHPUnit\Framework\TestCase +class StickyRoundRobinSelectorTest extends TestCase { public function tearDown(): void { diff --git a/tests/ConnectionPool/SniffingConnectionPoolIntegrationTest.php b/tests/ConnectionPool/SniffingConnectionPoolIntegrationTest.php index 93f0fbf25..91910e886 100644 --- a/tests/ConnectionPool/SniffingConnectionPoolIntegrationTest.php +++ b/tests/ConnectionPool/SniffingConnectionPoolIntegrationTest.php @@ -23,7 +23,6 @@ use OpenSearch\ClientBuilder; use OpenSearch\ConnectionPool\SniffingConnectionPool; -use OpenSearch\ConnectionPool\StaticConnectionPool; use OpenSearch\Tests\Utility; use PHPUnit\Framework\TestCase; diff --git a/tests/ConnectionPool/SniffingConnectionPoolTest.php b/tests/ConnectionPool/SniffingConnectionPoolTest.php index 0ebd32a0b..01e3b1ab9 100644 --- a/tests/ConnectionPool/SniffingConnectionPoolTest.php +++ b/tests/ConnectionPool/SniffingConnectionPoolTest.php @@ -104,7 +104,6 @@ public function forceNextConnection(): void $this->assertSame($secondConnection, $connectionPool->nextConnection(true)); } - /** @test */ public function itShouldReturnFirstSeededConnectionIfAlive(): void { diff --git a/tests/ConnectionPool/StaticConnectionPoolIntegrationTest.php b/tests/ConnectionPool/StaticConnectionPoolIntegrationTest.php index 916a64965..eebcaaa7d 100644 --- a/tests/ConnectionPool/StaticConnectionPoolIntegrationTest.php +++ b/tests/ConnectionPool/StaticConnectionPoolIntegrationTest.php @@ -21,8 +21,10 @@ namespace OpenSearch\Tests\ConnectionPool; -use OpenSearch; use OpenSearch\Tests\Utility; +use OpenSearch\ClientBuilder; +use OpenSearch\ConnectionPool\StaticConnectionPool; +use PHPUnit\Framework\TestCase; // @phpstan-ignore classConstant.deprecatedClass @trigger_error(StaticConnectionPoolIntegrationTest::class . ' is deprecated in 2.4.0 and will be removed in 3.0.0.', E_USER_DEPRECATED); @@ -36,7 +38,7 @@ * * @deprecated in 2.4.0 and will be removed in 3.0.0. */ -class StaticConnectionPoolIntegrationTest extends \PHPUnit\Framework\TestCase +class StaticConnectionPoolIntegrationTest extends TestCase { /** * @var string @@ -51,9 +53,9 @@ public function setUp(): void // Issue #636 public function test404Liveness() { - $client = \OpenSearch\ClientBuilder::create() + $client = ClientBuilder::create() ->setHosts([$this->host]) - ->setConnectionPool(\OpenSearch\ConnectionPool\StaticConnectionPool::class) + ->setConnectionPool(StaticConnectionPool::class) ->setSSLVerification(false) ->build(); diff --git a/tests/ConnectionPool/StaticConnectionPoolTest.php b/tests/ConnectionPool/StaticConnectionPoolTest.php index f351d06d6..bbdac370b 100644 --- a/tests/ConnectionPool/StaticConnectionPoolTest.php +++ b/tests/ConnectionPool/StaticConnectionPoolTest.php @@ -21,17 +21,14 @@ namespace OpenSearch\Tests\ConnectionPool; -use OpenSearch; use OpenSearch\ClientBuilder; use OpenSearch\Common\Exceptions\NoNodesAvailableException; -use OpenSearch\ConnectionPool\Selectors\RoundRobinSelector; use OpenSearch\ConnectionPool\Selectors\SelectorInterface; use OpenSearch\ConnectionPool\StaticConnectionPool; use OpenSearch\Connections\Connection; use OpenSearch\Connections\ConnectionFactory; use Mockery as m; -use OpenSearch\Connections\ConnectionFactoryInterface; -use OpenSearch\Connections\ConnectionInterface; +use PHPUnit\Framework\TestCase; // @phpstan-ignore classConstant.deprecatedClass @trigger_error(StaticConnectionPoolTest::class . ' is deprecated in 2.4.0 and will be removed in 3.0.0.', E_USER_DEPRECATED); @@ -44,7 +41,7 @@ * * @deprecated in 2.4.0 and will be removed in 3.0.0. */ -class StaticConnectionPoolTest extends \PHPUnit\Framework\TestCase +class StaticConnectionPoolTest extends TestCase { public function tearDown(): void { diff --git a/tests/Connections/ConnectionTest.php b/tests/Connections/ConnectionTest.php index e79128d18..f3737477e 100644 --- a/tests/Connections/ConnectionTest.php +++ b/tests/Connections/ConnectionTest.php @@ -31,6 +31,7 @@ use Exception; use Psr\Log\LoggerInterface; use ReflectionClass; +use PHPUnit\Framework\TestCase; use function base64_encode; use function random_bytes; @@ -38,14 +39,13 @@ // @phpstan-ignore classConstant.deprecatedClass @trigger_error(ConnectionTest::class . ' is deprecated in 2.4.0 and will be removed in 3.0.0.', E_USER_DEPRECATED); - /** * @covers \OpenSearch\Connections\Connection * @group legacy * * @deprecated in 2.4.0 and will be removed in 3.0.0. */ -class ConnectionTest extends \PHPUnit\Framework\TestCase +class ConnectionTest extends TestCase { /** * @var \PHPUnit\Framework\MockObject\MockObject&\Psr\Log\LoggerInterface diff --git a/tests/Endpoints/CreateIntegrationTest.php b/tests/Endpoints/CreateIntegrationTest.php index 55e5e3b04..4b91c1ed3 100644 --- a/tests/Endpoints/CreateIntegrationTest.php +++ b/tests/Endpoints/CreateIntegrationTest.php @@ -22,6 +22,7 @@ namespace OpenSearch\Tests\Endpoints; use OpenSearch\Tests\Utility; +use PHPUnit\Framework\TestCase; /** * Class CreateIntegrationTest @@ -30,7 +31,7 @@ * @group Integration * @group Integration-Min */ -class CreateIntegrationTest extends \PHPUnit\Framework\TestCase +class CreateIntegrationTest extends TestCase { public function testCreatePassingId() { diff --git a/tests/Endpoints/CreatePitTest.php b/tests/Endpoints/CreatePitTest.php index a55bf4269..6e5a14611 100644 --- a/tests/Endpoints/CreatePitTest.php +++ b/tests/Endpoints/CreatePitTest.php @@ -23,8 +23,9 @@ use OpenSearch\Endpoints\CreatePit; use OpenSearch\Exception\RuntimeException; +use PHPUnit\Framework\TestCase; -class CreatePitTest extends \PHPUnit\Framework\TestCase +class CreatePitTest extends TestCase { /** @var CreatePit */ private $instance; diff --git a/tests/Endpoints/CreatePointInTimeIntegrationTest.php b/tests/Endpoints/CreatePointInTimeIntegrationTest.php index 7e3033e90..8779c9a48 100644 --- a/tests/Endpoints/CreatePointInTimeIntegrationTest.php +++ b/tests/Endpoints/CreatePointInTimeIntegrationTest.php @@ -23,6 +23,7 @@ use OpenSearch\Client; use OpenSearch\Tests\Utility; +use PHPUnit\Framework\TestCase; /** * Class OpenPointInTimeIntegrationTest @@ -31,7 +32,7 @@ * @group Integration * @group Integration-Min */ -class CreatePointInTimeIntegrationTest extends \PHPUnit\Framework\TestCase +class CreatePointInTimeIntegrationTest extends TestCase { private const INDEX = 'movies'; diff --git a/tests/Endpoints/CreateTest.php b/tests/Endpoints/CreateTest.php index 9ad1d0379..0cbc24b0d 100644 --- a/tests/Endpoints/CreateTest.php +++ b/tests/Endpoints/CreateTest.php @@ -23,8 +23,9 @@ use OpenSearch\Endpoints\Create; use OpenSearch\Exception\RuntimeException; +use PHPUnit\Framework\TestCase; -class CreateTest extends \PHPUnit\Framework\TestCase +class CreateTest extends TestCase { /** @var Create */ private $instance; diff --git a/tests/Endpoints/DeletePitTest.php b/tests/Endpoints/DeletePitTest.php index 9f095e3f0..2bbe919c8 100644 --- a/tests/Endpoints/DeletePitTest.php +++ b/tests/Endpoints/DeletePitTest.php @@ -22,8 +22,9 @@ namespace OpenSearch\Tests\Endpoints; use OpenSearch\Endpoints\DeletePit; +use PHPUnit\Framework\TestCase; -class DeletePitTest extends \PHPUnit\Framework\TestCase +class DeletePitTest extends TestCase { /** @var DeletePit */ private $instance; diff --git a/tests/Endpoints/DeletePointInTimeIntegrationTest.php b/tests/Endpoints/DeletePointInTimeIntegrationTest.php index d1a7d22eb..5cdd4475d 100644 --- a/tests/Endpoints/DeletePointInTimeIntegrationTest.php +++ b/tests/Endpoints/DeletePointInTimeIntegrationTest.php @@ -23,6 +23,7 @@ use OpenSearch\Client; use OpenSearch\Tests\Utility; +use PHPUnit\Framework\TestCase; /** * Class ClosePointInTimeIntegrationTest @@ -31,7 +32,7 @@ * @group Integration * @group Integration-Min */ -class DeletePointInTimeIntegrationTest extends \PHPUnit\Framework\TestCase +class DeletePointInTimeIntegrationTest extends TestCase { private const INDEX = 'movies'; diff --git a/tests/Endpoints/MlNamespaceIntegrationTest.php b/tests/Endpoints/MlNamespaceIntegrationTest.php index 6c10335aa..26c0a1088 100644 --- a/tests/Endpoints/MlNamespaceIntegrationTest.php +++ b/tests/Endpoints/MlNamespaceIntegrationTest.php @@ -15,8 +15,8 @@ namespace OpenSearch\Tests\Endpoints; -use OpenSearch\Client; use OpenSearch\Tests\Utility; +use PHPUnit\Framework\TestCase; /** * Class MlNamespaceIntegrationTest @@ -24,7 +24,7 @@ * @subpackage Tests\Endpoints * @group Integration */ -class MlNamespaceIntegrationTest extends \PHPUnit\Framework\TestCase +class MlNamespaceIntegrationTest extends TestCase { public function testRegisterModelGroup() { diff --git a/tests/Endpoints/RefreshSearchAnalyzersTest.php b/tests/Endpoints/RefreshSearchAnalyzersTest.php index 70cc68327..1c930afe7 100644 --- a/tests/Endpoints/RefreshSearchAnalyzersTest.php +++ b/tests/Endpoints/RefreshSearchAnalyzersTest.php @@ -23,8 +23,9 @@ use OpenSearch\Endpoints\Indices\RefreshSearchAnalyzers; use OpenSearch\Exception\RuntimeException; +use PHPUnit\Framework\TestCase; -class RefreshSearchAnalyzersTest extends \PHPUnit\Framework\TestCase +class RefreshSearchAnalyzersTest extends TestCase { /** @var RefreshSearchAnalyzers */ private $instance; diff --git a/tests/Endpoints/StatusEndpointTest.php b/tests/Endpoints/StatusEndpointTest.php index 7d73bb7ba..ba6122aba 100644 --- a/tests/Endpoints/StatusEndpointTest.php +++ b/tests/Endpoints/StatusEndpointTest.php @@ -22,9 +22,9 @@ namespace OpenSearch\Tests\Endpoints; use OpenSearch\Endpoints\Snapshot\Status; -use OpenSearch\Common\Exceptions; +use PHPUnit\Framework\TestCase; -class StatusEndpointTest extends \PHPUnit\Framework\TestCase +class StatusEndpointTest extends TestCase { /** * @var \OpenSearch\Endpoints\Snapshot\Status diff --git a/tests/Exception/ErrorMessageExtractorTest.php b/tests/Exception/ErrorMessageExtractorTest.php index 2214a6fed..5e5e66fa1 100644 --- a/tests/Exception/ErrorMessageExtractorTest.php +++ b/tests/Exception/ErrorMessageExtractorTest.php @@ -5,7 +5,6 @@ namespace OpenSearch\Tests\Exception; use OpenSearch\Exception\ErrorMessageExtractor; -use OpenSearch\Serializers\SmartSerializer; use PHPUnit\Framework\TestCase; /** @@ -77,5 +76,4 @@ public function testExtractMessageRootCause(): void $this->assertEquals('root_cause_type: root_cause_reason', $message); } - } diff --git a/tests/Handlers/SigV4HandlerTest.php b/tests/Handlers/SigV4HandlerTest.php index e265f5c3b..bd7960aea 100644 --- a/tests/Handlers/SigV4HandlerTest.php +++ b/tests/Handlers/SigV4HandlerTest.php @@ -8,7 +8,6 @@ use Aws\Credentials\Credentials; use GuzzleHttp\Ring\Future\CompletedFutureArray; use OpenSearch\ClientBuilder; -use OpenSearch\Handlers\SigV4Handler; use PHPUnit\Framework\TestCase; // @phpstan-ignore classConstant.deprecatedClass diff --git a/tests/Helper/Iterators/SearchHitIteratorTest.php b/tests/Helper/Iterators/SearchHitIteratorTest.php index 406d7e657..846fd7a77 100644 --- a/tests/Helper/Iterators/SearchHitIteratorTest.php +++ b/tests/Helper/Iterators/SearchHitIteratorTest.php @@ -24,13 +24,14 @@ use OpenSearch\Helper\Iterators\SearchHitIterator; use OpenSearch\Helper\Iterators\SearchResponseIterator; use Mockery; +use PHPUnit\Framework\TestCase; /** * Class SearchResponseIteratorTest * * @deprecated in 2.4.0 and will be removed in 3.0.0. */ -class SearchHitIteratorTest extends \PHPUnit\Framework\TestCase +class SearchHitIteratorTest extends TestCase { /** * @var SearchResponseIterator|Mockery\MockInterface diff --git a/tests/Helper/Iterators/SearchResponseIteratorTest.php b/tests/Helper/Iterators/SearchResponseIteratorTest.php index b5473caca..76312c3ba 100644 --- a/tests/Helper/Iterators/SearchResponseIteratorTest.php +++ b/tests/Helper/Iterators/SearchResponseIteratorTest.php @@ -24,13 +24,14 @@ use OpenSearch\Client; use OpenSearch\Helper\Iterators\SearchResponseIterator; use Mockery as m; +use PHPUnit\Framework\TestCase; /** * Class SearchResponseIteratorTest * * @deprecated in 2.4.0 and will be removed in 3.0.0. */ -class SearchResponseIteratorTest extends \PHPUnit\Framework\TestCase +class SearchResponseIteratorTest extends TestCase { public function tearDown(): void { diff --git a/tests/LegacyClientIntegrationTest.php b/tests/LegacyClientIntegrationTest.php index abb21e7b4..6e191b924 100644 --- a/tests/LegacyClientIntegrationTest.php +++ b/tests/LegacyClientIntegrationTest.php @@ -27,6 +27,7 @@ use OpenSearch\Exception\RuntimeException; use OpenSearch\Tests\ClientBuilder\ArrayLogger; use Psr\Log\LogLevel; +use PHPUnit\Framework\TestCase; /** * Class ClientTest @@ -38,7 +39,7 @@ * * @deprecated in 2.4.0 and will be removed in 3.0.0. */ -class LegacyClientIntegrationTest extends \PHPUnit\Framework\TestCase +class LegacyClientIntegrationTest extends TestCase { /** * @var ArrayLogger diff --git a/tests/LegacyRegisteredNamespaceTest.php b/tests/LegacyRegisteredNamespaceTest.php index a661f05a0..abe5bf5cc 100644 --- a/tests/LegacyRegisteredNamespaceTest.php +++ b/tests/LegacyRegisteredNamespaceTest.php @@ -23,10 +23,10 @@ use OpenSearch; use OpenSearch\ClientBuilder; -use OpenSearch\Endpoints\AbstractEndpoint; use OpenSearch\Serializers\SerializerInterface; use OpenSearch\Transport; use Mockery as m; +use PHPUnit\Framework\TestCase; /** * Class RegisteredNamespaceTest @@ -34,7 +34,7 @@ * @subpackage Tests * @deprecated in 2.4.0 and will be removed in 3.0.0. */ -class LegacyRegisteredNamespaceTest extends \PHPUnit\Framework\TestCase +class LegacyRegisteredNamespaceTest extends TestCase { public function tearDown(): void { diff --git a/tests/Serializers/ArrayToJSONSerializerTest.php b/tests/Serializers/ArrayToJSONSerializerTest.php index c3b0a7daa..de02aaae2 100644 --- a/tests/Serializers/ArrayToJSONSerializerTest.php +++ b/tests/Serializers/ArrayToJSONSerializerTest.php @@ -23,13 +23,14 @@ use OpenSearch\Serializers\ArrayToJSONSerializer; use Mockery as m; +use PHPUnit\Framework\TestCase; /** * Class ArrayToJSONSerializerTest * * @deprecated in 2.4.0 and will be removed in 3.0.0. */ -class ArrayToJSONSerializerTest extends \PHPUnit\Framework\TestCase +class ArrayToJSONSerializerTest extends TestCase { public function tearDown(): void { diff --git a/tests/Serializers/EverythingToJSONSerializerTest.php b/tests/Serializers/EverythingToJSONSerializerTest.php index 137c5caa3..d56b9d134 100644 --- a/tests/Serializers/EverythingToJSONSerializerTest.php +++ b/tests/Serializers/EverythingToJSONSerializerTest.php @@ -23,13 +23,14 @@ use OpenSearch\Serializers\EverythingToJSONSerializer; use Mockery as m; +use PHPUnit\Framework\TestCase; /** * Class EverythingToJSONSerializerTest * * @deprecated in 2.4.0 and will be removed in 3.0.0. */ -class EverythingToJSONSerializerTest extends \PHPUnit\Framework\TestCase +class EverythingToJSONSerializerTest extends TestCase { public function tearDown(): void { diff --git a/util/ActionTest.php b/util/ActionTest.php index 8284f3112..bfeb68f8b 100644 --- a/util/ActionTest.php +++ b/util/ActionTest.php @@ -1,6 +1,5 @@ getMessage() @@ -181,8 +180,8 @@ function checkIfCodeHasValidSyntax(string $code): void try { eval($script . $code); } catch (OpenSearchException $e) { - } catch (Error $e) { - throw new Exception(sprintf( + } catch (\Error $e) { + throw new \Exception(sprintf( "The generated code:\n%s\nhas the following parse error:\n%s", $code, $e->getMessage() diff --git a/util/GenerateEndpoints.php b/util/GenerateEndpoints.php index 35d00c2f6..30f15d715 100644 --- a/util/GenerateEndpoints.php +++ b/util/GenerateEndpoints.php @@ -1,6 +1,5 @@ open($fileName, ZipArchive::CREATE | ZipArchive::OVERWRITE); + $zip = new \ZipArchive(); + $result = $zip->open($fileName, \ZipArchive::CREATE | \ZipArchive::OVERWRITE); if ($result !== true) { printf("Error opening the zip file %s: %s\n", $fileName, $result); exit(1); @@ -521,7 +516,7 @@ function backup(string $fileName) */ function restore(string $fileName) { - $zip = new ZipArchive(); + $zip = new \ZipArchive(); $result = $zip->open($fileName); if ($result !== true) { printf("Error opening the zip file %s: %s\n", $fileName, $result); @@ -564,8 +559,8 @@ function Patch_Endpoints() continue; } - $iterator = new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($dirPath, RecursiveDirectoryIterator::SKIP_DOTS) + $iterator = new \RecursiveIteratorIterator( + new \RecursiveDirectoryIterator($dirPath, \RecursiveDirectoryIterator::SKIP_DOTS) ); foreach ($iterator as $file) { diff --git a/util/NamespaceEndpoint.php b/util/NamespaceEndpoint.php index 5c748fee9..31d7f9129 100644 --- a/util/NamespaceEndpoint.php +++ b/util/NamespaceEndpoint.php @@ -1,6 +1,5 @@ open($tempFilePath); printf("Extracting %s\ninto %s/rest-spec/%s\n", $tempFilePath, __DIR__, $serverInfo['version']['build_hash']); $zip->extractTo(sprintf("%s/rest-spec/%s", __DIR__, $serverInfo['version']['build_hash'])); diff --git a/util/YamlTests.php b/util/YamlTests.php index 26ab6bb5c..6be74aba3 100644 --- a/util/YamlTests.php +++ b/util/YamlTests.php @@ -1,6 +1,5 @@ $value) { if (is_array($value)) { $value = var_export($value, true); - } elseif ($value instanceof \stdClass) { + } elseif ($value instanceof stdClass) { $value = 'new \stdClass'; } elseif (is_numeric($value)) { $value = (string) $value; diff --git a/util/build_tests.php b/util/build_tests.php index d698e407c..52476eaf1 100644 --- a/util/build_tests.php +++ b/util/build_tests.php @@ -27,7 +27,7 @@ try { $client = Utility::getClient(); -} catch (RuntimeException $e) { +} catch (\RuntimeException $e) { printf("ERROR: I cannot find STACK_VERSION and TEST_SUITE environment variables\n"); exit(1); } diff --git a/util/changelog_updater.php b/util/changelog_updater.php index 8d8bd04d1..a63339805 100644 --- a/util/changelog_updater.php +++ b/util/changelog_updater.php @@ -22,7 +22,7 @@ function main() try { $gitStatus = shell_exec("git status"); if ($gitStatus === null) { - throw new RuntimeException('Failed to execute git command.'); + throw new \RuntimeException('Failed to execute git command.'); } if (strpos($gitStatus, "Changes to be committed:") !== false || @@ -37,7 +37,7 @@ function main() ]); if ($response->getStatusCode() !== 200) { - throw new RuntimeException( + throw new \RuntimeException( 'Failed to fetch opensearch-api-specification commit information. Status code: ' . $response->getStatusCode() ); } @@ -49,7 +49,7 @@ function main() $changelogPath = "CHANGELOG.md"; $content = file_get_contents($changelogPath); if ($content === false) { - throw new RuntimeException('Failed to read CHANGELOG.md'); + throw new \RuntimeException('Failed to read CHANGELOG.md'); } if (strpos($content, $commitUrl) === false) { @@ -62,17 +62,17 @@ function main() $result = file_put_contents($changelogPath, $fileContent); if ($result === false) { - throw new RuntimeException('Failed to write to CHANGELOG.md'); + throw new \RuntimeException('Failed to write to CHANGELOG.md'); } } else { - throw new RuntimeException("'Updated APIs' section is not present in CHANGELOG.md"); + throw new \RuntimeException("'Updated APIs' section is not present in CHANGELOG.md"); } } } else { echo "No changes detected\n"; } - } catch (Exception $e) { + } catch (\Exception $e) { echo "Error occurred: " . $e->getMessage() . "\n"; } } diff --git a/util/license_header.php b/util/license_header.php index c2377dd10..6ae6e7044 100644 --- a/util/license_header.php +++ b/util/license_header.php @@ -22,7 +22,6 @@ " * GitHub history for details.\n" . " */\n"; - function doesFileNeedFix(string $filepath): bool { $content = file_get_contents($filepath); @@ -50,9 +49,9 @@ function fix_license_header(string $path): void addHeaderToFile($path); } } elseif (is_dir($path)) { - $iterator = new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS), - RecursiveIteratorIterator::LEAVES_ONLY + $iterator = new \RecursiveIteratorIterator( + new \RecursiveDirectoryIterator($path, \FilesystemIterator::SKIP_DOTS), + \RecursiveIteratorIterator::LEAVES_ONLY ); foreach ($iterator as $file) { if ($file->isFile() && doesFileNeedFix($file->getPathname())) {