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-10-31)

Signed-off-by: GitHub <[email protected]>
  • Loading branch information
dblock authored Oct 31, 2024
1 parent 2b2d7de commit 88633f1
Show file tree
Hide file tree
Showing 7 changed files with 389 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Fixed
- Fixed PHP 8.4 deprecations
### Updated APIs
- Updated opensearch-php APIs to reflect [opensearch-api-specification@58674f4](https://github.com/opensearch-project/opensearch-api-specification/commit/58674f4c2aacd3984a7c20011292fc883bb633e4)
- Updated opensearch-php APIs to reflect [opensearch-api-specification@1db1840](https://github.com/opensearch-project/opensearch-api-specification/commit/1db184063a463c5180a2cc824b1efc1aeebfd5eb)
- Updated opensearch-php APIs to reflect [opensearch-api-specification@cb320b5](https://github.com/opensearch-project/opensearch-api-specification/commit/cb320b5482551c4f28afa26ff0d1653332699722)
### Security
Expand Down
14 changes: 14 additions & 0 deletions src/OpenSearch/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
use OpenSearch\Namespaces\SslNamespace;
use OpenSearch\Namespaces\TasksNamespace;
use OpenSearch\Namespaces\TransformsNamespace;
use OpenSearch\Namespaces\WlmNamespace;

/**
* Class Client
Expand Down Expand Up @@ -230,6 +231,11 @@ class Client
*/
protected $transforms;

/**
* @var WlmNamespace
*/
protected $wlm;


/**
* Client constructor
Expand Down Expand Up @@ -271,6 +277,7 @@ public function __construct(Transport $transport, callable $endpoint, array $reg
$this->ssl = new SslNamespace($transport, $endpoint);
$this->tasks = new TasksNamespace($transport, $endpoint);
$this->transforms = new TransformsNamespace($transport, $endpoint);
$this->wlm = new WlmNamespace($transport, $endpoint);

$this->registeredNamespaces = $registeredNamespaces;
}
Expand Down Expand Up @@ -1942,6 +1949,13 @@ public function transforms(): TransformsNamespace
{
return $this->transforms;
}
/**
* Returns the wlm namespace
*/
public function wlm(): WlmNamespace
{
return $this->wlm;
}

/**
* Catchall for registered namespaces
Expand Down
55 changes: 55 additions & 0 deletions src/OpenSearch/Endpoints/Wlm/CreateQueryGroup.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\Wlm;

use OpenSearch\Endpoints\AbstractEndpoint;

/**
* NOTE: This file is autogenerated using util/GenerateEndpoints.php
*/
class CreateQueryGroup extends AbstractEndpoint
{
public function getURI(): string
{
return "/_wlm/query_group";
}

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

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

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

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

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

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

public function getURI(): string
{
$name = $this->name ?? null;
if (isset($name)) {
return "/_wlm/query_group/$name";
}
throw new RuntimeException('Missing parameter for the endpoint wlm.delete_query_group');
}

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

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

public function setName($name): DeleteQueryGroup
{
if (isset($name) !== true) {
return $this;
}
$this->name = $name;

return $this;
}
}
61 changes: 61 additions & 0 deletions src/OpenSearch/Endpoints/Wlm/GetQueryGroup.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?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\Wlm;

use OpenSearch\Endpoints\AbstractEndpoint;

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

public function getURI(): string
{
$name = $this->name ?? null;
if (isset($name)) {
return "/_wlm/query_group/$name";
}
return "/_wlm/query_group";
}

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

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

public function setName($name): GetQueryGroup
{
if (isset($name) !== true) {
return $this;
}
$this->name = $name;

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

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

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

public function getURI(): string
{
$name = $this->name ?? null;
if (isset($name)) {
return "/_wlm/query_group/$name";
}
throw new RuntimeException('Missing parameter for the endpoint wlm.update_query_group');
}

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

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

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

return $this;
}

public function setName($name): UpdateQueryGroup
{
if (isset($name) !== true) {
return $this;
}
$this->name = $name;

return $this;
}
}
Loading

0 comments on commit 88633f1

Please sign in to comment.