Skip to content

Commit

Permalink
Updated opensearch-php to reflect the latest OpenSearch API spec (202…
Browse files Browse the repository at this point in the history
…5-01-21)

Signed-off-by: GitHub <[email protected]>
  • Loading branch information
dblock authored Jan 21, 2025
1 parent 70e71ff commit fbf0f9e
Show file tree
Hide file tree
Showing 9 changed files with 493 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Fixed PHP 8.4 deprecations
- Fixed outdated tests
### Updated APIs
- Updated opensearch-php APIs to reflect [opensearch-api-specification@d8e4583](https://github.com/opensearch-project/opensearch-api-specification/commit/d8e45836afad678ab02f7e729e43b850443b90fb)
- Updated opensearch-php APIs to reflect [opensearch-api-specification@1422af3](https://github.com/opensearch-project/opensearch-api-specification/commit/1422af3cddc8140fe9c3d59ee0205b278e193bb9)
- Updated opensearch-php APIs to reflect [opensearch-api-specification@2395cb4](https://github.com/opensearch-project/opensearch-api-specification/commit/2395cb472ec5581656aac184f7b20548cd5b06ac)
- Updated opensearch-php APIs to reflect [opensearch-api-specification@ebe0f8a](https://github.com/opensearch-project/opensearch-api-specification/commit/ebe0f8a885f7db7e882d160c101055a5aa70a707)
Expand Down
72 changes: 72 additions & 0 deletions src/OpenSearch/Endpoints/Ml/ExecuteAgent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php

declare(strict_types=1);

/**
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

namespace OpenSearch\Endpoints\Ml;

use OpenSearch\Common\Exceptions\RuntimeException;
use OpenSearch\Endpoints\AbstractEndpoint;

/**
* NOTE: This file is autogenerated using util/GenerateEndpoints.php
*/
class ExecuteAgent extends AbstractEndpoint
{
protected $agent_id;

public function getURI(): string
{
$agent_id = $this->agent_id ?? null;
if (isset($agent_id)) {
return "/_plugins/_ml/agents/$agent_id/_execute";
}
throw new RuntimeException('Missing parameter for the endpoint ml.execute_agent');
}

public function getParamWhitelist(): array
{
return [
'pretty',
'human',
'error_trace',
'source',
'filter_path'
];
}

public function getMethod(): string
{
return 'POST';
}

public function setBody($body): static
{
if (is_null($body)) {
return $this;
}
$this->body = $body;

return $this;
}

public function setAgentId($agent_id): static
{
if (is_null($agent_id)) {
return $this;
}
$this->agent_id = $agent_id;

return $this;
}
}
62 changes: 62 additions & 0 deletions src/OpenSearch/Endpoints/Ml/GetAgent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php

declare(strict_types=1);

/**
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

namespace OpenSearch\Endpoints\Ml;

use OpenSearch\Common\Exceptions\RuntimeException;
use OpenSearch\Endpoints\AbstractEndpoint;

/**
* NOTE: This file is autogenerated using util/GenerateEndpoints.php
*/
class GetAgent extends AbstractEndpoint
{
protected $agent_id;

public function getURI(): string
{
$agent_id = $this->agent_id ?? null;
if (isset($agent_id)) {
return "/_plugins/_ml/agents/$agent_id";
}
throw new RuntimeException('Missing parameter for the endpoint ml.get_agent');
}

public function getParamWhitelist(): array
{
return [
'pretty',
'human',
'error_trace',
'source',
'filter_path'
];
}

public function getMethod(): string
{
return 'GET';
}

public function setAgentId($agent_id): static
{
if (is_null($agent_id)) {
return $this;
}
$this->agent_id = $agent_id;

return $this;
}
}
45 changes: 45 additions & 0 deletions src/OpenSearch/Endpoints/Ml/GetAllTools.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

declare(strict_types=1);

/**
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

namespace OpenSearch\Endpoints\Ml;

use OpenSearch\Endpoints\AbstractEndpoint;

/**
* NOTE: This file is autogenerated using util/GenerateEndpoints.php
*/
class GetAllTools extends AbstractEndpoint
{
public function getURI(): string
{
return "/_plugins/_ml/tools";
}

public function getParamWhitelist(): array
{
return [
'pretty',
'human',
'error_trace',
'source',
'filter_path'
];
}

public function getMethod(): string
{
return 'GET';
}
}
2 changes: 1 addition & 1 deletion src/OpenSearch/Endpoints/Ml/GetStats.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function getURI(): string
return "/_plugins/_ml/$node_id/stats/$stat";
}
if (isset($node_id)) {
return "/_plugins/_ml/$node_id/stats/";
return "/_plugins/_ml/$node_id/stats";
}
if (isset($stat)) {
return "/_plugins/_ml/stats/$stat";
Expand Down
62 changes: 62 additions & 0 deletions src/OpenSearch/Endpoints/Ml/GetTool.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php

declare(strict_types=1);

/**
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

namespace OpenSearch\Endpoints\Ml;

use OpenSearch\Common\Exceptions\RuntimeException;
use OpenSearch\Endpoints\AbstractEndpoint;

/**
* NOTE: This file is autogenerated using util/GenerateEndpoints.php
*/
class GetTool extends AbstractEndpoint
{
protected $tool_name;

public function getURI(): string
{
$tool_name = $this->tool_name ?? null;
if (isset($tool_name)) {
return "/_plugins/_ml/tools/$tool_name";
}
throw new RuntimeException('Missing parameter for the endpoint ml.get_tool');
}

public function getParamWhitelist(): array
{
return [
'pretty',
'human',
'error_trace',
'source',
'filter_path'
];
}

public function getMethod(): string
{
return 'GET';
}

public function setToolName($tool_name): static
{
if (is_null($tool_name)) {
return $this;
}
$this->tool_name = $tool_name;

return $this;
}
}
55 changes: 55 additions & 0 deletions src/OpenSearch/Endpoints/Ml/SearchAgents.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

declare(strict_types=1);

/**
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

namespace OpenSearch\Endpoints\Ml;

use OpenSearch\Endpoints\AbstractEndpoint;

/**
* NOTE: This file is autogenerated using util/GenerateEndpoints.php
*/
class SearchAgents extends AbstractEndpoint
{
public function getURI(): string
{
return "/_plugins/_ml/agents/_search";
}

public function getParamWhitelist(): array
{
return [
'pretty',
'human',
'error_trace',
'source',
'filter_path'
];
}

public function getMethod(): string
{
return isset($this->body) ? 'POST' : 'GET';
}

public function setBody($body): static
{
if (is_null($body)) {
return $this;
}
$this->body = $body;

return $this;
}
}
55 changes: 55 additions & 0 deletions src/OpenSearch/Endpoints/Ml/SearchTasks.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

declare(strict_types=1);

/**
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

namespace OpenSearch\Endpoints\Ml;

use OpenSearch\Endpoints\AbstractEndpoint;

/**
* NOTE: This file is autogenerated using util/GenerateEndpoints.php
*/
class SearchTasks extends AbstractEndpoint
{
public function getURI(): string
{
return "/_plugins/_ml/tasks/_search";
}

public function getParamWhitelist(): array
{
return [
'pretty',
'human',
'error_trace',
'source',
'filter_path'
];
}

public function getMethod(): string
{
return isset($this->body) ? 'POST' : 'GET';
}

public function setBody($body): static
{
if (is_null($body)) {
return $this;
}
$this->body = $body;

return $this;
}
}
Loading

0 comments on commit fbf0f9e

Please sign in to comment.