Skip to content

Commit

Permalink
Updated opensearch-php APIs to reflect opensearch-api-specification@5…
Browse files Browse the repository at this point in the history
…97ed8d.

Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Aug 12, 2024
1 parent 8bbd848 commit 05472bf
Show file tree
Hide file tree
Showing 17 changed files with 1,028 additions and 2 deletions.
2 changes: 0 additions & 2 deletions samples/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,3 @@
$info = $client->info();

echo "{$info['version']['distribution']}: {$info['version']['number']}\n";

?>
28 changes: 28 additions & 0 deletions src/OpenSearch/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
use OpenSearch\Namespaces\MonitoringNamespace;
use OpenSearch\Namespaces\NodesNamespace;
use OpenSearch\Namespaces\NotificationsNamespace;
use OpenSearch\Namespaces\ObservabilityNamespace;
use OpenSearch\Namespaces\PplNamespace;
use OpenSearch\Namespaces\QueryNamespace;
use OpenSearch\Namespaces\RemoteStoreNamespace;
use OpenSearch\Namespaces\RollupsNamespace;
use OpenSearch\Namespaces\SearchPipelineNamespace;
Expand Down Expand Up @@ -139,11 +141,21 @@ class Client
*/
protected $notifications;

/**
* @var ObservabilityNamespace
*/
protected $observability;

/**
* @var PplNamespace
*/
protected $ppl;

/**
* @var QueryNamespace
*/
protected $query;

/**
* @var RemoteStoreNamespace
*/
Expand Down Expand Up @@ -218,7 +230,9 @@ public function __construct(Transport $transport, callable $endpoint, array $reg
$this->monitoring = new MonitoringNamespace($transport, $endpoint);
$this->nodes = new NodesNamespace($transport, $endpoint);
$this->notifications = new NotificationsNamespace($transport, $endpoint);
$this->observability = new ObservabilityNamespace($transport, $endpoint);
$this->ppl = new PplNamespace($transport, $endpoint);
$this->query = new QueryNamespace($transport, $endpoint);
$this->remoteStore = new RemoteStoreNamespace($transport, $endpoint);
$this->rollups = new RollupsNamespace($transport, $endpoint);
$this->searchPipeline = new SearchPipelineNamespace($transport, $endpoint);
Expand Down Expand Up @@ -1743,13 +1757,27 @@ public function notifications(): NotificationsNamespace
{
return $this->notifications;
}
/**
* Returns the observability namespace
*/
public function observability(): ObservabilityNamespace
{
return $this->observability;
}
/**
* Returns the ppl namespace
*/
public function ppl(): PplNamespace
{
return $this->ppl;
}
/**
* Returns the query namespace
*/
public function query(): QueryNamespace
{
return $this->query;
}
/**
* Returns the remoteStore namespace
*/
Expand Down
6 changes: 6 additions & 0 deletions src/OpenSearch/Endpoints/Nodes/Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ public function getURI(): string
if (isset($node_id) && isset($metric)) {
return "/_nodes/$node_id/$metric";
}
if (isset($node_id)) {
return "/_nodes/$node_id";
}
if (isset($metric)) {
return "/_nodes/$metric";
}
return "/_nodes";
}

Expand Down
55 changes: 55 additions & 0 deletions src/OpenSearch/Endpoints/Observability/CreateObject.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\Observability;

use OpenSearch\Endpoints\AbstractEndpoint;

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

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

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

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

return $this;
}
}
62 changes: 62 additions & 0 deletions src/OpenSearch/Endpoints/Observability/DeleteObject.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\Observability;

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

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

public function getURI(): string
{
$object_id = $this->object_id ?? null;
if (isset($object_id)) {
return "/_plugins/_observability/object/$object_id";
}
throw new RuntimeException('Missing parameter for the endpoint observability.delete_object');
}

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

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

public function setObjectId($object_id): DeleteObject
{
if (isset($object_id) !== true) {
return $this;
}
$this->object_id = $object_id;

return $this;
}
}
47 changes: 47 additions & 0 deletions src/OpenSearch/Endpoints/Observability/DeleteObjects.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\Observability;

use OpenSearch\Endpoints\AbstractEndpoint;

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

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

public function getMethod(): string
{
return 'DELETE';
}
}
45 changes: 45 additions & 0 deletions src/OpenSearch/Endpoints/Observability/GetLocalstats.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\Observability;

use OpenSearch\Endpoints\AbstractEndpoint;

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

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

public function getMethod(): string
{
return 'GET';
}
}
62 changes: 62 additions & 0 deletions src/OpenSearch/Endpoints/Observability/GetObject.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\Observability;

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

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

public function getURI(): string
{
$object_id = $this->object_id ?? null;
if (isset($object_id)) {
return "/_plugins/_observability/object/$object_id";
}
throw new RuntimeException('Missing parameter for the endpoint observability.get_object');
}

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

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

public function setObjectId($object_id): GetObject
{
if (isset($object_id) !== true) {
return $this;
}
$this->object_id = $object_id;

return $this;
}
}
Loading

0 comments on commit 05472bf

Please sign in to comment.