-
Notifications
You must be signed in to change notification settings - Fork 964
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
605 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
<?php | ||
|
||
/** | ||
* Elasticsearch PHP Client | ||
* | ||
* @link https://github.com/elastic/elasticsearch-php | ||
* @copyright Copyright (c) Elasticsearch B.V (https://www.elastic.co) | ||
* @license https://opensource.org/licenses/MIT MIT License | ||
* | ||
* Licensed to Elasticsearch B.V under one or more agreements. | ||
* Elasticsearch B.V licenses this file to you under the MIT License. | ||
* See the LICENSE file in the project root for more information. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Elastic\Elasticsearch\Endpoints; | ||
|
||
use Elastic\Elasticsearch\Exception\ClientResponseException; | ||
use Elastic\Elasticsearch\Exception\MissingParameterException; | ||
use Elastic\Elasticsearch\Exception\ServerResponseException; | ||
use Elastic\Elasticsearch\Response\Elasticsearch; | ||
use Elastic\Transport\Exception\NoNodeAvailableException; | ||
use Http\Promise\Promise; | ||
|
||
/** | ||
* @generated This file is generated, please do not edit | ||
*/ | ||
class QueryRuleset extends AbstractEndpoint | ||
{ | ||
/** | ||
* Deletes a query ruleset. | ||
* | ||
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-query-ruleset.html | ||
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release | ||
* | ||
* @param array{ | ||
* ruleset_id: string, // (REQUIRED) The unique identifier of the query ruleset to delete | ||
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) | ||
* human: boolean, // Return human readable values for statistics. (DEFAULT: true) | ||
* error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) | ||
* source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. | ||
* filter_path: list, // A comma-separated list of filters used to reduce the response. | ||
* } $params | ||
* | ||
* @throws MissingParameterException if a required parameter is missing | ||
* @throws NoNodeAvailableException if all the hosts are offline | ||
* @throws ClientResponseException if the status code of response is 4xx | ||
* @throws ServerResponseException if the status code of response is 5xx | ||
* | ||
* @return Elasticsearch|Promise | ||
*/ | ||
public function delete(array $params = []) | ||
{ | ||
$this->checkRequiredParameters(['ruleset_id'], $params); | ||
$url = '/_query_rules/' . $this->encode($params['ruleset_id']); | ||
$method = 'DELETE'; | ||
|
||
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); | ||
$headers = [ | ||
'Accept' => 'application/json', | ||
]; | ||
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); | ||
} | ||
|
||
|
||
/** | ||
* Returns the details about a query ruleset. | ||
* | ||
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-query-ruleset.html | ||
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release | ||
* | ||
* @param array{ | ||
* ruleset_id: string, // (REQUIRED) The unique identifier of the query ruleset | ||
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) | ||
* human: boolean, // Return human readable values for statistics. (DEFAULT: true) | ||
* error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) | ||
* source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. | ||
* filter_path: list, // A comma-separated list of filters used to reduce the response. | ||
* } $params | ||
* | ||
* @throws MissingParameterException if a required parameter is missing | ||
* @throws NoNodeAvailableException if all the hosts are offline | ||
* @throws ClientResponseException if the status code of response is 4xx | ||
* @throws ServerResponseException if the status code of response is 5xx | ||
* | ||
* @return Elasticsearch|Promise | ||
*/ | ||
public function get(array $params = []) | ||
{ | ||
$this->checkRequiredParameters(['ruleset_id'], $params); | ||
$url = '/_query_rules/' . $this->encode($params['ruleset_id']); | ||
$method = 'GET'; | ||
|
||
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); | ||
$headers = [ | ||
'Accept' => 'application/json', | ||
]; | ||
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); | ||
} | ||
|
||
|
||
/** | ||
* Creates or updates a query ruleset. | ||
* | ||
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/put-query-ruleset.html | ||
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release | ||
* | ||
* @param array{ | ||
* ruleset_id: string, // (REQUIRED) The unique identifier of the ruleset to be created or updated. | ||
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) | ||
* human: boolean, // Return human readable values for statistics. (DEFAULT: true) | ||
* error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) | ||
* source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. | ||
* filter_path: list, // A comma-separated list of filters used to reduce the response. | ||
* body: array, // (REQUIRED) The query ruleset configuration, including `rules` | ||
* } $params | ||
* | ||
* @throws MissingParameterException if a required parameter is missing | ||
* @throws NoNodeAvailableException if all the hosts are offline | ||
* @throws ClientResponseException if the status code of response is 4xx | ||
* @throws ServerResponseException if the status code of response is 5xx | ||
* | ||
* @return Elasticsearch|Promise | ||
*/ | ||
public function put(array $params = []) | ||
{ | ||
$this->checkRequiredParameters(['ruleset_id','body'], $params); | ||
$url = '/_query_rules/' . $this->encode($params['ruleset_id']); | ||
$method = 'PUT'; | ||
|
||
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); | ||
$headers = [ | ||
'Accept' => 'application/json', | ||
'Content-Type' => 'application/json', | ||
]; | ||
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.