|
| 1 | +<?php |
| 2 | + |
| 3 | +/** |
| 4 | + * Elasticsearch PHP Client |
| 5 | + * |
| 6 | + * @link https://github.com/elastic/elasticsearch-php |
| 7 | + * @copyright Copyright (c) Elasticsearch B.V (https://www.elastic.co) |
| 8 | + * @license https://opensource.org/licenses/MIT MIT License |
| 9 | + * |
| 10 | + * Licensed to Elasticsearch B.V under one or more agreements. |
| 11 | + * Elasticsearch B.V licenses this file to you under the MIT License. |
| 12 | + * See the LICENSE file in the project root for more information. |
| 13 | + */ |
| 14 | + |
| 15 | +declare(strict_types=1); |
| 16 | + |
| 17 | +namespace Elastic\Elasticsearch\Endpoints; |
| 18 | + |
| 19 | +use Elastic\Elasticsearch\Exception\ClientResponseException; |
| 20 | +use Elastic\Elasticsearch\Exception\MissingParameterException; |
| 21 | +use Elastic\Elasticsearch\Exception\ServerResponseException; |
| 22 | +use Elastic\Elasticsearch\Response\Elasticsearch; |
| 23 | +use Elastic\Transport\Exception\NoNodeAvailableException; |
| 24 | +use Http\Promise\Promise; |
| 25 | + |
| 26 | +/** |
| 27 | + * @generated This file is generated, please do not edit |
| 28 | + */ |
| 29 | +class QueryRuleset extends AbstractEndpoint |
| 30 | +{ |
| 31 | + /** |
| 32 | + * Deletes a query ruleset. |
| 33 | + * |
| 34 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-query-ruleset.html |
| 35 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
| 36 | + * |
| 37 | + * @param array{ |
| 38 | + * ruleset_id: string, // (REQUIRED) The unique identifier of the query ruleset to delete |
| 39 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
| 40 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
| 41 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
| 42 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
| 43 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
| 44 | + * } $params |
| 45 | + * |
| 46 | + * @throws MissingParameterException if a required parameter is missing |
| 47 | + * @throws NoNodeAvailableException if all the hosts are offline |
| 48 | + * @throws ClientResponseException if the status code of response is 4xx |
| 49 | + * @throws ServerResponseException if the status code of response is 5xx |
| 50 | + * |
| 51 | + * @return Elasticsearch|Promise |
| 52 | + */ |
| 53 | + public function delete(array $params = []) |
| 54 | + { |
| 55 | + $this->checkRequiredParameters(['ruleset_id'], $params); |
| 56 | + $url = '/_query_rules/' . $this->encode($params['ruleset_id']); |
| 57 | + $method = 'DELETE'; |
| 58 | + |
| 59 | + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); |
| 60 | + $headers = [ |
| 61 | + 'Accept' => 'application/json', |
| 62 | + ]; |
| 63 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
| 64 | + } |
| 65 | + |
| 66 | + |
| 67 | + /** |
| 68 | + * Returns the details about a query ruleset. |
| 69 | + * |
| 70 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-query-ruleset.html |
| 71 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
| 72 | + * |
| 73 | + * @param array{ |
| 74 | + * ruleset_id: string, // (REQUIRED) The unique identifier of the query ruleset |
| 75 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
| 76 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
| 77 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
| 78 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
| 79 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
| 80 | + * } $params |
| 81 | + * |
| 82 | + * @throws MissingParameterException if a required parameter is missing |
| 83 | + * @throws NoNodeAvailableException if all the hosts are offline |
| 84 | + * @throws ClientResponseException if the status code of response is 4xx |
| 85 | + * @throws ServerResponseException if the status code of response is 5xx |
| 86 | + * |
| 87 | + * @return Elasticsearch|Promise |
| 88 | + */ |
| 89 | + public function get(array $params = []) |
| 90 | + { |
| 91 | + $this->checkRequiredParameters(['ruleset_id'], $params); |
| 92 | + $url = '/_query_rules/' . $this->encode($params['ruleset_id']); |
| 93 | + $method = 'GET'; |
| 94 | + |
| 95 | + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); |
| 96 | + $headers = [ |
| 97 | + 'Accept' => 'application/json', |
| 98 | + ]; |
| 99 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
| 100 | + } |
| 101 | + |
| 102 | + |
| 103 | + /** |
| 104 | + * Creates or updates a query ruleset. |
| 105 | + * |
| 106 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/put-query-ruleset.html |
| 107 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
| 108 | + * |
| 109 | + * @param array{ |
| 110 | + * ruleset_id: string, // (REQUIRED) The unique identifier of the ruleset to be created or updated. |
| 111 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
| 112 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
| 113 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
| 114 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
| 115 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
| 116 | + * body: array, // (REQUIRED) The query ruleset configuration, including `rules` |
| 117 | + * } $params |
| 118 | + * |
| 119 | + * @throws MissingParameterException if a required parameter is missing |
| 120 | + * @throws NoNodeAvailableException if all the hosts are offline |
| 121 | + * @throws ClientResponseException if the status code of response is 4xx |
| 122 | + * @throws ServerResponseException if the status code of response is 5xx |
| 123 | + * |
| 124 | + * @return Elasticsearch|Promise |
| 125 | + */ |
| 126 | + public function put(array $params = []) |
| 127 | + { |
| 128 | + $this->checkRequiredParameters(['ruleset_id','body'], $params); |
| 129 | + $url = '/_query_rules/' . $this->encode($params['ruleset_id']); |
| 130 | + $method = 'PUT'; |
| 131 | + |
| 132 | + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); |
| 133 | + $headers = [ |
| 134 | + 'Accept' => 'application/json', |
| 135 | + 'Content-Type' => 'application/json', |
| 136 | + ]; |
| 137 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
| 138 | + } |
| 139 | +} |
0 commit comments