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
…4-08-14)

Signed-off-by: GitHub <noreply@github.com>
  • Loading branch information
dblock committed Aug 14, 2024
1 parent bad675e commit 40898f6
Show file tree
Hide file tree
Showing 9 changed files with 245 additions and 80 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Removed
### Fixed
### Updated APIs
- Updated opensearch-php APIs to reflect [opensearch-api-specification@83eab43](https://github.com/opensearch-project/opensearch-api-specification/commit/83eab434d08d5b623c8518ac50b88331d146a783)
- Updated opensearch-php APIs to reflect [opensearch-api-specification@cb320b5](https://github.com/opensearch-project/opensearch-api-specification/commit/cb320b5482551c4f28afa26ff0d1653332699722)
### Security
### Dependencies
Expand Down
47 changes: 28 additions & 19 deletions src/OpenSearch/Endpoints/Ml/DeployModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,36 +16,45 @@
use OpenSearch\Common\Exceptions\RuntimeException;
use OpenSearch\Endpoints\AbstractEndpoint;

/**
* NOTE: This file is autogenerated using util/GenerateEndpoints.php
*/
class DeployModel extends AbstractEndpoint
{
/**
* @return string[]
*/
public function getParamWhitelist(): array
{
return [];
}
protected $model_id;

/**
* @return string
*/
public function getURI(): string
{
if ($this->id) {
return "/_plugins/_ml/models/$this->id/_deploy";
$model_id = $this->model_id ?? null;
if (isset($model_id)) {
return "/_plugins/_ml/models/$model_id/_deploy";
}
throw new RuntimeException('Missing parameter for the endpoint ml.deploy_model');
}

throw new RuntimeException(
'id is required for deploy'
);

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

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

public function setModelId($model_id): DeployModel
{
if (isset($model_id) !== true) {
return $this;
}
$this->model_id = $model_id;

return $this;
}
}
47 changes: 28 additions & 19 deletions src/OpenSearch/Endpoints/Ml/UndeployModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,36 +16,45 @@
use OpenSearch\Common\Exceptions\RuntimeException;
use OpenSearch\Endpoints\AbstractEndpoint;

/**
* NOTE: This file is autogenerated using util/GenerateEndpoints.php
*/
class UndeployModel extends AbstractEndpoint
{
/**
* @return string[]
*/
public function getParamWhitelist(): array
{
return [];
}
protected $model_id;

/**
* @return string
*/
public function getURI(): string
{
if ($this->id) {
return "/_plugins/_ml/models/$this->id/_undeploy";
$model_id = $this->model_id ?? null;
if (isset($model_id)) {
return "/_plugins/_ml/models/$model_id/_undeploy";
}
throw new RuntimeException('Missing parameter for the endpoint ml.undeploy_model');
}

throw new RuntimeException(
'id is required for undeploy'
);

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

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

public function setModelId($model_id): UndeployModel
{
if (isset($model_id) !== true) {
return $this;
}
$this->model_id = $model_id;

return $this;
}
}
2 changes: 1 addition & 1 deletion src/OpenSearch/Endpoints/Security/ConfigUpgradeCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ConfigUpgradeCheck extends AbstractEndpoint
{
public function getURI(): string
{
return "/_plugins/_security/_upgrade_check";
return "/_plugins/_security/api/_upgrade_check";
}

public function getParamWhitelist(): array
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSearch/Endpoints/Security/ConfigUpgradePerform.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ConfigUpgradePerform extends AbstractEndpoint
{
public function getURI(): string
{
return "/_plugins/_security/_upgrade_perform";
return "/_plugins/_security/api/_upgrade_perform";
}

public function getParamWhitelist(): array
Expand Down
47 changes: 47 additions & 0 deletions src/OpenSearch/Endpoints/Security/GetAllCertificates.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?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\Security;

use OpenSearch\Endpoints\AbstractEndpoint;

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

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

public function getMethod(): string
{
return 'GET';
}
}
64 changes: 64 additions & 0 deletions src/OpenSearch/Endpoints/Security/GetNodeCertificates.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?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\Security;

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

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

public function getURI(): string
{
$node_id = $this->node_id ?? null;
if (isset($node_id)) {
return "/_plugins/_security/api/certificates/$node_id";
}
throw new RuntimeException('Missing parameter for the endpoint security.get_node_certificates');
}

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

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

public function setNodeId($node_id): GetNodeCertificates
{
if (isset($node_id) !== true) {
return $this;
}
$this->node_id = $node_id;

return $this;
}
}
10 changes: 0 additions & 10 deletions src/OpenSearch/Endpoints/Security/PostDashboardsInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,4 @@ public function getMethod(): string
{
return 'POST';
}

public function setBody($body): PostDashboardsInfo
{
if (isset($body) !== true) {
return $this;
}
$this->body = $body;

return $this;
}
}
Loading

0 comments on commit 40898f6

Please sign in to comment.