Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated opensearch-php to reflect the latest OpenSearch API spec #235

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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@07e329e](https://github.com/opensearch-project/opensearch-api-specification/commit/07e329e8d01fd0576de6a0a3c35412fd5a9163db)
- 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
Loading